lkml.org 
[lkml]   [2008]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 33/56] ocfs2: Make ocfs2_get_quota_block() consistent with ocfs2_read_quota_block()
Date
From: Jan Kara <jack@suse.cz>

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>
---
fs/ocfs2/quota_global.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 339c98a..27a8123 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -102,26 +102,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
@@ -207,7 +206,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) {
--
1.5.6


\
 
 \ /
  Last update: 2008-12-22 23:03    [W:0.649 / U:0.488 seconds]
©2003-2014 Jasper Spaans. hosted at Digital Ocean