[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e938e161-81c2-4def-87f2-22e80489874f@linux.alibaba.com>
Date: Sat, 18 Jan 2025 11:25:25 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Jens Axboe <axboe@...nel.dk>, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Cc: hannes@...xchg.org, clm@...a.com, linux-kernel@...r.kernel.org,
willy@...radead.org, kirill@...temov.name, bfoster@...hat.com
Subject: Re: [PATCH 10/12] mm/filemap: add filemap_fdatawrite_range_kick()
helper
On 12/20/24 11:47 PM, Jens Axboe wrote:
> Works like filemap_fdatawrite_range(), except it's a non-integrity data
> writeback and hence only starts writeback on the specified range. Will
> help facilitate generically starting uncached writeback from
> generic_write_sync(), as header dependencies preclude doing this inline
> from fs.h.
>
> Signed-off-by: Jens Axboe <axboe@...nel.dk>
> ---
> include/linux/fs.h | 2 ++
> mm/filemap.c | 18 ++++++++++++++++++
> 2 files changed, 20 insertions(+)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 6a838b5479a6..653b5efa3d3f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2878,6 +2878,8 @@ extern int __must_check file_fdatawait_range(struct file *file, loff_t lstart,
> extern int __must_check file_check_and_advance_wb_err(struct file *file);
> extern int __must_check file_write_and_wait_range(struct file *file,
> loff_t start, loff_t end);
> +int filemap_fdatawrite_range_kick(struct address_space *mapping, loff_t start,
> + loff_t end);
>
> static inline int file_write_and_wait(struct file *file)
> {
> diff --git a/mm/filemap.c b/mm/filemap.c
> index aa0b3af6533d..9842258ba343 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -449,6 +449,24 @@ int filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
> }
> EXPORT_SYMBOL(filemap_fdatawrite_range);
>
> +/**
> + * filemap_fdatawrite_range_kick - start writeback on a range
> + * @mapping: target address_space
> + * @start: index to start writeback on
> + * @end: last (non-inclusive) index for writeback
> + *
> + * This is a non-integrity writeback helper, to start writing back folios
> + * for the indicated range.
> + *
> + * Return: %0 on success, negative error code otherwise.
> + */
> +int filemap_fdatawrite_range_kick(struct address_space *mapping, loff_t start,
> + loff_t end)
> +{
> + return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_NONE);
> +}
__filemap_fdatawrite_range() actually accepts @end argument as "last
(**inclusive**) index".
--
Thanks,
Jingbo
Powered by blists - more mailing lists