diff options
Diffstat (limited to 'fs/jfs/jfs_extent.c')
-rw-r--r-- | fs/jfs/jfs_extent.c | 73 |
1 files changed, 29 insertions, 44 deletions
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index 7ae1e3281de9..bbbd5f202e37 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c | |||
@@ -141,7 +141,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | /* Allocate blocks to quota. */ | 143 | /* Allocate blocks to quota. */ |
144 | if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { | 144 | if (vfs_dq_alloc_block(ip, nxlen)) { |
145 | dbFree(ip, nxaddr, (s64) nxlen); | 145 | dbFree(ip, nxaddr, (s64) nxlen); |
146 | mutex_unlock(&JFS_IP(ip)->commit_mutex); | 146 | mutex_unlock(&JFS_IP(ip)->commit_mutex); |
147 | return -EDQUOT; | 147 | return -EDQUOT; |
@@ -164,7 +164,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, bool abnr) | |||
164 | */ | 164 | */ |
165 | if (rc) { | 165 | if (rc) { |
166 | dbFree(ip, nxaddr, nxlen); | 166 | dbFree(ip, nxaddr, nxlen); |
167 | DQUOT_FREE_BLOCK(ip, nxlen); | 167 | vfs_dq_free_block(ip, nxlen); |
168 | mutex_unlock(&JFS_IP(ip)->commit_mutex); | 168 | mutex_unlock(&JFS_IP(ip)->commit_mutex); |
169 | return (rc); | 169 | return (rc); |
170 | } | 170 | } |
@@ -256,7 +256,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) | |||
256 | goto exit; | 256 | goto exit; |
257 | 257 | ||
258 | /* Allocat blocks to quota. */ | 258 | /* Allocat blocks to quota. */ |
259 | if (DQUOT_ALLOC_BLOCK(ip, nxlen)) { | 259 | if (vfs_dq_alloc_block(ip, nxlen)) { |
260 | dbFree(ip, nxaddr, (s64) nxlen); | 260 | dbFree(ip, nxaddr, (s64) nxlen); |
261 | mutex_unlock(&JFS_IP(ip)->commit_mutex); | 261 | mutex_unlock(&JFS_IP(ip)->commit_mutex); |
262 | return -EDQUOT; | 262 | return -EDQUOT; |
@@ -297,7 +297,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) | |||
297 | /* extend the extent */ | 297 | /* extend the extent */ |
298 | if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) { | 298 | if ((rc = xtExtend(0, ip, xoff + xlen, (int) nextend, 0))) { |
299 | dbFree(ip, xaddr + xlen, delta); | 299 | dbFree(ip, xaddr + xlen, delta); |
300 | DQUOT_FREE_BLOCK(ip, nxlen); | 300 | vfs_dq_free_block(ip, nxlen); |
301 | goto exit; | 301 | goto exit; |
302 | } | 302 | } |
303 | } else { | 303 | } else { |
@@ -308,7 +308,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, bool abnr) | |||
308 | */ | 308 | */ |
309 | if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) { | 309 | if ((rc = xtTailgate(0, ip, xoff, (int) ntail, nxaddr, 0))) { |
310 | dbFree(ip, nxaddr, nxlen); | 310 | dbFree(ip, nxaddr, nxlen); |
311 | DQUOT_FREE_BLOCK(ip, nxlen); | 311 | vfs_dq_free_block(ip, nxlen); |
312 | goto exit; | 312 | goto exit; |
313 | } | 313 | } |
314 | } | 314 | } |
@@ -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 | ||