hfsplus: Call hfsplus_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 hfsplus_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/hfsplus/extents.c
fs/hfsplus/hfsplus_fs.h
fs/hfsplus/inode.c

index 7054a542689f9cfca6f94aadb5002aa0b7716119..721f779b4ec3e3969104e01951e4216c234d178b 100644 (file)
@@ -557,12 +557,12 @@ void hfsplus_file_truncate(struct inode *inode)
                void *fsdata;
                loff_t size = inode->i_size;
 
-               res = pagecache_write_begin(NULL, mapping, size, 0, 0,
-                                           &page, &fsdata);
+               res = hfsplus_write_begin(NULL, mapping, size, 0,
+                                         &page, &fsdata);
                if (res)
                        return;
-               res = pagecache_write_end(NULL, mapping, size,
-                       0, 0, page, fsdata);
+               res = generic_write_end(NULL, mapping, size, 0, 0,
+                                       page, fsdata);
                if (res < 0)
                        return;
                mark_inode_dirty(inode);
index 1798949f269bb89d40ddafc1172508e817856089..396e73aa096128eb5eb1a056ade059ff90324a84 100644 (file)
@@ -468,6 +468,8 @@ extern const struct address_space_operations hfsplus_aops;
 extern const struct address_space_operations hfsplus_btree_aops;
 extern const struct dentry_operations hfsplus_dentry_operations;
 
+int hfsplus_write_begin(struct file *file, struct address_space *mapping,
+               loff_t pos, unsigned len, struct page **pagep, void **fsdata);
 struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
                                umode_t mode);
 void hfsplus_delete_inode(struct inode *inode);
index 73010aa4623f817141f845a43fa5bfc48bd21300..905ae3660315ca756a26eaf2ae5711a7f22fb5fa 100644 (file)
@@ -43,9 +43,8 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to)
        }
 }
 
-static int hfsplus_write_begin(struct file *file, struct address_space *mapping,
-                       loff_t pos, unsigned len,
-                       struct page **pagep, void **fsdata)
+int hfsplus_write_begin(struct file *file, struct address_space *mapping,
+               loff_t pos, unsigned len, struct page **pagep, void **fsdata)
 {
        int ret;