提交 cfef1f7b 编写于 作者: M Matthew Wilcox (Oracle)

hfs: Call hfs_write_begin() and generic_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 hfs_write_begin() available to
this file and call it directly.
Signed-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 652118b8
...@@ -491,10 +491,10 @@ void hfs_file_truncate(struct inode *inode) ...@@ -491,10 +491,10 @@ void hfs_file_truncate(struct inode *inode)
/* XXX: Can use generic_cont_expand? */ /* XXX: Can use generic_cont_expand? */
size = inode->i_size - 1; size = inode->i_size - 1;
res = pagecache_write_begin(NULL, mapping, size+1, 0, 0, res = hfs_write_begin(NULL, mapping, size + 1, 0, &page,
&page, &fsdata); &fsdata);
if (!res) { if (!res) {
res = pagecache_write_end(NULL, mapping, size+1, 0, 0, res = generic_write_end(NULL, mapping, size + 1, 0, 0,
page, fsdata); page, fsdata);
} }
if (res) if (res)
......
...@@ -201,6 +201,8 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); ...@@ -201,6 +201,8 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern const struct address_space_operations hfs_aops; extern const struct address_space_operations hfs_aops;
extern const struct address_space_operations hfs_btree_aops; extern const struct address_space_operations hfs_btree_aops;
int hfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, struct page **pagep, void **fsdata);
extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t); extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t);
extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
extern int hfs_write_inode(struct inode *, struct writeback_control *); extern int hfs_write_inode(struct inode *, struct writeback_control *);
......
...@@ -49,9 +49,8 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to) ...@@ -49,9 +49,8 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to)
} }
} }
static int hfs_write_begin(struct file *file, struct address_space *mapping, int hfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, loff_t pos, unsigned len, struct page **pagep, void **fsdata)
struct page **pagep, void **fsdata)
{ {
int ret; int ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册