aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@huawei.com>2015-02-16 18:59:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-16 20:56:04 -0500
commit026749a86ebff68cb2accdcd29872d36ac148920 (patch)
tree8fb74b121646906d19041ce09a627b85cdd7d427 /fs/ocfs2
parent6f9e2456c9f8904346958b6d9602a755372865b0 (diff)
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: Joseph 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/file.c11
-rw-r--r--fs/ocfs2/file.h9
2 files changed, 18 insertions, 2 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index e0f04d55fd05..2fce3c40ad27 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -295,7 +295,7 @@ out:
295 return ret; 295 return ret;
296} 296}
297 297
298static int ocfs2_set_inode_size(handle_t *handle, 298int ocfs2_set_inode_size(handle_t *handle,
299 struct inode *inode, 299 struct inode *inode,
300 struct buffer_head *fe_bh, 300 struct buffer_head *fe_bh,
301 u64 new_i_size) 301 u64 new_i_size)
@@ -441,7 +441,7 @@ out:
441 return status; 441 return status;
442} 442}
443 443
444static int ocfs2_truncate_file(struct inode *inode, 444int ocfs2_truncate_file(struct inode *inode,
445 struct buffer_head *di_bh, 445 struct buffer_head *di_bh,
446 u64 new_i_size) 446 u64 new_i_size)
447{ 447{
@@ -709,6 +709,13 @@ leave:
709 return status; 709 return status;
710} 710}
711 711
712int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
713 u32 clusters_to_add, int mark_unwritten)
714{
715 return __ocfs2_extend_allocation(inode, logical_start,
716 clusters_to_add, mark_unwritten);
717}
718
712/* 719/*
713 * While a write will already be ordering the data, a truncate will not. 720 * While a write will already be ordering the data, a truncate will not.
714 * Thus, we need to explicitly order the zeroed pages. 721 * Thus, we need to explicitly order the zeroed pages.
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index 97bf761c9e7c..e8c62f22215c 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -51,13 +51,22 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
51 struct ocfs2_alloc_context *data_ac, 51 struct ocfs2_alloc_context *data_ac,
52 struct ocfs2_alloc_context *meta_ac, 52 struct ocfs2_alloc_context *meta_ac,
53 enum ocfs2_alloc_restarted *reason_ret); 53 enum ocfs2_alloc_restarted *reason_ret);
54int ocfs2_set_inode_size(handle_t *handle,
55 struct inode *inode,
56 struct buffer_head *fe_bh,
57 u64 new_i_size);
54int ocfs2_simple_size_update(struct inode *inode, 58int ocfs2_simple_size_update(struct inode *inode,
55 struct buffer_head *di_bh, 59 struct buffer_head *di_bh,
56 u64 new_i_size); 60 u64 new_i_size);
61int ocfs2_truncate_file(struct inode *inode,
62 struct buffer_head *di_bh,
63 u64 new_i_size);
57int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh, 64int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
58 u64 new_i_size, u64 zero_to); 65 u64 new_i_size, u64 zero_to);
59int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh, 66int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
60 loff_t zero_to); 67 loff_t zero_to);
68int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
69 u32 clusters_to_add, int mark_unwritten);
61int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); 70int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
62int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, 71int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
63 struct kstat *stat); 72 struct kstat *stat);