aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-12-10 05:28:10 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2009-01-05 02:39:17 -0500
commit7ed122e42c72b3e4531f8b4a9f72159e8303ac15 (patch)
treeaa9976f47cf34b0b6d267654e74b9ea4f7a29d75 /fs/gfs2/ops_address.c
parent9a776db7371b9c77a8f4f0d2ac6374d78ac7db7d (diff)
GFS2: Streamline alloc calculations for writes
This patch removes some unused code, and make the calculation of the number of blocks required conditional in order to reduce the number of times this (potentially expensive) calculation is done. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 0df560f4269a..6e4ea36c6605 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -625,7 +625,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
625{ 625{
626 struct gfs2_inode *ip = GFS2_I(mapping->host); 626 struct gfs2_inode *ip = GFS2_I(mapping->host);
627 struct gfs2_sbd *sdp = GFS2_SB(mapping->host); 627 struct gfs2_sbd *sdp = GFS2_SB(mapping->host);
628 unsigned int data_blocks, ind_blocks, rblocks; 628 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
629 int alloc_required; 629 int alloc_required;
630 int error = 0; 630 int error = 0;
631 struct gfs2_alloc *al; 631 struct gfs2_alloc *al;
@@ -639,11 +639,13 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
639 if (unlikely(error)) 639 if (unlikely(error))
640 goto out_uninit; 640 goto out_uninit;
641 641
642 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
643 error = gfs2_write_alloc_required(ip, pos, len, &alloc_required); 642 error = gfs2_write_alloc_required(ip, pos, len, &alloc_required);
644 if (error) 643 if (error)
645 goto out_unlock; 644 goto out_unlock;
646 645
646 if (alloc_required || gfs2_is_jdata(ip))
647 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
648
647 if (alloc_required) { 649 if (alloc_required) {
648 al = gfs2_alloc_get(ip); 650 al = gfs2_alloc_get(ip);
649 if (!al) { 651 if (!al) {