aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_dtree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:00 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:28 -0500
commit5dd4056db84387975140ff2568eaa0406f07985e (patch)
tree03c26d7f6e3367b167bfeeb1a01654c6619573f4 /fs/jfs/jfs_dtree.c
parent49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (diff)
dquot: cleanup space allocation / freeing routines
Get rid of the alloc_space, free_space, reserve_space, claim_space and release_rsv dquot operations - they are always called from the filesystem and if a filesystem really needs their own (which none currently does) it can just call into it's own routine directly. Move shared logic into the common __dquot_alloc_space, dquot_claim_space_nodirty and __dquot_free_space low-level methods, and rationalize the wrappers around it to move as much as possible code into the common block for CONFIG_QUOTA vs not. Also rename all these helpers to be named dquot_* instead of vfs_dq_*. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/jfs/jfs_dtree.c')
-rw-r--r--fs/jfs/jfs_dtree.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 925871e9887b..0e4623be70ce 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -381,10 +381,10 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
381 * It's time to move the inline table to an external 381 * It's time to move the inline table to an external
382 * page and begin to build the xtree 382 * page and begin to build the xtree
383 */ 383 */
384 if (vfs_dq_alloc_block(ip, sbi->nbperpage)) 384 if (dquot_alloc_block(ip, sbi->nbperpage))
385 goto clean_up; 385 goto clean_up;
386 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) { 386 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) {
387 vfs_dq_free_block(ip, sbi->nbperpage); 387 dquot_free_block(ip, sbi->nbperpage);
388 goto clean_up; 388 goto clean_up;
389 } 389 }
390 390
@@ -408,7 +408,7 @@ static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot)
408 memcpy(&jfs_ip->i_dirtable, temp_table, 408 memcpy(&jfs_ip->i_dirtable, temp_table,
409 sizeof (temp_table)); 409 sizeof (temp_table));
410 dbFree(ip, xaddr, sbi->nbperpage); 410 dbFree(ip, xaddr, sbi->nbperpage);
411 vfs_dq_free_block(ip, sbi->nbperpage); 411 dquot_free_block(ip, sbi->nbperpage);
412 goto clean_up; 412 goto clean_up;
413 } 413 }
414 ip->i_size = PSIZE; 414 ip->i_size = PSIZE;
@@ -1027,10 +1027,9 @@ static int dtSplitUp(tid_t tid,
1027 n = xlen; 1027 n = xlen;
1028 1028
1029 /* Allocate blocks to quota. */ 1029 /* Allocate blocks to quota. */
1030 if (vfs_dq_alloc_block(ip, n)) { 1030 rc = dquot_alloc_block(ip, n);
1031 rc = -EDQUOT; 1031 if (rc)
1032 goto extendOut; 1032 goto extendOut;
1033 }
1034 quota_allocation += n; 1033 quota_allocation += n;
1035 1034
1036 if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen, 1035 if ((rc = dbReAlloc(sbi->ipbmap, xaddr, (s64) xlen,
@@ -1308,7 +1307,7 @@ static int dtSplitUp(tid_t tid,
1308 1307
1309 /* Rollback quota allocation */ 1308 /* Rollback quota allocation */
1310 if (rc && quota_allocation) 1309 if (rc && quota_allocation)
1311 vfs_dq_free_block(ip, quota_allocation); 1310 dquot_free_block(ip, quota_allocation);
1312 1311
1313 dtSplitUp_Exit: 1312 dtSplitUp_Exit:
1314 1313
@@ -1369,9 +1368,10 @@ static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
1369 return -EIO; 1368 return -EIO;
1370 1369
1371 /* Allocate blocks to quota. */ 1370 /* Allocate blocks to quota. */
1372 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 1371 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1372 if (rc) {
1373 release_metapage(rmp); 1373 release_metapage(rmp);
1374 return -EDQUOT; 1374 return rc;
1375 } 1375 }
1376 1376
1377 jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); 1377 jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
@@ -1892,6 +1892,7 @@ static int dtSplitRoot(tid_t tid,
1892 struct dt_lock *dtlck; 1892 struct dt_lock *dtlck;
1893 struct tlock *tlck; 1893 struct tlock *tlck;
1894 struct lv *lv; 1894 struct lv *lv;
1895 int rc;
1895 1896
1896 /* get split root page */ 1897 /* get split root page */
1897 smp = split->mp; 1898 smp = split->mp;
@@ -1916,9 +1917,10 @@ static int dtSplitRoot(tid_t tid,
1916 rp = rmp->data; 1917 rp = rmp->data;
1917 1918
1918 /* Allocate blocks to quota. */ 1919 /* Allocate blocks to quota. */
1919 if (vfs_dq_alloc_block(ip, lengthPXD(pxd))) { 1920 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1921 if (rc) {
1920 release_metapage(rmp); 1922 release_metapage(rmp);
1921 return -EDQUOT; 1923 return rc;
1922 } 1924 }
1923 1925
1924 BT_MARK_DIRTY(rmp, ip); 1926 BT_MARK_DIRTY(rmp, ip);
@@ -2287,7 +2289,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip,
2287 xlen = lengthPXD(&fp->header.self); 2289 xlen = lengthPXD(&fp->header.self);
2288 2290
2289 /* Free quota allocation. */ 2291 /* Free quota allocation. */
2290 vfs_dq_free_block(ip, xlen); 2292 dquot_free_block(ip, xlen);
2291 2293
2292 /* free/invalidate its buffer page */ 2294 /* free/invalidate its buffer page */
2293 discard_metapage(fmp); 2295 discard_metapage(fmp);
@@ -2363,7 +2365,7 @@ static int dtDeleteUp(tid_t tid, struct inode *ip,
2363 xlen = lengthPXD(&p->header.self); 2365 xlen = lengthPXD(&p->header.self);
2364 2366
2365 /* Free quota allocation */ 2367 /* Free quota allocation */
2366 vfs_dq_free_block(ip, xlen); 2368 dquot_free_block(ip, xlen);
2367 2369
2368 /* free/invalidate its buffer page */ 2370 /* free/invalidate its buffer page */
2369 discard_metapage(mp); 2371 discard_metapage(mp);