Christoph Hellwig
05bdb99653
block: replace fmode_t with a block-specific type for block open flags
...
The only overlap between the block open flags mapped into the fmode_t and
other uses of fmode_t are FMODE_READ and FMODE_WRITE. Define a new
blk_mode_t instead for use in blkdev_get_by_{dev,path}, ->open and
->ioctl and stop abusing fmode_t.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Acked-by: Jack Wang <jinpu.wang@ionos.com > [rnbd]
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
Link: https://lore.kernel.org/r/20230608110258.189493-28-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-12 08:04:05 -06:00
Christoph Hellwig
81b1fb7d17
fs: remove sb->s_mode
...
There is no real need to store the open mode in the super_block now.
It is only used by f2fs, which can easily recalculate it.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Acked-by: Christian Brauner <brauner@kernel.org >
Link: https://lore.kernel.org/r/20230608110258.189493-18-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-12 08:04:04 -06:00
Christoph Hellwig
3f0b3e785e
block: add a sb_open_mode helper
...
Add a helper to return the open flags for blkdev_get_by* for passed in
super block flags instead of open coding the logic in many places.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Acked-by: Christian Brauner <brauner@kernel.org >
Link: https://lore.kernel.org/r/20230608110258.189493-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-12 08:04:04 -06:00
Christoph Hellwig
2736e8eeb0
block: use the holder as indication for exclusive opens
...
The current interface for exclusive opens is rather confusing as it
requires both the FMODE_EXCL flag and a holder. Remove the need to pass
FMODE_EXCL and just key off the exclusive open off a non-NULL holder.
For blkdev_put this requires adding the holder argument, which provides
better debug checking that only the holder actually releases the hold,
but at the same time allows removing the now superfluous mode argument.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Acked-by: Christian Brauner <brauner@kernel.org >
Acked-by: David Sterba <dsterba@suse.com > [btrfs]
Acked-by: Jack Wang <jinpu.wang@ionos.com > [rnbd]
Link: https://lore.kernel.org/r/20230608110258.189493-16-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-12 08:04:04 -06:00
Christoph Hellwig
2ef789288a
btrfs: don't pass a holder for non-exclusive blkdev_get_by_path
...
Passing a holder to blkdev_get_by_path when FMODE_EXCL isn't set doesn't
make sense, so pass NULL instead and remove the holder argument from the
call chains the only end up in non-FMODE_EXCL blkdev_get_by_path calls.
Exclusive mode for device scanning is not used since commit 50d281fc43
("btrfs: scan device in non-exclusive mode")".
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Acked-by: Christian Brauner <brauner@kernel.org >
Acked-by: David Sterba <dsterba@suse.com >
Link: https://lore.kernel.org/r/20230608110258.189493-15-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-12 08:04:04 -06:00
Christoph Hellwig
cf056a4312
init: improve the name_to_dev_t interface
...
name_to_dev_t has a very misleading name, that doesn't make clear
it should only be used by the early init code, and also has a bad
calling convention that doesn't allow returning different kinds of
errors. Rename it to early_lookup_bdev to make the use case clear,
and return an errno, where -EINVAL means the string could not be
parsed, and -ENODEV means it the string was valid, but there was
no device found for it.
Also stub out the whole call for !CONFIG_BLOCK as all the non-block
root cases are always covered in the caller.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20230531125535.676098-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:56:46 -06:00
Christoph Hellwig
dd2e31afba
ext4: wire up the ->mark_dead holder operation for log devices
...
Implement a set of holder_ops that shut down the file system when the
block device used as log device is removed undeneath the file system.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
f5db130d44
ext4: wire up sops->shutdown
...
Wire up the shutdown method to shut down the file system when the
underlying block device is marked dead.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-16-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
97524b454b
ext4: split ext4_shutdown
...
Split ext4_shutdown into a low-level helper that will be reused for
implementing the shutdown super operation and a wrapper for the ioctl
handling.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-15-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
8067ca1dcd
xfs: wire up the ->mark_dead holder operation for log and RT devices
...
Implement a set of holder_ops that shut down the file system when the
block device used as log or RT device is removed undeneath the file
system.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Darrick J. Wong <djwong@kernel.org >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
e7caa877e5
xfs: wire up sops->shutdown
...
Wire up the shutdown method to shut down the file system when the
underlying block device is marked dead. Add a new message to
clearly distinguish this shutdown reason from other shutdowns.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Darrick J. Wong <djwong@kernel.org >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-13-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
87efb39075
fs: add a method to shut down the file system
...
Add a new ->shutdown super operation that can be used to tell the file
system to shut down, and call it from newly created holder ops when the
block device under a file system shuts down.
This only covers the main block device for "simple" file systems using
get_tree_bdev / mount_bdev. File systems their own get_tree method
or opening additional devices will need to set up their own
blk_holder_ops.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
Reviewed-by: Jan Kara <jack@suse.cz >
Reviewed-by: Darrick J. Wong <djwong@kernel.org >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-12-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Christoph Hellwig
0718afd47f
block: introduce holder ops
...
Add a new blk_holder_ops structure, which is passed to blkdev_get_by_* and
installed in the block_device for exclusive claims. It will be used to
allow the block layer to call back into the user of the block device for
thing like notification of a removed device or a device resize.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Jan Kara <jack@suse.cz >
Acked-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Link: https://lore.kernel.org/r/20230601094459.1350643-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-05 10:53:04 -06:00
Johannes Thumshirn
c2478469f2
fs: iomap: use bio_add_folio_nofail where possible
...
When the iomap buffered-io code can't add a folio to a bio, it allocates a
new bio and adds the folio to that one. This is done using bio_add_folio(),
but doesn't check for errors.
As adding a folio to a newly created bio can't fail, use the newly
introduced bio_add_folio_nofail() function.
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org >
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/58fa893c24c67340a63323f09a179fefdca07f2a.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-06-01 09:13:31 -06:00
Johannes Thumshirn
0fa5b08cf6
zonefs: use __bio_add_page for adding single page to bio
...
The zonefs superblock reading code uses bio_add_page() to add a page to a
newly created bio. bio_add_page() can fail, but the return value is
never checked.
Use __bio_add_page() as adding a single page to a newly created bio is
guaranteed to succeed.
This brings us a step closer to marking bio_add_page() as __must_check.
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/04c9978ccaa0fc9871cd4248356638d98daccf0c.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-31 09:50:02 -06:00
Johannes Thumshirn
effa7ddeeb
gfs2: use __bio_add_page for adding single page to bio
...
The GFS2 superblock reading code uses bio_add_page() to add a page to a
newly created bio. bio_add_page() can fail, but the return value is never
checked.
Use __bio_add_page() as adding a single page to a newly created bio is
guaranteed to succeed.
This brings us a step closer to marking bio_add_page() as __must_check.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/087c67d4e4973f949d3519c1e4822784ce583c5a.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-31 09:50:02 -06:00
Johannes Thumshirn
2896db174c
jfs: logmgr: use __bio_add_page to add single page to bio
...
The JFS IO code uses bio_add_page() to add a page to a newly created bio.
bio_add_page() can fail, but the return value is never checked.
Use __bio_add_page() as adding a single page to a newly created bio is
guaranteed to succeed.
This brings us a step closer to marking bio_add_page() as __must_check.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/9fb5ed86d19f6e0b6f64dfc4109a48ff8ff24497.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-31 09:50:02 -06:00
Johannes Thumshirn
741af75d40
fs: buffer: use __bio_add_page to add single page to bio
...
The buffer_head submission code uses bio_add_page() to add a page to a
newly created bio. bio_add_page() can fail, but the return value is never
checked.
Use __bio_add_page() as adding a single page to a newly created bio is
guaranteed to succeed.
This brings us a step closer to marking bio_add_page() as __must_check.
Reviewed-by: Gou Hao <gouhao@uniontech.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Link: https://lore.kernel.org/r/84ff2dcbe81b258a73ad900adb5266e208b61a4d.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-31 09:50:02 -06:00
David Howells
1ccf164ec8
block: Use iov_iter_extract_pages() and page pinning in direct-io.c
...
Change the old block-based direct-I/O code to use iov_iter_extract_pages()
to pin user pages or leave kernel pages unpinned rather than taking refs
when submitting bios.
This makes use of the preceding patches to not take pins on the zero page
(thereby allowing insertion of zero pages in with pinned pages) and to get
additional pins on pages, allowing an extracted page to be used in multiple
bios without having to re-extract it.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@infradead.org >
cc: David Hildenbrand <david@redhat.com >
cc: Lorenzo Stoakes <lstoakes@gmail.com >
cc: Andrew Morton <akpm@linux-foundation.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Matthew Wilcox <willy@infradead.org >
cc: Jan Kara <jack@suse.cz >
cc: Jeff Layton <jlayton@kernel.org >
cc: Jason Gunthorpe <jgg@nvidia.com >
cc: Logan Gunthorpe <logang@deltatee.com >
cc: Hillf Danton <hdanton@sina.com >
cc: Christian Brauner <brauner@kernel.org >
cc: Linus Torvalds <torvalds@linux-foundation.org >
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-kernel@vger.kernel.org
cc: linux-mm@kvack.org
Reviewed-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20230526214142.958751-4-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-31 09:48:15 -06:00
Christoph Hellwig
e51bab4e20
block: Replace BIO_NO_PAGE_REF with BIO_PAGE_REFFED with inverted logic
...
Replace BIO_NO_PAGE_REF with a BIO_PAGE_REFFED flag that has the inverted
meaning is only set when a page reference has been acquired that needs to
be released by bio_release_pages().
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Jan Kara <jack@suse.cz >
cc: Matthew Wilcox <willy@infradead.org >
cc: Logan Gunthorpe <logang@deltatee.com >
cc: linux-block@vger.kernel.org
Reviewed-by: Jan Kara <jack@suse.cz >
Link: https://lore.kernel.org/r/20230522205744.2825689-4-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:44 -06:00
David Howells
a450f49708
iomap: Don't get an reference on ZERO_PAGE for direct I/O block zeroing
...
ZERO_PAGE can't go away, no need to hold an extra reference.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: David Hildenbrand <david@redhat.com >
Reviewed-by: John Hubbard <jhubbard@nvidia.com >
Reviewed-by: Dave Chinner <dchinner@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: linux-fsdevel@vger.kernel.org
Reviewed-by: Christian Brauner <brauner@kernel.org >
Reviewed-by: Jan Kara <jack@suse.cz >
Link: https://lore.kernel.org/r/20230522205744.2825689-2-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:44 -06:00
Jens Axboe
bbeb087e5a
Merge branch 'for-6.5/splice' into for-6.5/block
...
Merge splice bits as subsequent block cleanups and improvements for DIO
depend on them.
* for-6.5/splice: (31 commits)
splice: kdoc for filemap_splice_read() and copy_splice_read()
iov_iter: Kill ITER_PIPE
splice: Remove generic_file_splice_read()
splice: Use filemap_splice_read() instead of generic_file_splice_read()
cifs: Use filemap_splice_read()
trace: Convert trace/seq to use copy_splice_read()
zonefs: Provide a splice-read wrapper
xfs: Provide a splice-read wrapper
orangefs: Provide a splice-read wrapper
ocfs2: Provide a splice-read wrapper
ntfs3: Provide a splice-read wrapper
nfs: Provide a splice-read wrapper
f2fs: Provide a splice-read wrapper
ext4: Provide a splice-read wrapper
ecryptfs: Provide a splice-read wrapper
ceph: Provide a splice-read wrapper
afs: Provide a splice-read wrapper
9p: Add splice_read wrapper
net: Make sock_splice_read() use copy_splice_read() by default
tty, proc, kernfs, random: Use copy_splice_read()
...
2023-05-24 08:42:22 -06:00
David Howells
9eee8bd814
splice: kdoc for filemap_splice_read() and copy_splice_read()
...
Provide kerneldoc comments for filemap_splice_read() and
copy_splice_read().
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christian Brauner <brauner@kernel.org >
cc: Christoph Hellwig <hch@lst.de >
cc: Jens Axboe <axboe@kernel.dk >
cc: Steve French <smfrench@gmail.com >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-32-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:17 -06:00
David Howells
c6585011bc
splice: Remove generic_file_splice_read()
...
Remove generic_file_splice_read() as it has been replaced with calls to
filemap_splice_read() and copy_splice_read().
With this, ITER_PIPE is no longer used.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Steve French <smfrench@gmail.com >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: David Hildenbrand <david@redhat.com >
cc: John Hubbard <jhubbard@nvidia.com >
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-30-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:17 -06:00
David Howells
2cb1e08985
splice: Use filemap_splice_read() instead of generic_file_splice_read()
...
Replace pointers to generic_file_splice_read() with calls to
filemap_splice_read().
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: David Hildenbrand <david@redhat.com >
cc: John Hubbard <jhubbard@nvidia.com >
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-29-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:17 -06:00
David Howells
ab82513126
cifs: Use filemap_splice_read()
...
Make cifs use filemap_splice_read() rather than doing its own version of
generic_file_splice_read().
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com >
cc: Jens Axboe <axboe@kernel.dk >
cc: Steve French <smfrench@gmail.com >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: David Hildenbrand <david@redhat.com >
cc: John Hubbard <jhubbard@nvidia.com >
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-28-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
6ef48ec391
zonefs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for zonefs. This does some checks before
proceeding and locks the inode across the call to filemap_splice_read() and
a size check in case of truncation. Splicing from direct I/O is handled by
the caller.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Darrick J. Wong <djwong@kernel.org >
cc: linux-xfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Acked-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20230522135018.2742245-26-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
54919f94ec
xfs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for XFS. This does a stat count and a
shutdown check before proceeding, then emits a new trace line and locks the
inode across the call to filemap_splice_read() and adds to the stats
afterwards. Splicing from direct I/O or DAX is handled by the caller.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Darrick J. Wong <djwong@kernel.org >
cc: linux-xfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-25-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
6bbf64beab
orangefs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for ocfs2. This increments the read stats
and then locks the inode across the call to filemap_splice_read() and a
revalidation of the mapping. Splicing from direct I/O is done by the
caller.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Mike Marshall <hubcap@omnibond.com >
cc: Martin Brandenburg <martin@omnibond.com >
cc: devel@lists.orangefs.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-24-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
94aca682a4
ocfs2: Provide a splice-read wrapper
...
Provide a splice_read wrapper for ocfs2. This emits trace lines and does
an atime lock/update before calling filemap_splice_read(). Splicing from
direct I/O is handled by the caller.
A couple of new tracepoints are added for this purpose.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Mark Fasheh <mark@fasheh.com >
cc: Joel Becker <jlbec@evilplan.org >
cc: ocfs2-devel@oss.oracle.com
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-23-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
5149439880
ntfs3: Provide a splice-read wrapper
...
Provide a splice_read wrapper for NTFS3 to perform various checks before
allowing the operation to proceed.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com >
cc: ntfs3@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-22-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
a7db503401
nfs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for NFS. This locks the inode around
filemap_splice_read() and revalidates the mapping. Splicing from direct
I/O is handled by the caller.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Trond Myklebust <trond.myklebust@hammerspace.com >
cc: Anna Schumaker <anna@kernel.org >
cc: linux-nfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-21-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
ceb11d0e2d
f2fs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for f2fs. This does some checks and tracing
before calling filemap_splice_read() and will update the iostats
afterwards. Direct I/O is handled by the caller.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Jaegeuk Kim <jaegeuk@kernel.org >
cc: Chao Yu <chao@kernel.org >
cc: linux-f2fs-devel@lists.sourceforge.net
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-20-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
fa6c46e7c2
ext4: Provide a splice-read wrapper
...
Provide a splice_read wrapper for Ext4. This does the inode shutdown check
before proceeding. Splicing from DAX files and O_DIRECT fds is handled by
the caller.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Acked-by: Theodore Ts'o <tytso@mit.edu >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Andreas Dilger <adilger.kernel@dilger.ca >
cc: linux-ext4@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-19-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
390df3b830
ecryptfs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for ecryptfs to update the access time on the
lower file after the operation. Splicing from a direct I/O fd will update
the access time when ->read_iter() is called.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Tyler Hicks <code@tyhicks.com >
cc: ecryptfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-18-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
ccfdf7cbb5
ceph: Provide a splice-read wrapper
...
Provide a splice_read wrapper for Ceph. This does the inode shutdown check
before proceeding and jumps to copy_splice_read() if the file has inline
data or is a synchronous file.
We try and get FILE_RD and either FILE_CACHE and/or FILE_LAZYIO caps and
hold them across filemap_splice_read(). If we fail to get FILE_CACHE or
FILE_LAZYIO capabilities, we use copy_splice_read() instead.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Xiubo Li <xiubli@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Ilya Dryomov <idryomov@gmail.com >
cc: Jeff Layton <jlayton@kernel.org >
cc: ceph-devel@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-17-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
d96d96eebb
afs: Provide a splice-read wrapper
...
Provide a splice_read wrapper for AFS to call afs_validate() before going
into generic_file_splice_read() so that we're likely to have a callback
promise from the server.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Marc Dionne <marc.dionne@auristor.com >
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-16-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
c829d0bd33
9p: Add splice_read wrapper
...
Add a splice_read wrapper for 9p. We should use copy_splice_read() if
9PL_DIRECT is set and filemap_splice_read() otherwise. Note that this
doesn't seem to be particularly related to O_DIRECT.
Signed-off-by: David Howells <dhowells@redhat.com >
cc: Christoph Hellwig <hch@lst.de >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: Dominique Martinet <asmadeus@codewreck.org >
cc: Eric Van Hensbergen <ericvh@kernel.org >
cc: Latchesar Ionkov <lucho@ionkov.net >
cc: Christian Schoenebeck <linux_oss@crudebyte.com >
cc: v9fs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-15-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
b0072734ff
tty, proc, kernfs, random: Use copy_splice_read()
...
Use copy_splice_read() for tty, procfs, kernfs and random files rather
than going through generic_file_splice_read() as they just copy the file
into the output buffer and don't splice pages. This avoids the need for
them to have a ->read_folio() to satisfy filemap_splice_read().
Signed-off-by: David Howells <dhowells@redhat.com >
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
cc: Christoph Hellwig <hch@lst.de >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: John Hubbard <jhubbard@nvidia.com >
cc: David Hildenbrand <david@redhat.com >
cc: Matthew Wilcox <willy@infradead.org >
cc: Miklos Szeredi <miklos@szeredi.hu >
cc: Arnd Bergmann <arnd@arndb.de >
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-13-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
a1be2935d0
coda: Implement splice-read
...
Implement splice-read for coda by passing the request down a layer rather
than going through generic_file_splice_read() which is going to be changed
to assume that ->read_folio() is present on buffered files.
Signed-off-by: David Howells <dhowells@redhat.com >
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu >
cc: Christoph Hellwig <hch@lst.de >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: John Hubbard <jhubbard@nvidia.com >
cc: David Hildenbrand <david@redhat.com >
cc: Matthew Wilcox <willy@infradead.org >
cc: coda@cs.cmu.edu
cc: codalist@coda.cs.cmu.edu
cc: linux-unionfs@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-12-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
d4120d87a0
overlayfs: Implement splice-read
...
Implement splice-read for overlayfs by passing the request down a layer
rather than going through generic_file_splice_read() which is going to be
changed to assume that ->read_folio() is present on buffered files.
Signed-off-by: David Howells <dhowells@redhat.com >
Acked-by: Christian Brauner <brauner@kernel.org >
cc: Christoph Hellwig <hch@lst.de >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: John Hubbard <jhubbard@nvidia.com >
cc: David Hildenbrand <david@redhat.com >
cc: Matthew Wilcox <willy@infradead.org >
cc: Miklos Szeredi <miklos@szeredi.hu >
cc: Amir Goldstein <amir73il@gmail.com >
cc: linux-unionfs@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-11-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
b85930a077
splice: Make splice from a DAX file use copy_splice_read()
...
Make a read splice from a DAX file go directly to copy_splice_read() to do
the reading as filemap_splice_read() is unlikely to find any pagecache to
splice.
I think this affects only erofs, Ext2, Ext4, fuse and XFS.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
Reviewed-by: Theodore Ts'o <tytso@mit.edu >
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: linux-erofs@lists.ozlabs.org
cc: linux-ext4@vger.kernel.org
cc: linux-xfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-9-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
aa3dbde878
splice: Make splice from an O_DIRECT fd use copy_splice_read()
...
Make a read splice from a file descriptor that's open O_DIRECT use
copy_splice_read() to do the reading as filemap_splice_read() is unlikely
to find any pagecache to splice.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: Jens Axboe <axboe@kernel.dk >
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-8-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
123856f0e8
splice: Check for zero count in vfs_splice_read()
...
Make vfs_splice_read() return immediately if the length is 0.
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-7-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
6a3f30b8bd
splice: Make do_splice_to() generic and export it
...
Rename do_splice_to() to vfs_splice_read() and export it so that it can be
used as a helper when calling down to a lower layer filesystem as it
performs all the necessary checks[1].
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Miklos Szeredi <miklos@szeredi.hu >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: John Hubbard <jhubbard@nvidia.com >
cc: David Hildenbrand <david@redhat.com >
cc: Matthew Wilcox <willy@infradead.org >
cc: linux-unionfs@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/CAJfpeguGksS3sCigmRi9hJdUec8qtM9f+_9jC1rJhsXT+dV01w@mail.gmail.com/ [1]
Link: https://lore.kernel.org/r/20230522135018.2742245-6-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:16 -06:00
David Howells
e69f37bce1
splice: Clean up copy_splice_read() a bit
...
Do a couple of cleanups to copy_splice_read():
(1) Cast to struct page **, not void *.
(2) Simplify the calculation of the number of pages to keep/reclaim in
copy_splice_read().
Suggested-by: Christoph Hellwig <hch@infradead.org >
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: David Hildenbrand <david@redhat.com >
cc: John Hubbard <jhubbard@nvidia.com >
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-5-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:15 -06:00
David Howells
69df79a451
splice: Rename direct_splice_read() to copy_splice_read()
...
Rename direct_splice_read() to copy_splice_read() to better reflect as to
what it does.
Suggested-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: David Howells <dhowells@redhat.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Christian Brauner <brauner@kernel.org >
cc: Steve French <sfrench@samba.org >
cc: Jens Axboe <axboe@kernel.dk >
cc: Al Viro <viro@zeniv.linux.org.uk >
cc: linux-cifs@vger.kernel.org
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-4-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-24 08:42:15 -06:00
Christoph Hellwig
bda2795a63
fs: remove the special !CONFIG_BLOCK def_blk_fops
...
def_blk_fops always returns -ENODEV, which dosn't match the return value
of a non-existing block device with CONFIG_BLOCK, which is -ENXIO.
Just remove the extra implementation and fall back to the default
no_open_fops that always returns -ENXIO.
Fixes: 9361401eb7 ("[PATCH] BLOCK: Make it possible to disable the block layer [try #6 ]")
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20230508144405.41792-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2023-05-19 19:48:53 -06:00
Linus Torvalds
bb7c241fae
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
...
Pull ext4 fixes from Ted Ts'o:
"Some ext4 bug fixes (mostly to address Syzbot reports)"
* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: bail out of ext4_xattr_ibody_get() fails for any reason
ext4: add bounds checking in get_max_inline_xattr_value_size()
ext4: add indication of ro vs r/w mounts in the mount message
ext4: fix deadlock when converting an inline directory in nojournal mode
ext4: improve error recovery code paths in __ext4_remount()
ext4: improve error handling from ext4_dirhash()
ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled
ext4: check iomap type only if ext4_iomap_begin() does not fail
ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
ext4: fix data races when using cached status extents
ext4: avoid deadlock in fs reclaim with page writeback
ext4: fix invalid free tracking in ext4_xattr_move_to_block()
ext4: remove a BUG_ON in ext4_mb_release_group_pa()
ext4: allow ext4_get_group_info() to fail
ext4: fix lockdep warning when enabling MMP
ext4: fix WARNING in mb_find_extent
2023-05-13 17:45:39 -07:00
Theodore Ts'o
2a534e1d0d
ext4: bail out of ext4_xattr_ibody_get() fails for any reason
...
In ext4_update_inline_data(), if ext4_xattr_ibody_get() fails for any
reason, it's best if we just fail as opposed to stumbling on,
especially if the failure is EFSCORRUPTED.
Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu >
2023-05-13 18:05:05 -04:00