cifs: Don't use certain unnecessary folio_*() functions

Filesystems should use folio->index and folio->mapping, instead of
folio_index(folio), folio_mapping() and folio_file_mapping() since
they know that it's in the pagecache.

Change this automagically with:

perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c
perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c
perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/smb/client/*.c

Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.com>
cc: Ronnie Sahlberg <lsahlber@redhat.com>
cc: Shyam Prasad N <sprasad@microsoft.com>
cc: Tom Talpey <tom@talpey.com>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
This commit is contained in:
David Howells 2024-01-09 17:54:35 +00:00
parent fa7d614da3
commit c40497d823

View File

@ -87,7 +87,7 @@ void cifs_pages_written_back(struct inode *inode, loff_t start, unsigned int len
continue; continue;
if (!folio_test_writeback(folio)) { if (!folio_test_writeback(folio)) {
WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", WARN_ONCE(1, "bad %x @%llx page %lx %lx\n",
len, start, folio_index(folio), end); len, start, folio->index, end);
continue; continue;
} }
@ -120,7 +120,7 @@ void cifs_pages_write_failed(struct inode *inode, loff_t start, unsigned int len
continue; continue;
if (!folio_test_writeback(folio)) { if (!folio_test_writeback(folio)) {
WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", WARN_ONCE(1, "bad %x @%llx page %lx %lx\n",
len, start, folio_index(folio), end); len, start, folio->index, end);
continue; continue;
} }
@ -151,7 +151,7 @@ void cifs_pages_write_redirty(struct inode *inode, loff_t start, unsigned int le
xas_for_each(&xas, folio, end) { xas_for_each(&xas, folio, end) {
if (!folio_test_writeback(folio)) { if (!folio_test_writeback(folio)) {
WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", WARN_ONCE(1, "bad %x @%llx page %lx %lx\n",
len, start, folio_index(folio), end); len, start, folio->index, end);
continue; continue;
} }
@ -2651,7 +2651,7 @@ static void cifs_extend_writeback(struct address_space *mapping,
continue; continue;
if (xa_is_value(folio)) if (xa_is_value(folio))
break; break;
if (folio_index(folio) != index) if (folio->index != index)
break; break;
if (!folio_try_get_rcu(folio)) { if (!folio_try_get_rcu(folio)) {
xas_reset(&xas); xas_reset(&xas);
@ -2899,7 +2899,7 @@ redo_folio:
goto skip_write; goto skip_write;
} }
if (folio_mapping(folio) != mapping || if (folio->mapping != mapping ||
!folio_test_dirty(folio)) { !folio_test_dirty(folio)) {
start += folio_size(folio); start += folio_size(folio);
folio_unlock(folio); folio_unlock(folio);