Commit 15502712 authored by Tao Ma's avatar Tao Ma

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: default avatarTao Ma <tao.ma@oracle.com>
parent b8908236
...@@ -1693,7 +1693,7 @@ int ocfs2_write_begin_nolock(struct file *filp, ...@@ -1693,7 +1693,7 @@ int ocfs2_write_begin_nolock(struct file *filp,
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
} else if (ret == 1) { } else if (ret == 1) {
ret = ocfs2_refcount_cow(inode, di_bh, ret = ocfs2_refcount_cow(inode, filp, di_bh,
wc->w_cpos, wc->w_clen, UINT_MAX); wc->w_cpos, wc->w_clen, UINT_MAX);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
......
...@@ -361,7 +361,7 @@ static int ocfs2_cow_file_pos(struct inode *inode, ...@@ -361,7 +361,7 @@ static int ocfs2_cow_file_pos(struct inode *inode,
if (!(ext_flags & OCFS2_EXT_REFCOUNTED)) if (!(ext_flags & OCFS2_EXT_REFCOUNTED))
goto out; goto out;
return ocfs2_refcount_cow(inode, fe_bh, cpos, 1, cpos+1); return ocfs2_refcount_cow(inode, NULL, fe_bh, cpos, 1, cpos+1);
out: out:
return status; return status;
...@@ -904,8 +904,8 @@ static int ocfs2_zero_extend_get_range(struct inode *inode, ...@@ -904,8 +904,8 @@ static int ocfs2_zero_extend_get_range(struct inode *inode,
zero_clusters = last_cpos - zero_cpos; zero_clusters = last_cpos - zero_cpos;
if (needs_cow) { if (needs_cow) {
rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos, zero_clusters, rc = ocfs2_refcount_cow(inode, NULL, di_bh, zero_cpos,
UINT_MAX); zero_clusters, UINT_MAX);
if (rc) { if (rc) {
mlog_errno(rc); mlog_errno(rc);
goto out; goto out;
...@@ -2071,7 +2071,7 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode, ...@@ -2071,7 +2071,7 @@ static int ocfs2_prepare_inode_for_refcount(struct inode *inode,
*meta_level = 1; *meta_level = 1;
ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); ret = ocfs2_refcount_cow(inode, file, di_bh, cpos, clusters, UINT_MAX);
if (ret) if (ret)
mlog_errno(ret); mlog_errno(ret);
out: out:
......
...@@ -3404,6 +3404,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) ...@@ -3404,6 +3404,7 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context)
* unrefcounted extent. * unrefcounted extent.
*/ */
static int ocfs2_refcount_cow_hunk(struct inode *inode, static int ocfs2_refcount_cow_hunk(struct inode *inode,
struct file *file,
struct buffer_head *di_bh, struct buffer_head *di_bh,
u32 cpos, u32 write_len, u32 max_cpos) u32 cpos, u32 write_len, u32 max_cpos)
{ {
...@@ -3481,6 +3482,7 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, ...@@ -3481,6 +3482,7 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode,
* clusters between cpos and cpos+write_len are safe to modify. * clusters between cpos and cpos+write_len are safe to modify.
*/ */
int ocfs2_refcount_cow(struct inode *inode, int ocfs2_refcount_cow(struct inode *inode,
struct file *file,
struct buffer_head *di_bh, struct buffer_head *di_bh,
u32 cpos, u32 write_len, u32 max_cpos) u32 cpos, u32 write_len, u32 max_cpos)
{ {
...@@ -3500,7 +3502,7 @@ int ocfs2_refcount_cow(struct inode *inode, ...@@ -3500,7 +3502,7 @@ int ocfs2_refcount_cow(struct inode *inode,
num_clusters = write_len; num_clusters = write_len;
if (ext_flags & OCFS2_EXT_REFCOUNTED) { if (ext_flags & OCFS2_EXT_REFCOUNTED) {
ret = ocfs2_refcount_cow_hunk(inode, di_bh, cpos, ret = ocfs2_refcount_cow_hunk(inode, file, di_bh, cpos,
num_clusters, max_cpos); num_clusters, max_cpos);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
......
...@@ -52,7 +52,8 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, ...@@ -52,7 +52,8 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
u32 clusters, u32 clusters,
int *credits, int *credits,
int *ref_blocks); int *ref_blocks);
int ocfs2_refcount_cow(struct inode *inode, struct buffer_head *di_bh, int ocfs2_refcount_cow(struct inode *inode,
struct file *filep, struct buffer_head *di_bh,
u32 cpos, u32 write_len, u32 max_cpos); u32 cpos, u32 write_len, u32 max_cpos);
typedef int (ocfs2_post_refcount_func)(struct inode *inode, typedef int (ocfs2_post_refcount_func)(struct inode *inode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment