aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/file.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-05-18 09:28:23 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-06-06 06:20:22 -0400
commit5407e24229408d7586ee451a384fc13e4a2332be (patch)
tree7534b0d0fc69de50b6156ec4e384a71acf01dea1 /fs/gfs2/file.c
parent0a305e496059a113f93bdd3ad27a5aaa917fe34d (diff)
GFS2: Fold quota data into the reservations struct
This patch moves the ancillary quota data structures into the block reservations structure. This saves GFS2 some time and effort in allocating and deallocating the qadata structure. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r--fs/gfs2/file.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 37906174d417..26e2905070ed 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -366,7 +366,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
366 u64 pos = page->index << PAGE_CACHE_SHIFT; 366 u64 pos = page->index << PAGE_CACHE_SHIFT;
367 unsigned int data_blocks, ind_blocks, rblocks; 367 unsigned int data_blocks, ind_blocks, rblocks;
368 struct gfs2_holder gh; 368 struct gfs2_holder gh;
369 struct gfs2_qadata *qa;
370 loff_t size; 369 loff_t size;
371 int ret; 370 int ret;
372 371
@@ -397,14 +396,13 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
397 goto out_unlock; 396 goto out_unlock;
398 } 397 }
399 398
400 ret = -ENOMEM; 399 ret = gfs2_rindex_update(sdp);
401 qa = gfs2_qadata_get(ip); 400 if (ret)
402 if (qa == NULL)
403 goto out_unlock; 401 goto out_unlock;
404 402
405 ret = gfs2_quota_lock_check(ip); 403 ret = gfs2_quota_lock_check(ip);
406 if (ret) 404 if (ret)
407 goto out_alloc_put; 405 goto out_unlock;
408 gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks); 406 gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
409 ret = gfs2_inplace_reserve(ip, data_blocks + ind_blocks); 407 ret = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
410 if (ret) 408 if (ret)
@@ -451,8 +449,6 @@ out_trans_fail:
451 gfs2_inplace_release(ip); 449 gfs2_inplace_release(ip);
452out_quota_unlock: 450out_quota_unlock:
453 gfs2_quota_unlock(ip); 451 gfs2_quota_unlock(ip);
454out_alloc_put:
455 gfs2_qadata_put(ip);
456out_unlock: 452out_unlock:
457 gfs2_glock_dq(&gh); 453 gfs2_glock_dq(&gh);
458out: 454out:
@@ -764,7 +760,6 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
764 struct gfs2_inode *ip = GFS2_I(inode); 760 struct gfs2_inode *ip = GFS2_I(inode);
765 unsigned int data_blocks = 0, ind_blocks = 0, rblocks; 761 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
766 loff_t bytes, max_bytes; 762 loff_t bytes, max_bytes;
767 struct gfs2_qadata *qa;
768 int error; 763 int error;
769 const loff_t pos = offset; 764 const loff_t pos = offset;
770 const loff_t count = len; 765 const loff_t count = len;
@@ -804,15 +799,13 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
804 offset += bytes; 799 offset += bytes;
805 continue; 800 continue;
806 } 801 }
807 qa = gfs2_qadata_get(ip); 802 error = gfs2_rindex_update(sdp);
808 if (!qa) { 803 if (error)
809 error = -ENOMEM;
810 goto out_unlock; 804 goto out_unlock;
811 }
812 805
813 error = gfs2_quota_lock_check(ip); 806 error = gfs2_quota_lock_check(ip);
814 if (error) 807 if (error)
815 goto out_alloc_put; 808 goto out_unlock;
816 809
817retry: 810retry:
818 gfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks); 811 gfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);
@@ -852,7 +845,6 @@ retry:
852 offset += max_bytes; 845 offset += max_bytes;
853 gfs2_inplace_release(ip); 846 gfs2_inplace_release(ip);
854 gfs2_quota_unlock(ip); 847 gfs2_quota_unlock(ip);
855 gfs2_qadata_put(ip);
856 } 848 }
857 849
858 if (error == 0) 850 if (error == 0)
@@ -863,8 +855,6 @@ out_trans_fail:
863 gfs2_inplace_release(ip); 855 gfs2_inplace_release(ip);
864out_qunlock: 856out_qunlock:
865 gfs2_quota_unlock(ip); 857 gfs2_quota_unlock(ip);
866out_alloc_put:
867 gfs2_qadata_put(ip);
868out_unlock: 858out_unlock:
869 gfs2_glock_dq(&ip->i_gh); 859 gfs2_glock_dq(&ip->i_gh);
870out_uninit: 860out_uninit: