linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	avi@scylladb.com
Subject: Re: [PATCH 10/11] iomap: add a IOMAP_DIO_OVERWRITE_ONLY flag
Date: Thu, 21 Jan 2021 08:32:54 -0500	[thread overview]
Message-ID: <20210121133254.GA1793795@bfoster> (raw)
In-Reply-To: <20210121085906.322712-11-hch@lst.de>

On Thu, Jan 21, 2021 at 09:59:05AM +0100, Christoph Hellwig wrote:
> Add a flag to signal an only pure overwrites are allowed.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Agreed that the explicit flag name is much more clear:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/iomap/direct-io.c  | 7 +++++++
>  include/linux/iomap.h | 8 ++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
> index 947343730e2c93..65d32364345d22 100644
> --- a/fs/iomap/direct-io.c
> +++ b/fs/iomap/direct-io.c
> @@ -485,6 +485,13 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>  		iomap_flags |= IOMAP_NOWAIT;
>  	}
>  
> +	if (dio_flags & IOMAP_DIO_OVERWRITE_ONLY) {
> +		ret = -EAGAIN;
> +		if (pos >= dio->i_size || pos + count > dio->i_size)
> +			goto out_free_dio;
> +		iomap_flags |= IOMAP_OVERWRITE_ONLY;
> +	}
> +
>  	ret = filemap_write_and_wait_range(mapping, pos, end);
>  	if (ret)
>  		goto out_free_dio;
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index be4e1e1e01e801..cfa20afd7d5b87 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -122,6 +122,7 @@ struct iomap_page_ops {
>  #define IOMAP_FAULT		(1 << 3) /* mapping for page fault */
>  #define IOMAP_DIRECT		(1 << 4) /* direct I/O */
>  #define IOMAP_NOWAIT		(1 << 5) /* do not block */
> +#define IOMAP_OVERWRITE_ONLY	(1 << 6) /* purely overwrites allowed */
>  
>  struct iomap_ops {
>  	/*
> @@ -262,6 +263,13 @@ struct iomap_dio_ops {
>   */
>  #define IOMAP_DIO_FORCE_WAIT	(1 << 0)
>  
> +/*
> + * Do not allocate blocks or zero partial blocks, but instead fall back to
> + * the caller by returning -EAGAIN.  Used to optimize direct I/O writes that
> + * are not aligned to the file system block size.
> +  */
> +#define IOMAP_DIO_OVERWRITE_ONLY	(1 << 1)
> +
>  ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>  		const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
>  		unsigned int dio_flags);
> -- 
> 2.29.2
> 


  parent reply	other threads:[~2021-01-21 14:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  8:58 reduce sub-block DIO serialisation v3 Christoph Hellwig
2021-01-21  8:58 ` [PATCH 01/11] xfs: factor out a xfs_ilock_iocb helper Christoph Hellwig
2021-01-21  8:58 ` [PATCH 02/11] xfs: make xfs_file_aio_write_checks IOCB_NOWAIT-aware Christoph Hellwig
2021-01-21  8:58 ` [PATCH 03/11] xfs: cleanup the read/write helper naming Christoph Hellwig
2021-01-21  8:58 ` [PATCH 04/11] xfs: remove the buffered I/O fallback assert Christoph Hellwig
2021-01-21  8:59 ` [PATCH 05/11] xfs: simplify the read/write tracepoints Christoph Hellwig
2021-01-21  8:59 ` [PATCH 06/11] xfs: improve the reflink_bounce_dio_write tracepoint Christoph Hellwig
2021-01-21  8:59 ` [PATCH 07/11] xfs: split unaligned DIO write code out Christoph Hellwig
2021-01-21  8:59 ` [PATCH 08/11] iomap: rename the flags variable in __iomap_dio_rw Christoph Hellwig
2021-01-21  8:59 ` [PATCH 09/11] iomap: pass a flags argument to iomap_dio_rw Christoph Hellwig
2021-01-21  9:30   ` Dave Chinner
2021-01-21 18:53   ` Darrick J. Wong
2021-01-21  8:59 ` [PATCH 10/11] iomap: add a IOMAP_DIO_OVERWRITE_ONLY flag Christoph Hellwig
2021-01-21  9:32   ` Dave Chinner
2021-01-21 13:32   ` Brian Foster [this message]
2021-01-21 18:55   ` Darrick J. Wong
2021-01-21  8:59 ` [PATCH 11/11] xfs: reduce exclusive locking on unaligned dio Christoph Hellwig
2021-01-21  9:35   ` Dave Chinner
2021-01-22 10:20     ` Christoph Hellwig
2021-01-21 13:33   ` Brian Foster
2021-01-21 19:01     ` Darrick J. Wong
2021-01-22 16:20 reduce sub-block DIO serialisation v4 Christoph Hellwig
2021-01-22 16:20 ` [PATCH 10/11] iomap: add a IOMAP_DIO_OVERWRITE_ONLY flag Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210121133254.GA1793795@bfoster \
    --to=bfoster@redhat.com \
    --cc=avi@scylladb.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).