linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	Matthew Wilcox <willy@infradead.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-block@vger.kernel.org,  linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 2/3] block: update the stable_writes flag in bdev_add
Date: Tue, 24 Oct 2023 14:04:05 +0200	[thread overview]
Message-ID: <CAOi1vP-=PMN_ae9qOK1H1HzS2y6=BEzkcd364MNo+5FeqhQb_Q@mail.gmail.com> (raw)
In-Reply-To: <20231024064416.897956-3-hch@lst.de>

On Tue, Oct 24, 2023 at 8:44 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Propagate the per-queue stable_write flags into each bdev inode in bdev_add.
> This makes sure devices that require stable writes have it set for I/O
> on the block device node as well.
>
> Note that this doesn't cover the case of a flag changing on a live device
> yet.  We should handle that as well, but I plan to cover it as part of a
> more general rework of how changing runtime paramters on block devices
> works.
>
> Fixes: 1cb039f3dc16 ("bdi: replace BDI_CAP_STABLE_WRITES with a queue and a sb flag")
> Reported-by: Ilya Dryomov <idryomov@gmail.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/bdev.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/block/bdev.c b/block/bdev.c
> index f3b13aa1b7d428..04dba25b0019eb 100644
> --- a/block/bdev.c
> +++ b/block/bdev.c
> @@ -425,6 +425,8 @@ void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors)
>
>  void bdev_add(struct block_device *bdev, dev_t dev)
>  {
> +       if (bdev_stable_writes(bdev))
> +               mapping_set_stable_writes(bdev->bd_inode->i_mapping);
>         bdev->bd_dev = dev;
>         bdev->bd_inode->i_rdev = dev;
>         bdev->bd_inode->i_ino = dev;
> --
> 2.39.2
>

Tested with RBD which behaves like a DIF/DIX device (i.e. requires
stable pages):

Tested-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya


  reply	other threads:[~2023-10-24 12:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24  6:44 add and use a per-mapping stable writes flag Christoph Hellwig
2023-10-24  6:44 ` [PATCH 1/3] filemap: add " Christoph Hellwig
2023-10-24 11:43   ` Matthew Wilcox
2023-10-24 12:03   ` Ilya Dryomov
2023-10-24 12:09     ` Matthew Wilcox
2023-10-24 12:45       ` Ilya Dryomov
2023-10-24 15:00   ` Darrick J. Wong
2023-10-24 15:10     ` Matthew Wilcox
2023-10-24 16:14     ` Christoph Hellwig
2023-10-24  6:44 ` [PATCH 2/3] block: update the stable_writes flag in bdev_add Christoph Hellwig
2023-10-24 12:04   ` Ilya Dryomov [this message]
2023-10-24 15:01   ` Darrick J. Wong
2023-10-24  6:44 ` [PATCH 3/3] xfs: respect the stable writes flag on the RT device Christoph Hellwig
2023-10-24 15:09   ` Darrick J. Wong
2023-10-24 15:14     ` Matthew Wilcox
2023-10-24 16:16     ` 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='CAOi1vP-=PMN_ae9qOK1H1HzS2y6=BEzkcd364MNo+5FeqhQb_Q@mail.gmail.com' \
    --to=idryomov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.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