diff options
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 7ae1e3281de9..16bc326eeca4 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c | |||
@@ -362,11 +362,12 @@ exit: | |||
362 | int extHint(struct inode *ip, s64 offset, xad_t * xp) | 362 | int extHint(struct inode *ip, s64 offset, xad_t * xp) |
363 | { | 363 | { |
364 | struct super_block *sb = ip->i_sb; | 364 | struct super_block *sb = ip->i_sb; |
365 | struct xadlist xadl; | 365 | int nbperpage = JFS_SBI(sb)->nbperpage; |
366 | struct lxdlist lxdl; | ||
367 | lxd_t lxd; | ||
368 | s64 prev; | 366 | s64 prev; |
369 | int rc, nbperpage = JFS_SBI(sb)->nbperpage; | 367 | int rc = 0; |
368 | s64 xaddr; | ||
369 | int xlen; | ||
370 | int xflag; | ||
370 | 371 | ||
371 | /* init the hint as "no hint provided" */ | 372 | /* init the hint as "no hint provided" */ |
372 | XADaddress(xp, 0); | 373 | XADaddress(xp, 0); |
@@ -376,46 +377,30 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp) | |||
376 | */ | 377 | */ |
377 | prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; | 378 | prev = ((offset & ~POFFSET) >> JFS_SBI(sb)->l2bsize) - nbperpage; |
378 | 379 | ||
379 | /* if the offsets in the first page of the file, | 380 | /* if the offset is in the first page of the file, no hint provided. |
380 | * no hint provided. | ||
381 | */ | 381 | */ |
382 | if (prev < 0) | 382 | if (prev < 0) |
383 | return (0); | 383 | goto out; |
384 | |||
385 | /* prepare to lookup the previous page's extent info */ | ||
386 | lxdl.maxnlxd = 1; | ||
387 | lxdl.nlxd = 1; | ||
388 | lxdl.lxd = &lxd; | ||
389 | LXDoffset(&lxd, prev) | ||
390 | LXDlength(&lxd, nbperpage); | ||
391 | |||
392 | xadl.maxnxad = 1; | ||
393 | xadl.nxad = 0; | ||
394 | xadl.xad = xp; | ||
395 | |||
396 | /* perform the lookup */ | ||
397 | if ((rc = xtLookupList(ip, &lxdl, &xadl, 0))) | ||
398 | return (rc); | ||
399 | |||
400 | /* check if no extent exists for the previous page. | ||
401 | * this is possible for sparse files. | ||
402 | */ | ||
403 | if (xadl.nxad == 0) { | ||
404 | // assert(ISSPARSE(ip)); | ||
405 | return (0); | ||
406 | } | ||
407 | 384 | ||
408 | /* only preserve the abnr flag within the xad flags | 385 | rc = xtLookup(ip, prev, nbperpage, &xflag, &xaddr, &xlen, 0); |
409 | * of the returned hint. | ||
410 | */ | ||
411 | xp->flag &= XAD_NOTRECORDED; | ||
412 | 386 | ||
413 | if(xadl.nxad != 1 || lengthXAD(xp) != nbperpage) { | 387 | if ((rc == 0) && xlen) { |
414 | jfs_error(ip->i_sb, "extHint: corrupt xtree"); | 388 | if (xlen != nbperpage) { |
415 | return -EIO; | 389 | jfs_error(ip->i_sb, "extHint: corrupt xtree"); |
416 | } | 390 | rc = -EIO; |
391 | } | ||
392 | XADaddress(xp, xaddr); | ||
393 | XADlength(xp, xlen); | ||
394 | /* | ||
395 | * only preserve the abnr flag within the xad flags | ||
396 | * of the returned hint. | ||
397 | */ | ||
398 | xp->flag = xflag & XAD_NOTRECORDED; | ||
399 | } else | ||
400 | rc = 0; | ||
417 | 401 | ||
418 | return (0); | 402 | out: |
403 | return (rc); | ||
419 | } | 404 | } |
420 | 405 | ||
421 | 406 | ||