Re: [PATCH -v3] SELinux: Add get, set, and cloning of superblock security information
Any complaints or questions left here? I've got more people reporting problems with NFS/SELinux and this is the first (and hardest) step to making NFS and any genic LSM play nicely. If there are not any problems how should this be pushed to linus? Through James Morris's git tree? Through Chris Wright's LSM tree? And I did get a: Acked-by: Stephen D. Smalley [EMAIL PROTECTED] Which I don't think ever appeared on all the lists for everyone interested. -Eric Adds security_get_sb_mnt_opts, security_set_sb_mnt_opts, and security_clont_sb_mnt_opts to the LSM and to SELinux. This will allow filesystems to directly own and control all of their mount options if they so choose. This interface deals only with option identifiers and strings so it should generic enough for any LSM which may come in the future. Filesystems which pass text mount data around in the kernel (almost all of them) need not currently make use of this interface for SELinux sake since it will still parse those strings as it always has. An LSM would need to implement these functions only if they had mount time options, such as selinux has context= or fscontext=. If the LSM has no mount time options they could simply not implement and let the dummy ops take care of things. A LSM other than SELinux would need to define new option numbers in security.h (or could reuse if they have the same basic meaning I guess) and any FS which decides to own there own security options would need to be patched to use this new interface for every possible LSM. This is because it was stated to me very clearly that LSM's should not attempt to understand FS mount data and the burdon to understand security should be in the FS which owns the options. Signed-off-by: Eric Paris [EMAIL PROTECTED] --- For now the only forseen user of this interface is NFS. NFS uses a binary blob in kernel for mount data (it uses this blob irrespective of the binary vs. text mount options it can get from userspace.) NFS must then set its own mount options explicitly so we need some interface for it to do so. include/linux/security.h | 36 ++ security/dummy.c | 26 ++ security/security.c | 20 + security/selinux/hooks.c | 749 - security/selinux/include/objsec.h |1 + 5 files changed, 578 insertions(+), 254 deletions(-) diff --git a/include/linux/security.h b/include/linux/security.h index ac05083..dcbb792 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -34,6 +34,12 @@ #include linux/xfrm.h #include net/flow.h +/* only a char in selinux superblock security struct flags */ +#define FSCONTEXT_MNT 0x01 +#define CONTEXT_MNT0x02 +#define ROOTCONTEXT_MNT0x04 +#define DEFCONTEXT_MNT 0x08 + /* * Bounding set */ @@ -261,6 +267,22 @@ struct request_sock; * Update module state after a successful pivot. * @old_nd contains the nameidata structure for the old root. * @new_nd contains the nameidata structure for the new root. + * @sb_get_mnt_opts: + * Get the security relevant mount options used for a superblock + * @sb the superblock to get security mount options from + * @mount_options array for pointers to mount options + * @mount_flags array of ints specifying what each mount options is + * @num_opts number of options in the arrays + * @sb_set_mnt_opts: + * Set the security relevant mount options used for a superblock + * @sb the superblock to set security mount options for + * @mount_options array for pointers to mount options + * @mount_flags array of ints specifying what each mount options is + * @num_opts number of options in the arrays + * @sb_clone_mnt_opts: + * Copy all security options from a given superblock to another + * @oldsb old superblock which contain information to clone + * @newsb new superblock which needs filled in * * Security hooks for inode operations. * @@ -1242,6 +1264,13 @@ struct security_operations { struct nameidata * new_nd); void (*sb_post_pivotroot) (struct nameidata * old_nd, struct nameidata * new_nd); + int (*sb_get_mnt_opts) (const struct super_block *sb, + char ***mount_options, int **flags, + int *num_opts); + int (*sb_set_mnt_opts) (struct super_block *sb, char **mount_options, + int *flags, int num_opts); + void (*sb_clone_mnt_opts) (const struct super_block *oldsb, + struct super_block *newsb); int (*inode_alloc_security) (struct inode *inode); void (*inode_free_security) (struct inode *inode); @@ -1499,6 +1528,13 @@ void security_sb_post_mountroot(void); void
[RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
Hello, This is my first pass at implementing SEEK_HOLE/SEEK_DATA. This has been in solaris for about a year now, and is described here http://docs.sun.com/app/docs/doc/819-2241/lseek-2?l=ena=viewq=SEEK_HOLE http://blogs.sun.com/roller/page/bonwick?entry=seek_hole_and_seek_data I've added a file operation to allow filesystems to override the default seek_hole_data function, which just loops through bmap looking for either a hole or data. I've tested this and it seems to work well. I ran my testcase on a solaris box to make sure I got consistent results (I just ran my test script on the solaris box, I haven't looked at any of their code in case thats a concern). All comments welcome. Thank you, Josef diff --git a/fs/read_write.c b/fs/read_write.c index ea1f94c..cf61e1e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -31,10 +31,32 @@ const struct file_operations generic_ro_fops = { EXPORT_SYMBOL(generic_ro_fops); +static loff_t generic_seek_hole_data(struct file *file, loff_t offset, +int origin) +{ + loff_t retval = -ENXIO; + struct inode *inode = file-f_mapping-host; + sector_t block, found_block; + sector_t last_block = (i_size_read(inode) - 1) inode-i_blkbits; + int want = (origin == SEEK_HOLE) ? 0 : 1; + + for (block = offset inode-i_blkbits; block = last_block; block++) { + found_block = bmap(inode, block); + + if (!!found_block == want) { + retval = block inode-i_blkbits; + break; + } + } + + return retval; +} + loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) { long long retval; struct inode *inode = file-f_mapping-host; + loff_t (*fn)(struct file *, loff_t, int); mutex_lock(inode-i_mutex); switch (origin) { @@ -43,15 +65,24 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) break; case SEEK_CUR: offset += file-f_pos; + break; + case SEEK_HOLE: + case SEEK_DATA: + fn = generic_seek_hole_data; + if (file-f_op-seek_hole_data) + fn = file-f_op-seek_hole_data; + offset = fn(file, offset, origin); } retval = -EINVAL; if (offset=0 offset=inode-i_sb-s_maxbytes) { - if (offset != file-f_pos) { + if (offset != file-f_pos origin != SEEK_HOLE) { file-f_pos = offset; file-f_version = 0; } retval = offset; - } + } else if (offset 0) + retval = offset; + mutex_unlock(inode-i_mutex); return retval; } diff --git a/include/linux/fs.h b/include/linux/fs.h index b3ec4a4..a55d68e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -30,7 +30,9 @@ #define SEEK_SET 0 /* seek relative to beginning of file */ #define SEEK_CUR 1 /* seek relative to current file position */ #define SEEK_END 2 /* seek relative to end of file */ -#define SEEK_MAX SEEK_END +#define SEEK_HOLE 3 /* seek relative to the next hole */ +#define SEEK_DATA 4 /* seek relative to the next block with data */ +#define SEEK_MAX SEEK_DATA /* And dynamically-tunable limits and defaults: */ struct files_stat_struct { @@ -1163,6 +1165,7 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, u struct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); + loff_t (*seek_hole_data) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
I have a few comments. Some of them are inline with the code. The one generic thing is that the Sun documentation specifically says to check pathconf(_PC_MIN_HOLE_SIZE) on the filesystem to see if it supports this request. Have you looked into adding this to the Linux version of pathconf? I haven't tried to look at the latest glibc, but 2.3.2 doesn't appear to have it. If we do have it, this request should really go to the kernel to ask the individual filesystem. However, it looks like pathconf is entirely implemented in glibc. Should we add a system call or some other way to pass pathconf requests into the kernel? I know pathconf currently returns some inaccurate results in some cases due to this limitation. There are some existing ones like _PC_LINK_MAX that glibc tries to guess the correct result based on statfs and can get wrong in any non-standard setup. Brad Boyer [EMAIL PROTECTED] On Wed, Nov 28, 2007 at 03:02:07PM -0500, Josef Bacik wrote: diff --git a/fs/read_write.c b/fs/read_write.c index ea1f94c..cf61e1e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -31,10 +31,32 @@ const struct file_operations generic_ro_fops = { EXPORT_SYMBOL(generic_ro_fops); +static loff_t generic_seek_hole_data(struct file *file, loff_t offset, + int origin) +{ + loff_t retval = -ENXIO; + struct inode *inode = file-f_mapping-host; + sector_t block, found_block; + sector_t last_block = (i_size_read(inode) - 1) inode-i_blkbits; + int want = (origin == SEEK_HOLE) ? 0 : 1; + + for (block = offset inode-i_blkbits; block = last_block; block++) { + found_block = bmap(inode, block); + + if (!!found_block == want) { + retval = block inode-i_blkbits; + break; + } + } + + return retval; +} + It looks like this function can return an offset that is before the one passed in as an argument due to losing the lower bits. I think it needs to do somthing more like this in the loop initializer: block = (offset + (1 inode-i_blkbits) - 1) inode-i_blkbits; By adding 1 block if it wasn't already on an even block, this assures us that it won't go backwards from the original offset while allowing someone to get a block that really does start exactly on the offset. loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) { long long retval; struct inode *inode = file-f_mapping-host; + loff_t (*fn)(struct file *, loff_t, int); mutex_lock(inode-i_mutex); switch (origin) { @@ -43,15 +65,24 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) break; case SEEK_CUR: offset += file-f_pos; + break; + case SEEK_HOLE: + case SEEK_DATA: + fn = generic_seek_hole_data; + if (file-f_op-seek_hole_data) + fn = file-f_op-seek_hole_data; + offset = fn(file, offset, origin); } retval = -EINVAL; if (offset=0 offset=inode-i_sb-s_maxbytes) { - if (offset != file-f_pos) { + if (offset != file-f_pos origin != SEEK_HOLE) { Why is SEEK_HOLE special in this case? The description of SEEK_HOLE and SEEK_DATA in the Sun document would imply to me that they should be handled the same. file-f_pos = offset; file-f_version = 0; } retval = offset; - } + } else if (offset 0) + retval = offset; + mutex_unlock(inode-i_mutex); return retval; } - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Wed, Nov 28, 2007 at 02:56:54PM -0800, Nicholas Miell wrote: On Wed, 2007-11-28 at 15:02 -0500, Josef Bacik wrote: Hello, This is my first pass at implementing SEEK_HOLE/SEEK_DATA. This has been in solaris for about a year now, and is described here http://docs.sun.com/app/docs/doc/819-2241/lseek-2?l=ena=viewq=SEEK_HOLE http://blogs.sun.com/roller/page/bonwick?entry=seek_hole_and_seek_data I've added a file operation to allow filesystems to override the default seek_hole_data function, which just loops through bmap looking for either a hole or data. I've tested this and it seems to work well. I ran my testcase on a solaris box to make sure I got consistent results (I just ran my test script on the solaris box, I haven't looked at any of their code in case thats a concern). All comments welcome. Thank you, Josef I stand by my belief that SEEK_HOLE/SEEK_DATA is a lousy interface. It abuses the seek operation to become a query operation, it requires a total number of system calls proportional to the number holes+data and it isn't general enough for other similar uses (e.g. total number of contiguous extents, compressed extents, offline extents, extents currently shared with other inodes, extents embedded in the inode (tails), etc.) Something like the following would be much better: int getfilextents(int fd, off_t offset, int type, size_t *length, struct extent *extents) with int fd: open file offset: offset in file to start reporting extents type: one of EXTENT_TYPE_HOLE, EXTENT_TYPE_DATA, EXTENT_TYPE_EXTENTS, EXTENT_TYPE_COMPRESSED, EXTENT_TYPE_UNCOMPRESSED etc. length: in/out parameter, on entry contains length of extents array, on exit contains number of valid entries in the extents array or total number of extents remaining in the file, whichever is larger extents: array of struct extent { off_t offset; off_t length }, only updated if non-NULL Making the type parameter a bitmask and adding a type member to struct extent could be useful so that multiple types of extents could be reported at once could be useful, too. (But you end up with weird cases like data extents overlapping with compressed extents.) Actually, now that I've searched my mailbox, Andreas Dilger's FIEMAP proposal is pretty much what I suggest here and is certainly superior to Sun's SEEK_HOLE/SEEK_DATA. Agreed, however in speaking hch and others the consensus was FIEMAP was good, however there was no reason why SEEK_HOLE/SEEK_DATA shouldn't also be implemented, and then at some point down the road when a generic FIEMAP is in place either change the SEEK_HOLE/SEEK_DATA implementation to try to use FIEMAP by default and then fall back on bmap if it has to, or some other such operation. I'm cool with passing on this implementation in preference for FIEMAP, but given the discussion I had earlier this week with some of the other fs people the general thought was go ahead and do this for now. Josef - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Nov 28, 2007 14:56 -0800, Nicholas Miell wrote: I stand by my belief that SEEK_HOLE/SEEK_DATA is a lousy interface. It abuses the seek operation to become a query operation, it requires a total number of system calls proportional to the number holes+data and it isn't general enough for other similar uses (e.g. total number of contiguous extents, compressed extents, offline extents, extents currently shared with other inodes, extents embedded in the inode (tails), etc.) Something like the following would be much better: int getfilextents(int fd, off_t offset, int type, size_t *length, struct extent *extents) with int fd: open file offset: offset in file to start reporting extents type: one of EXTENT_TYPE_HOLE, EXTENT_TYPE_DATA, EXTENT_TYPE_EXTENTS, EXTENT_TYPE_COMPRESSED, EXTENT_TYPE_UNCOMPRESSED etc. This is what FIEMAP is supposed to do. We wrote a spec and implemented a prototype for ext4, but haven't had time to make it generic to move the large part of the code into the VFS. If someone wanted to take that up, it would be much appreciated. See [RFC] add FIEMAP ioctl to efficiently map file allocation in linux-fsdevel for details on this interface. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Wed, Nov 28, 2007 at 01:56:49PM -0800, Brad Boyer wrote: I have a few comments. Some of them are inline with the code. The one generic thing is that the Sun documentation specifically says to check pathconf(_PC_MIN_HOLE_SIZE) on the filesystem to see if it supports this request. Have you looked into adding this to the Linux version of pathconf? I haven't tried to look at the latest glibc, but 2.3.2 doesn't appear to have it. If we do have it, this request should really go to the kernel to ask the individual filesystem. However, it looks like pathconf is entirely implemented in glibc. Should we add a system call or some other way to pass pathconf requests into the kernel? I know pathconf currently returns some inaccurate results in some cases due to this limitation. There are some existing ones like _PC_LINK_MAX that glibc tries to guess the correct result based on statfs and can get wrong in any non-standard setup. Since it appears pathconf doesn't actually interface with the kernel I think that its not really worth chasing down. I don't think every fs maintainer is really going to want to chase down a glibc person in order to change what pathconf returns for their particular fs. On Wed, Nov 28, 2007 at 03:02:07PM -0500, Josef Bacik wrote: diff --git a/fs/read_write.c b/fs/read_write.c index ea1f94c..cf61e1e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -31,10 +31,32 @@ const struct file_operations generic_ro_fops = { EXPORT_SYMBOL(generic_ro_fops); +static loff_t generic_seek_hole_data(struct file *file, loff_t offset, +int origin) +{ + loff_t retval = -ENXIO; + struct inode *inode = file-f_mapping-host; + sector_t block, found_block; + sector_t last_block = (i_size_read(inode) - 1) inode-i_blkbits; + int want = (origin == SEEK_HOLE) ? 0 : 1; + + for (block = offset inode-i_blkbits; block = last_block; block++) { + found_block = bmap(inode, block); + + if (!!found_block == want) { + retval = block inode-i_blkbits; + break; + } + } + + return retval; +} + It looks like this function can return an offset that is before the one passed in as an argument due to losing the lower bits. I think it needs to do somthing more like this in the loop initializer: block = (offset + (1 inode-i_blkbits) - 1) inode-i_blkbits; By adding 1 block if it wasn't already on an even block, this assures us that it won't go backwards from the original offset while allowing someone to get a block that really does start exactly on the offset. loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) { long long retval; struct inode *inode = file-f_mapping-host; + loff_t (*fn)(struct file *, loff_t, int); mutex_lock(inode-i_mutex); switch (origin) { @@ -43,15 +65,24 @@ loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) break; case SEEK_CUR: offset += file-f_pos; + break; + case SEEK_HOLE: + case SEEK_DATA: + fn = generic_seek_hole_data; + if (file-f_op-seek_hole_data) + fn = file-f_op-seek_hole_data; + offset = fn(file, offset, origin); } retval = -EINVAL; if (offset=0 offset=inode-i_sb-s_maxbytes) { - if (offset != file-f_pos) { + if (offset != file-f_pos origin != SEEK_HOLE) { Why is SEEK_HOLE special in this case? The description of SEEK_HOLE and SEEK_DATA in the Sun document would imply to me that they should be handled the same. This was my interpretation of the man page, however Joern looked at what solaris does and it seems that SEEK_HOLE does update f_pos, so I will change this. file-f_pos = offset; file-f_version = 0; } retval = offset; - } + } else if (offset 0) + retval = offset; + mutex_unlock(inode-i_mutex); return retval; Thanks much for your comments, Josef - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Wed, 28 November 2007 16:39:59 -0700, Andreas Dilger wrote: On Nov 28, 2007 14:56 -0800, Nicholas Miell wrote: type: one of EXTENT_TYPE_HOLE, EXTENT_TYPE_DATA, EXTENT_TYPE_EXTENTS, EXTENT_TYPE_COMPRESSED, EXTENT_TYPE_UNCOMPRESSED etc. This is what FIEMAP is supposed to do. We wrote a spec and implemented a prototype for ext4, but haven't had time to make it generic to move the large part of the code into the VFS. If someone wanted to take that up, it would be much appreciated. See [RFC] add FIEMAP ioctl to efficiently map file allocation in linux-fsdevel for details on this interface. I didn't follow the discussion much, since it didn't appear to suit logfs too well. In a nutshell, logfs is purely block-based, prepends every block with a header, may compress blocks and packs them as tightly as possible (byte alignment). Maybe the MAP part fooled me to believe FIEMAP would also expose physical location of extends on the medium. But reading the proposal again, I am unsure about that part. If physical locations are exposed, SEEK_HOLE/SEEK_DATA is significantly more elegant for logfs. If not, FIEMAP could be useful. Jörn -- Measure. Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest. -- Rob Pike - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Thu, 2007-11-29 at 00:48 +0100, Jörn Engel wrote: On Wed, 28 November 2007 16:39:59 -0700, Andreas Dilger wrote: On Nov 28, 2007 14:56 -0800, Nicholas Miell wrote: type: one of EXTENT_TYPE_HOLE, EXTENT_TYPE_DATA, EXTENT_TYPE_EXTENTS, EXTENT_TYPE_COMPRESSED, EXTENT_TYPE_UNCOMPRESSED etc. This is what FIEMAP is supposed to do. We wrote a spec and implemented a prototype for ext4, but haven't had time to make it generic to move the large part of the code into the VFS. If someone wanted to take that up, it would be much appreciated. See [RFC] add FIEMAP ioctl to efficiently map file allocation in linux-fsdevel for details on this interface. I didn't follow the discussion much, since it didn't appear to suit logfs too well. In a nutshell, logfs is purely block-based, prepends every block with a header, may compress blocks and packs them as tightly as possible (byte alignment). Maybe the MAP part fooled me to believe FIEMAP would also expose physical location of extends on the medium. But reading the proposal again, I am unsure about that part. If physical locations are exposed, SEEK_HOLE/SEEK_DATA is significantly more elegant for logfs. If not, FIEMAP could be useful. Jörn I'd have to reread the original proposal, but I remember FIEMAP as being a generalized way of getting information about a files extents. I think the original proposal only dealt with mapping file offsets to physical extents, but IIRC the interface was flexible enough to implement a where are the holes request. Regardless, SEEK_HOLE/SEEK_DATA being a better suited interface for the needs of logfs doesn't make it the best interface for that need. -- Nicholas Miell [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 19/19] Use page_cache_xxx in drivers/block/rd.c
Use page_cache_xxx in drivers/block/rd.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- drivers/block/rd.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: mm/drivers/block/rd.c === --- mm.orig/drivers/block/rd.c 2007-11-28 12:19:49.673905513 -0800 +++ mm/drivers/block/rd.c 2007-11-28 14:13:01.076977633 -0800 @@ -122,7 +122,7 @@ static void make_page_uptodate(struct pa } } while ((bh = bh-b_this_page) != head); } else { - memset(page_address(page), 0, PAGE_CACHE_SIZE); + memset(page_address(page), 0, page_cache_size(page_mapping(page))); } flush_dcache_page(page); SetPageUptodate(page); @@ -215,9 +215,9 @@ static const struct address_space_operat static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector, struct address_space *mapping) { - pgoff_t index = sector (PAGE_CACHE_SHIFT - 9); + pgoff_t index = sector (page_cache_size(mapping) - 9); unsigned int vec_offset = vec-bv_offset; - int offset = (sector 9) ~PAGE_CACHE_MASK; + int offset = page_cache_offset(mapping, (sector 9)); int size = vec-bv_len; int err = 0; @@ -227,7 +227,7 @@ static int rd_blkdev_pagecache_IO(int rw char *src; char *dst; - count = PAGE_CACHE_SIZE - offset; + count = page_cache_size(mapping) - offset; if (count size) count = size; size -= count; -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 16/19] Use page_cache_xxx in fs/ext4
Use page_cache_xxx in fs/ext4 Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext4/dir.c |3 ++- fs/ext4/inode.c | 33 + 2 files changed, 19 insertions(+), 17 deletions(-) Index: mm/fs/ext4/dir.c === --- mm.orig/fs/ext4/dir.c 2007-11-28 12:24:24.767962686 -0800 +++ mm/fs/ext4/dir.c2007-11-28 14:11:23.532977270 -0800 @@ -132,7 +132,8 @@ static int ext4_readdir(struct file * fi err = ext4_get_blocks_wrap(NULL, inode, blk, 1, map_bh, 0, 0); if (err 0) { pgoff_t index = map_bh.b_blocknr - (PAGE_CACHE_SHIFT - inode-i_blkbits); + (page_cache_size(inode-i_mapping) + - inode-i_blkbits); if (!ra_has_index(filp-f_ra, index)) page_cache_sync_readahead( sb-s_bdev-bd_inode-i_mapping, Index: mm/fs/ext4/inode.c === --- mm.orig/fs/ext4/inode.c 2007-11-28 12:24:24.965213091 -0800 +++ mm/fs/ext4/inode.c 2007-11-28 14:12:47.716740818 -0800 @@ -1110,8 +1110,8 @@ static int ext4_write_begin(struct file pgoff_t index; unsigned from, to; - index = pos PAGE_CACHE_SHIFT; - from = pos (PAGE_CACHE_SIZE - 1); + index = page_cache_index(mapping, pos); + from = page_cache_offset(mapping, pos); to = from + len; retry: @@ -1206,7 +1206,7 @@ static int ext4_ordered_write_end(struct unsigned from, to; int ret = 0, ret2; - from = pos (PAGE_CACHE_SIZE - 1); + from = page_cache_offset(mapping, pos); to = from + len; ret = walk_page_buffers(handle, page_buffers(page), @@ -1276,7 +1276,7 @@ static int ext4_journalled_write_end(str int partial = 0; unsigned from, to; - from = pos (PAGE_CACHE_SIZE - 1); + from = page_cache_offset(mapping, pos); to = from + len; if (copied len) { @@ -1579,6 +1579,7 @@ static int ext4_ordered_writepage(struct handle_t *handle = NULL; int ret = 0; int err; + int pagesize = page_cache_size(inode-i_mapping); J_ASSERT(PageLocked(page)); @@ -1601,8 +1602,7 @@ static int ext4_ordered_writepage(struct (1 BH_Dirty)|(1 BH_Uptodate)); } page_bufs = page_buffers(page); - walk_page_buffers(handle, page_bufs, 0, - PAGE_CACHE_SIZE, NULL, bget_one); + walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bget_one); ret = block_write_full_page(page, ext4_get_block, wbc); @@ -1619,13 +1619,12 @@ static int ext4_ordered_writepage(struct * and generally junk. */ if (ret == 0) { - err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE, + err = walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, jbd2_journal_dirty_data_fn); if (!ret) ret = err; } - walk_page_buffers(handle, page_bufs, 0, - PAGE_CACHE_SIZE, NULL, bput_one); + walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bput_one); err = ext4_journal_stop(handle); if (!ret) ret = err; @@ -1677,6 +1676,7 @@ static int ext4_journalled_writepage(str handle_t *handle = NULL; int ret = 0; int err; + int pagesize = page_cache_size(inode-i_mapping); if (ext4_journal_current_handle()) goto no_write; @@ -1693,17 +1693,17 @@ static int ext4_journalled_writepage(str * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); - ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE, + ret = block_prepare_write(page, 0, page_cache_size(mapping), ext4_get_block); if (ret != 0) { ext4_journal_stop(handle); goto out_unlock; } ret = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, do_journal_get_write_access); + page_cache_size(mapping), NULL, do_journal_get_write_access); err = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, write_end_fn); + page_cache_size(mapping), NULL, write_end_fn); if (ret == 0) ret = err; EXT4_I(inode)-i_state |= EXT4_STATE_JDATA; @@ -1936,8 +1936,8 @@ void ext4_set_aops(struct inode *inode) int
[patch 13/19] Use page_cache_xxx in fs/splice.c
Use page_cache_xxx in fs/splice.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/splice.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) Index: mm/fs/splice.c === --- mm.orig/fs/splice.c 2007-11-28 12:25:34.032908404 -0800 +++ mm/fs/splice.c 2007-11-28 14:11:11.285227032 -0800 @@ -285,9 +285,9 @@ __generic_file_splice_read(struct file * .spd_release = spd_release_page, }; - index = *ppos PAGE_CACHE_SHIFT; - loff = *ppos ~PAGE_CACHE_MASK; - req_pages = (len + loff + PAGE_CACHE_SIZE - 1) PAGE_CACHE_SHIFT; + index = page_cache_index(mapping, *ppos); + loff = page_cache_offset(mapping, *ppos); + req_pages = page_cache_next(mapping, len + loff); nr_pages = min(req_pages, (unsigned)PIPE_BUFFERS); /* @@ -342,7 +342,7 @@ __generic_file_splice_read(struct file * * Now loop over the map and see if we need to start IO on any * pages, fill in the partial map, etc. */ - index = *ppos PAGE_CACHE_SHIFT; + index = page_cache_index(mapping, *ppos); nr_pages = spd.nr_pages; spd.nr_pages = 0; for (page_nr = 0; page_nr nr_pages; page_nr++) { @@ -354,7 +354,8 @@ __generic_file_splice_read(struct file * /* * this_len is the max we'll use from this page */ - this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff); + this_len = min_t(unsigned long, len, + page_cache_size(mapping) - loff); page = pages[page_nr]; if (PageReadahead(page)) @@ -414,7 +415,7 @@ fill_it: * i_size must be checked after PageUptodate. */ isize = i_size_read(mapping-host); - end_index = (isize - 1) PAGE_CACHE_SHIFT; + end_index = page_cache_index(mapping, isize - 1); if (unlikely(!isize || index end_index)) break; @@ -428,7 +429,7 @@ fill_it: /* * max good bytes in this page */ - plen = ((isize - 1) ~PAGE_CACHE_MASK) + 1; + plen = page_cache_offset(mapping, isize - 1) + 1; if (plen = loff) break; @@ -453,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = (loff_t)index PAGE_CACHE_SHIFT; + in-f_ra.prev_pos = page_cache_index(mapping, index); if (spd.nr_pages) return splice_to_pipe(pipe, spd); @@ -579,11 +580,11 @@ static int pipe_to_file(struct pipe_inod if (unlikely(ret)) return ret; - offset = sd-pos ~PAGE_CACHE_MASK; + offset = page_cache_offset(mapping, sd-pos); this_len = sd-len; - if (this_len + offset PAGE_CACHE_SIZE) - this_len = PAGE_CACHE_SIZE - offset; + if (this_len + offset page_cache_size(mapping)) + this_len = page_cache_size(mapping) - offset; ret = pagecache_write_begin(file, mapping, sd-pos, this_len, AOP_FLAG_UNINTERRUPTIBLE, page, fsdata); @@ -790,7 +791,7 @@ generic_file_splice_write_nolock(struct unsigned long nr_pages; *ppos += ret; - nr_pages = (ret + PAGE_CACHE_SIZE - 1) PAGE_CACHE_SHIFT; + nr_pages = page_cache_next(mapping, ret); /* * If file or inode is SYNC and we actually wrote some data, @@ -852,7 +853,7 @@ generic_file_splice_write(struct pipe_in unsigned long nr_pages; *ppos += ret; - nr_pages = (ret + PAGE_CACHE_SIZE - 1) PAGE_CACHE_SHIFT; + nr_pages = page_cache_next(mapping, ret); /* * If file or inode is SYNC and we actually wrote some data, -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 09/19] Use page_cache_xxx in fs/sync
Use page_cache_xxx in fs/sync. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/sync.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: mm/fs/sync.c === --- mm.orig/fs/sync.c 2007-11-16 21:16:36.0 -0800 +++ mm/fs/sync.c2007-11-28 14:10:56.269227507 -0800 @@ -260,8 +260,8 @@ int do_sync_mapping_range(struct address ret = 0; if (flags SYNC_FILE_RANGE_WAIT_BEFORE) { ret = wait_on_page_writeback_range(mapping, - offset PAGE_CACHE_SHIFT, - endbyte PAGE_CACHE_SHIFT); + page_cache_index(mapping, offset), + page_cache_index(mapping, endbyte)); if (ret 0) goto out; } @@ -275,8 +275,8 @@ int do_sync_mapping_range(struct address if (flags SYNC_FILE_RANGE_WAIT_AFTER) { ret = wait_on_page_writeback_range(mapping, - offset PAGE_CACHE_SHIFT, - endbyte PAGE_CACHE_SHIFT); + page_cache_index(mapping, offset), + page_cache_index(mapping, endbyte)); } out: return ret; -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 11/19] Use page_cache_xxx in mm/mpage.c
Use page_cache_xxx in mm/mpage.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/mpage.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) Index: linux-2.6/fs/mpage.c === --- linux-2.6.orig/fs/mpage.c 2007-11-26 17:51:53.347521636 -0800 +++ linux-2.6/fs/mpage.c2007-11-26 18:12:48.496772168 -0800 @@ -125,7 +125,8 @@ mpage_alloc(struct block_device *bdev, static void map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block) { - struct inode *inode = page-mapping-host; + struct address_space *mapping = page-mapping; + struct inode *inode = mapping-host; struct buffer_head *page_bh, *head; int block = 0; @@ -134,9 +135,9 @@ map_buffer_to_page(struct page *page, st * don't make any buffers if there is only one buffer on * the page and the page just needs to be set up to date */ - if (inode-i_blkbits == PAGE_CACHE_SHIFT + if (inode-i_blkbits == page_cache_shift(mapping) buffer_uptodate(bh)) { - SetPageUptodate(page); + SetPageUptodate(page); return; } create_empty_buffers(page, 1 inode-i_blkbits, 0); @@ -169,9 +170,10 @@ do_mpage_readpage(struct bio *bio, struc sector_t *last_block_in_bio, struct buffer_head *map_bh, unsigned long *first_logical_block, get_block_t get_block) { - struct inode *inode = page-mapping-host; + struct address_space *mapping = page-mapping; + struct inode *inode = mapping-host; const unsigned blkbits = inode-i_blkbits; - const unsigned blocks_per_page = PAGE_CACHE_SIZE blkbits; + const unsigned blocks_per_page = page_cache_size(mapping) blkbits; const unsigned blocksize = 1 blkbits; sector_t block_in_file; sector_t last_block; @@ -188,7 +190,7 @@ do_mpage_readpage(struct bio *bio, struc if (page_has_buffers(page)) goto confused; - block_in_file = (sector_t)page-index (PAGE_CACHE_SHIFT - blkbits); + block_in_file = (sector_t)page-index (page_cache_shift(mapping) - blkbits); last_block = block_in_file + nr_pages * blocks_per_page; last_block_in_file = (i_size_read(inode) + blocksize - 1) blkbits; if (last_block last_block_in_file) @@ -276,7 +278,8 @@ do_mpage_readpage(struct bio *bio, struc } if (first_hole != blocks_per_page) { - zero_user_segment(page, first_hole blkbits, PAGE_CACHE_SIZE); + zero_user_segment(page, first_hole blkbits, + page_cache_size(mapping)); if (first_hole == 0) { SetPageUptodate(page); unlock_page(page); @@ -454,7 +457,7 @@ static int __mpage_writepage(struct page struct inode *inode = page-mapping-host; const unsigned blkbits = inode-i_blkbits; unsigned long end_index; - const unsigned blocks_per_page = PAGE_CACHE_SIZE blkbits; + const unsigned blocks_per_page = page_cache_size(mapping) blkbits; sector_t last_block; sector_t block_in_file; sector_t blocks[MAX_BUF_PER_PAGE]; @@ -523,7 +526,8 @@ static int __mpage_writepage(struct page * The page has no buffers: map it to disk */ BUG_ON(!PageUptodate(page)); - block_in_file = (sector_t)page-index (PAGE_CACHE_SHIFT - blkbits); + block_in_file = (sector_t)page-index + (page_cache_shift(mapping) - blkbits); last_block = (i_size - 1) blkbits; map_bh.b_page = page; for (page_block = 0; page_block blocks_per_page; ) { @@ -555,7 +559,7 @@ static int __mpage_writepage(struct page first_unmapped = page_block; page_is_mapped: - end_index = i_size PAGE_CACHE_SHIFT; + end_index = page_cache_index(mapping, i_size); if (page-index = end_index) { /* * The page straddles i_size. It must be zeroed out on each @@ -565,11 +569,11 @@ page_is_mapped: * is zeroed when mapped, and writes to that region are not * written out to the file. */ - unsigned offset = i_size (PAGE_CACHE_SIZE - 1); + unsigned offset = page_cache_offset(mapping, i_size); if (page-index end_index || !offset) goto confused; - zero_user_segment(page, offset, PAGE_CACHE_SIZE); + zero_user_segment(page, offset, page_cache_size(mapping)); } /* -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at
[patch 05/19] Use page_cache_xxx in mm/rmap.c
Use page_cache_xxx in mm/rmap.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/rmap.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) Index: mm/mm/rmap.c === --- mm.orig/mm/rmap.c 2007-11-28 12:27:32.312059099 -0800 +++ mm/mm/rmap.c2007-11-28 14:10:42.758227810 -0800 @@ -190,9 +190,14 @@ static void page_unlock_anon_vma(struct static inline unsigned long vma_address(struct page *page, struct vm_area_struct *vma) { - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff; unsigned long address; + if (PageAnon(page)) + pgoff = page-index; + else + pgoff = page-index mapping_order(page-mapping); + address = vma-vm_start + ((pgoff - vma-vm_pgoff) PAGE_SHIFT); if (unlikely(address vma-vm_start || address = vma-vm_end)) { /* page should be within @vma mapping range */ @@ -345,7 +350,7 @@ static int page_referenced_file(struct p { unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); struct vm_area_struct *vma; struct prio_tree_iter iter; int referenced = 0; @@ -464,7 +469,7 @@ out: static int page_mkclean_file(struct address_space *mapping, struct page *page) { - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); struct vm_area_struct *vma; struct prio_tree_iter iter; int ret = 0; @@ -897,7 +902,7 @@ static int try_to_unmap_anon(struct page static int try_to_unmap_file(struct page *page, int migration) { struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); struct vm_area_struct *vma; struct prio_tree_iter iter; int ret = SWAP_AGAIN; -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 03/19] Use page_cache_xxx in mm/page-writeback.c
Use page_cache_xxx in mm/page-writeback.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/page-writeback.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: mm/mm/page-writeback.c === --- mm.orig/mm/page-writeback.c 2007-11-28 12:27:32.211962401 -0800 +++ mm/mm/page-writeback.c 2007-11-28 14:10:34.338227137 -0800 @@ -818,8 +818,8 @@ int write_cache_pages(struct address_spa index = mapping-writeback_index; /* Start from prev offset */ end = -1; } else { - index = wbc-range_start PAGE_CACHE_SHIFT; - end = wbc-range_end PAGE_CACHE_SHIFT; + index = page_cache_index(mapping, wbc-range_start); + end = page_cache_index(mapping, wbc-range_end); if (wbc-range_start == 0 wbc-range_end == LLONG_MAX) range_whole = 1; scanned = 1; @@ -1025,7 +1025,7 @@ int __set_page_dirty_nobuffers(struct pa __inc_zone_page_state(page, NR_FILE_DIRTY); __inc_bdi_stat(mapping-backing_dev_info, BDI_RECLAIMABLE); - task_io_account_write(PAGE_CACHE_SIZE); + task_io_account_write(page_cache_size(mapping)); } radix_tree_tag_set(mapping-page_tree, page_index(page), PAGECACHE_TAG_DIRTY); -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions
This patchset cleans up page cache handling by replacing open coded shifts and adds with inline function calls. The ultimate goal is to replace all uses of PAGE_CACHE_xxx in the kernel through the use of these functions. All the functions take a mapping parameter. The mapping parameter is required if we want to support large block sizes in filesystems and block devices. Patchset against 2.6.24-rc3-mm2. -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 07/19] Use page_cache_xxx in mm/migrate.c
Use page_cache_xxx in mm/migrate.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/migrate.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/mm/migrate.c === --- mm.orig/mm/migrate.c2007-11-28 12:27:32.184464256 -0800 +++ mm/mm/migrate.c 2007-11-28 14:10:49.200977227 -0800 @@ -197,7 +197,7 @@ static void remove_file_migration_ptes(s struct vm_area_struct *vma; struct address_space *mapping = page_mapping(new); struct prio_tree_iter iter; - pgoff_t pgoff = new-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = new-index mapping_order(mapping); if (!mapping) return; -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 02/19] Use page_cache_xxx functions in mm/filemap.c
Convert the uses of PAGE_CACHE_xxx to use page_cache_xxx instead. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/filemap.c | 91 +-- 1 file changed, 46 insertions(+), 45 deletions(-) Index: mm/mm/filemap.c === --- mm.orig/mm/filemap.c2007-11-28 12:27:32.155962689 -0800 +++ mm/mm/filemap.c 2007-11-28 14:10:29.408977142 -0800 @@ -314,8 +314,8 @@ EXPORT_SYMBOL(add_to_page_cache_lru); int sync_page_range(struct inode *inode, struct address_space *mapping, loff_t pos, loff_t count) { - pgoff_t start = pos PAGE_CACHE_SHIFT; - pgoff_t end = (pos + count - 1) PAGE_CACHE_SHIFT; + pgoff_t start = page_cache_index(mapping, pos); + pgoff_t end = page_cache_index(mapping, pos + count - 1); int ret; if (!mapping_cap_writeback_dirty(mapping) || !count) @@ -346,8 +346,8 @@ EXPORT_SYMBOL(sync_page_range); int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, loff_t pos, loff_t count) { - pgoff_t start = pos PAGE_CACHE_SHIFT; - pgoff_t end = (pos + count - 1) PAGE_CACHE_SHIFT; + pgoff_t start = page_cache_index(mapping, pos); + pgoff_t end = page_cache_index(mapping, pos + count - 1); int ret; if (!mapping_cap_writeback_dirty(mapping) || !count) @@ -376,7 +376,7 @@ int filemap_fdatawait(struct address_spa return 0; return wait_on_page_writeback_range(mapping, 0, - (i_size - 1) PAGE_CACHE_SHIFT); + page_cache_index(mapping, i_size - 1)); } EXPORT_SYMBOL(filemap_fdatawait); @@ -424,8 +424,8 @@ int filemap_write_and_wait_range(struct /* See comment of filemap_write_and_wait() */ if (err != -EIO) { int err2 = wait_on_page_writeback_range(mapping, - lstart PAGE_CACHE_SHIFT, - lend PAGE_CACHE_SHIFT); + page_cache_index(mapping, lstart), + page_cache_index(mapping, lend)); if (!err) err = err2; } @@ -897,11 +897,11 @@ void do_generic_mapping_read(struct addr unsigned int prev_offset; int error; - index = *ppos PAGE_CACHE_SHIFT; - prev_index = ra-prev_pos PAGE_CACHE_SHIFT; - prev_offset = ra-prev_pos (PAGE_CACHE_SIZE-1); - last_index = (*ppos + desc-count + PAGE_CACHE_SIZE-1) PAGE_CACHE_SHIFT; - offset = *ppos ~PAGE_CACHE_MASK; + index = page_cache_index(mapping, *ppos); + prev_index = page_cache_index(mapping, ra-prev_pos); + prev_offset = page_cache_offset(mapping, ra-prev_pos); + last_index = page_cache_next(mapping, *ppos + desc-count); + offset = page_cache_offset(mapping, *ppos); for (;;) { struct page *page; @@ -938,16 +938,16 @@ page_ok: */ isize = i_size_read(inode); - end_index = (isize - 1) PAGE_CACHE_SHIFT; + end_index = page_cache_index(mapping, isize - 1); if (unlikely(!isize || index end_index)) { page_cache_release(page); goto out; } /* nr is the maximum number of bytes to copy from this page */ - nr = PAGE_CACHE_SIZE; + nr = page_cache_size(mapping); if (index == end_index) { - nr = ((isize - 1) ~PAGE_CACHE_MASK) + 1; + nr = page_cache_offset(mapping, isize - 1) + 1; if (nr = offset) { page_cache_release(page); goto out; @@ -982,8 +982,8 @@ page_ok: */ ret = actor(desc, page, offset, nr); offset += ret; - index += offset PAGE_CACHE_SHIFT; - offset = ~PAGE_CACHE_MASK; + index += page_cache_index(mapping, offset); + offset = page_cache_offset(mapping, offset); prev_offset = offset; page_cache_release(page); @@ -1073,11 +1073,8 @@ no_cached_page: } out: - ra-prev_pos = prev_index; - ra-prev_pos = PAGE_CACHE_SHIFT; - ra-prev_pos |= prev_offset; - - *ppos = ((loff_t)index PAGE_CACHE_SHIFT) + offset; + ra-prev_pos = page_cache_pos(mapping, prev_index, prev_offset); + *ppos = page_cache_pos(mapping, index, offset); if (filp) file_accessed(filp); } @@ -1257,8 +1254,8 @@ asmlinkage ssize_t sys_readahead(int fd, if (file) { if (file-f_mode FMODE_READ) {
[patch 04/19] Use page_cache_xxx in mm/truncate.c
Use page_cache_xxx in mm/truncate.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/truncate.c | 35 ++- 1 file changed, 18 insertions(+), 17 deletions(-) Index: mm/mm/truncate.c === --- mm.orig/mm/truncate.c 2007-11-28 12:27:32.480099915 -0800 +++ mm/mm/truncate.c2007-11-28 14:10:39.013977394 -0800 @@ -46,9 +46,10 @@ void do_invalidatepage(struct page *page (*invalidatepage)(page, offset); } -static inline void truncate_partial_page(struct page *page, unsigned partial) +static inline void truncate_partial_page(struct address_space *mapping, + struct page *page, unsigned partial) { - zero_user_segment(page, partial, PAGE_CACHE_SIZE); + zero_user_segment(page, partial, page_cache_size(mapping)); if (PagePrivate(page)) do_invalidatepage(page, partial); } @@ -98,7 +99,7 @@ truncate_complete_page(struct address_sp if (page-mapping != mapping) return; - cancel_dirty_page(page, PAGE_CACHE_SIZE); + cancel_dirty_page(page, page_cache_size(mapping)); if (PagePrivate(page)) do_invalidatepage(page, 0); @@ -160,9 +161,9 @@ invalidate_complete_page(struct address_ void truncate_inode_pages_range(struct address_space *mapping, loff_t lstart, loff_t lend) { - const pgoff_t start = (lstart + PAGE_CACHE_SIZE-1) PAGE_CACHE_SHIFT; + const pgoff_t start = page_cache_next(mapping, lstart); pgoff_t end; - const unsigned partial = lstart (PAGE_CACHE_SIZE - 1); + const unsigned partial = page_cache_offset(mapping, lstart); struct pagevec pvec; pgoff_t next; int i; @@ -170,8 +171,9 @@ void truncate_inode_pages_range(struct a if (mapping-nrpages == 0) return; - BUG_ON((lend (PAGE_CACHE_SIZE - 1)) != (PAGE_CACHE_SIZE - 1)); - end = (lend PAGE_CACHE_SHIFT); + BUG_ON(page_cache_offset(mapping, lend) != + page_cache_size(mapping) - 1); + end = page_cache_index(mapping, lend); pagevec_init(pvec, 0); next = start; @@ -197,8 +199,8 @@ void truncate_inode_pages_range(struct a } if (page_mapped(page)) { unmap_mapping_range(mapping, - (loff_t)page_indexPAGE_CACHE_SHIFT, - PAGE_CACHE_SIZE, 0); + page_cache_pos(mapping, page_index, 0), + page_cache_size(mapping), 0); } truncate_complete_page(mapping, page); unlock_page(page); @@ -211,7 +213,7 @@ void truncate_inode_pages_range(struct a struct page *page = find_lock_page(mapping, start - 1); if (page) { wait_on_page_writeback(page); - truncate_partial_page(page, partial); + truncate_partial_page(mapping, page, partial); unlock_page(page); page_cache_release(page); } @@ -239,8 +241,8 @@ void truncate_inode_pages_range(struct a wait_on_page_writeback(page); if (page_mapped(page)) { unmap_mapping_range(mapping, - (loff_t)page-indexPAGE_CACHE_SHIFT, - PAGE_CACHE_SIZE, 0); + page_cache_pos(mapping, page-index, 0), + page_cache_size(mapping), 0); } if (page-index next) next = page-index; @@ -424,9 +426,8 @@ int invalidate_inode_pages2_range(struct * Zap the rest of the file in one hit. */ unmap_mapping_range(mapping, - (loff_t)page_indexPAGE_CACHE_SHIFT, - (loff_t)(end - page_index + 1) -PAGE_CACHE_SHIFT, + page_cache_pos(mapping, page_index, 0), + page_cache_pos(mapping, end - page_index + 1, 0), 0); did_range_unmap = 1; } else { @@ -434,8 +435,8 @@ int invalidate_inode_pages2_range(struct * Just zap this page */ unmap_mapping_range(mapping, -
[patch 06/19] Use page_cache_xxx in mm/filemap_xip.c
Use page_cache_xxx in mm/filemap_xip.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/filemap_xip.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) Index: mm/mm/filemap_xip.c === --- mm.orig/mm/filemap_xip.c2007-11-28 12:27:32.155962689 -0800 +++ mm/mm/filemap_xip.c 2007-11-28 14:10:46.124978450 -0800 @@ -60,24 +60,24 @@ do_xip_mapping_read(struct address_space BUG_ON(!mapping-a_ops-get_xip_page); - index = *ppos PAGE_CACHE_SHIFT; - offset = *ppos ~PAGE_CACHE_MASK; + index = page_cache_index(mapping, *ppos); + offset = page_cache_offset(mapping, *ppos); isize = i_size_read(inode); if (!isize) goto out; - end_index = (isize - 1) PAGE_CACHE_SHIFT; + end_index = page_cache_index(mapping, isize - 1); for (;;) { struct page *page; unsigned long nr, ret; /* nr is the maximum number of bytes to copy from this page */ - nr = PAGE_CACHE_SIZE; + nr = page_cache_size(mapping); if (index = end_index) { if (index end_index) goto out; - nr = ((isize - 1) ~PAGE_CACHE_MASK) + 1; + nr = page_cache_next(mapping, size - 1) + 1; if (nr = offset) { goto out; } @@ -116,8 +116,8 @@ do_xip_mapping_read(struct address_space */ ret = actor(desc, page, offset, nr); offset += ret; - index += offset PAGE_CACHE_SHIFT; - offset = ~PAGE_CACHE_MASK; + index += page_cache_index(mapping, offset); + offset = page_cache_offset(mapping, offset); if (ret == nr desc-count) continue; @@ -130,7 +130,7 @@ no_xip_page: } out: - *ppos = ((loff_t) index PAGE_CACHE_SHIFT) + offset; + *ppos = page_cache_pos(mapping, index, offset); if (filp) file_accessed(filp); } @@ -219,7 +219,7 @@ static int xip_file_fault(struct vm_area /* XXX: are VM_FAULT_ codes OK? */ - size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) PAGE_CACHE_SHIFT; + size = page_cache_next(mapping, i_size_read(inode)); if (vmf-pgoff = size) return VM_FAULT_SIGBUS; @@ -289,9 +289,9 @@ __xip_file_write(struct file *filp, cons size_t copied; char *kaddr; - offset = (pos (PAGE_CACHE_SIZE -1)); /* Within page */ - index = pos PAGE_CACHE_SHIFT; - bytes = PAGE_CACHE_SIZE - offset; + offset = page_cache_offset(mapping, pos); /* Within page */ + index = page_cache_index(mapping, pos); + bytes = page_cache_size(mapping) - offset; if (bytes count) bytes = count; @@ -402,8 +402,8 @@ EXPORT_SYMBOL_GPL(xip_file_write); int xip_truncate_page(struct address_space *mapping, loff_t from) { - pgoff_t index = from PAGE_CACHE_SHIFT; - unsigned offset = from (PAGE_CACHE_SIZE-1); + pgoff_t index = page_cache_index(mapping, from); + unsigned offset = page_cache_offset(mapping, from); unsigned blocksize; unsigned length; struct page *page; -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 08/19] Use page_cache_xxx in fs/libfs.c
Use page_cache_xxx in fs/libfs.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/libfs.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) Index: mm/fs/libfs.c === --- mm.orig/fs/libfs.c 2007-11-28 12:24:57.449215408 -0800 +++ mm/fs/libfs.c 2007-11-28 14:10:51.773477763 -0800 @@ -17,7 +17,8 @@ int simple_getattr(struct vfsmount *mnt, { struct inode *inode = dentry-d_inode; generic_fillattr(inode, stat); - stat-blocks = inode-i_mapping-nrpages (PAGE_CACHE_SHIFT - 9); + stat-blocks = inode-i_mapping-nrpages + (page_cache_shift(inode-i_mapping) - 9); return 0; } @@ -341,10 +342,10 @@ int simple_prepare_write(struct file *fi unsigned from, unsigned to) { if (!PageUptodate(page)) { - if (to - from != PAGE_CACHE_SIZE) + if (to - from != page_cache_size(file-f_mapping)) zero_user_segments(page, 0, from, - to, PAGE_CACHE_SIZE); + to, page_cache_size(file-f_mapping)); } return 0; } @@ -372,8 +373,9 @@ int simple_write_begin(struct file *file static int simple_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) { - struct inode *inode = page-mapping-host; - loff_t pos = ((loff_t)page-index PAGE_CACHE_SHIFT) + to; + struct address_space *mapping = page-mapping; + struct inode *inode = mapping-host; + loff_t pos = page_cache_pos(mapping, page-index, to); if (!PageUptodate(page)) SetPageUptodate(page); -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 12/19] Use page_cache_xxx in mm/fadvise.c
Use page_cache_xxx in mm/fadvise.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/fadvise.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: mm/mm/fadvise.c === --- mm.orig/mm/fadvise.c2007-11-16 21:16:36.0 -0800 +++ mm/mm/fadvise.c 2007-11-28 14:11:06.164977155 -0800 @@ -79,8 +79,8 @@ asmlinkage long sys_fadvise64_64(int fd, } /* First and last PARTIAL page! */ - start_index = offset PAGE_CACHE_SHIFT; - end_index = endbyte PAGE_CACHE_SHIFT; + start_index = page_cache_index(mapping, offset); + end_index = page_cache_index(mapping, endbyte); /* Careful about overflow on the +1 */ nrpages = end_index - start_index + 1; @@ -100,8 +100,8 @@ asmlinkage long sys_fadvise64_64(int fd, filemap_flush(mapping); /* First and last FULL page! */ - start_index = (offset+(PAGE_CACHE_SIZE-1)) PAGE_CACHE_SHIFT; - end_index = (endbyte PAGE_CACHE_SHIFT); + start_index = page_cache_next(mapping, offset); + end_index = page_cache_index(mapping, endbyte); if (end_index = start_index) invalidate_mapping_pages(mapping, start_index, -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 15/19] Use page_cache_xxx in fs/ext3
Use page_cache_xxx in fs/ext3 Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext3/dir.c |3 ++- fs/ext3/inode.c | 39 --- 2 files changed, 22 insertions(+), 20 deletions(-) Index: mm/fs/ext3/dir.c === --- mm.orig/fs/ext3/dir.c 2007-11-16 21:16:36.0 -0800 +++ mm/fs/ext3/dir.c2007-11-28 14:11:16.689227316 -0800 @@ -133,7 +133,8 @@ static int ext3_readdir(struct file * fi map_bh, 0, 0); if (err 0) { pgoff_t index = map_bh.b_blocknr - (PAGE_CACHE_SHIFT - inode-i_blkbits); + (page_cache_shift(inode-i_mapping) + - inode-i_blkbits); if (!ra_has_index(filp-f_ra, index)) page_cache_sync_readahead( sb-s_bdev-bd_inode-i_mapping, Index: mm/fs/ext3/inode.c === --- mm.orig/fs/ext3/inode.c 2007-11-28 12:24:24.567962333 -0800 +++ mm/fs/ext3/inode.c 2007-11-28 14:11:16.701086757 -0800 @@ -1159,8 +1159,8 @@ static int ext3_write_begin(struct file pgoff_t index; unsigned from, to; - index = pos PAGE_CACHE_SHIFT; - from = pos (PAGE_CACHE_SIZE - 1); + index = page_cache_index(mapping, pos); + from = page_cache_offset(mapping, pos); to = from + len; retry: @@ -1256,7 +1256,7 @@ static int ext3_ordered_write_end(struct unsigned from, to; int ret = 0, ret2; - from = pos (PAGE_CACHE_SIZE - 1); + from = page_cache_offset(mapping, pos); to = from + len; ret = walk_page_buffers(handle, page_buffers(page), @@ -1326,7 +1326,7 @@ static int ext3_journalled_write_end(str int partial = 0; unsigned from, to; - from = pos (PAGE_CACHE_SIZE - 1); + from = page_cache_offset(mapping, pos); to = from + len; if (copied len) { @@ -1489,6 +1489,7 @@ static int ext3_ordered_writepage(struct handle_t *handle = NULL; int ret = 0; int err; + int pagesize = page_cache_size(inode-i_mapping); J_ASSERT(PageLocked(page)); @@ -1511,8 +1512,7 @@ static int ext3_ordered_writepage(struct (1 BH_Dirty)|(1 BH_Uptodate)); } page_bufs = page_buffers(page); - walk_page_buffers(handle, page_bufs, 0, - PAGE_CACHE_SIZE, NULL, bget_one); + walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bget_one); ret = block_write_full_page(page, ext3_get_block, wbc); @@ -1529,13 +1529,12 @@ static int ext3_ordered_writepage(struct * and generally junk. */ if (ret == 0) { - err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE, - NULL, journal_dirty_data_fn); + err = walk_page_buffers(handle, page_bufs, 0, pagesize, + NULL, journal_dirty_data_fn); if (!ret) ret = err; } - walk_page_buffers(handle, page_bufs, 0, - PAGE_CACHE_SIZE, NULL, bput_one); + walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bput_one); err = ext3_journal_stop(handle); if (!ret) ret = err; @@ -1583,10 +1582,12 @@ out_fail: static int ext3_journalled_writepage(struct page *page, struct writeback_control *wbc) { - struct inode *inode = page-mapping-host; + struct address_space *mapping = page-mapping; + struct inode *inode = mapping-host; handle_t *handle = NULL; int ret = 0; int err; + int pagesize = page_cache_size(inode-i_mapping); if (ext3_journal_current_handle()) goto no_write; @@ -1603,17 +1604,16 @@ static int ext3_journalled_writepage(str * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); - ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE, - ext3_get_block); + ret = block_prepare_write(page, 0, pagesize, ext3_get_block); if (ret != 0) { ext3_journal_stop(handle); goto out_unlock; } ret = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, do_journal_get_write_access); + pagesize, NULL, do_journal_get_write_access); err = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, write_end_fn); +
[patch 14/19] Use page_cache_xxx in ext2
Use page_cache_xxx functions in fs/ext2/* Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext2/dir.c | 40 +++- 1 file changed, 23 insertions(+), 17 deletions(-) Index: linux-2.6/fs/ext2/dir.c === --- linux-2.6.orig/fs/ext2/dir.c2007-11-26 17:45:29.155116723 -0800 +++ linux-2.6/fs/ext2/dir.c 2007-11-26 18:15:08.660772219 -0800 @@ -63,7 +63,8 @@ static inline void ext2_put_page(struct static inline unsigned long dir_pages(struct inode *inode) { - return (inode-i_size+PAGE_CACHE_SIZE-1)PAGE_CACHE_SHIFT; + return (inode-i_size+page_cache_size(inode-i_mapping)-1) + page_cache_shift(inode-i_mapping); } /* @@ -74,10 +75,11 @@ static unsigned ext2_last_byte(struct inode *inode, unsigned long page_nr) { unsigned last_byte = inode-i_size; + struct address_space *mapping = inode-i_mapping; - last_byte -= page_nr PAGE_CACHE_SHIFT; - if (last_byte PAGE_CACHE_SIZE) - last_byte = PAGE_CACHE_SIZE; + last_byte -= page_nr page_cache_shift(mapping); + if (last_byte page_cache_size(mapping)) + last_byte = page_cache_size(mapping); return last_byte; } @@ -105,18 +107,19 @@ static int ext2_commit_chunk(struct page static void ext2_check_page(struct page *page) { - struct inode *dir = page-mapping-host; + struct address_space *mapping = page-mapping; + struct inode *dir = mapping-host; struct super_block *sb = dir-i_sb; unsigned chunk_size = ext2_chunk_size(dir); char *kaddr = page_address(page); u32 max_inumber = le32_to_cpu(EXT2_SB(sb)-s_es-s_inodes_count); unsigned offs, rec_len; - unsigned limit = PAGE_CACHE_SIZE; + unsigned limit = page_cache_size(mapping); ext2_dirent *p; char *error; - if ((dir-i_size PAGE_CACHE_SHIFT) == page-index) { - limit = dir-i_size ~PAGE_CACHE_MASK; + if (page_cache_index(mapping, dir-i_size) == page-index) { + limit = page_cache_offset(mapping, dir-i_size); if (limit (chunk_size - 1)) goto Ebadsize; if (!limit) @@ -168,7 +171,7 @@ Einumber: bad_entry: ext2_error (sb, ext2_check_page, bad entry in directory #%lu: %s - offset=%lu, inode=%lu, rec_len=%d, name_len=%d, - dir-i_ino, error, (page-indexPAGE_CACHE_SHIFT)+offs, + dir-i_ino, error, page_cache_pos(mapping, page-index, offs), (unsigned long) le32_to_cpu(p-inode), rec_len, p-name_len); goto fail; @@ -177,7 +180,7 @@ Eend: ext2_error (sb, ext2_check_page, entry in directory #%lu spans the page boundary offset=%lu, inode=%lu, - dir-i_ino, (page-indexPAGE_CACHE_SHIFT)+offs, + dir-i_ino, page_cache_pos(mapping, page-index, offs), (unsigned long) le32_to_cpu(p-inode)); fail: SetPageChecked(page); @@ -276,8 +279,9 @@ ext2_readdir (struct file * filp, void * loff_t pos = filp-f_pos; struct inode *inode = filp-f_path.dentry-d_inode; struct super_block *sb = inode-i_sb; - unsigned int offset = pos ~PAGE_CACHE_MASK; - unsigned long n = pos PAGE_CACHE_SHIFT; + struct address_space *mapping = inode-i_mapping; + unsigned int offset = page_cache_offset(mapping, pos); + unsigned long n = page_cache_index(mapping, pos); unsigned long npages = dir_pages(inode); unsigned chunk_mask = ~(ext2_chunk_size(inode)-1); unsigned char *types = NULL; @@ -298,14 +302,14 @@ ext2_readdir (struct file * filp, void * ext2_error(sb, __FUNCTION__, bad page in #%lu, inode-i_ino); - filp-f_pos += PAGE_CACHE_SIZE - offset; + filp-f_pos += page_cache_size(mapping) - offset; return -EIO; } kaddr = page_address(page); if (unlikely(need_revalidate)) { if (offset) { offset = ext2_validate_entry(kaddr, offset, chunk_mask); - filp-f_pos = (nPAGE_CACHE_SHIFT) + offset; + filp-f_pos = page_cache_pos(mapping, n, offset); } filp-f_version = inode-i_version; need_revalidate = 0; @@ -328,7 +332,7 @@ ext2_readdir (struct file * filp, void * offset = (char *)de - kaddr; over = filldir(dirent, de-name, de-name_len, - (nPAGE_CACHE_SHIFT) | offset, +
[patch 17/19] Use page_cache_xxx in fs/reiserfs
Use page_cache_xxx in fs/reiserfs Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/reiserfs/file.c|6 -- fs/reiserfs/inode.c | 33 - fs/reiserfs/ioctl.c |2 +- fs/reiserfs/stree.c |5 +++-- fs/reiserfs/tail_conversion.c |5 +++-- fs/reiserfs/xattr.c | 19 ++- 6 files changed, 41 insertions(+), 29 deletions(-) Index: mm/fs/reiserfs/file.c === --- mm.orig/fs/reiserfs/file.c 2007-11-16 21:16:36.0 -0800 +++ mm/fs/reiserfs/file.c 2007-11-28 14:12:52.242227141 -0800 @@ -161,11 +161,12 @@ int reiserfs_commit_page(struct inode *i int partial = 0; unsigned blocksize; struct buffer_head *bh, *head; - unsigned long i_size_index = inode-i_size PAGE_CACHE_SHIFT; + unsigned long i_size_index = + page_cache_index(inode-i_mapping, inode-i_size); int new; int logit = reiserfs_file_data_log(inode); struct super_block *s = inode-i_sb; - int bh_per_page = PAGE_CACHE_SIZE / s-s_blocksize; + int bh_per_page = page_cache_size(inode-i_mapping) / s-s_blocksize; struct reiserfs_transaction_handle th; int ret = 0; @@ -260,6 +261,7 @@ static ssize_t reiserfs_file_write(struc /* To simplify coding at this time, we store locked pages in array for now */ struct reiserfs_transaction_handle th; + struct address_space *mapping = inode-i_mapping; th.t_trans_id = 0; /* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items Index: mm/fs/reiserfs/inode.c === --- mm.orig/fs/reiserfs/inode.c 2007-11-28 12:25:33.863963689 -0800 +++ mm/fs/reiserfs/inode.c 2007-11-28 14:12:52.242227141 -0800 @@ -337,7 +337,8 @@ static int _get_block_create_0(struct in goto finished; } // read file tail into part of page - offset = (cpu_key_k_offset(key) - 1) (PAGE_CACHE_SIZE - 1); + offset = page_cache_offset(inode-i_mapping, + cpu_key_k_offset(key) - 1); fs_gen = get_generation(inode-i_sb); copy_item_head(tmp_ih, ih); @@ -523,10 +524,10 @@ static int convert_tail_for_hole(struct return -EIO; /* always try to read until the end of the block */ - tail_start = tail_offset (PAGE_CACHE_SIZE - 1); + tail_start = page_cache_offset(inode-i_mapping, tail_offset); tail_end = (tail_start | (bh_result-b_size - 1)) + 1; - index = tail_offset PAGE_CACHE_SHIFT; + index = page_cache_index(inode-i_mapping, tail_offset); /* hole_page can be zero in case of direct_io, we are sure that we cannot get here if we write with O_DIRECT into tail page */ @@ -2000,11 +2001,13 @@ static int grab_tail_page(struct inode * /* we want the page with the last byte in the file, ** not the page that will hold the next byte for appending */ - unsigned long index = (p_s_inode-i_size - 1) PAGE_CACHE_SHIFT; + unsigned long index = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size - 1); unsigned long pos = 0; unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = (p_s_inode-i_size) (PAGE_CACHE_SIZE - 1); + unsigned long offset = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size); struct buffer_head *bh; struct buffer_head *head; struct page *page; @@ -2076,7 +2079,8 @@ int reiserfs_truncate_file(struct inode { struct reiserfs_transaction_handle th; /* we want the offset for the first byte after the end of the file */ - unsigned long offset = p_s_inode-i_size (PAGE_CACHE_SIZE - 1); + unsigned long offset = page_cache_offset(p_s_inode-i_mapping, + p_s_inode-i_size); unsigned blocksize = p_s_inode-i_sb-s_blocksize; unsigned length; struct page *page = NULL; @@ -2225,7 +2229,7 @@ static int map_block_for_writepage(struc } else if (is_direct_le_ih(ih)) { char *p; p = page_address(bh_result-b_page); - p += (byte_offset - 1) (PAGE_CACHE_SIZE - 1); + p += page_cache_offset(inode-i_mapping, byte_offset - 1); copy_size = ih_item_len(ih) - pos_in_item; fs_gen = get_generation(inode-i_sb); @@ -2324,7 +2328,8 @@ static int reiserfs_write_full_page(stru struct writeback_control *wbc) { struct inode *inode = page-mapping-host; - unsigned long end_index = inode-i_size
[patch 18/19] Use page_cache_xxx for fs/xfs
Use page_cache_xxx for fs/xfs Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_aops.c | 55 +++- fs/xfs/linux-2.6/xfs_lrw.c |4 +-- 2 files changed, 31 insertions(+), 28 deletions(-) Index: mm/fs/xfs/linux-2.6/xfs_aops.c === --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 12:25:38.768212813 -0800 +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 14:12:55.637977383 -0800 @@ -75,7 +75,7 @@ xfs_page_trace( xfs_inode_t *ip; bhv_vnode_t *vp = vn_from_inode(inode); loff_t isize = i_size_read(inode); - loff_t offset = page_offset(page); + loff_t offset = page_cache_offset(page-mapping); int delalloc = -1, unmapped = -1, unwritten = -1; if (page_has_buffers(page)) @@ -618,7 +618,7 @@ xfs_probe_page( break; } while ((bh = bh-b_this_page) != head); } else - ret = mapped ? 0 : PAGE_CACHE_SIZE; + ret = mapped ? 0 : page_cache_size(page-mapping); } return ret; @@ -645,7 +645,7 @@ xfs_probe_cluster( } while ((bh = bh-b_this_page) != head); /* if we reached the end of the page, sum forwards in following pages */ - tlast = i_size_read(inode) PAGE_CACHE_SHIFT; + tlast = page_cache_index(inode-i_mapping, i_size_read(inode)); tindex = startpage-index + 1; /* Prune this back to avoid pathological behavior */ @@ -663,14 +663,14 @@ xfs_probe_cluster( size_t pg_offset, pg_len = 0; if (tindex == tlast) { - pg_offset = - i_size_read(inode) (PAGE_CACHE_SIZE - 1); + pg_offset = page_cache_offset(inode-i_mapping, + i_size_read(inode)); if (!pg_offset) { done = 1; break; } } else - pg_offset = PAGE_CACHE_SIZE; + pg_offset = page_cache_size(inode-i_mapping); if (page-index == tindex !TestSetPageLocked(page)) { pg_len = xfs_probe_page(page, pg_offset, mapped); @@ -752,7 +752,8 @@ xfs_convert_page( int bbits = inode-i_blkbits; int len, page_dirty; int count = 0, done = 0, uptodate = 1; - xfs_off_t offset = page_offset(page); + struct address_space*map = inode-i_mapping; + xfs_off_t offset = page_cache_pos(map, page-index, 0); if (page-index != tindex) goto fail; @@ -760,7 +761,7 @@ xfs_convert_page( goto fail; if (PageWriteback(page)) goto fail_unlock_page; - if (page-mapping != inode-i_mapping) + if (page-mapping != map) goto fail_unlock_page; if (!xfs_is_delayed_page(page, (*ioendp)-io_type)) goto fail_unlock_page; @@ -772,20 +773,20 @@ xfs_convert_page( * Derivation: * * End offset is the highest offset that this page should represent. -* If we are on the last page, (end_offset (PAGE_CACHE_SIZE - 1)) -* will evaluate non-zero and be less than PAGE_CACHE_SIZE and +* If we are on the last page, (end_offset page_cache_mask()) +* will evaluate non-zero and be less than page_cache_size() and * hence give us the correct page_dirty count. On any other page, * it will be zero and in that case we need page_dirty to be the * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) PAGE_CACHE_SHIFT, + (xfs_off_t)(page-index + 1) page_cache_shift(map), i_size_read(inode)); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, end_offset (PAGE_CACHE_SIZE - 1), - PAGE_CACHE_SIZE); - p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE; + p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), + page_cache_size(map)); + p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -941,6 +942,8 @@ xfs_page_state_convert( int page_dirty, count = 0; int trylock = 0; int
[patch 01/19] Define functions for page cache handling
We use the macros PAGE_CACHE_SIZE PAGE_CACHE_SHIFT PAGE_CACHE_MASK and PAGE_CACHE_ALIGN in various places in the kernel. Many times common operations like calculating the offset or the index are coded using shifts and adds. This patch provides inline functions to get the calculations accomplished without having to explicitly shift and add constants. All functions take an address_space pointer. The address space pointer will be used in the future to eventually support a larger buffers. Information reachable via the mapping may then determine page size. New functionRelated base page constant page_cache_shift(a) PAGE_CACHE_SHIFT page_cache_size(a) PAGE_CACHE_SIZE page_cache_mask(a) PAGE_CACHE_MASK page_cache_index(a, pos)Calculate page number from position page_cache_next(addr, pos) Page number of next page page_cache_offset(a, pos) Calculate offset into a page page_cache_pos(a, index, offset) Form position based on page number and an offset. This provides a basis that would allow the conversion of all page cache handling in the kernel and ultimately allow the removal of the PAGE_CACHE_* constants. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- include/linux/pagemap.h | 54 +++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8a83537..836e9dd 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -52,12 +52,66 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) * space in smaller chunks for same flexibility). * * Or rather, it _will_ be done in larger chunks. + * + * The following constants can be used if a filesystem only supports a single + * page size. */ #define PAGE_CACHE_SHIFT PAGE_SHIFT #define PAGE_CACHE_SIZEPAGE_SIZE #define PAGE_CACHE_MASKPAGE_MASK #define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)PAGE_CACHE_MASK) +/* + * Functions that are currently setup for a fixed PAGE_SIZEd. The use of + * these will allow a variable page size pagecache in the future. + */ +static inline int mapping_order(struct address_space *a) +{ + return 0; +} + +static inline int page_cache_shift(struct address_space *a) +{ + return PAGE_SHIFT; +} + +static inline unsigned int page_cache_size(struct address_space *a) +{ + return PAGE_SIZE; +} + +static inline loff_t page_cache_mask(struct address_space *a) +{ + return (loff_t)PAGE_MASK; +} + +static inline unsigned int page_cache_offset(struct address_space *a, + loff_t pos) +{ + return pos ~PAGE_MASK; +} + +static inline pgoff_t page_cache_index(struct address_space *a, + loff_t pos) +{ + return pos page_cache_shift(a); +} + +/* + * Index of the page starting on or after the given position. + */ +static inline pgoff_t page_cache_next(struct address_space *a, + loff_t pos) +{ + return page_cache_index(a, pos + page_cache_size(a) - 1); +} + +static inline loff_t page_cache_pos(struct address_space *a, + pgoff_t index, unsigned long offset) +{ + return ((loff_t)index page_cache_shift(a)) + offset; +} + #define page_cache_get(page) get_page(page) #define page_cache_release(page) put_page(page) void release_pages(struct page **pages, int nr, int cold); -- 1.5.2.5 -- - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[patch 10/19] Use page_cache_xxx in fs/buffer.c
Use page_cache_xxx in fs/buffer.c. Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/buffer.c | 101 +--- 1 file changed, 56 insertions(+), 45 deletions(-) Index: mm/fs/buffer.c === --- mm.orig/fs/buffer.c 2007-11-28 14:09:42.757727389 -0800 +++ mm/fs/buffer.c 2007-11-28 14:10:59.728728042 -0800 @@ -278,7 +278,7 @@ __find_get_block_slow(struct block_devic struct page *page; int all_mapped = 1; - index = block (PAGE_CACHE_SHIFT - bd_inode-i_blkbits); + index = block (page_cache_shift(bd_mapping) - bd_inode-i_blkbits); page = find_get_page(bd_mapping, index); if (!page) goto out; @@ -720,7 +720,7 @@ static int __set_page_dirty(struct page __inc_zone_page_state(page, NR_FILE_DIRTY); __inc_bdi_stat(mapping-backing_dev_info, BDI_RECLAIMABLE); - task_io_account_write(PAGE_CACHE_SIZE); + task_io_account_write(page_cache_size(mapping)); } radix_tree_tag_set(mapping-page_tree, page_index(page), PAGECACHE_TAG_DIRTY); @@ -914,10 +914,11 @@ struct buffer_head *alloc_page_buffers(s { struct buffer_head *bh, *head; long offset; + unsigned int page_size = page_cache_size(page-mapping); try_again: head = NULL; - offset = PAGE_SIZE; + offset = page_size; while ((offset -= size) = 0) { bh = alloc_buffer_head(GFP_NOFS); if (!bh) @@ -1640,6 +1641,7 @@ static int __block_write_full_page(struc struct buffer_head *bh, *head; const unsigned blocksize = 1 inode-i_blkbits; int nr_underway = 0; + struct address_space *mapping = inode-i_mapping; BUG_ON(!PageLocked(page)); @@ -1660,7 +1662,8 @@ static int __block_write_full_page(struc * handle that here by just cleaning them. */ - block = (sector_t)page-index (PAGE_CACHE_SHIFT - inode-i_blkbits); + block = (sector_t)page-index + (page_cache_shift(mapping) - inode-i_blkbits); head = page_buffers(page); bh = head; @@ -1777,7 +1780,7 @@ recover: } while ((bh = bh-b_this_page) != head); SetPageError(page); BUG_ON(PageWriteback(page)); - mapping_set_error(page-mapping, err); + mapping_set_error(mapping, err); set_page_writeback(page); do { struct buffer_head *next = bh-b_this_page; @@ -1844,8 +1847,8 @@ static int __block_prepare_write(struct struct buffer_head *bh, *head, *wait[2], **wait_bh=wait; BUG_ON(!PageLocked(page)); - BUG_ON(from PAGE_CACHE_SIZE); - BUG_ON(to PAGE_CACHE_SIZE); + BUG_ON(from page_cache_size(inode-i_mapping)); + BUG_ON(to page_cache_size(inode-i_mapping)); BUG_ON(from to); blocksize = 1 inode-i_blkbits; @@ -1854,7 +1857,8 @@ static int __block_prepare_write(struct head = page_buffers(page); bbits = inode-i_blkbits; - block = (sector_t)page-index (PAGE_CACHE_SHIFT - bbits); + block = (sector_t)page-index + (page_cache_shift(inode-i_mapping) - bbits); for(bh = head, block_start = 0; bh != head || !block_start; block++, block_start=block_end, bh = bh-b_this_page) { @@ -1969,8 +1973,8 @@ int block_write_begin(struct file *file, unsigned start, end; int ownpage = 0; - index = pos PAGE_CACHE_SHIFT; - start = pos (PAGE_CACHE_SIZE - 1); + index = page_cache_index(mapping, pos); + start = page_cache_offset(mapping, pos); end = start + len; page = *pagep; @@ -2017,7 +2021,7 @@ int block_write_end(struct file *file, s struct inode *inode = mapping-host; unsigned start; - start = pos (PAGE_CACHE_SIZE - 1); + start = page_cache_offset(mapping, pos); if (unlikely(copied len)) { /* @@ -2095,7 +2099,8 @@ int block_read_full_page(struct page *pa create_empty_buffers(page, blocksize, 0); head = page_buffers(page); - iblock = (sector_t)page-index (PAGE_CACHE_SHIFT - inode-i_blkbits); + iblock = (sector_t)page-index + (page_cache_shift(page-mapping) - inode-i_blkbits); lblock = (i_size_read(inode)+blocksize-1) inode-i_blkbits; bh = head; nr = 0; @@ -2213,16 +2218,16 @@ int cont_expand_zero(struct file *file, unsigned zerofrom, offset, len; int err = 0; - index = pos PAGE_CACHE_SHIFT; - offset = pos ~PAGE_CACHE_MASK; + index = page_cache_index(mapping, pos); + offset = page_cache_offset(mapping, pos); - while (index (curidx = (curpos =
Re: [patch 18/19] Use page_cache_xxx for fs/xfs
On Wed, Nov 28, 2007 at 05:11:10PM -0800, Christoph Lameter wrote: Use page_cache_xxx for fs/xfs Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_aops.c | 55 +++- fs/xfs/linux-2.6/xfs_lrw.c |4 +-- 2 files changed, 31 insertions(+), 28 deletions(-) Index: mm/fs/xfs/linux-2.6/xfs_aops.c === --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 12:25:38.768212813 -0800 +++ mm/fs/xfs/linux-2.6/xfs_aops.c2007-11-28 14:12:55.637977383 -0800 @@ -75,7 +75,7 @@ xfs_page_trace( xfs_inode_t *ip; bhv_vnode_t *vp = vn_from_inode(inode); loff_t isize = i_size_read(inode); - loff_t offset = page_offset(page); + loff_t offset = page_cache_offset(page-mapping); That's not right. Should be loff_t offset = page_cache_pos(page-mapping, page-index, 0); @@ -752,7 +752,8 @@ xfs_convert_page( int bbits = inode-i_blkbits; int len, page_dirty; int count = 0, done = 0, uptodate = 1; - xfs_off_t offset = page_offset(page); + struct address_space*map = inode-i_mapping; + xfs_off_t offset = page_cache_pos(map, page-index, 0); But you got that one right ;) @@ -772,20 +773,20 @@ xfs_convert_page( * Derivation: * * End offset is the highest offset that this page should represent. - * If we are on the last page, (end_offset (PAGE_CACHE_SIZE - 1)) - * will evaluate non-zero and be less than PAGE_CACHE_SIZE and + * If we are on the last page, (end_offset page_cache_mask()) + * will evaluate non-zero and be less than page_cache_size() and * hence give us the correct page_dirty count. On any other page, * it will be zero and in that case we need page_dirty to be the * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) PAGE_CACHE_SHIFT, + (xfs_off_t)(page-index + 1) page_cache_shift(map), (xfs_off_t)page_cache_pos(map, page-index + 1, 0), i_size_read(inode)); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, end_offset (PAGE_CACHE_SIZE - 1), - PAGE_CACHE_SIZE); - p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE; + p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), + page_cache_size(map)); H. p_offset = min(val 4095, 4096)? I think that should just be: p_offset = page_cache_offset(map, end_offset); @@ -967,22 +970,22 @@ xfs_page_state_convert( * Derivation: * * End offset is the highest offset that this page should represent. - * If we are on the last page, (end_offset (PAGE_CACHE_SIZE - 1)) - * will evaluate non-zero and be less than PAGE_CACHE_SIZE and - * hence give us the correct page_dirty count. On any other page, + * If we are on the last page, (page_cache_offset(mapping, end_offset)) + * will evaluate non-zero and be less than page_cache_size(mapping) + * and hence give us the correct page_dirty count. On any other page, * it will be zero and in that case we need page_dirty to be the * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) PAGE_CACHE_SHIFT, offset); + (xfs_off_t)page_cache_pos(map, page-index + 1, 0), offset); You got that one ;) len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, end_offset (PAGE_CACHE_SIZE - 1), - PAGE_CACHE_SIZE); - p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE; + p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), + pagesize); Again, that can be: p_offset = page_cache_offset(map, end_offset); and you can kill the new temporary pagesize variable. @@ -1130,7 +1133,7 @@ xfs_page_state_convert( if (ioend iomap_valid) { offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) - PAGE_CACHE_SHIFT; + page_cache_shift(map); offset = page_cache_index(map, (iomap.iomap_offset + iomap.iomap_bsize - 1)); @@ -142,8 +142,8 @@ xfs_iozero( unsigned offset, bytes; void *fsdata; - offset = (pos (PAGE_CACHE_SIZE -1)); /* Within page */ - bytes = PAGE_CACHE_SIZE - offset; + offset =
Re: [patch 01/19] Define functions for page cache handling
On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote: +/* + * Index of the page starting on or after the given position. + */ +static inline pgoff_t page_cache_next(struct address_space *a, + loff_t pos) +{ + return page_cache_index(a, pos + page_cache_size(a) - 1); return page_cache_index(a, pos + page_cache_mask(a)); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Wed, 28 November 2007 16:06:25 -0800, Nicholas Miell wrote: I'd have to reread the original proposal, but I remember FIEMAP as being a generalized way of getting information about a files extents. I think the original proposal only dealt with mapping file offsets to physical extents, but IIRC the interface was flexible enough to implement a where are the holes request. Regardless, SEEK_HOLE/SEEK_DATA being a better suited interface for the needs of logfs doesn't make it the best interface for that need. I'm not sure we are looking for the best interface. A significant improvement without significant drawbacks would be enough for me. Having to provide physical extends complete with device offsets would be a significant drawback. Even if such an interface may have greater advantages under ideal circumstances. Jörn -- He who knows others is wise. He who knows himself is enlightened. -- Lao Tsu - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
On Wed, Nov 28, 2007 at 05:10:57PM -0800, Christoph Lameter wrote: Use page_cache_xxx in mm/rmap.c Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/rmap.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) Index: mm/mm/rmap.c === --- mm.orig/mm/rmap.c 2007-11-28 12:27:32.312059099 -0800 +++ mm/mm/rmap.c 2007-11-28 14:10:42.758227810 -0800 @@ -190,9 +190,14 @@ static void page_unlock_anon_vma(struct static inline unsigned long vma_address(struct page *page, struct vm_area_struct *vma) { - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff; unsigned long address; + if (PageAnon(page)) + pgoff = page-index; + else + pgoff = page-index mapping_order(page-mapping); + address = vma-vm_start + ((pgoff - vma-vm_pgoff) PAGE_SHIFT); if (unlikely(address vma-vm_start || address = vma-vm_end)) { /* page should be within @vma mapping range */ @@ -345,7 +350,7 @@ static int page_referenced_file(struct p { unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); Based on the first hunk, shouldn't this be: pgoff_t pgoff = page-index mapping_order(mapping); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 01/19] Define functions for page cache handling
On Thu, 29 Nov 2007, David Chinner wrote: On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote: +/* + * Index of the page starting on or after the given position. + */ +static inline pgoff_t page_cache_next(struct address_space *a, + loff_t pos) +{ + return page_cache_index(a, pos + page_cache_size(a) - 1); return page_cache_index(a, pos + page_cache_mask(a)); Na that is confusing. We really want to go to one byte before the end of the page. - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Nov 29, 2007 00:48 +0100, Jörn Engel wrote: I didn't follow the discussion much, since it didn't appear to suit logfs too well. In a nutshell, logfs is purely block-based, prepends every block with a header, may compress blocks and packs them as tightly as possible (byte alignment). The FIEMAP interface in some ways well suited to your needs, because it uses byte offsets instead of FIBMAP, which uses block offsets. I now see that one hole in the specification is that your physical extent is not the same length as the logical extent that the data represents. I'm not sure that is in itself a reason not to use FIEMAP. There is already a provision for logical extents that do not map directly to the physical layout (i.e. FIEMAP_EXTENT_NO_DIRECT flag on the extent). In the case of logfs, the extent fe_length would represent the logical length of the data that the extent covers, fe_offset is the start of the physical extent, and FIEMAP_EXTENT_NO_DIRECT indicates that this extent cannot be directly mapped. This is useful for applications like LILO that would otherwise assume the physical offset can be used to access the data from the block device. It would still provide very useful information about the layout of files on disk for filefrag, and if tar or cp used FIEMAP they could know to read the data from the start up to the end of an extent to avoid waiting for a seek in the middle of the IO, and of course skipping holes during copy. A very smart tar might even FIEMAP a whole bunch of files and then read the extents in physical block offset order to reduce seeking. I don't think most applications will care about the actual physical location of an extent, so much as the relative locations of extents within a file and between files. Maybe the MAP part fooled me to believe FIEMAP would also expose physical location of extends on the medium. But reading the proposal again, I am unsure about that part. If physical locations are exposed, SEEK_HOLE/SEEK_DATA is significantly more elegant for logfs. If not, FIEMAP could be useful. SEEK_HOLE/SEEK_DATA only provides a fraction of the useful information that FIEMAP does. It won't give users or developers any information about the on disk layout (which is quite important for knowing if allocation algorithms are good). Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 18/19] Use page_cache_xxx for fs/xfs
In other words the following patch? Fixes to the use of page_cache_xx functions in xfs Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_aops.c | 17 ++--- fs/xfs/linux-2.6/xfs_lrw.c |2 +- 2 files changed, 7 insertions(+), 12 deletions(-) Index: mm/fs/xfs/linux-2.6/xfs_aops.c === --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800 +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:22:15.686920219 -0800 @@ -75,7 +75,7 @@ xfs_page_trace( xfs_inode_t *ip; bhv_vnode_t *vp = vn_from_inode(inode); loff_t isize = i_size_read(inode); - loff_t offset = page_cache_offset(page-mapping); + loff_t offset = page_cache_pos(page-mapping, page-index, 0); int delalloc = -1, unmapped = -1, unwritten = -1; if (page_has_buffers(page)) @@ -780,13 +780,11 @@ xfs_convert_page( * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) page_cache_shift(map), + (xfs_off_t)page_cache_pos(map, page-index + 1, 0), i_size_read(inode)); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - page_cache_size(map)); - p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); + p_offset = page_cache_offset(map, end_offset); page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -943,7 +941,6 @@ xfs_page_state_convert( int trylock = 0; int all_bh = unmapped; struct address_space*map = inode-i_mapping; - int pagesize = page_cache_size(map); if (startio) { if (wbc-sync_mode == WB_SYNC_NONE wbc-nonblocking) @@ -979,9 +976,7 @@ xfs_page_state_convert( end_offset = min_t(unsigned long long, (xfs_off_t)page_cache_pos(map, page-index + 1, 0), offset); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - pagesize); - p_offset = p_offset ? roundup(p_offset, len) : pagesize; + p_offset = page_cache_offset(map, end_offset); page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -1132,8 +1127,8 @@ xfs_page_state_convert( xfs_start_page_writeback(page, wbc, 1, count); if (ioend iomap_valid) { - offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) - page_cache_shift(map); + offset = page_cache_index(map, + (iomap.iomap_offset + iomap.iomap_bsize - 1)); tlast = min_t(pgoff_t, offset, last_index); xfs_cluster_write(inode, page-index + 1, iomap, ioend, wbc, startio, all_bh, tlast); Index: mm/fs/xfs/linux-2.6/xfs_lrw.c === --- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800 +++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800 @@ -142,7 +142,7 @@ xfs_iozero( unsigned offset, bytes; void *fsdata; - offset = page_cache_offset(mapping, pos); /* Within page */ + offset = page_cache_offset(mapping, pos); bytes = page_cache_size(mapping) - offset; if (bytes count) bytes = count; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
On Thu, 29 Nov 2007, David Chinner wrote: unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); Based on the first hunk, shouldn't this be: pgoff_t pgoff = page-index mapping_order(mapping); Yes that is much simpler rmap: simplify page_referenced_file use of page cache inlines Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/rmap.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/mm/rmap.c === --- mm.orig/mm/rmap.c 2007-11-28 19:28:45.689883608 -0800 +++ mm/mm/rmap.c2007-11-28 19:29:35.090382690 -0800 @@ -350,7 +350,7 @@ static int page_referenced_file(struct p { unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); + pgoff_t pgoff = page-index mapping_order(mapping); struct vm_area_struct *vma; struct prio_tree_iter iter; int referenced = 0; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
On Wed, Nov 28, 2007 at 05:11:02PM -0800, Christoph Lameter wrote: @@ -914,10 +914,11 @@ struct buffer_head *alloc_page_buffers(s { struct buffer_head *bh, *head; long offset; + unsigned int page_size = page_cache_size(page-mapping); try_again: head = NULL; - offset = PAGE_SIZE; + offset = page_size; while ((offset -= size) = 0) { bh = alloc_buffer_head(GFP_NOFS); if (!bh) We don't really need a temporary variable here lblock = (i_size_read(inode)+blocksize-1) inode-i_blkbits; bh = head; nr = 0; @@ -2213,16 +2218,16 @@ int cont_expand_zero(struct file *file, unsigned zerofrom, offset, len; int err = 0; - index = pos PAGE_CACHE_SHIFT; - offset = pos ~PAGE_CACHE_MASK; + index = page_cache_index(mapping, pos); + offset = page_cache_offset(mapping, pos); - while (index (curidx = (curpos = *bytes)PAGE_CACHE_SHIFT)) { - zerofrom = curpos ~PAGE_CACHE_MASK; + while (index (curidx = page_cache_index(mapping, (curpos = *bytes { + zerofrom = page_cache_offset(mapping, curpos); That doesn't get any prettier. Perhaps: while (index (curidx = page_cache_index(mapping, *bytes))) { curpos = *bytes; zerofrom = page_cache_offset(mapping, curpos); @@ -2356,20 +2362,22 @@ block_page_mkwrite(struct vm_area_struct unsigned long end; loff_t size; int ret = -EINVAL; + struct address_space *mapping; lock_page(page); + mapping = page-mapping; size = i_size_read(inode); - if ((page-mapping != inode-i_mapping) || + if ((mapping != inode-i_mapping) || (page_offset(page) size)) { Should check (page_cache_pos(mapping, page-index, 0) size) @@ -2607,9 +2616,10 @@ EXPORT_SYMBOL(nobh_write_end); int nobh_writepage(struct page *page, get_block_t *get_block, struct writeback_control *wbc) { - struct inode * const inode = page-mapping-host; + struct address_space *mapping = page-mapping; + struct inode * const inode = mapping-host; loff_t i_size = i_size_read(inode); - const pgoff_t end_index = i_size PAGE_CACHE_SHIFT; + const pgoff_t end_index = page_cache_offset(mapping, i_size); const pgoff_t end_index = page_cache_index(mapping, i_size); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote: @@ -453,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = (loff_t)index PAGE_CACHE_SHIFT; + in-f_ra.prev_pos = page_cache_index(mapping, index); in-f_ra.prev_pos = page_cache_pos(mapping, index, 0); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
On Thu, 29 Nov 2007, David Chinner wrote: - while (index (curidx = (curpos = *bytes)PAGE_CACHE_SHIFT)) { - zerofrom = curpos ~PAGE_CACHE_MASK; + while (index (curidx = page_cache_index(mapping, (curpos = *bytes { + zerofrom = page_cache_offset(mapping, curpos); That doesn't get any prettier. Perhaps: while (index (curidx = page_cache_index(mapping, *bytes))) { curpos = *bytes; zerofrom = page_cache_offset(mapping, curpos); Results in a gcc warning about the possible use of an unitialized variable. How about this? fs/buffer.c enhancements and fixes Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/buffer.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: mm/fs/buffer.c === --- mm.orig/fs/buffer.c 2007-11-28 19:39:23.606383803 -0800 +++ mm/fs/buffer.c 2007-11-28 19:46:10.238382715 -0800 @@ -914,11 +914,10 @@ struct buffer_head *alloc_page_buffers(s { struct buffer_head *bh, *head; long offset; - unsigned int page_size = page_cache_size(page-mapping); try_again: head = NULL; - offset = page_size; + offset = page_cache_size(page-mapping); while ((offset -= size) = 0) { bh = alloc_buffer_head(GFP_NOFS); if (!bh) @@ -2221,7 +2220,8 @@ int cont_expand_zero(struct file *file, index = page_cache_index(mapping, pos); offset = page_cache_offset(mapping, pos); - while (index (curidx = page_cache_index(mapping, (curpos = *bytes { + while (curpos = *bytes, curidx = page_cache_index(mapping, curpos), + index curidx) { zerofrom = page_cache_offset(mapping, curpos); if (zerofrom (blocksize-1)) { *bytes |= (blocksize-1); @@ -2368,7 +2368,7 @@ block_page_mkwrite(struct vm_area_struct mapping = page-mapping; size = i_size_read(inode); if ((mapping != inode-i_mapping) || - (page_offset(page) size)) { + (page_cache_pos(mapping, page-index, 0) size)) { /* page got truncated out from underneath us */ goto out_unlock; } - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 16/19] Use page_cache_xxx in fs/ext4
On Wed, Nov 28, 2007 at 05:11:08PM -0800, Christoph Lameter wrote: @@ -1677,6 +1676,7 @@ static int ext4_journalled_writepage(str handle_t *handle = NULL; int ret = 0; int err; + int pagesize = page_cache_size(inode-i_mapping); if (ext4_journal_current_handle()) goto no_write; @@ -1693,17 +1693,17 @@ static int ext4_journalled_writepage(str * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); - ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE, + ret = block_prepare_write(page, 0, page_cache_size(mapping), ext4_get_block); if (ret != 0) { ext4_journal_stop(handle); goto out_unlock; } ret = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, do_journal_get_write_access); + page_cache_size(mapping), NULL, do_journal_get_write_access); err = walk_page_buffers(handle, page_buffers(page), 0, - PAGE_CACHE_SIZE, NULL, write_end_fn); + page_cache_size(mapping), NULL, write_end_fn); These three should use the pagesize variable. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
On Thu, 29 Nov 2007, David Chinner wrote: On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote: @@ -453,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = (loff_t)index PAGE_CACHE_SHIFT; + in-f_ra.prev_pos = page_cache_index(mapping, index); in-f_ra.prev_pos = page_cache_pos(mapping, index, 0); splice.c: Wrong inline function used Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/splice.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/fs/splice.c === --- mm.orig/fs/splice.c 2007-11-28 19:48:43.246633219 -0800 +++ mm/fs/splice.c 2007-11-28 19:49:06.405882592 -0800 @@ -454,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = page_cache_index(mapping, index); + in-f_ra.prev_pos = page_cache_pos(mapping, index, 0); if (spd.nr_pages) return splice_to_pipe(pipe, spd); - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
On Wed, Nov 28, 2007 at 05:11:09PM -0800, Christoph Lameter wrote: @@ -2000,11 +2001,13 @@ static int grab_tail_page(struct inode * /* we want the page with the last byte in the file, ** not the page that will hold the next byte for appending */ - unsigned long index = (p_s_inode-i_size - 1) PAGE_CACHE_SHIFT; + unsigned long index = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size - 1); unsigned long pos = 0; unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = (p_s_inode-i_size) (PAGE_CACHE_SIZE - 1); + unsigned long offset = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size); unsigned long offset = page_cache_offset(p_s_inode-i_mapping, Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 14/19] Use page_cache_xxx in ext2
ext2: Simplify some functions Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext2/dir.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) Index: mm/fs/ext2/dir.c === --- mm.orig/fs/ext2/dir.c 2007-11-28 19:51:05.038882954 -0800 +++ mm/fs/ext2/dir.c2007-11-28 19:53:59.074132710 -0800 @@ -63,8 +63,7 @@ static inline void ext2_put_page(struct static inline unsigned long dir_pages(struct inode *inode) { - return (inode-i_size+page_cache_size(inode-i_mapping)-1) - page_cache_shift(inode-i_mapping); + return page_cache_next(inode-i_mapping, inode-i_size); } /* @@ -74,13 +73,9 @@ static inline unsigned long dir_pages(st static unsigned ext2_last_byte(struct inode *inode, unsigned long page_nr) { - unsigned last_byte = inode-i_size; struct address_space *mapping = inode-i_mapping; - last_byte -= page_nr page_cache_shift(mapping); - if (last_byte page_cache_size(mapping)) - last_byte = page_cache_size(mapping); - return last_byte; + return inode-i_size - page_cache_pos(mapping, page_nr, 0); } static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len) - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 16/19] Use page_cache_xxx in fs/ext4
On Thu, 29 Nov 2007, David Chinner wrote: These three should use the pagesize variable. ext4: use pagesize variable instead of the inline function Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext4/inode.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) Index: mm/fs/ext4/inode.c === --- mm.orig/fs/ext4/inode.c 2007-11-28 19:56:18.234382799 -0800 +++ mm/fs/ext4/inode.c 2007-11-28 19:57:10.774132672 -0800 @@ -1693,17 +1693,16 @@ static int ext4_journalled_writepage(str * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); - ret = block_prepare_write(page, 0, page_cache_size(mapping), - ext4_get_block); + ret = block_prepare_write(page, 0, pagesize, ext4_get_block); if (ret != 0) { ext4_journal_stop(handle); goto out_unlock; } ret = walk_page_buffers(handle, page_buffers(page), 0, - page_cache_size(mapping), NULL, do_journal_get_write_access); + pagesize, NULL, do_journal_get_write_access); err = walk_page_buffers(handle, page_buffers(page), 0, - page_cache_size(mapping), NULL, write_end_fn); + pagesize, NULL, write_end_fn); if (ret == 0) ret = err; EXT4_I(inode)-i_state |= EXT4_STATE_JDATA; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 18/19] Use page_cache_xxx for fs/xfs
On Wed, Nov 28, 2007 at 07:28:17PM -0800, Christoph Lameter wrote: In other words the following patch? Index: mm/fs/xfs/linux-2.6/xfs_aops.c === --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800 +++ mm/fs/xfs/linux-2.6/xfs_aops.c2007-11-28 19:22:15.686920219 -0800 @@ -75,7 +75,7 @@ xfs_page_trace( xfs_inode_t *ip; bhv_vnode_t *vp = vn_from_inode(inode); loff_t isize = i_size_read(inode); - loff_t offset = page_cache_offset(page-mapping); + loff_t offset = page_cache_pos(page-mapping, page-index, 0); int delalloc = -1, unmapped = -1, unwritten = -1; if (page_has_buffers(page)) Good. @@ -780,13 +780,11 @@ xfs_convert_page( * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) page_cache_shift(map), + (xfs_off_t)page_cache_pos(map, page-index + 1, 0), i_size_read(inode)); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - page_cache_size(map)); - p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); + p_offset = page_cache_offset(map, end_offset); No, still need the roundup. i.e.: - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - page_cache_size(map)); + p_offset = page_cache_offset(map, end_offset); p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -943,7 +941,6 @@ xfs_page_state_convert( int trylock = 0; int all_bh = unmapped; struct address_space*map = inode-i_mapping; - int pagesize = page_cache_size(map); if (startio) { if (wbc-sync_mode == WB_SYNC_NONE wbc-nonblocking) @@ -979,9 +976,7 @@ xfs_page_state_convert( end_offset = min_t(unsigned long long, (xfs_off_t)page_cache_pos(map, page-index + 1, 0), offset); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - pagesize); - p_offset = p_offset ? roundup(p_offset, len) : pagesize; + p_offset = page_cache_offset(map, end_offset); And still need the roundup here as well. page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -1132,8 +1127,8 @@ xfs_page_state_convert( xfs_start_page_writeback(page, wbc, 1, count); if (ioend iomap_valid) { - offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) - page_cache_shift(map); + offset = page_cache_index(map, + (iomap.iomap_offset + iomap.iomap_bsize - 1)); Good. tlast = min_t(pgoff_t, offset, last_index); xfs_cluster_write(inode, page-index + 1, iomap, ioend, wbc, startio, all_bh, tlast); Index: mm/fs/xfs/linux-2.6/xfs_lrw.c === --- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c2007-11-28 19:22:35.454383115 -0800 +++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800 @@ -142,7 +142,7 @@ xfs_iozero( unsigned offset, bytes; void *fsdata; - offset = page_cache_offset(mapping, pos); /* Within page */ + offset = page_cache_offset(mapping, pos); Ok. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
On Wed, Nov 28, 2007 at 07:30:54PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (PAGE_CACHE_SHIFT - PAGE_SHIFT); + pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); Based on the first hunk, shouldn't this be: pgoff_t pgoff = page-index mapping_order(mapping); Yes that is much simpler rmap: simplify page_referenced_file use of page cache inlines Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/rmap.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/mm/rmap.c === --- mm.orig/mm/rmap.c 2007-11-28 19:28:45.689883608 -0800 +++ mm/mm/rmap.c 2007-11-28 19:29:35.090382690 -0800 @@ -350,7 +350,7 @@ static int page_referenced_file(struct p { unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); + pgoff_t pgoff = page-index mapping_order(mapping); struct vm_area_struct *vma; struct prio_tree_iter iter; int referenced = 0; And the other two occurrences of this in the first patch? Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
On Wed, Nov 28, 2007 at 07:50:16PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote: @@ -453,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = (loff_t)index PAGE_CACHE_SHIFT; + in-f_ra.prev_pos = page_cache_index(mapping, index); in-f_ra.prev_pos = page_cache_pos(mapping, index, 0); splice.c: Wrong inline function used Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/splice.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/fs/splice.c === --- mm.orig/fs/splice.c 2007-11-28 19:48:43.246633219 -0800 +++ mm/fs/splice.c2007-11-28 19:49:06.405882592 -0800 @@ -454,7 +454,7 @@ fill_it: */ while (page_nr nr_pages) page_cache_release(pages[page_nr++]); - in-f_ra.prev_pos = page_cache_index(mapping, index); + in-f_ra.prev_pos = page_cache_pos(mapping, index, 0); if (spd.nr_pages) return splice_to_pipe(pipe, spd); Ok. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 18/19] Use page_cache_xxx for fs/xfs
Is this correct? Fixes to the use of page_cache_xx functions in xfs Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_aops.c | 18 -- fs/xfs/linux-2.6/xfs_lrw.c |2 +- 2 files changed, 9 insertions(+), 11 deletions(-) Index: mm/fs/xfs/linux-2.6/xfs_aops.c === --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800 +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 20:04:24.230882714 -0800 @@ -75,7 +75,7 @@ xfs_page_trace( xfs_inode_t *ip; bhv_vnode_t *vp = vn_from_inode(inode); loff_t isize = i_size_read(inode); - loff_t offset = page_cache_offset(page-mapping); + loff_t offset = page_cache_pos(page-mapping, page-index, 0); int delalloc = -1, unmapped = -1, unwritten = -1; if (page_has_buffers(page)) @@ -780,12 +780,11 @@ xfs_convert_page( * count of buffers on the page. */ end_offset = min_t(unsigned long long, - (xfs_off_t)(page-index + 1) page_cache_shift(map), + (xfs_off_t)page_cache_pos(map, page-index + 1, 0), i_size_read(inode)); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - page_cache_size(map)); + p_offset = page_cache_offset(map, end_offset); p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); page_dirty = p_offset / len; @@ -943,7 +942,6 @@ xfs_page_state_convert( int trylock = 0; int all_bh = unmapped; struct address_space*map = inode-i_mapping; - int pagesize = page_cache_size(map); if (startio) { if (wbc-sync_mode == WB_SYNC_NONE wbc-nonblocking) @@ -979,9 +977,9 @@ xfs_page_state_convert( end_offset = min_t(unsigned long long, (xfs_off_t)page_cache_pos(map, page-index + 1, 0), offset); len = 1 inode-i_blkbits; - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset), - pagesize); - p_offset = p_offset ? roundup(p_offset, len) : pagesize; + p_offset = page_cache_offset(map, end_offset); + p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map); + page_dirty = p_offset / len; bh = head = page_buffers(page); @@ -1132,8 +1130,8 @@ xfs_page_state_convert( xfs_start_page_writeback(page, wbc, 1, count); if (ioend iomap_valid) { - offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) - page_cache_shift(map); + offset = page_cache_index(map, + (iomap.iomap_offset + iomap.iomap_bsize - 1)); tlast = min_t(pgoff_t, offset, last_index); xfs_cluster_write(inode, page-index + 1, iomap, ioend, wbc, startio, all_bh, tlast); Index: mm/fs/xfs/linux-2.6/xfs_lrw.c === --- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800 +++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800 @@ -142,7 +142,7 @@ xfs_iozero( unsigned offset, bytes; void *fsdata; - offset = page_cache_offset(mapping, pos); /* Within page */ + offset = page_cache_offset(mapping, pos); bytes = page_cache_size(mapping) - offset; if (bytes count) bytes = count; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
On Wed, Nov 28, 2007 at 07:48:08PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: - while (index (curidx = (curpos = *bytes)PAGE_CACHE_SHIFT)) { - zerofrom = curpos ~PAGE_CACHE_MASK; + while (index (curidx = page_cache_index(mapping, (curpos = *bytes { + zerofrom = page_cache_offset(mapping, curpos); That doesn't get any prettier. Perhaps: while (index (curidx = page_cache_index(mapping, *bytes))) { curpos = *bytes; zerofrom = page_cache_offset(mapping, curpos); Results in a gcc warning about the possible use of an unitialized variable. fmeh. How about this? fs/buffer.c enhancements and fixes Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/buffer.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: mm/fs/buffer.c === --- mm.orig/fs/buffer.c 2007-11-28 19:39:23.606383803 -0800 +++ mm/fs/buffer.c2007-11-28 19:46:10.238382715 -0800 @@ -914,11 +914,10 @@ struct buffer_head *alloc_page_buffers(s { struct buffer_head *bh, *head; long offset; - unsigned int page_size = page_cache_size(page-mapping); try_again: head = NULL; - offset = page_size; + offset = page_cache_size(page-mapping); while ((offset -= size) = 0) { bh = alloc_buffer_head(GFP_NOFS); if (!bh) @@ -2221,7 +2220,8 @@ int cont_expand_zero(struct file *file, index = page_cache_index(mapping, pos); offset = page_cache_offset(mapping, pos); - while (index (curidx = page_cache_index(mapping, (curpos = *bytes { + while (curpos = *bytes, curidx = page_cache_index(mapping, curpos), + index curidx) { zerofrom = page_cache_offset(mapping, curpos); if (zerofrom (blocksize-1)) { *bytes |= (blocksize-1); @@ -2368,7 +2368,7 @@ block_page_mkwrite(struct vm_area_struct mapping = page-mapping; size = i_size_read(inode); if ((mapping != inode-i_mapping) || - (page_offset(page) size)) { + (page_cache_pos(mapping, page-index, 0) size)) { /* page got truncated out from underneath us */ goto out_unlock; } Works for me. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
On Thu, 29 Nov 2007, David Chinner wrote: unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = (p_s_inode-i_size) (PAGE_CACHE_SIZE - 1); + unsigned long offset = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size); unsigned long offset = page_cache_offset(p_s_inode-i_mapping, Reiserfs: Wrong type of inline function Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/reiserfs/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/fs/reiserfs/inode.c === --- mm.orig/fs/reiserfs/inode.c 2007-11-28 19:59:41.083133259 -0800 +++ mm/fs/reiserfs/inode.c 2007-11-28 20:00:23.317882809 -0800 @@ -2006,7 +2006,7 @@ static int grab_tail_page(struct inode * unsigned long pos = 0; unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = page_cache_index(p_s_inode-i_mapping, + unsigned long offset = page_cache_offset(p_s_inode-i_mapping, p_s_inode-i_size); struct buffer_head *bh; struct buffer_head *head; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 14/19] Use page_cache_xxx in ext2
On Wed, Nov 28, 2007 at 05:11:06PM -0800, Christoph Lameter wrote: Use page_cache_xxx functions in fs/ext2/* Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext2/dir.c | 40 +++- 1 file changed, 23 insertions(+), 17 deletions(-) Index: linux-2.6/fs/ext2/dir.c === --- linux-2.6.orig/fs/ext2/dir.c 2007-11-26 17:45:29.155116723 -0800 +++ linux-2.6/fs/ext2/dir.c 2007-11-26 18:15:08.660772219 -0800 @@ -63,7 +63,8 @@ static inline void ext2_put_page(struct static inline unsigned long dir_pages(struct inode *inode) { - return (inode-i_size+PAGE_CACHE_SIZE-1)PAGE_CACHE_SHIFT; + return (inode-i_size+page_cache_size(inode-i_mapping)-1) + page_cache_shift(inode-i_mapping); } return page_cache_next(inode-mapping, inode-i_size); /* @@ -74,10 +75,11 @@ static unsigned ext2_last_byte(struct inode *inode, unsigned long page_nr) { unsigned last_byte = inode-i_size; + struct address_space *mapping = inode-i_mapping; - last_byte -= page_nr PAGE_CACHE_SHIFT; - if (last_byte PAGE_CACHE_SIZE) - last_byte = PAGE_CACHE_SIZE; + last_byte -= page_nr page_cache_shift(mapping); last_byte -= page_cache_pos(mapping, page_nr, 0); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 14/19] Use page_cache_xxx in ext2
On Wed, Nov 28, 2007 at 07:55:40PM -0800, Christoph Lameter wrote: ext2: Simplify some functions Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext2/dir.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) Index: mm/fs/ext2/dir.c === --- mm.orig/fs/ext2/dir.c 2007-11-28 19:51:05.038882954 -0800 +++ mm/fs/ext2/dir.c 2007-11-28 19:53:59.074132710 -0800 @@ -63,8 +63,7 @@ static inline void ext2_put_page(struct static inline unsigned long dir_pages(struct inode *inode) { - return (inode-i_size+page_cache_size(inode-i_mapping)-1) - page_cache_shift(inode-i_mapping); + return page_cache_next(inode-i_mapping, inode-i_size); } ok. /* @@ -74,13 +73,9 @@ static inline unsigned long dir_pages(st static unsigned ext2_last_byte(struct inode *inode, unsigned long page_nr) { - unsigned last_byte = inode-i_size; struct address_space *mapping = inode-i_mapping; - last_byte -= page_nr page_cache_shift(mapping); - if (last_byte page_cache_size(mapping)) - last_byte = page_cache_size(mapping); - return last_byte; + return inode-i_size - page_cache_pos(mapping, page_nr, 0); I don't think that gives the same return value. The return value is supposed to be clamped at a maximum of page_cache_size(mapping). Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 16/19] Use page_cache_xxx in fs/ext4
On Wed, Nov 28, 2007 at 07:58:45PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: These three should use the pagesize variable. ext4: use pagesize variable instead of the inline function Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext4/inode.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) Index: mm/fs/ext4/inode.c === --- mm.orig/fs/ext4/inode.c 2007-11-28 19:56:18.234382799 -0800 +++ mm/fs/ext4/inode.c2007-11-28 19:57:10.774132672 -0800 @@ -1693,17 +1693,16 @@ static int ext4_journalled_writepage(str * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); - ret = block_prepare_write(page, 0, page_cache_size(mapping), - ext4_get_block); + ret = block_prepare_write(page, 0, pagesize, ext4_get_block); if (ret != 0) { ext4_journal_stop(handle); goto out_unlock; } ret = walk_page_buffers(handle, page_buffers(page), 0, - page_cache_size(mapping), NULL, do_journal_get_write_access); + pagesize, NULL, do_journal_get_write_access); err = walk_page_buffers(handle, page_buffers(page), 0, - page_cache_size(mapping), NULL, write_end_fn); + pagesize, NULL, write_end_fn); if (ret == 0) ret = err; EXT4_I(inode)-i_state |= EXT4_STATE_JDATA; ok. Cheers, dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
On Wed, Nov 28, 2007 at 08:02:01PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = (p_s_inode-i_size) (PAGE_CACHE_SIZE - 1); + unsigned long offset = page_cache_index(p_s_inode-i_mapping, + p_s_inode-i_size); unsigned long offset = page_cache_offset(p_s_inode-i_mapping, Reiserfs: Wrong type of inline function Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/reiserfs/inode.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: mm/fs/reiserfs/inode.c === --- mm.orig/fs/reiserfs/inode.c 2007-11-28 19:59:41.083133259 -0800 +++ mm/fs/reiserfs/inode.c2007-11-28 20:00:23.317882809 -0800 @@ -2006,7 +2006,7 @@ static int grab_tail_page(struct inode * unsigned long pos = 0; unsigned long start = 0; unsigned long blocksize = p_s_inode-i_sb-s_blocksize; - unsigned long offset = page_cache_index(p_s_inode-i_mapping, + unsigned long offset = page_cache_offset(p_s_inode-i_mapping, p_s_inode-i_size); struct buffer_head *bh; struct buffer_head *head; Ok. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
On Thu, 29 Nov 2007, David Chinner wrote: And the other two occurrences of this in the first patch? Ahh... Ok they are also in rmap.c: rmap: simplify page_referenced_file use of page cache inlines Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- mm/rmap.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: mm/mm/rmap.c === --- mm.orig/mm/rmap.c 2007-11-28 20:03:15.255240262 -0800 +++ mm/mm/rmap.c2007-11-28 20:08:50.278132294 -0800 @@ -350,7 +350,7 @@ static int page_referenced_file(struct p { unsigned int mapcount; struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); + pgoff_t pgoff = page-index mapping_order(mapping); struct vm_area_struct *vma; struct prio_tree_iter iter; int referenced = 0; @@ -469,7 +469,7 @@ out: static int page_mkclean_file(struct address_space *mapping, struct page *page) { - pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); + pgoff_t pgoff = page-index mapping_order(mapping); struct vm_area_struct *vma; struct prio_tree_iter iter; int ret = 0; @@ -902,7 +902,7 @@ static int try_to_unmap_anon(struct page static int try_to_unmap_file(struct page *page, int migration) { struct address_space *mapping = page-mapping; - pgoff_t pgoff = page-index (page_cache_shift(mapping) - PAGE_SHIFT); + pgoff_t pgoff = page-index mapping_order(mapping); struct vm_area_struct *vma; struct prio_tree_iter iter; int ret = SWAP_AGAIN; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 18/19] Use page_cache_xxx for fs/xfs
On Wed, Nov 28, 2007 at 08:06:30PM -0800, Christoph Lameter wrote: Is this correct? Yup, looks good now. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
On Wed, Nov 28, 2007 at 08:09:39PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: And the other two occurrences of this in the first patch? Ahh... Ok they are also in rmap.c: rmap: simplify page_referenced_file use of page cache inlines Ok. Cheers, dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 14/19] Use page_cache_xxx in ext2
On Thu, 29 Nov 2007, David Chinner wrote: I don't think that gives the same return value. The return value is supposed to be clamped at a maximum of page_cache_size(mapping). Ok. So this? ext2: Simplify some functions Signed-off-by: Christoph Lameter [EMAIL PROTECTED] --- fs/ext2/dir.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Index: mm/fs/ext2/dir.c === --- mm.orig/fs/ext2/dir.c 2007-11-28 20:13:07.387132777 -0800 +++ mm/fs/ext2/dir.c2007-11-28 20:14:35.739632586 -0800 @@ -63,8 +63,7 @@ static inline void ext2_put_page(struct static inline unsigned long dir_pages(struct inode *inode) { - return (inode-i_size+page_cache_size(inode-i_mapping)-1) - page_cache_shift(inode-i_mapping); + return page_cache_next(inode-i_mapping, inode-i_size); } /* @@ -77,7 +76,7 @@ ext2_last_byte(struct inode *inode, unsi unsigned last_byte = inode-i_size; struct address_space *mapping = inode-i_mapping; - last_byte -= page_nr page_cache_shift(mapping); + last_byte -= page_cache_pos(mapping, page_nr, 0); if (last_byte page_cache_size(mapping)) last_byte = page_cache_size(mapping); return last_byte; - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
On Wed, 28 November 2007 20:27:11 -0700, Andreas Dilger wrote: On Nov 29, 2007 00:48 +0100, Jörn Engel wrote: I didn't follow the discussion much, since it didn't appear to suit logfs too well. In a nutshell, logfs is purely block-based, prepends every block with a header, may compress blocks and packs them as tightly as possible (byte alignment). The FIEMAP interface in some ways well suited to your needs, because it uses byte offsets instead of FIBMAP, which uses block offsets. I now see that one hole in the specification is that your physical extent is not the same length as the logical extent that the data represents. I'm not sure that is in itself a reason not to use FIEMAP. There is already a provision for logical extents that do not map directly to the physical layout (i.e. FIEMAP_EXTENT_NO_DIRECT flag on the extent). In the case of logfs, the extent fe_length would represent the logical length of the data that the extent covers, fe_offset is the start of the physical extent, and FIEMAP_EXTENT_NO_DIRECT indicates that this extent cannot be directly mapped. This is useful for applications like LILO that would otherwise assume the physical offset can be used to access the data from the block device. That could work. There really isn't a reason for any application to mess with physical locations when dealing with logfs. SEEK_HOLE/SEEK_DATA only provides a fraction of the useful information that FIEMAP does. It won't give users or developers any information about the on disk layout (which is quite important for knowing if allocation algorithms are good). It has the advantage of being easy to use. My completely untested attempt at a copy loop is just 14 lines. Add some error handling and it should still be quite small. off_t data_ofs, hole_ofs; long count; for (data_ofs = hole_ofs = 0; ; ) { if (data_ofs = hole_ofs) { data_ofs = llseek(in_fd, data_ofs, SEEK_DATA); hole_ofs = llseek(in_fd, data_ofs, SEEK_HOLE); } count = splice(in_fd, data_ofs, out_fd, data_ofs, hole_ofs - data_ofs, 0); if (count == 0) break; data_ofs += count; } And when trying to optimize away some of the system calls, my personal preference would be to teach splice about seek_hole and seek_data and just splice the complete file range in one go. Jörn -- Security vulnerabilities are here to stay. -- Scott Culp, Manager of the Microsoft Security Response Center, 2001 - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 14/19] Use page_cache_xxx in ext2
On Wed, Nov 28, 2007 at 08:15:26PM -0800, Christoph Lameter wrote: On Thu, 29 Nov 2007, David Chinner wrote: I don't think that gives the same return value. The return value is supposed to be clamped at a maximum of page_cache_size(mapping). Ok. So this? Looks good. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions
On Wed, Nov 28, 2007 at 05:10:52PM -0800, Christoph Lameter wrote: This patchset cleans up page cache handling by replacing open coded shifts and adds with inline function calls. The ultimate goal is to replace all uses of PAGE_CACHE_xxx in the kernel through the use of these functions. All the functions take a mapping parameter. The mapping parameter is required if we want to support large block sizes in filesystems and block devices. Patchset against 2.6.24-rc3-mm2. Reviewed-by: Dave Chinner [EMAIL PROTECTED] -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-fsdevel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html