ntfs3: Call ntfs_write_begin() and ntfs_write_end() directly

There is only one kind of write_begin/write_end aops, so we don't need to
look up which aop it is, just make ntfs_write_begin() and ntfs_write_end()
available to this file and call them directly.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 27a77913
...@@ -157,15 +157,14 @@ static int ntfs_extend_initialized_size(struct file *file, ...@@ -157,15 +157,14 @@ static int ntfs_extend_initialized_size(struct file *file,
if (pos + len > new_valid) if (pos + len > new_valid)
len = new_valid - pos; len = new_valid - pos;
err = pagecache_write_begin(file, mapping, pos, len, 0, &page, err = ntfs_write_begin(file, mapping, pos, len, &page, &fsdata);
&fsdata);
if (err) if (err)
goto out; goto out;
zero_user_segment(page, zerofrom, PAGE_SIZE); zero_user_segment(page, zerofrom, PAGE_SIZE);
/* This function in any case puts page. */ /* This function in any case puts page. */
err = pagecache_write_end(file, mapping, pos, len, len, page, err = ntfs_write_end(file, mapping, pos, len, len, page,
fsdata); fsdata);
if (err < 0) if (err < 0)
goto out; goto out;
......
...@@ -861,9 +861,8 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn, ...@@ -861,9 +861,8 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn,
bh_result, create, GET_BLOCK_WRITE_BEGIN); bh_result, create, GET_BLOCK_WRITE_BEGIN);
} }
static int ntfs_write_begin(struct file *file, struct address_space *mapping, int ntfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, u32 len, struct page **pagep, loff_t pos, u32 len, struct page **pagep, void **fsdata)
void **fsdata)
{ {
int err; int err;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
...@@ -904,10 +903,9 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping, ...@@ -904,10 +903,9 @@ static int ntfs_write_begin(struct file *file, struct address_space *mapping,
/* /*
* ntfs_write_end - Address_space_operations::write_end. * ntfs_write_end - Address_space_operations::write_end.
*/ */
static int ntfs_write_end(struct file *file, struct address_space *mapping, int ntfs_write_end(struct file *file, struct address_space *mapping,
loff_t pos, u32 len, u32 copied, struct page *page, loff_t pos, u32 len, u32 copied, struct page *page,
void *fsdata) void *fsdata)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
struct ntfs_inode *ni = ntfs_i(inode); struct ntfs_inode *ni = ntfs_i(inode);
......
...@@ -689,6 +689,11 @@ int ntfs_set_size(struct inode *inode, u64 new_size); ...@@ -689,6 +689,11 @@ int ntfs_set_size(struct inode *inode, u64 new_size);
int reset_log_file(struct inode *inode); int reset_log_file(struct inode *inode);
int ntfs_get_block(struct inode *inode, sector_t vbn, int ntfs_get_block(struct inode *inode, sector_t vbn,
struct buffer_head *bh_result, int create); struct buffer_head *bh_result, int create);
int ntfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, u32 len, struct page **pagep, void **fsdata);
int ntfs_write_end(struct file *file, struct address_space *mapping,
loff_t pos, u32 len, u32 copied, struct page *page,
void *fsdata);
int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc); int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc);
int ntfs_sync_inode(struct inode *inode); int ntfs_sync_inode(struct inode *inode);
int ntfs_flush_inodes(struct super_block *sb, struct inode *i1, int ntfs_flush_inodes(struct super_block *sb, struct inode *i1,
......
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