rescue large xfs preferred iosize from the inode diet patch
PATCH 1/1 rescue large xfs preferred iosize from the inode diet patch
The inode diet patch in -mm unhooked xfs_preferred_iosize from the stat call:
fs/xfs/linux-2.6/xfs_vnode.c +0 -1
@@ -122,7 +122,6 @@ vn_revalidate_core( inode->i_blocks = vap->va_nblocks; inode->i_mtime = vap->va_mtime; inode->i_ctime = vap->va_ctime; - inode->i_blksize = vap->va_blocksize;if (vap->va_xflags &XFS_XFLAG_IMMUTABLE )
This in turn breaks the largeio mount option for xfs:
largeio/nolargeio
If "nolargeio" is specified, the optimal I/O reported in st_blksize by stat(2) will be as small as possible to allow user applications to avoid inefficient read/modify/write I/O. If "largeio" specified, a filesystem that has a "swidth" specified will return the "swidth" value (in bytes) in st_blksize. If the filesystem does not have a "swidth" specified but does specify an "allocsize" then "allocsize" (in bytes) will be returned instead.
If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified.
and the (undocumented?) allocsize mount option as well.
For a filesystem like this with sunit/swidth specified,
meta-data=/dev/sda1 isize=512 agcount=32, agsize=7625840 blks
= sectsz=512 attr=0
data = bsize=4096 blocks=244026880, imaxpct=25
= sunit=16 swidth=16 blks, unwritten=1
naming =version 2 bsize=4096
log =internal bsize=4096 blocks=32768, version=1
= sectsz=512 sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0stat on a stock FC6 kernel w/ the largeio mount option returns only the page size:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096
with the following patch, it does what it should:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 65536
same goes for filesystems w/o sunit,swidth but with the allocsize mount option.
stock:
[root@link-07]# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096
w/ patch:
[root@link-07# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 32768
XFS guys, does this look ok?
fs/xfs/linux-2.6/xfs_iops.c +5 -1
@@ -623,12 +623,16 @@ xfs_vn_getattr( {struct inode *inode = dentry->d_inode;bhv_vnode_t *vp =vn_from_inode (inode); +xfs_inode_t *ip;int error =0 ;if (unlikely (vp->v_flag &VMODIFIED )) error =vn_revalidate (vp); -if (!error) +if (!error) {generic_fillattr (inode, stat); + ip =xfs_vtoi (vp); + stat->blksize =xfs_preferred_iosize (ip->i_mount); + }return -error; }
Quoted 1 line · Eric Sandeen
The inode diet patch in -mm unhooked
xfs_preferred_iosizefrom the stat call:
....
Quoted 15 lines
Signed-off-by Eric Sandeen <[email protected]>XFS guys, does this look ok?
Index:
linux-2.6.18/fs/xfs/linux-2.6/xfs_iops.c
===================================================================fs/xfs/linux-2.6/xfs_iops.c +1
-0@@ -623,12 +623,16 @@ xfs_vn_getattr( {struct inode *inode = dentry->d_inode;bhv_vnode_t *vp =vn_from_inode (inode); +xfs_inode_t *ip;int error =0 ;
fs/xfs/linux-2.6/xfs_iops.c xfs_vn_getattr( · line 637
Quoted 10 lines
fs/xfs/linux-2.6/xfs_iops.c +4
-1if (unlikely (vp->v_flag &VMODIFIED )) error =vn_revalidate (vp); -if (!error) +if (!error) {generic_fillattr (inode, stat); + ip =xfs_vtoi (vp); + stat->blksize =xfs_preferred_iosize (ip->i_mount); + }return -error; }
ACK. Looks good, Eric. Good catch.
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group
Hi Eric,
Quoted 78 lines · Eric Sandeen
The inode diet patch in -mm unhooked
xfs_preferred_iosizefrom the stat call:fs/xfs/linux-2.6/xfs_vnode.c +0
-1@@ -122,7 +122,6 @@ vn_revalidate_core( inode->i_blocks = vap->va_nblocks; inode->i_mtime = vap->va_mtime; inode->i_ctime = vap->va_ctime; - inode->i_blksize = vap->va_blocksize;if (vap->va_xflags &XFS_XFLAG_IMMUTABLE )This in turn breaks the largeio mount option for xfs:
largeio/nolargeio
If "nolargeio" is specified, the optimal I/O reported inst_blksizeby stat(2) will be as small as possible to allow user applications to avoid inefficient read/modify/write I/O. If "largeio" specified, a filesystem that has a "swidth" specified will return the "swidth" value (in bytes) inst_blksize. If the filesystem does not have a "swidth" specified but does specify an "allocsize" then "allocsize" (in bytes) will be returned instead.
If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified.and the (undocumented?) allocsize mount option as well.
For a filesystem like this with sunit/swidth specified,
meta-data=/dev/sda1 isize=512 agcount=32, agsize=7625840 blks = sectsz=512 attr=0 data = bsize=4096 blocks=244026880, imaxpct=25 = sunit=16 swidth=16 blks, unwritten=1 naming =version 2 bsize=4096 log =internal bsize=4096 blocks=32768, version=1 = sectsz=512 sunit=0 blks realtime =none extsz=65536 blocks=0, rtextents=0stat on a stock FC6 kernel w/ the largeio mount option returns only the page size:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096with the following patch, it does what it should:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 65536same goes for filesystems w/o sunit,swidth but with the allocsize mount option.
stock:
[root@link-07]# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096w/ patch:
[root@link-07# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 32768Signed-off-by Eric Sandeen <[email protected]>XFS guys, does this look ok?
Index:
linux-2.6.18/fs/xfs/linux-2.6/xfs_iops.c
===================================================================fs/xfs/linux-2.6/xfs_iops.c +1
-0@@ -623,12 +623,16 @@ xfs_vn_getattr( {struct inode *inode = dentry->d_inode;bhv_vnode_t *vp =vn_from_inode (inode); +xfs_inode_t *ip;int error =0 ;if (unlikely (vp->v_flag &VMODIFIED ))
fs/xfs/linux-2.6/xfs_iops.c xfs_vn_getattr( · line 638
Quoted 10 lines
fs/xfs/linux-2.6/xfs_iops.c +4
-1error =vn_revalidate (vp); -if (!error) +if (!error) {generic_fillattr (inode, stat); + ip =xfs_vtoi (vp); + stat->blksize =xfs_preferred_iosize (ip->i_mount); + }return -error; }
Looked at your patch and then at our xfs code in the tree and the existing code is different than what yours is based on. I then noticed in the logs Nathan has actually made changes for this:
----------------------------
revision 1.254
date: 2006/07/17 10:46:05; author: nathans; state: Exp; lines: +20 -5
modid: xfs-linux-melb:xfs-kern:26565a
Update XFS for i_blksize removal from generic inode structure
----------------------------
I even reviewed the change (and I don't remember it - getting old).
I looked at the mods scheduled for 2.6.19 and this is one of them.
So the fix for this is coming soon (and the fix is different from the one above).
Cheers,
Tim.
Quoted 12 lines · Timothy Shimmin
Looked at your patch and then at our xfs code in the tree and the existing code is different than what yours is based on. I then noticed in the logs Nathan has actually made changes for this:
----------------------------
revision 1.254
date: 2006/07/17 10:46:05; author: nathans; state: Exp; lines: +20 -5
modid: xfs-linux-melb:xfs-kern:26565a
Update XFS fori_blksizeremoval from generic inode structure
----------------------------
I even reviewed the change (and I don't remember it - getting old).
Quoted 4 lines
I looked at the mods scheduled for 2.6.19 and this is one of them.
So the fix for this is coming soon (and the fix is different from the one above).
Ah, ok, thanks guys. Should have checked CVS I guess.
-Eric
Quoted 16 lines · Eric Sandeen
Quoted 14 lines · Timothy Shimmin
Looked at your patch and then at our xfs code in the tree and the existing code is different than what yours is based on. I then noticed in the logs Nathan has actually made changes for this:
----------------------------
revision 1.254
date: 2006/07/17 10:46:05; author: nathans; state: Exp; lines: +20 -5
modid: xfs-linux-melb:xfs-kern:26565a
Update XFS fori_blksizeremoval from generic inode structure
----------------------------
I even reviewed the change (and I don't remember it - getting old).I looked at the mods scheduled for 2.6.19 and this is one of them.
Quoted 8 lines
Quoted 2 lines
So the fix for this is coming soon (and the fix is different from the one above).
Ah, ok, thanks guys. Should have checked CVS I guess.
-Eric
cc -= lkml;
actually the patch nathan put in seems like a lot of replicated code.
But maybe he's solving some problem I didn't think of.
Any idea what?
-Eric
Quoted 7 lines · Eric Sandeen
Quoted 3 lines · Eric Sandeen
Ah, ok, thanks guys. Should have checked CVS I guess.
cc -= lkml;
actually the patch nathan put in seems like a lot of replicated code.
Yeah, that's what caught me - I looked at the tree which had nathan's patch in it, and assumed that the stuff the -mm tree had cleaned it up to use the generic_fillattr() code.
Quoted 1 line
But maybe he's solving some problem I didn't think of.
The difference is the old code updated the fields in the linux inode with all the info from disk and then filled in the stat data from the linux inode. The new code gets the data from "disk" and puts it straight into the the stat buffer without updating the linux inode.
Quoted 1 line
Any idea what?
I would have thought that we want what we report to userspace to be consistent in the linux inode as well. I suppose that by duplicating the code we removed a copy of the data but I see little advantage from doing that considering the extra code to do it and the fat that the linux inode may not be up to date now....
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group
Quoted 19 lines · David Chinner
Quoted 6 lines · Eric Sandeen
Quoted 2 lines · Eric Sandeen
Ah, ok, thanks guys. Should have checked CVS I guess.
cc -= lkml;
actually the patch nathan put in seems like a lot of replicated code.
Yeah, that's what caught me - I looked at the tree which had nathan's patch in it, and assumed that the stuff the -mm tree had cleaned it up to use the
generic_fillattr()code.Quoted 1 line
But maybe he's solving some problem I didn't think of.
The difference is the old code updated the fields in the linux inode with all the info from disk and then filled in the stat data from the linux inode. The new code gets the data from "disk" and puts it straight into the the stat buffer without updating the linux inode.
Quoted 8 lines
Quoted 1 line
Any idea what?
I would have thought that we want what we report to userspace to be consistent in the linux inode as well. I suppose that by duplicating the code we removed a copy of the data but I see little advantage from doing that considering the extra code to do it and the fat that the linux inode may not be up to date now....
Well we just sync it (linux inode) up at points when we need to don't we? (Hmmm, doesn't look like we call vn_revalidate much anymore.)
I agree Eric's fix is simpler but I'd like to wait for Nathan's comments. Perhaps he is trying to future proof us, from this thing happening again when we rely on the linux inode? :)
Review at the time:
-------------------------------
Re: review: rework stat/getattr for i_blksize removal
To: Timothy Shimmin <[email protected]>
Subject: Re: review: rework stat/getattr for i_blksize removal
From: Nathan Scott <[email protected]>
Date: Thu, 6 Jul 2006 15:45:14 +1000
Cc: xfs-dev
Quoted 4 lines · Timothy Shimmin
Hi Nathan,
Looks reasonable.
Just a few questions of interest below :)
Thanks & no worries...
Quoted 5 lines
So we don't need to call
vn_revalidatebecause we no longer need to update the inode at this point with the data from the vnode because we are no longer looking at the linux inode?
We are now just looking at the vnode and its fields (which we get a lot from the xfs inode inxfs_getattr).
Yep.
Quoted 6 lines
(quoted diff) +3
-0+ error = bhv_vop_getattr(vp, &vattr, ATTR_LAZY, NULL); + if (likely(!error)) { + stat->size = i_size_read(inode);Q: OOI, Why can't we use vattr.va_size?
Isinode->i_sizeup to date at this point?
Slightly more uptodate at times, but we probably could use it too. There are times where that is updated in advance of the XFS inode (e.g. during write, its updated per-page, whereas we only update the XFS inode right at the end).
I was just looking to reduce any risk here, but maybe we should go for the xfs_inode size, for consistency ... lemme ponder it a bit.
Quoted 6 lines
(quoted diff) +3
-0+ stat->rdev = (vattr.va_rdev == 0) ? 0 : + MKDEV(sysv_major(vattr.va_rdev) & 0x1ff, + sysv_minor(vattr.va_rdev));Q: Is it really worth special casing 0 with a conditional? Result will be the same won't it?
Heh - good point. It is the same in the end, will fix.
cheers.
Signature · 5 lines
Nathan ------------------------------- --Tim
Quoted 104 lines · On Fri, 22 Sep 2006 12:03:30 +1000 Timothy Shimmin <[email protected]> wrote:
Hi Eric,
Quoted 78 lines · Eric Sandeen
The inode diet patch in -mm unhooked
xfs_preferred_iosizefrom the stat call:fs/xfs/linux-2.6/xfs_vnode.c +0
-1@@ -122,7 +122,6 @@ vn_revalidate_core( inode->i_blocks = vap->va_nblocks; inode->i_mtime = vap->va_mtime; inode->i_ctime = vap->va_ctime; - inode->i_blksize = vap->va_blocksize;if (vap->va_xflags &XFS_XFLAG_IMMUTABLE )This in turn breaks the largeio mount option for xfs:
largeio/nolargeio
If "nolargeio" is specified, the optimal I/O reported inst_blksizeby stat(2) will be as small as possible to allow user applications to avoid inefficient read/modify/write I/O. If "largeio" specified, a filesystem that has a "swidth" specified will return the "swidth" value (in bytes) inst_blksize. If the filesystem does not have a "swidth" specified but does specify an "allocsize" then "allocsize" (in bytes) will be returned instead.
If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified.and the (undocumented?) allocsize mount option as well.
For a filesystem like this with sunit/swidth specified,
meta-data=/dev/sda1 isize=512 agcount=32, agsize=7625840 blks = sectsz=512 attr=0 data = bsize=4096 blocks=244026880, imaxpct=25 = sunit=16 swidth=16 blks, unwritten=1 naming =version 2 bsize=4096 log =internal bsize=4096 blocks=32768, version=1 = sectsz=512 sunit=0 blks realtime =none extsz=65536 blocks=0, rtextents=0stat on a stock FC6 kernel w/ the largeio mount option returns only the page size:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096with the following patch, it does what it should:
[root@link-07]# mount -o largeio /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 65536same goes for filesystems w/o sunit,swidth but with the allocsize mount option.
stock:
[root@link-07]# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 4096w/ patch:
[root@link-07# mount -o largeio,allocsize=32768 /dev/sda1 /mnt/test/ [root@link-07]# stat -c %o /mnt/test/foo 32768Signed-off-by Eric Sandeen <[email protected]>XFS guys, does this look ok?
Index:
linux-2.6.18/fs/xfs/linux-2.6/xfs_iops.c
===================================================================fs/xfs/linux-2.6/xfs_iops.c +1
-0@@ -623,12 +623,16 @@ xfs_vn_getattr( {struct inode *inode = dentry->d_inode;bhv_vnode_t *vp =vn_from_inode (inode); +xfs_inode_t *ip;int error =0 ;if (unlikely (vp->v_flag &VMODIFIED ))fs/xfs/linux-2.6/xfs_iops.c xfs_vn_getattr( · line 638
Quoted 10 lines
fs/xfs/linux-2.6/xfs_iops.c +4
-1error =vn_revalidate (vp); -if (!error) +if (!error) {generic_fillattr (inode, stat); + ip =xfs_vtoi (vp); + stat->blksize =xfs_preferred_iosize (ip->i_mount); + }return -error; }Looked at your patch and then at our xfs code in the tree and the existing code is different than what yours is based on. I then noticed in the logs Nathan has actually made changes for this:
----------------------------
revision 1.254
date: 2006/07/17 10:46:05; author: nathans; state: Exp; lines: +20 -5
modid: xfs-linux-melb:xfs-kern:26565a
Update XFS fori_blksizeremoval from generic inode structure
----------------------------
I even reviewed the change (and I don't remember it - getting old).
Quoted 5 lines
I looked at the mods scheduled for 2.6.19 and this is one of them.
So the fix for this is coming soon (and the fix is different from the one above).
eh? Eric's patch is based on -mm, which includes the XFS git tree. If I go and merge the inode-diet patches from -mm, XFS gets broken until you guys merge the above mystery patch. (I prefer to merge the -mm patches after all the git trees have gone, but sometimes maintainers dawdle and I get bored of waiting).
Is git://oss.sgi.com:8090/nathans/xfs-2.6 obsolete, or are you hiding stuff from me? ;)
Quoted 4 lines · Andrew Morton
Quoted 3 lines
So the fix for this is coming soon (and the fix is different from the one above).
Quoted 10 lines
eh? Eric's patch is based on -mm, which includes the XFS git tree. If I go and merge the inode-diet patches from -mm, XFS gets broken until you guys merge the above mystery patch. (I prefer to merge the -mm patches after all the git trees have gone, but sometimes maintainers dawdle and I get bored of waiting).
Is
git://oss.sgi.com:8090/nathans/xfs-2.6obsolete, or are you hiding stuff from me? ;)
well it's in cvs:
but I'm too lazy to check git on a friday evening. :)
Well, sgi-guys, I'll let you sort out which patch you want. Sorry for not checking cvs first!
-Eric
Quoted 12 lines · On Fri, 22 Sep 2006 18:19:18 -0500 Eric Sandeen <[email protected]> wrote:
Quoted 10 lines · Andrew Morton
Quoted 3 lines
So the fix for this is coming soon (and the fix is different from the one above).
eh? Eric's patch is based on -mm, which includes the XFS git tree. If I go and merge the inode-diet patches from -mm, XFS gets broken until you guys merge the above mystery patch. (I prefer to merge the -mm patches after all the git trees have gone, but sometimes maintainers dawdle and I get bored of waiting).
Quoted 5 lines
Quoted 4 lines
Is
git://oss.sgi.com:8090/nathans/xfs-2.6obsolete, or are you hiding stuff from me? ;)well it's in cvs:
That's nearly four months old!
Quoted 1 line
<checks to see if the changelog is in Aramaic too>
Quoted 20 lines · Andrew Morton
On Fri, 22 Sep 2006 12:03:30 +1000
Quoted 12 lines
Looked at your patch and then at our xfs code in the tree and the existing code is different than what yours is based on. I then noticed in the logs Nathan has actually made changes for this:
----------------------------
revision 1.254
date: 2006/07/17 10:46:05; author: nathans; state: Exp; lines: +20 -5
modid: xfs-linux-melb:xfs-kern:26565a
Update XFS fori_blksizeremoval from generic inode structure
----------------------------
I even reviewed the change (and I don't remember it - getting old).Quoted 5 lines
I looked at the mods scheduled for 2.6.19 and this is one of them.
So the fix for this is coming soon (and the fix is different from the one above).
Quoted 9 lines
eh? Eric's patch is based on -mm, which includes the XFS git tree. If I go and merge the inode-diet patches from -mm, XFS gets broken until you guys merge the above mystery patch. (I prefer to merge the -mm patches after all the git trees have gone, but sometimes maintainers dawdle and I get bored of waiting).
Is
git://oss.sgi.com:8090/nathans/xfs-2.6obsolete, or are you hiding stuff from me? ;)
:)
We're still getting our act together since Nathan is no longer here. Going forward the new git tree is at:
git://oss.sgi.com:8090/xfs/xfs-2.6
This has some more recent changes than the "nathans" one but is far from up to date with the internal sgi tree and the external cvs tree (as you noticed with the nathans one:).
I will get the "xfs" one updated in the next day or so.
(Aside: for some strange reason, the "nathans" one has 3 extra
mods (commits) and as expected (to me:) the "xfs" one has 10 extra mods (commits) and there is about 46 mods (including missing 3) pending for the "xfs" tree.
If we end up moving from our internal SCM to git at some point, this could make the updates less of a hassle:).
--Tim