aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/eattr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 13:02:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 13:02:46 -0400
commitef38ff9d372d4fe69e415370939a0f1fb5783af1 (patch)
treefcf38cbbd55298606a695adaf7f2ea97f3185c19 /fs/gfs2/eattr.c
parentfda31d7d4b5a9c663ac3ed1ba244018a88deecaf (diff)
parent62be1f71677c53d5e51223807a06ac9052f49b0f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: (49 commits) [GFS2] fix assertion in log_refund() [GFS2] fix GFP_KERNEL misuses [GFS2] test for IS_ERR rather than 0 [GFS2] Invalidate cache at correct point [GFS2] fs/gfs2/recovery.c: suppress warnings [GFS2] Faster gfs2_bitfit algorithm [GFS2] Streamline quota lock/check for no-quota case [GFS2] Remove drop of module ref where not needed [GFS2] gfs2_adjust_quota has broken unstuffing code [GFS2] possible null pointer dereference fixup [GFS2] Need to ensure that sector_t is 64bits for GFS2 [GFS2] re-support special inode [GFS2] remove gfs2_dev_iops [GFS2] fix file_system_type leak on gfs2meta mount [GFS2] Allow bmap to allocate extents [GFS2] Fix a page lock / glock deadlock [GFS2] proper extern for gfs2/locking/dlm/mount.c:gdlm_ops [GFS2] gfs2/ops_file.c should #include "ops_inode.h" [GFS2] be*_add_cpu conversion [GFS2] Fix bug where we called drop_bh incorrectly ...
Diffstat (limited to 'fs/gfs2/eattr.c')
-rw-r--r--fs/gfs2/eattr.c58
1 files changed, 25 insertions, 33 deletions
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index bee99704ea10..e3f76f451b0a 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -277,10 +277,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
277 } 277 }
278 278
279 *dataptrs = 0; 279 *dataptrs = 0;
280 if (!ip->i_di.di_blocks) 280 gfs2_add_inode_blocks(&ip->i_inode, -1);
281 gfs2_consist_inode(ip);
282 ip->i_di.di_blocks--;
283 gfs2_set_inode_blocks(&ip->i_inode);
284 } 281 }
285 if (bstart) 282 if (bstart)
286 gfs2_free_meta(ip, bstart, blen); 283 gfs2_free_meta(ip, bstart, blen);
@@ -321,6 +318,8 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
321 int error; 318 int error;
322 319
323 al = gfs2_alloc_get(ip); 320 al = gfs2_alloc_get(ip);
321 if (!al)
322 return -ENOMEM;
324 323
325 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 324 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
326 if (error) 325 if (error)
@@ -449,7 +448,7 @@ static int ea_get_unstuffed(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
449 unsigned int x; 448 unsigned int x;
450 int error = 0; 449 int error = 0;
451 450
452 bh = kcalloc(nptrs, sizeof(struct buffer_head *), GFP_KERNEL); 451 bh = kcalloc(nptrs, sizeof(struct buffer_head *), GFP_NOFS);
453 if (!bh) 452 if (!bh)
454 return -ENOMEM; 453 return -ENOMEM;
455 454
@@ -582,10 +581,11 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
582{ 581{
583 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 582 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
584 struct gfs2_ea_header *ea; 583 struct gfs2_ea_header *ea;
584 unsigned int n = 1;
585 u64 block; 585 u64 block;
586 586
587 block = gfs2_alloc_meta(ip); 587 block = gfs2_alloc_block(ip, &n);
588 588 gfs2_trans_add_unrevoke(sdp, block, 1);
589 *bhp = gfs2_meta_new(ip->i_gl, block); 589 *bhp = gfs2_meta_new(ip->i_gl, block);
590 gfs2_trans_add_bh(ip->i_gl, *bhp, 1); 590 gfs2_trans_add_bh(ip->i_gl, *bhp, 1);
591 gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA); 591 gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA);
@@ -597,8 +597,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
597 ea->ea_flags = GFS2_EAFLAG_LAST; 597 ea->ea_flags = GFS2_EAFLAG_LAST;
598 ea->ea_num_ptrs = 0; 598 ea->ea_num_ptrs = 0;
599 599
600 ip->i_di.di_blocks++; 600 gfs2_add_inode_blocks(&ip->i_inode, 1);
601 gfs2_set_inode_blocks(&ip->i_inode);
602 601
603 return 0; 602 return 0;
604} 603}
@@ -642,15 +641,15 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
642 struct buffer_head *bh; 641 struct buffer_head *bh;
643 u64 block; 642 u64 block;
644 int mh_size = sizeof(struct gfs2_meta_header); 643 int mh_size = sizeof(struct gfs2_meta_header);
644 unsigned int n = 1;
645 645
646 block = gfs2_alloc_meta(ip); 646 block = gfs2_alloc_block(ip, &n);
647 647 gfs2_trans_add_unrevoke(sdp, block, 1);
648 bh = gfs2_meta_new(ip->i_gl, block); 648 bh = gfs2_meta_new(ip->i_gl, block);
649 gfs2_trans_add_bh(ip->i_gl, bh, 1); 649 gfs2_trans_add_bh(ip->i_gl, bh, 1);
650 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); 650 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED);
651 651
652 ip->i_di.di_blocks++; 652 gfs2_add_inode_blocks(&ip->i_inode, 1);
653 gfs2_set_inode_blocks(&ip->i_inode);
654 653
655 copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize : 654 copy = data_len > sdp->sd_jbsize ? sdp->sd_jbsize :
656 data_len; 655 data_len;
@@ -684,15 +683,13 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
684 int error; 683 int error;
685 684
686 al = gfs2_alloc_get(ip); 685 al = gfs2_alloc_get(ip);
686 if (!al)
687 return -ENOMEM;
687 688
688 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 689 error = gfs2_quota_lock_check(ip);
689 if (error) 690 if (error)
690 goto out; 691 goto out;
691 692
692 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
693 if (error)
694 goto out_gunlock_q;
695
696 al->al_requested = blks; 693 al->al_requested = blks;
697 694
698 error = gfs2_inplace_reserve(ip); 695 error = gfs2_inplace_reserve(ip);
@@ -966,9 +963,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
966 gfs2_trans_add_bh(ip->i_gl, indbh, 1); 963 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
967 } else { 964 } else {
968 u64 blk; 965 u64 blk;
969 966 unsigned int n = 1;
970 blk = gfs2_alloc_meta(ip); 967 blk = gfs2_alloc_block(ip, &n);
971 968 gfs2_trans_add_unrevoke(sdp, blk, 1);
972 indbh = gfs2_meta_new(ip->i_gl, blk); 969 indbh = gfs2_meta_new(ip->i_gl, blk);
973 gfs2_trans_add_bh(ip->i_gl, indbh, 1); 970 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
974 gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); 971 gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
@@ -978,8 +975,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
978 *eablk = cpu_to_be64(ip->i_di.di_eattr); 975 *eablk = cpu_to_be64(ip->i_di.di_eattr);
979 ip->i_di.di_eattr = blk; 976 ip->i_di.di_eattr = blk;
980 ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; 977 ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT;
981 ip->i_di.di_blocks++; 978 gfs2_add_inode_blocks(&ip->i_inode, 1);
982 gfs2_set_inode_blocks(&ip->i_inode);
983 979
984 eablk++; 980 eablk++;
985 } 981 }
@@ -1210,7 +1206,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1210 unsigned int x; 1206 unsigned int x;
1211 int error; 1207 int error;
1212 1208
1213 bh = kcalloc(nptrs, sizeof(struct buffer_head *), GFP_KERNEL); 1209 bh = kcalloc(nptrs, sizeof(struct buffer_head *), GFP_NOFS);
1214 if (!bh) 1210 if (!bh)
1215 return -ENOMEM; 1211 return -ENOMEM;
1216 1212
@@ -1347,7 +1343,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1347 else 1343 else
1348 goto out; 1344 goto out;
1349 1345
1350 gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE, 0); 1346 gfs2_rlist_alloc(&rlist, LM_ST_EXCLUSIVE);
1351 1347
1352 for (x = 0; x < rlist.rl_rgrps; x++) { 1348 for (x = 0; x < rlist.rl_rgrps; x++) {
1353 struct gfs2_rgrpd *rgd; 1349 struct gfs2_rgrpd *rgd;
@@ -1387,10 +1383,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1387 } 1383 }
1388 1384
1389 *eablk = 0; 1385 *eablk = 0;
1390 if (!ip->i_di.di_blocks) 1386 gfs2_add_inode_blocks(&ip->i_inode, -1);
1391 gfs2_consist_inode(ip);
1392 ip->i_di.di_blocks--;
1393 gfs2_set_inode_blocks(&ip->i_inode);
1394 } 1387 }
1395 if (bstart) 1388 if (bstart)
1396 gfs2_free_meta(ip, bstart, blen); 1389 gfs2_free_meta(ip, bstart, blen);
@@ -1442,10 +1435,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1442 gfs2_free_meta(ip, ip->i_di.di_eattr, 1); 1435 gfs2_free_meta(ip, ip->i_di.di_eattr, 1);
1443 1436
1444 ip->i_di.di_eattr = 0; 1437 ip->i_di.di_eattr = 0;
1445 if (!ip->i_di.di_blocks) 1438 gfs2_add_inode_blocks(&ip->i_inode, -1);
1446 gfs2_consist_inode(ip);
1447 ip->i_di.di_blocks--;
1448 gfs2_set_inode_blocks(&ip->i_inode);
1449 1439
1450 error = gfs2_meta_inode_buffer(ip, &dibh); 1440 error = gfs2_meta_inode_buffer(ip, &dibh);
1451 if (!error) { 1441 if (!error) {
@@ -1474,6 +1464,8 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
1474 int error; 1464 int error;
1475 1465
1476 al = gfs2_alloc_get(ip); 1466 al = gfs2_alloc_get(ip);
1467 if (!al)
1468 return -ENOMEM;
1477 1469
1478 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1470 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1479 if (error) 1471 if (error)