diff options
author | Tao Ma <tao.ma@oracle.com> | 2010-08-11 22:36:38 -0400 |
---|---|---|
committer | Tao Ma <tao.ma@oracle.com> | 2010-08-11 22:39:57 -0400 |
commit | 155027121fe52f9b4f25e9d156c22f2f5012e5fe (patch) | |
tree | 74067d52b685ab314173e74cc85a43a5d9e20c7d | |
parent | b890823635e022467b924e3d9da8c5166a4e349c (diff) |
ocfs2: Add struct file to ocfs2_refcount_cow.
Add a new parameter 'struct file *' to ocfs2_refcount_cow
so that we can add readahead support later.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
-rw-r--r-- | fs/ocfs2/aops.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.h | 3 |
4 files changed, 10 insertions, 7 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index e3efdd93773f..7155c5a919d7 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1693,7 +1693,7 @@ int ocfs2_write_begin_nolock(struct file *filp, | |||
1693 | mlog_errno(ret); | 1693 | mlog_errno(ret); |
1694 | goto out; | 1694 | goto out; |
1695 | } else if (ret == 1) { | 1695 | } else if (ret == 1) { |
1696 | ret = ocfs2_refcount_cow(inode, di_bh, | 1696 | ret = ocfs2_refcount_cow(inode, filp, di_bh, |
1697 | wc->w_cpos, wc->w_clen, UINT_MAX); | 1697 | wc->w_cpos, wc->w_clen, UINT_MAX); |
1698 | if (ret) { | 1698 | if (ret) { |
1699 | mlog_errno(ret); | 1699 | mlog_errno(ret); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 5920159a421f..4331f57e9fde 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -361,7 +361,7 @@ static int ocfs2_cow_file_pos(struct inode *inode, | |||
361 | if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) | 361 | if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) |
362 | goto out; | 362 | goto out; |
363 | 363 | ||
364 | return ocfs2_refcount_cow(inode, fe_bh, cpos, 1, cpos+1); | 364 | return ocfs2_refcount_cow(inode, NULL, fe_bh, cpos, 1, cpos+1); |
365 | 365 | ||
366 | out: | 366 | out: |
367 | return status; | 367 | return status; |
@@ -904,8 +904,8 @@ static int ocfs2_zero_extend_get_range(struct inode *inode, | |||
904 | zero_clusters = last_cpos - zero_cpos; | 904 | zero_clusters = last_cpos - zero_cpos; |
905 | 905 | ||
906 | if (needs_cow) { | 906 | if (needs_cow) { |
907 | rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos, zero_clusters, | 907 | rc = ocfs2_refcount_cow(inode, NULL, di_bh, zero_cpos, |
908 | UINT_MAX); | 908 | zero_clusters, UINT_MAX); |
909 | if (rc) { | 909 | if (rc) { |
910 | mlog_errno(rc); | 910 | mlog_errno(rc); |
911 | goto out; | 911 | goto out; |
@@ -2071,7 +2071,7 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode, | |||
2071 | 2071 | ||
2072 | *meta_level = 1; | 2072 | *meta_level = 1; |
2073 | 2073 | ||
2074 | ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); | 2074 | ret = ocfs2_refcount_cow(inode, file, di_bh, cpos, clusters, UINT_MAX); |
2075 | if (ret) | 2075 | if (ret) |
2076 | mlog_errno(ret); | 2076 | mlog_errno(ret); |
2077 | out: | 2077 | out: |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 3ac5aa733e9c..66dab3c0d495 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3404,6 +3404,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) | |||
3404 | * unrefcounted extent. | 3404 | * unrefcounted extent. |
3405 | */ | 3405 | */ |
3406 | static int ocfs2_refcount_cow_hunk(struct inode *inode, | 3406 | static int ocfs2_refcount_cow_hunk(struct inode *inode, |
3407 | struct file *file, | ||
3407 | struct buffer_head *di_bh, | 3408 | struct buffer_head *di_bh, |
3408 | u32 cpos, u32 write_len, u32 max_cpos) | 3409 | u32 cpos, u32 write_len, u32 max_cpos) |
3409 | { | 3410 | { |
@@ -3481,6 +3482,7 @@ out: | |||
3481 | * clusters between cpos and cpos+write_len are safe to modify. | 3482 | * clusters between cpos and cpos+write_len are safe to modify. |
3482 | */ | 3483 | */ |
3483 | int ocfs2_refcount_cow(struct inode *inode, | 3484 | int ocfs2_refcount_cow(struct inode *inode, |
3485 | struct file *file, | ||
3484 | struct buffer_head *di_bh, | 3486 | struct buffer_head *di_bh, |
3485 | u32 cpos, u32 write_len, u32 max_cpos) | 3487 | u32 cpos, u32 write_len, u32 max_cpos) |
3486 | { | 3488 | { |
@@ -3500,7 +3502,7 @@ int ocfs2_refcount_cow(struct inode *inode, | |||
3500 | num_clusters = write_len; | 3502 | num_clusters = write_len; |
3501 | 3503 | ||
3502 | if (ext_flags & OCFS2_EXT_REFCOUNTED) { | 3504 | if (ext_flags & OCFS2_EXT_REFCOUNTED) { |
3503 | ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos, | 3505 | ret = ocfs2_refcount_cow_hunk(inode, file, di_bh, cpos, |
3504 | num_clusters, max_cpos); | 3506 | num_clusters, max_cpos); |
3505 | if (ret) { | 3507 | if (ret) { |
3506 | mlog_errno(ret); | 3508 | mlog_errno(ret); |
diff --git a/fs/ocfs2/refcounttree.h b/fs/ocfs2/refcounttree.h index 9983ba1570e2..29cba0eaa927 100644 --- a/fs/ocfs2/refcounttree.h +++ b/fs/ocfs2/refcounttree.h | |||
@@ -52,7 +52,8 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
52 | u32 clusters, | 52 | u32 clusters, |
53 | int *credits, | 53 | int *credits, |
54 | int *ref_blocks); | 54 | int *ref_blocks); |
55 | int ocfs2_refcount_cow(struct inode *inode, struct buffer_head *di_bh, | 55 | int ocfs2_refcount_cow(struct inode *inode, |
56 | struct file *filep, struct buffer_head *di_bh, | ||
56 | u32 cpos, u32 write_len, u32 max_cpos); | 57 | u32 cpos, u32 write_len, u32 max_cpos); |
57 | 58 | ||
58 | typedef int (ocfs2_post_refcount_func)(struct inode *inode, | 59 | typedef int (ocfs2_post_refcount_func)(struct inode *inode, |