Skip to content

Commit 026749a

Browse files
josephhztorvalds
authored andcommitted
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>
1 parent 6f9e245 commit 026749a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

fs/ocfs2/file.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
295295
return ret;
296296
}
297297

298-
static int ocfs2_set_inode_size(handle_t *handle,
298+
int ocfs2_set_inode_size(handle_t *handle,
299299
struct inode *inode,
300300
struct buffer_head *fe_bh,
301301
u64 new_i_size)
@@ -441,7 +441,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
441441
return status;
442442
}
443443

444-
static int ocfs2_truncate_file(struct inode *inode,
444+
int ocfs2_truncate_file(struct inode *inode,
445445
struct buffer_head *di_bh,
446446
u64 new_i_size)
447447
{
@@ -709,6 +709,13 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
709709
return status;
710710
}
711711

712+
int 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+
712719
/*
713720
* While a write will already be ordering the data, a truncate will not.
714721
* Thus, we need to explicitly order the zeroed pages.

fs/ocfs2/file.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,22 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
5151
struct ocfs2_alloc_context *data_ac,
5252
struct ocfs2_alloc_context *meta_ac,
5353
enum ocfs2_alloc_restarted *reason_ret);
54+
int ocfs2_set_inode_size(handle_t *handle,
55+
struct inode *inode,
56+
struct buffer_head *fe_bh,
57+
u64 new_i_size);
5458
int ocfs2_simple_size_update(struct inode *inode,
5559
struct buffer_head *di_bh,
5660
u64 new_i_size);
61+
int ocfs2_truncate_file(struct inode *inode,
62+
struct buffer_head *di_bh,
63+
u64 new_i_size);
5764
int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
5865
u64 new_i_size, u64 zero_to);
5966
int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
6067
loff_t zero_to);
68+
int ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
69+
u32 clusters_to_add, int mark_unwritten);
6170
int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
6271
int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
6372
struct kstat *stat);

0 commit comments

Comments
 (0)