hfs: Call hfs_write_begin() and generic_write_end() directly
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 3 Mar 2022 18:43:29 +0000 (13:43 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 8 May 2022 18:45:56 +0000 (14:45 -0400)
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: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/hfs/extent.c
fs/hfs/hfs_fs.h
fs/hfs/inode.c

index 263d5028d9d18e8c2db8426a5e12c82635160673..3f7e9bef987430b8c0494675efb0a1c3dd59e6bd 100644 (file)
@@ -491,10 +491,10 @@ void hfs_file_truncate(struct inode *inode)
 
                /* XXX: Can use generic_cont_expand? */
                size = inode->i_size - 1;
-               res = pagecache_write_begin(NULL, mapping, size+1, 0, 0,
-                                           &page, &fsdata);
+               res = hfs_write_begin(NULL, mapping, size + 1, 0, &page,
+                               &fsdata);
                if (!res) {
-                       res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
+                       res = generic_write_end(NULL, mapping, size + 1, 0, 0,
                                        page, fsdata);
                }
                if (res)
index b8eb0322a3e5947dee7e6585a85dcab1f2f9de9e..68d0305880f7141fa0129255efd51d8e0fa3082d 100644 (file)
@@ -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_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 void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
 extern int hfs_write_inode(struct inode *, struct writeback_control *);
index 93d9aa8321399ca4bb29cd7fba43afb6cf61b6c3..9a26b9510da01e4e0ab6ed3bde9ca590f24573b9 100644 (file)
@@ -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,
-                       loff_t pos, unsigned len,
-                       struct page **pagep, void **fsdata)
+int hfs_write_begin(struct file *file, struct address_space *mapping,
+               loff_t pos, unsigned len, struct page **pagep, void **fsdata)
 {
        int ret;