From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] (and bad attr2 bug) - pack xfs_sb_t for 64-bit arches
Date: Mon, 20 Nov 2006 22:02:21 -0600 [thread overview]
Message-ID: <45627A4D.3020502@sandeen.net> (raw)
In-Reply-To: <45612621.5010404@sandeen.net>
Eric Sandeen wrote:
> Eric Sandeen wrote:
>
>> ugh. it's broken on x86 too, so it's not just the alignment/padding,
>>
>> although that should be fixed for cross-arch mounts.
>>
>> -Eric
>>
>>
> here's a testcase to corrupt it FWIW.
>
>
Ok, with expert collaboration from Russell, Barry, Tim,
Nathan, David, et al, how about this:
For btree dirs, we need a different calculation for the space
used in di_u, to set the minimum threshold for the fork offset...
This fixes my testcase, but as Tim points out -now- we need to compact
the btree ptrs, if we return (and use) an offset < current forkoff...
whee....
-Eric
Index: linux-2.6.18/fs/xfs.orig/xfs_attr_leaf.c
===================================================================
--- linux-2.6.18.orig/fs/xfs.orig/xfs_attr_leaf.c
+++ linux-2.6.18/fs/xfs.orig/xfs_attr_leaf.c
@@ -116,6 +116,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t
int minforkoff; /* lower limit on valid forkoff locations */
int maxforkoff; /* upper limit on valid forkoff locations */
xfs_mount_t *mp = dp->i_mount;
+ int dsize = 0;
offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */
@@ -134,8 +135,21 @@ xfs_attr_shortform_bytesfit(xfs_inode_t
return 0;
}
+ switch (dp->i_d.di_format) {
+ case XFS_DINODE_FMT_LOCAL:
+ case XFS_DINODE_FMT_EXTENTS:
+ dsize = dp->i_df.if_bytes;
+ break;
+ case XFS_DINODE_FMT_BTREE:
+ dsize = XFS_BMDR_SPACE_CALC(
+ XFS_BMAP_BROOT_NUMRECS(dp->i_df.if_broot));
+ break;
+ default:
+ /* should bail, unknown format, .... */
+ }
+
/* data fork btree root can have at least this many key/ptr pairs */
- minforkoff = MAX(dp->i_df.if_bytes, XFS_BMDR_SPACE_CALC(MINDBTPTRS));
+ minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS));
minforkoff = roundup(minforkoff, 8) >> 3;
/* attr fork btree root can have at least this many key/ptr pairs */
next prev parent reply other threads:[~2006-11-21 4:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-16 19:00 [PATCH] (and bad attr2 bug) - pack xfs_sb_t for 64-bit arches Eric Sandeen
2006-11-16 22:10 ` Eric Sandeen
2006-11-20 3:50 ` Eric Sandeen
2006-11-21 4:02 ` Eric Sandeen [this message]
2006-11-22 1:02 ` Russell Cattelan
2006-11-22 8:59 ` Timothy Shimmin
2006-11-22 15:44 ` Eric Sandeen
2006-11-22 16:24 ` Russell Cattelan
2006-11-22 16:38 ` Eric Sandeen
2006-11-23 7:09 ` Timothy Shimmin
2006-11-23 17:37 ` Russell Cattelan
2006-11-24 4:47 ` Timothy Shimmin
2006-11-27 12:50 ` Tim Shimmin
2006-11-29 9:56 ` [PATCH] attr2 patch for data btrees & attr 2 was: " Timothy Shimmin
2006-11-23 22:49 ` [PATCH] " David Chinner
2006-11-16 22:45 ` David Chinner
2006-11-16 22:55 ` Eric Sandeen
2006-11-17 15:53 ` Russell Cattelan
2006-11-17 1:08 ` Timothy Shimmin
2006-11-17 2:39 ` David Chinner
2006-11-17 4:11 ` Timothy Shimmin
2006-11-17 5:55 ` David Chinner
2006-11-17 6:34 ` sandeen
2006-11-17 6:52 ` Nathan Scott
2006-11-17 15:20 ` sandeen
2006-11-19 23:11 ` Nathan Scott
2006-11-20 1:39 ` Eric Sandeen
2006-11-20 3:00 ` Nathan Scott
2006-11-20 3:32 ` Eric Sandeen
2006-11-20 3:37 ` Nathan Scott
2006-11-17 6:58 ` David Chinner
2006-11-17 23:49 ` Eric Sandeen
2007-05-17 14:41 ` Eric Sandeen
2007-05-21 7:42 ` David Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45627A4D.3020502@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox