akpm at linux-foundation.org
2014-Dec-15 22:51 UTC
[Ocfs2-devel] [patch 08/15] ocfs2: eliminate the static flag of some functions
From: Weiwei Wang <wangww631 at huawei.com> Subject: ocfs2: eliminate the static flag of some functions 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 7): Eliminate the static flag of some functions which will be used in append O_DIRECT write. Signed-off-by: Weiwei Wang <wangww631 at huawei.com> Signed-off-by: Joseph Qi <joseph.qi at huawei.com> Cc: Joel Becker <jlbec at evilplan.org> Cc: Mark Fasheh <mfasheh at suse.com> Signed-off-by: Andrew Morton <akpm at linux-foundation.org> --- fs/ocfs2/file.c | 11 +++++++++-- fs/ocfs2/file.h | 9 +++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff -puN fs/ocfs2/file.c~ocfs2-eliminate-the-static-flag-of-some-functions fs/ocfs2/file.c --- a/fs/ocfs2/file.c~ocfs2-eliminate-the-static-flag-of-some-functions +++ a/fs/ocfs2/file.c @@ -295,7 +295,7 @@ out: return ret; } -static int ocfs2_set_inode_size(handle_t *handle, +int ocfs2_set_inode_size(handle_t *handle, struct inode *inode, struct buffer_head *fe_bh, u64 new_i_size) @@ -441,7 +441,7 @@ out: return status; } -static int ocfs2_truncate_file(struct inode *inode, +int ocfs2_truncate_file(struct inode *inode, struct buffer_head *di_bh, u64 new_i_size) { @@ -709,6 +709,13 @@ leave: 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. * Thus, we need to explicitly order the zeroed pages. diff -puN fs/ocfs2/file.h~ocfs2-eliminate-the-static-flag-of-some-functions fs/ocfs2/file.h --- a/fs/ocfs2/file.h~ocfs2-eliminate-the-static-flag-of-some-functions +++ a/fs/ocfs2/file.h @@ -51,13 +51,22 @@ int ocfs2_add_inode_data(struct ocfs2_su struct ocfs2_alloc_context *data_ac, struct ocfs2_alloc_context *meta_ac, 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, struct buffer_head *di_bh, 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, u64 new_i_size, u64 zero_to); int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh, 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_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); _
Mark Fasheh
2014-Dec-17 23:55 UTC
[Ocfs2-devel] [patch 08/15] ocfs2: eliminate the static flag of some functions
On Mon, Dec 15, 2014 at 02:51:11PM -0800, Andrew Morton wrote:> From: Weiwei Wang <wangww631 at huawei.com> > Subject: ocfs2: eliminate the static flag of some functions > > 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.Thanks for taking this task on Weiwei - it's not an easy one! I have one comment right off the bat - since we're changing how things work on disk (in particular, the orphan handling), we'll have to gate this on a feature flag. Otherwise, we risk corrupting if an older FS loads the newer format. I would suggest adding a readonly feature flag and moving as much of the fallback code into it's own set of functions to be used when the flag is not set. --Mark -- Mark Fasheh