diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-04-26 02:34:57 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-05-05 21:18:09 -0400 |
commit | c901fb00731e307c2c6e8c7d5eee005df5835f9d (patch) | |
tree | 4c68bf68590d04d1045ae5d66a9ae158c56019fa /fs/ocfs2/xattr.c | |
parent | 3e4218df3176657be72ad2fa199779be6c11fe4f (diff) |
ocfs2: Make ocfs2_extend_trans() really extend.
In ocfs2, we use ocfs2_extend_trans() to extend a journal handle's
blocks. But if jbd2_journal_extend() fails, it will only restart
with the the new number of blocks. This tends to be awkward since
in most cases we want additional reserved blocks. It makes our code
harder to mantain since the caller can't be sure all the original
blocks will not be accessed and dirtied again. There are 15 callers
of ocfs2_extend_trans() in fs/ocfs2, and 12 of them have to add
h_buffer_credits before they call ocfs2_extend_trans(). This makes
ocfs2_extend_trans() really extend atop the original block count.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r-- | fs/ocfs2/xattr.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4cf6fde71027..38a55ff45b3a 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -3295,8 +3295,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, | |||
3295 | goto out; | 3295 | goto out; |
3296 | } | 3296 | } |
3297 | 3297 | ||
3298 | ret = ocfs2_extend_trans(ctxt->handle, credits + | 3298 | ret = ocfs2_extend_trans(ctxt->handle, credits); |
3299 | ctxt->handle->h_buffer_credits); | ||
3300 | if (ret) { | 3299 | if (ret) { |
3301 | mlog_errno(ret); | 3300 | mlog_errno(ret); |
3302 | goto out; | 3301 | goto out; |
@@ -3326,8 +3325,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, | |||
3326 | goto out; | 3325 | goto out; |
3327 | } | 3326 | } |
3328 | 3327 | ||
3329 | ret = ocfs2_extend_trans(ctxt->handle, credits + | 3328 | ret = ocfs2_extend_trans(ctxt->handle, credits); |
3330 | ctxt->handle->h_buffer_credits); | ||
3331 | if (ret) { | 3329 | if (ret) { |
3332 | mlog_errno(ret); | 3330 | mlog_errno(ret); |
3333 | goto out; | 3331 | goto out; |
@@ -3361,8 +3359,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode, | |||
3361 | goto out; | 3359 | goto out; |
3362 | } | 3360 | } |
3363 | 3361 | ||
3364 | ret = ocfs2_extend_trans(ctxt->handle, credits + | 3362 | ret = ocfs2_extend_trans(ctxt->handle, credits); |
3365 | ctxt->handle->h_buffer_credits); | ||
3366 | if (ret) { | 3363 | if (ret) { |
3367 | mlog_errno(ret); | 3364 | mlog_errno(ret); |
3368 | goto out; | 3365 | goto out; |
@@ -4870,8 +4867,7 @@ static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle, | |||
4870 | * We need to update the first bucket of the old extent and all | 4867 | * We need to update the first bucket of the old extent and all |
4871 | * the buckets going to the new extent. | 4868 | * the buckets going to the new extent. |
4872 | */ | 4869 | */ |
4873 | credits = ((num_buckets + 1) * blks_per_bucket) + | 4870 | credits = ((num_buckets + 1) * blks_per_bucket); |
4874 | handle->h_buffer_credits; | ||
4875 | ret = ocfs2_extend_trans(handle, credits); | 4871 | ret = ocfs2_extend_trans(handle, credits); |
4876 | if (ret) { | 4872 | if (ret) { |
4877 | mlog_errno(ret); | 4873 | mlog_errno(ret); |
@@ -4941,7 +4937,7 @@ static int ocfs2_divide_xattr_cluster(struct inode *inode, | |||
4941 | u32 *first_hash) | 4937 | u32 *first_hash) |
4942 | { | 4938 | { |
4943 | u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); | 4939 | u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); |
4944 | int ret, credits = 2 * blk_per_bucket + handle->h_buffer_credits; | 4940 | int ret, credits = 2 * blk_per_bucket; |
4945 | 4941 | ||
4946 | BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize); | 4942 | BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize); |
4947 | 4943 | ||
@@ -5181,8 +5177,7 @@ static int ocfs2_extend_xattr_bucket(struct inode *inode, | |||
5181 | * existing bucket. Then we add the last existing bucket, the | 5177 | * existing bucket. Then we add the last existing bucket, the |
5182 | * new bucket, and the first bucket (3 * blk_per_bucket). | 5178 | * new bucket, and the first bucket (3 * blk_per_bucket). |
5183 | */ | 5179 | */ |
5184 | credits = (end_blk - target_blk) + (3 * blk_per_bucket) + | 5180 | credits = (end_blk - target_blk) + (3 * blk_per_bucket); |
5185 | handle->h_buffer_credits; | ||
5186 | ret = ocfs2_extend_trans(handle, credits); | 5181 | ret = ocfs2_extend_trans(handle, credits); |
5187 | if (ret) { | 5182 | if (ret) { |
5188 | mlog_errno(ret); | 5183 | mlog_errno(ret); |