Skip to content

Commit

Permalink
ocfs2: Make ocfs2_get_quota_block() consistent with ocfs2_read_quota_…
Browse files Browse the repository at this point in the history
…block()

Make function return error status and not buffer pointer so that it's
consistent with ocfs2_read_quota_block().

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
  • Loading branch information
Jan Kara authored and Mark Fasheh committed Jan 5, 2009
1 parent af09e51 commit 53a3604
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions fs/ocfs2/quota_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,25 @@ int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
return rc;
}

static struct buffer_head *ocfs2_get_quota_block(struct inode *inode,
int block, int *err)
static int ocfs2_get_quota_block(struct inode *inode, int block,
struct buffer_head **bh)
{
u64 pblock, pcount;
struct buffer_head *bh;
int err;

down_read(&OCFS2_I(inode)->ip_alloc_sem);
*err = ocfs2_extent_map_get_blocks(inode, block, &pblock, &pcount,
NULL);
err = ocfs2_extent_map_get_blocks(inode, block, &pblock, &pcount, NULL);
up_read(&OCFS2_I(inode)->ip_alloc_sem);
if (*err) {
mlog_errno(*err);
return NULL;
if (err) {
mlog_errno(err);
return err;
}
bh = sb_getblk(inode->i_sb, pblock);
if (!bh) {
*err = -EIO;
mlog_errno(*err);
*bh = sb_getblk(inode->i_sb, pblock);
if (!*bh) {
err = -EIO;
mlog_errno(err);
}
return bh;
return err;;
}

/* Read data from global quotafile - avoid pagecache and such because we cannot
Expand Down Expand Up @@ -209,7 +208,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
err = ocfs2_read_quota_block(gqinode, blk, &bh);
ja_type = OCFS2_JOURNAL_ACCESS_WRITE;
} else {
bh = ocfs2_get_quota_block(gqinode, blk, &err);
err = ocfs2_get_quota_block(gqinode, blk, &bh);
ja_type = OCFS2_JOURNAL_ACCESS_CREATE;
}
if (err) {
Expand Down

0 comments on commit 53a3604

Please sign in to comment.