2005-03-09 Marcus Brinkmann * pager.c: Include . (pager_clear_user_data): Set the S_IMMAP0 flag in the node's stat mode. (diskfs_get_filemap): Clear the S_IMMAP0 flag in the node's stat mode after creating the pager. * inode.c (read_node): Set the S_IMMAP0 flag in the node's stat mode. --- ext2fs/inode.c 2005-08-30 17:08:51.000000000 +0200 +++ ext2fs/inode.c.new 2005-08-30 17:09:16.000000000 +0200 @@ -309,7 +309,7 @@ if (S_ISREG (st->st_mode) || S_ISDIR (st->st_mode) || (S_ISLNK (st->st_mode) && st->st_blocks)) np->allocsize = round_block (np->dn_stat.st_size); - else + else { /* Allocsize should be zero for anything except directories, files, and long symlinks. These are the only things allowed to have any blocks allocated as well, although st_size may be zero for any type (cases @@ -317,6 +317,11 @@ linux, some devices). */ np->allocsize = 0; +#ifdef S_IMMAP0 + /* We start out with no map users. */ + st->st_mode |= S_IMMAP0; +#endif + } return 0; } --- ext2fs/pager.c 2005-08-30 17:08:51.000000000 +0200 +++ ext2fs/pager.c.new 2005-08-30 17:09:17.000000000 +0200 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "ext2fs.h" @@ -799,6 +800,9 @@ if (upi->type == FILE_DATA) { struct pager *pager; +#ifdef S_IMMAP0 + struct node *np; +#endif spin_lock (&node_to_page_lock); pager = upi->node->dn->pager; @@ -806,6 +810,13 @@ upi->node->dn->pager = 0; spin_unlock (&node_to_page_lock); +#ifdef S_IMMAP0 + np = upi->node; + mutex_lock (&np->lock); + np->dn_stat.st_mode |= S_IMMAP0; + mutex_unlock (&np->lock); +#endif + diskfs_nrele_light (upi->node); } @@ -1251,6 +1262,10 @@ return MACH_PORT_NULL; } +#ifdef S_IMMAP0 + node->dn_stat.st_mode &= ~S_IMMAP0; +#endif + right = pager_get_port (node->dn->pager); ports_port_deref (node->dn->pager); }