ntfs3: refactor ntfs_writepages
authorChristoph Hellwig <hch@lst.de>
Mon, 13 Jun 2022 05:37:10 +0000 (07:37 +0200)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Aug 2022 16:34:04 +0000 (12:34 -0400)
Handle the resident case with an explicit generic_writepages call instead
of using the obscure overload that makes mpage_writepages with a NULL
get_block do the same thing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/ntfs3/inode.c

index be4ebdd8048b0454488114e89a4d6fe80ecaeb2f..28c09c25b823d13f2d2f32a6490c91c3b527f7a4 100644 (file)
@@ -851,12 +851,10 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
 static int ntfs_writepages(struct address_space *mapping,
                           struct writeback_control *wbc)
 {
-       struct inode *inode = mapping->host;
-       struct ntfs_inode *ni = ntfs_i(inode);
        /* Redirect call to 'ntfs_writepage' for resident files. */
-       get_block_t *get_block = is_resident(ni) ? NULL : &ntfs_get_block;
-
-       return mpage_writepages(mapping, wbc, get_block);
+       if (is_resident(ntfs_i(mapping->host)))
+               return generic_writepages(mapping, wbc);
+       return mpage_writepages(mapping, wbc, ntfs_get_block);
 }
 
 static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn,