diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-10 10:18:55 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-25 03:18:25 -0500 |
commit | 6dbd822487d0a9f14432cb4680415b80656b63a2 (patch) | |
tree | f0391d598c27cd7c39c67cfa13799a784f4c389a /fs | |
parent | ac39aadd0440ae696e6dacaa8006ce1737b17008 (diff) |
[GFS2] Reduce inode size by moving i_alloc out of line
It is possible to reduce the size of GFS2 inodes by taking the i_alloc
structure out of the gfs2_inode. This patch allocates the i_alloc
structure whenever its needed, and frees it afterward. This decreases
the amount of low memory we use at the expense of requiring a memory
allocation for each page or partial page that we write. A quick test
with postmark shows that the overhead is not measurable and I also note
that OCFS2 use the same approach.
In the future I'd like to solve the problem by shrinking down the size
of the members of the i_alloc structure, but for now, this reduces the
immediate problem of using too much low-memory on x86 and doesn't add
too much overhead.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/bmap.c | 4 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 4 | ||||
-rw-r--r-- | fs/gfs2/eattr.c | 2 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 2 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 7 | ||||
-rw-r--r-- | fs/gfs2/main.c | 1 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 5 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_inode.c | 8 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 12 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 20 | ||||
-rw-r--r-- | fs/gfs2/rgrp.h | 4 |
12 files changed, 39 insertions, 36 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 224114166529..73dfad70de66 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -683,7 +683,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
683 | if (metadata) | 683 | if (metadata) |
684 | revokes = (height) ? sdp->sd_inptrs : sdp->sd_diptrs; | 684 | revokes = (height) ? sdp->sd_inptrs : sdp->sd_diptrs; |
685 | 685 | ||
686 | error = gfs2_rindex_hold(sdp, &ip->i_alloc.al_ri_gh); | 686 | error = gfs2_rindex_hold(sdp, &ip->i_alloc->al_ri_gh); |
687 | if (error) | 687 | if (error) |
688 | return error; | 688 | return error; |
689 | 689 | ||
@@ -785,7 +785,7 @@ out_rg_gunlock: | |||
785 | out_rlist: | 785 | out_rlist: |
786 | gfs2_rlist_free(&rlist); | 786 | gfs2_rlist_free(&rlist); |
787 | out: | 787 | out: |
788 | gfs2_glock_dq_uninit(&ip->i_alloc.al_ri_gh); | 788 | gfs2_glock_dq_uninit(&ip->i_alloc->al_ri_gh); |
789 | return error; | 789 | return error; |
790 | } | 790 | } |
791 | 791 | ||
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 9949bb746a52..57e2ed932adc 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1876,7 +1876,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, | |||
1876 | if (error) | 1876 | if (error) |
1877 | goto out; | 1877 | goto out; |
1878 | 1878 | ||
1879 | error = gfs2_rindex_hold(sdp, &dip->i_alloc.al_ri_gh); | 1879 | error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); |
1880 | if (error) | 1880 | if (error) |
1881 | goto out_qs; | 1881 | goto out_qs; |
1882 | 1882 | ||
@@ -1949,7 +1949,7 @@ out_rg_gunlock: | |||
1949 | gfs2_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs); | 1949 | gfs2_glock_dq_m(rlist.rl_rgrps, rlist.rl_ghs); |
1950 | out_rlist: | 1950 | out_rlist: |
1951 | gfs2_rlist_free(&rlist); | 1951 | gfs2_rlist_free(&rlist); |
1952 | gfs2_glock_dq_uninit(&dip->i_alloc.al_ri_gh); | 1952 | gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); |
1953 | out_qs: | 1953 | out_qs: |
1954 | gfs2_quota_unhold(dip); | 1954 | gfs2_quota_unhold(dip); |
1955 | out: | 1955 | out: |
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index 2a7435b5c4dc..bee99704ea10 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c | |||
@@ -1418,7 +1418,7 @@ out: | |||
1418 | static int ea_dealloc_block(struct gfs2_inode *ip) | 1418 | static int ea_dealloc_block(struct gfs2_inode *ip) |
1419 | { | 1419 | { |
1420 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1420 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1421 | struct gfs2_alloc *al = &ip->i_alloc; | 1421 | struct gfs2_alloc *al = ip->i_alloc; |
1422 | struct gfs2_rgrpd *rgd; | 1422 | struct gfs2_rgrpd *rgd; |
1423 | struct buffer_head *dibh; | 1423 | struct buffer_head *dibh; |
1424 | int error; | 1424 | int error; |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 745dada4085c..4cdda1a3e12c 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -264,7 +264,7 @@ struct gfs2_inode { | |||
264 | struct gfs2_glock *i_gl; /* Move into i_gh? */ | 264 | struct gfs2_glock *i_gl; /* Move into i_gh? */ |
265 | struct gfs2_holder i_iopen_gh; | 265 | struct gfs2_holder i_iopen_gh; |
266 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ | 266 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ |
267 | struct gfs2_alloc i_alloc; | 267 | struct gfs2_alloc *i_alloc; |
268 | u64 i_last_rg_alloc; | 268 | u64 i_last_rg_alloc; |
269 | 269 | ||
270 | spinlock_t i_spin; | 270 | spinlock_t i_spin; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 53bca9978fb5..c84764ad82b3 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -711,9 +711,10 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation) | |||
711 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 711 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
712 | int error; | 712 | int error; |
713 | 713 | ||
714 | gfs2_alloc_get(dip); | 714 | if (gfs2_alloc_get(dip) == NULL) |
715 | return -ENOMEM; | ||
715 | 716 | ||
716 | dip->i_alloc.al_requested = RES_DINODE; | 717 | dip->i_alloc->al_requested = RES_DINODE; |
717 | error = gfs2_inplace_reserve(dip); | 718 | error = gfs2_inplace_reserve(dip); |
718 | if (error) | 719 | if (error) |
719 | goto out; | 720 | goto out; |
@@ -900,7 +901,7 @@ fail_end_trans: | |||
900 | gfs2_trans_end(sdp); | 901 | gfs2_trans_end(sdp); |
901 | 902 | ||
902 | fail_ipreserv: | 903 | fail_ipreserv: |
903 | if (dip->i_alloc.al_rgd) | 904 | if (dip->i_alloc->al_rgd) |
904 | gfs2_inplace_release(dip); | 905 | gfs2_inplace_release(dip); |
905 | 906 | ||
906 | fail_quota_locks: | 907 | fail_quota_locks: |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 653fd5a6203a..88686fcdfb1b 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -31,6 +31,7 @@ static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo) | |||
31 | inode_init_once(&ip->i_inode); | 31 | inode_init_once(&ip->i_inode); |
32 | spin_lock_init(&ip->i_spin); | 32 | spin_lock_init(&ip->i_spin); |
33 | init_rwsem(&ip->i_rw_mutex); | 33 | init_rwsem(&ip->i_rw_mutex); |
34 | ip->i_alloc = NULL; | ||
34 | } | 35 | } |
35 | 36 | ||
36 | static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo) | 37 | static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo) |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 37406a379e7a..38dbe99a30ed 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -646,7 +646,6 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, | |||
646 | if (error) | 646 | if (error) |
647 | goto out_unlock; | 647 | goto out_unlock; |
648 | 648 | ||
649 | ip->i_alloc.al_requested = 0; | ||
650 | if (alloc_required) { | 649 | if (alloc_required) { |
651 | al = gfs2_alloc_get(ip); | 650 | al = gfs2_alloc_get(ip); |
652 | 651 | ||
@@ -823,7 +822,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
823 | struct gfs2_inode *ip = GFS2_I(inode); | 822 | struct gfs2_inode *ip = GFS2_I(inode); |
824 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 823 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
825 | struct buffer_head *dibh; | 824 | struct buffer_head *dibh; |
826 | struct gfs2_alloc *al = &ip->i_alloc; | 825 | struct gfs2_alloc *al = ip->i_alloc; |
827 | struct gfs2_dinode *di; | 826 | struct gfs2_dinode *di; |
828 | unsigned int from = pos & (PAGE_CACHE_SIZE - 1); | 827 | unsigned int from = pos & (PAGE_CACHE_SIZE - 1); |
829 | unsigned int to = from + len; | 828 | unsigned int to = from + len; |
@@ -861,7 +860,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
861 | brelse(dibh); | 860 | brelse(dibh); |
862 | gfs2_trans_end(sdp); | 861 | gfs2_trans_end(sdp); |
863 | failed: | 862 | failed: |
864 | if (al->al_requested) { | 863 | if (al) { |
865 | gfs2_inplace_release(ip); | 864 | gfs2_inplace_release(ip); |
866 | gfs2_quota_unlock(ip); | 865 | gfs2_quota_unlock(ip); |
867 | gfs2_alloc_put(ip); | 866 | gfs2_alloc_put(ip); |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 597f7ff2bc11..d7f4726ae0ce 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -364,9 +364,11 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page) | |||
364 | ret = gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE, &alloc_required); | 364 | ret = gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE, &alloc_required); |
365 | if (ret || !alloc_required) | 365 | if (ret || !alloc_required) |
366 | goto out_unlock; | 366 | goto out_unlock; |
367 | 367 | ret = -ENOMEM; | |
368 | ip->i_alloc.al_requested = 0; | ||
369 | al = gfs2_alloc_get(ip); | 368 | al = gfs2_alloc_get(ip); |
369 | if (al == NULL) | ||
370 | goto out_unlock; | ||
371 | |||
370 | ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 372 | ret = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
371 | if (ret) | 373 | if (ret) |
372 | goto out_alloc_put; | 374 | goto out_alloc_put; |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 8386ab323e33..9f71372c1757 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -61,7 +61,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry, | |||
61 | inode = gfs2_createi(ghs, &dentry->d_name, S_IFREG | mode, 0); | 61 | inode = gfs2_createi(ghs, &dentry->d_name, S_IFREG | mode, 0); |
62 | if (!IS_ERR(inode)) { | 62 | if (!IS_ERR(inode)) { |
63 | gfs2_trans_end(sdp); | 63 | gfs2_trans_end(sdp); |
64 | if (dip->i_alloc.al_rgd) | 64 | if (dip->i_alloc->al_rgd) |
65 | gfs2_inplace_release(dip); | 65 | gfs2_inplace_release(dip); |
66 | gfs2_quota_unlock(dip); | 66 | gfs2_quota_unlock(dip); |
67 | gfs2_alloc_put(dip); | 67 | gfs2_alloc_put(dip); |
@@ -376,7 +376,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry, | |||
376 | } | 376 | } |
377 | 377 | ||
378 | gfs2_trans_end(sdp); | 378 | gfs2_trans_end(sdp); |
379 | if (dip->i_alloc.al_rgd) | 379 | if (dip->i_alloc->al_rgd) |
380 | gfs2_inplace_release(dip); | 380 | gfs2_inplace_release(dip); |
381 | gfs2_quota_unlock(dip); | 381 | gfs2_quota_unlock(dip); |
382 | gfs2_alloc_put(dip); | 382 | gfs2_alloc_put(dip); |
@@ -452,7 +452,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
452 | gfs2_assert_withdraw(sdp, !error); /* dip already pinned */ | 452 | gfs2_assert_withdraw(sdp, !error); /* dip already pinned */ |
453 | 453 | ||
454 | gfs2_trans_end(sdp); | 454 | gfs2_trans_end(sdp); |
455 | if (dip->i_alloc.al_rgd) | 455 | if (dip->i_alloc->al_rgd) |
456 | gfs2_inplace_release(dip); | 456 | gfs2_inplace_release(dip); |
457 | gfs2_quota_unlock(dip); | 457 | gfs2_quota_unlock(dip); |
458 | gfs2_alloc_put(dip); | 458 | gfs2_alloc_put(dip); |
@@ -558,7 +558,7 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
558 | } | 558 | } |
559 | 559 | ||
560 | gfs2_trans_end(sdp); | 560 | gfs2_trans_end(sdp); |
561 | if (dip->i_alloc.al_rgd) | 561 | if (dip->i_alloc->al_rgd) |
562 | gfs2_inplace_release(dip); | 562 | gfs2_inplace_release(dip); |
563 | gfs2_quota_unlock(dip); | 563 | gfs2_quota_unlock(dip); |
564 | gfs2_alloc_put(dip); | 564 | gfs2_alloc_put(dip); |
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 60cc50fe15b4..a08dabd6ce90 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -453,7 +453,7 @@ static void qdsb_put(struct gfs2_quota_data *qd) | |||
453 | int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid) | 453 | int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid) |
454 | { | 454 | { |
455 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 455 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
456 | struct gfs2_alloc *al = &ip->i_alloc; | 456 | struct gfs2_alloc *al = ip->i_alloc; |
457 | struct gfs2_quota_data **qd = al->al_qd; | 457 | struct gfs2_quota_data **qd = al->al_qd; |
458 | int error; | 458 | int error; |
459 | 459 | ||
@@ -501,7 +501,7 @@ out: | |||
501 | void gfs2_quota_unhold(struct gfs2_inode *ip) | 501 | void gfs2_quota_unhold(struct gfs2_inode *ip) |
502 | { | 502 | { |
503 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 503 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
504 | struct gfs2_alloc *al = &ip->i_alloc; | 504 | struct gfs2_alloc *al = ip->i_alloc; |
505 | unsigned int x; | 505 | unsigned int x; |
506 | 506 | ||
507 | gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags)); | 507 | gfs2_assert_warn(sdp, !test_bit(GIF_QD_LOCKED, &ip->i_flags)); |
@@ -853,7 +853,7 @@ fail: | |||
853 | int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid) | 853 | int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid) |
854 | { | 854 | { |
855 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 855 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
856 | struct gfs2_alloc *al = &ip->i_alloc; | 856 | struct gfs2_alloc *al = ip->i_alloc; |
857 | unsigned int x; | 857 | unsigned int x; |
858 | int error = 0; | 858 | int error = 0; |
859 | 859 | ||
@@ -921,7 +921,7 @@ static int need_sync(struct gfs2_quota_data *qd) | |||
921 | 921 | ||
922 | void gfs2_quota_unlock(struct gfs2_inode *ip) | 922 | void gfs2_quota_unlock(struct gfs2_inode *ip) |
923 | { | 923 | { |
924 | struct gfs2_alloc *al = &ip->i_alloc; | 924 | struct gfs2_alloc *al = ip->i_alloc; |
925 | struct gfs2_quota_data *qda[4]; | 925 | struct gfs2_quota_data *qda[4]; |
926 | unsigned int count = 0; | 926 | unsigned int count = 0; |
927 | unsigned int x; | 927 | unsigned int x; |
@@ -969,7 +969,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type) | |||
969 | int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid) | 969 | int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid) |
970 | { | 970 | { |
971 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 971 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
972 | struct gfs2_alloc *al = &ip->i_alloc; | 972 | struct gfs2_alloc *al = ip->i_alloc; |
973 | struct gfs2_quota_data *qd; | 973 | struct gfs2_quota_data *qd; |
974 | s64 value; | 974 | s64 value; |
975 | unsigned int x; | 975 | unsigned int x; |
@@ -1013,7 +1013,7 @@ int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid) | |||
1013 | void gfs2_quota_change(struct gfs2_inode *ip, s64 change, | 1013 | void gfs2_quota_change(struct gfs2_inode *ip, s64 change, |
1014 | u32 uid, u32 gid) | 1014 | u32 uid, u32 gid) |
1015 | { | 1015 | { |
1016 | struct gfs2_alloc *al = &ip->i_alloc; | 1016 | struct gfs2_alloc *al = ip->i_alloc; |
1017 | struct gfs2_quota_data *qd; | 1017 | struct gfs2_quota_data *qd; |
1018 | unsigned int x; | 1018 | unsigned int x; |
1019 | 1019 | ||
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 68c4bf363c46..3552110b2e5f 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -819,11 +819,9 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd) | |||
819 | 819 | ||
820 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip) | 820 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip) |
821 | { | 821 | { |
822 | struct gfs2_alloc *al = &ip->i_alloc; | 822 | BUG_ON(ip->i_alloc != NULL); |
823 | 823 | ip->i_alloc = kzalloc(sizeof(struct gfs2_alloc), GFP_KERNEL); | |
824 | /* FIXME: Should assert that the correct locks are held here... */ | 824 | return ip->i_alloc; |
825 | memset(al, 0, sizeof(*al)); | ||
826 | return al; | ||
827 | } | 825 | } |
828 | 826 | ||
829 | /** | 827 | /** |
@@ -1061,7 +1059,7 @@ static struct inode *get_local_rgrp(struct gfs2_inode *ip, u64 *last_unlinked) | |||
1061 | struct inode *inode = NULL; | 1059 | struct inode *inode = NULL; |
1062 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1060 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1063 | struct gfs2_rgrpd *rgd, *begin = NULL; | 1061 | struct gfs2_rgrpd *rgd, *begin = NULL; |
1064 | struct gfs2_alloc *al = &ip->i_alloc; | 1062 | struct gfs2_alloc *al = ip->i_alloc; |
1065 | int flags = LM_FLAG_TRY; | 1063 | int flags = LM_FLAG_TRY; |
1066 | int skipped = 0; | 1064 | int skipped = 0; |
1067 | int loops = 0; | 1065 | int loops = 0; |
@@ -1176,7 +1174,7 @@ out: | |||
1176 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) | 1174 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, char *file, unsigned int line) |
1177 | { | 1175 | { |
1178 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1176 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1179 | struct gfs2_alloc *al = &ip->i_alloc; | 1177 | struct gfs2_alloc *al = ip->i_alloc; |
1180 | struct inode *inode; | 1178 | struct inode *inode; |
1181 | int error = 0; | 1179 | int error = 0; |
1182 | u64 last_unlinked = NO_BLOCK; | 1180 | u64 last_unlinked = NO_BLOCK; |
@@ -1222,7 +1220,7 @@ try_again: | |||
1222 | void gfs2_inplace_release(struct gfs2_inode *ip) | 1220 | void gfs2_inplace_release(struct gfs2_inode *ip) |
1223 | { | 1221 | { |
1224 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1222 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1225 | struct gfs2_alloc *al = &ip->i_alloc; | 1223 | struct gfs2_alloc *al = ip->i_alloc; |
1226 | 1224 | ||
1227 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) | 1225 | if (gfs2_assert_warn(sdp, al->al_alloced <= al->al_requested) == -1) |
1228 | fs_warn(sdp, "al_alloced = %u, al_requested = %u " | 1226 | fs_warn(sdp, "al_alloced = %u, al_requested = %u " |
@@ -1412,7 +1410,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, | |||
1412 | u64 gfs2_alloc_data(struct gfs2_inode *ip) | 1410 | u64 gfs2_alloc_data(struct gfs2_inode *ip) |
1413 | { | 1411 | { |
1414 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1412 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1415 | struct gfs2_alloc *al = &ip->i_alloc; | 1413 | struct gfs2_alloc *al = ip->i_alloc; |
1416 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1414 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1417 | u32 goal, blk; | 1415 | u32 goal, blk; |
1418 | u64 block; | 1416 | u64 block; |
@@ -1457,7 +1455,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip) | |||
1457 | u64 gfs2_alloc_meta(struct gfs2_inode *ip) | 1455 | u64 gfs2_alloc_meta(struct gfs2_inode *ip) |
1458 | { | 1456 | { |
1459 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1457 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1460 | struct gfs2_alloc *al = &ip->i_alloc; | 1458 | struct gfs2_alloc *al = ip->i_alloc; |
1461 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1459 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1462 | u32 goal, blk; | 1460 | u32 goal, blk; |
1463 | u64 block; | 1461 | u64 block; |
@@ -1503,7 +1501,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip) | |||
1503 | u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) | 1501 | u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation) |
1504 | { | 1502 | { |
1505 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 1503 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
1506 | struct gfs2_alloc *al = &dip->i_alloc; | 1504 | struct gfs2_alloc *al = dip->i_alloc; |
1507 | struct gfs2_rgrpd *rgd = al->al_rgd; | 1505 | struct gfs2_rgrpd *rgd = al->al_rgd; |
1508 | u32 blk; | 1506 | u32 blk; |
1509 | u64 block; | 1507 | u64 block; |
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index b4c6adfc6f2e..149bb161f4b6 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h | |||
@@ -32,7 +32,9 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd); | |||
32 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); | 32 | struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); |
33 | static inline void gfs2_alloc_put(struct gfs2_inode *ip) | 33 | static inline void gfs2_alloc_put(struct gfs2_inode *ip) |
34 | { | 34 | { |
35 | return; /* So we can see where ip->i_alloc is used */ | 35 | BUG_ON(ip->i_alloc == NULL); |
36 | kfree(ip->i_alloc); | ||
37 | ip->i_alloc = NULL; | ||
36 | } | 38 | } |
37 | 39 | ||
38 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, | 40 | int gfs2_inplace_reserve_i(struct gfs2_inode *ip, |