Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Yu Kuai
Hi, 在 2023/12/06 22:58, Matthew Wilcox 写道: On Tue, Dec 05, 2023 at 08:37:15PM +0800, Yu Kuai wrote: +struct folio *bdev_read_folio(struct block_device *bdev, pgoff_t index) +{ + return read_mapping_folio(bdev->bd_inode->i_mapping, index, NULL); +} +EXPORT_SYMBOL_GPL(bdev_read_folio); I'

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Christoph Hellwig
On Wed, Dec 06, 2023 at 12:50:38PM -0500, Theodore Ts'o wrote: > This was added because pulling a mounted a USB thumb drive (or a HDD > drops off the SATA bus) while the file system is mounted and actively > in use, would result in a kernel OOPS. If that's no longer true, > that's great, but it wo

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Theodore Ts'o
On Tue, Dec 05, 2023 at 10:14:00PM -0800, Christoph Hellwig wrote: > > +/* > > + * The del_gendisk() function uninitializes the disk-specific data > > + * structures, including the bdi structure, without telling anyone > > + * else. Once this happens, any attempt to call mark_buffer_dirty() > > +

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Matthew Wilcox
On Tue, Dec 05, 2023 at 08:37:15PM +0800, Yu Kuai wrote: > +struct folio *bdev_read_folio(struct block_device *bdev, pgoff_t index) > +{ > + return read_mapping_folio(bdev->bd_inode->i_mapping, index, NULL); > +} > +EXPORT_SYMBOL_GPL(bdev_read_folio); I'm coming to the opinion that 'index' is

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Christoph Hellwig
On Wed, Dec 06, 2023 at 02:50:56PM +0800, Yu Kuai wrote: > I'm a litter confused, so there are 3 use cases: > 1) use GFP_USER, default gfp from bdev_alloc. > 2) use GFP_KERNEL > 3) use GFP_NOFS > > I understand that you're suggesting memalloc_nofs_save() to distinguish > 2 and 3, but how can I dis

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Yu Kuai
Hi, 在 2023/12/06 14:14, Christoph Hellwig 写道: +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, + pgoff_t end) +{ + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); +} +EXPORT_SYMBOL_GPL(invalidate_bdev_range); All these could

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Christoph Hellwig
> +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, > +pgoff_t end) > +{ > + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); > +} > +EXPORT_SYMBOL_GPL(invalidate_bdev_range); All these could probably use kerneldoc comments. For this

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Bart Van Assche
On 12/5/23 04:37, Yu Kuai wrote: +static inline u8 block_bits(struct block_device *bdev) +{ + return bdev->bd_inode->i_blkbits; +} This function needs a name that's more descriptive. Thanks, Bart.

[PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai Those apis will be used for other modules, so that bd_inode won't be accessed directly from other modules. Signed-off-by: Yu Kuai --- block/bdev.c | 116 + block/bio.c| 1 + block/blk.h| 2 - include/li