提交 026749a8 编写于 作者: J Joseph Qi 提交者: Linus Torvalds

ocfs2: prepare some interfaces used in append direct io

Currently in case of append O_DIRECT write (block not allocated yet),
ocfs2 will fall back to buffered I/O.  This has some disadvantages.
Firstly, it is not the behavior as expected.  Secondly, it will consume
huge page cache, e.g.  in mass backup scenario.  Thirdly, modern
filesystems such as ext4 support this feature.

In this patch set, the direct I/O write doesn't fallback to buffer I/O
write any more because the allocate blocks are enabled in direct I/O now.

This patch (of 9):

Prepare some interfaces which will be used in append O_DIRECT write.
Signed-off-by: NJoseph Qi <joseph.qi@huawei.com>
Cc: Weiwei Wang <wangww631@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Xuejiufei <xuejiufei@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: alex chen <alex.chen@huawei.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6f9e2456
...@@ -295,7 +295,7 @@ int ocfs2_update_inode_atime(struct inode *inode, ...@@ -295,7 +295,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
return ret; return ret;
} }
static int ocfs2_set_inode_size(handle_t *handle, int ocfs2_set_inode_size(handle_t *handle,
struct inode *inode, struct inode *inode,
struct buffer_head *fe_bh, struct buffer_head *fe_bh,
u64 new_i_size) u64 new_i_size)
...@@ -441,7 +441,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, ...@@ -441,7 +441,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
return status; return status;
} }
static int ocfs2_truncate_file(struct inode *inode, int ocfs2_truncate_file(struct inode *inode,
struct buffer_head *di_bh, struct buffer_head *di_bh,
u64 new_i_size) u64 new_i_size)
{ {
...@@ -709,6 +709,13 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, ...@@ -709,6 +709,13 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
return status; return status;
} }
int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
u32 clusters_to_add, int mark_unwritten)
{
return __ocfs2_extend_allocation(inode, logical_start,
clusters_to_add, mark_unwritten);
}
/* /*
* While a write will already be ordering the data, a truncate will not. * While a write will already be ordering the data, a truncate will not.
* Thus, we need to explicitly order the zeroed pages. * Thus, we need to explicitly order the zeroed pages.
......
...@@ -51,13 +51,22 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb, ...@@ -51,13 +51,22 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *data_ac,
struct ocfs2_alloc_context *meta_ac, struct ocfs2_alloc_context *meta_ac,
enum ocfs2_alloc_restarted *reason_ret); enum ocfs2_alloc_restarted *reason_ret);
int ocfs2_set_inode_size(handle_t *handle,
struct inode *inode,
struct buffer_head *fe_bh,
u64 new_i_size);
int ocfs2_simple_size_update(struct inode *inode, int ocfs2_simple_size_update(struct inode *inode,
struct buffer_head *di_bh, struct buffer_head *di_bh,
u64 new_i_size); u64 new_i_size);
int ocfs2_truncate_file(struct inode *inode,
struct buffer_head *di_bh,
u64 new_i_size);
int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh, int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
u64 new_i_size, u64 zero_to); u64 new_i_size, u64 zero_to);
int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh, int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
loff_t zero_to); loff_t zero_to);
int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
u32 clusters_to_add, int mark_unwritten);
int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat); struct kstat *stat);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册