diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-21 17:05:23 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-21 17:05:23 -0400 |
commit | 7276b3b0c77101f8b3f4e45e89a29cf9045e831a (patch) | |
tree | 3dd0a981218e490ddf47f925ba20c254e491ce98 /fs/gfs2/quota.c | |
parent | 91fa47964165a42401fbc1f41caa63ab78564305 (diff) |
[GFS2] Tidy up meta_io code
Fix a bug in the directory reading code, where we might have dereferenced
a NULL pointer in case of OOM. Updated the directory code to use the new
& improved version of gfs2_meta_ra() which now returns the first block
that was being read. Previously it was releasing it requiring following
code to grab the block again at each point it was called.
Also turned off readahead on directory lookups since we are reading a
hash table, and therefore reading the entries in order is very
unlikely. Readahead is still used for all other calls to the
directory reading function (e.g. when growing the hash table).
Removed the DIO_START constant. Everywhere this was used, it was
used to unconditionally start i/o aside from a couple of places, so
I've removed it and made the couple of exceptions to this rule into
separate functions.
Also hunted through the other DIO flags and removed them as arguments
from functions which were always called with the same combination of
arguments.
Updated gfs2_meta_indirect_buffer to be a bit more efficient and
hopefully also be a bit easier to read.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index c5eb6c646177..da46e14388f4 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -265,7 +265,7 @@ static int bh_get(struct gfs2_quota_data *qd) error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map, 1); if (error) goto fail; - error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_START | DIO_WAIT, &bh); + error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); if (error) goto fail; error = -EIO; @@ -1059,8 +1059,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) u32 extlen = 0; int error; - if (!ip->i_di.di_size || - ip->i_di.di_size > (64 << 20) || + if (!ip->i_di.di_size || ip->i_di.di_size > (64 << 20) || ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1)) { gfs2_consist_inode(ip); return -EIO; @@ -1091,19 +1090,16 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) if (error) goto fail; } - gfs2_meta_ra(ip->i_gl, dblock, extlen); - error = gfs2_meta_read(ip->i_gl, dblock, DIO_START | DIO_WAIT, - &bh); - if (error) - goto fail; error = -EIO; + bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); + if (!bh) + goto fail; if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_QC)) { brelse(bh); goto fail; } - for (y = 0; - y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots; + for (y = 0; y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots; y++, slot++) { struct gfs2_quota_change qc; struct gfs2_quota_data *qd; |