]> git.baikalelectronics.ru Git - kernel.git/commitdiff
afs: Enable multipage folio support
authorDavid Howells <dhowells@redhat.com>
Wed, 10 Aug 2022 17:52:47 +0000 (18:52 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 14 Aug 2022 00:20:51 +0000 (17:20 -0700)
Enable multipage folio support for the afs filesystem.

Support has already been implemented in netfslib, fscache and cachefiles
and in most of afs, but I've waited for Matthew Wilcox's latest folio
changes.

Note that it does require a change to afs_write_begin() to return the
correct subpage.  This is a "temporary" change as we're working on
getting rid of the need for ->write_begin() and ->write_end()
completely, at least as far as network filesystems are concerned - but
it doesn't prevent afs from making use of the capability.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: kafs-testing@auristor.com
Cc: Marc Dionne <marc.dionne@auristor.com>
Cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/lkml/2274528.1645833226@warthog.procyon.org.uk/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/afs/inode.c
fs/afs/write.c

index 64dab70d4a4f3af59869d4473bb0096ceea9905d..6d3a3dbe4928617eb724ad5f9ee209c075c2321e 100644 (file)
@@ -104,12 +104,14 @@ static int afs_inode_init_from_status(struct afs_operation *op,
                inode->i_op     = &afs_file_inode_operations;
                inode->i_fop    = &afs_file_operations;
                inode->i_mapping->a_ops = &afs_file_aops;
+               mapping_set_large_folios(inode->i_mapping);
                break;
        case AFS_FTYPE_DIR:
                inode->i_mode   = S_IFDIR |  (status->mode & S_IALLUGO);
                inode->i_op     = &afs_dir_inode_operations;
                inode->i_fop    = &afs_dir_file_operations;
                inode->i_mapping->a_ops = &afs_dir_aops;
+               mapping_set_large_folios(inode->i_mapping);
                break;
        case AFS_FTYPE_SYMLINK:
                /* Symlinks with a mode of 0644 are actually mountpoints. */
index 2c885b22de34feffc2d34a80151d58631b134a70..9ebdd36eaf2fc6f4b0f54f39440c29332ab26d4c 100644 (file)
@@ -91,7 +91,7 @@ try_again:
                        goto flush_conflicting_write;
        }
 
-       *_page = &folio->page;
+       *_page = folio_file_page(folio, pos / PAGE_SIZE);
        _leave(" = 0");
        return 0;