diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 10:02:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 10:02:36 -0700 |
commit | ffd14285142cb398b2b613e27f71be415d28072e (patch) | |
tree | 32ffd364a8ee1e69d27ec058a3d710551d24a057 /fs/jfs/jfs_extent.c | |
parent | 0d34fb8e93ceba7b6dad0062dbb4a0813bacd75b (diff) | |
parent | c68a65da35906b32505bbb8eecab316e6736e28b (diff) | |
download | talos-obmc-linux-ffd14285142cb398b2b613e27f71be415d28072e.tar.gz talos-obmc-linux-ffd14285142cb398b2b613e27f71be415d28072e.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6:
jfs: needs crc32_le
jfs: Fix error handling in metapage_writepage()
jfs: return f_fsid for statfs(2)
jfs: remove xtLookupList()
jfs: clean up a dangling comment
Diffstat (limited to 'fs/jfs/jfs_extent.c')
-rw-r--r-- | fs/jfs/jfs_extent.c | 63 |
1 files changed, 24 insertions, 39 deletions
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index 169802ea07f9..bbbd5f202e37 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c @@ -362,11 +362,12 @@ exit: int extHint(struct inode *ip, s64 offset, xad_t * xp) { struct super_block *sb = ip->i_sb; - struct xadlist xadl; - struct lxdlist lxdl; - lxd_t lxd; + int nbperpage = JFS_SBI(sb)->nbperpage; s64 prev; - int rc, nbperpage = JFS_SBI(sb)->nbperpage; + int rc = 0; + s64 xaddr; + int xlen; + int xflag; /* init the hint as "no hint provided" */ XADaddress(xp, 0); @@ -376,46 +377,30 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) */ prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; - /* if the offsets in the first page of the file, - * no hint provided. + /* if the offset is in the first page of the file, no hint provided. */ if (prev < 0) - return (0); - - /* prepare to lookup the previous page's extent info */ - lxdl.maxnlxd = 1; - lxdl.nlxd = 1; - lxdl.lxd = &lxd; - LXDoffset(&lxd, prev) - LXDlength(&lxd, nbperpage); - - xadl.maxnxad = 1; - xadl.nxad = 0; - xadl.xad = xp; - - /* perform the lookup */ - if ((rc = xtLookupList(ip, &lxdl, &xadl, 0))) - return (rc); - - /* check if no extent exists for the previous page. - * this is possible for sparse files. - */ - if (xadl.nxad == 0) { -// assert(ISSPARSE(ip)); - return (0); - } + goto out; - /* only preserve the abnr flag within the xad flags - * of the returned hint. - */ - xp->flag &= XAD_NOTRECORDED; + rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0); - if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) { - jfs_error(ip->i_sb, "extHint: corrupt xtree"); - return -EIO; - } + if ((rc == 0) && xlen) { + if (xlen != nbperpage) { + jfs_error(ip->i_sb, "extHint: corrupt xtree"); + rc = -EIO; + } + XADaddress(xp, xaddr); + XADlength(xp, xlen); + /* + * only preserve the abnr flag within the xad flags + * of the returned hint. + */ + xp->flag = xflag & XAD_NOTRECORDED; + } else + rc = 0; - return (0); +out: + return (rc); } |