lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210926215633.GG2361455@dread.disaster.area>
Date:   Mon, 27 Sep 2021 07:56:33 +1000
From:   Dave Chinner <david@...morbit.com>
To:     David Howells <dhowells@...hat.com>
Cc:     willy@...radead.org, hch@....de, trond.myklebust@...marydata.com,
        "Darrick J. Wong" <djwong@...nel.org>, linux-xfs@...r.kernel.org,
        linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-mm@...ck.org, darrick.wong@...cle.com,
        viro@...iv.linux.org.uk, jlayton@...nel.org,
        torvalds@...ux-foundation.org, linux-nfs@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/9] Introduce IOCB_SWAP kiocb flag to trigger REQ_SWAP

On Fri, Sep 24, 2021 at 06:18:32PM +0100, David Howells wrote:
> Introduce an IOCB_SWAP flag for the kiocb struct such that the REQ_SWAP
> will get set on lower level operation structures in generic code.
> 
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Matthew Wilcox <willy@...radead.org>
> cc: Christoph Hellwig <hch@....de>
> cc: Darrick J. Wong <djwong@...nel.org>
> cc: linux-xfs@...r.kernel.org
> cc: linux-block@...r.kernel.org
> cc: linux-fsdevel@...r.kernel.org
> cc: linux-mm@...ck.org
> ---
> 
>  fs/direct-io.c      |    2 ++
>  include/linux/bio.h |    2 ++
>  include/linux/fs.h  |    1 +
>  3 files changed, 5 insertions(+)
> 
> diff --git a/fs/direct-io.c b/fs/direct-io.c
> index b2e86e739d7a..76eec0a68fa4 100644
> --- a/fs/direct-io.c
> +++ b/fs/direct-io.c
> @@ -1216,6 +1216,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
>  	}
>  	if (iocb->ki_flags & IOCB_HIPRI)
>  		dio->op_flags |= REQ_HIPRI;
> +	if (iocb->ki_flags & IOCB_SWAP)
> +		dio->op_flags |= REQ_SWAP;
>  
>  	/*
>  	 * For AIO O_(D)SYNC writes we need to defer completions to a workqueue
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 00952e92eae1..b01133727494 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -787,6 +787,8 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb)
>  	bio->bi_opf |= REQ_HIPRI;
>  	if (!is_sync_kiocb(kiocb))
>  		bio->bi_opf |= REQ_NOWAIT;
> +	if (kiocb->ki_flags & IOCB_SWAP)
> +		bio->bi_opf |= REQ_SWAP;
>  }
>  
>  struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index c909ca6c0eb6..c20f4423e2f1 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -321,6 +321,7 @@ enum rw_hint {
>  #define IOCB_NOIO		(1 << 20)
>  /* can use bio alloc cache */
>  #define IOCB_ALLOC_CACHE	(1 << 21)
> +#define IOCB_SWAP		(1 << 22)	/* Operation on a swapfile */
>  
>  struct kiocb {
>  	struct file		*ki_filp;

This doesn't set REQ_SWAP for the iomap based DIO path.
bio_set_polled() is only called from iomap for IOCB_HIPRI IO.

Cheers,

Dave.
-- 
Dave Chinner
david@...morbit.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ