[PATCH v2 3/5] fs: change write_begin/write_end interface to take struct kiocb *
Matthew Wilcox
willy at infradead.org
Tue Jun 24 12:51:51 UTC 2025
On Tue, Jun 24, 2025 at 12:12:08PM +0000, 陈涛涛 Taotao Chen wrote:
> -static int blkdev_write_end(struct file *file, struct address_space *mapping,
> +static int blkdev_write_end(struct kiocb *iocb, struct address_space *mapping,
> loff_t pos, unsigned len, unsigned copied, struct folio *folio,
> void *fsdata)
> {
> int ret;
> - ret = block_write_end(file, mapping, pos, len, copied, folio, fsdata);
> + ret = block_write_end(iocb->ki_filp, mapping, pos, len, copied, folio, fsdata);
... huh. I thought block_write_end() had to have the same prototype as
->write_end because it was used by some filesystems as the ->write_end.
I see that's not true (any more?). Maybe I was confused with
generic_write_end(). Anyway, block_write_end() doesn't use it's file
argument, and never will, so we can just remove it.
> +++ b/include/linux/fs.h
> @@ -446,10 +446,10 @@ struct address_space_operations {
>
> void (*readahead)(struct readahead_control *);
>
> - int (*write_begin)(struct file *, struct address_space *mapping,
> + int (*write_begin)(struct kiocb *, struct address_space *mapping,
> loff_t pos, unsigned len,
> struct folio **foliop, void **fsdata);
> - int (*write_end)(struct file *, struct address_space *mapping,
> + int (*write_end)(struct kiocb *, struct address_space *mapping,
> loff_t pos, unsigned len, unsigned copied,
> struct folio *folio, void *fsdata);
Should we make this a 'const struct kiocb *'? I don't see a need for
filesystems to be allowed to modify the kiocb in future, but perhaps
other people have different opinions.
More information about the Intel-gfx
mailing list