Message ID | 20231024064416.897956-3-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/3] filemap: add a per-mapping stable writes flag | expand |
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
On Tue, Oct 24, 2023 at 08:44:15AM +0200, Christoph Hellwig 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. Yessssssssss! :) > 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> Seems sane to me, Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > --- > 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 >
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;
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(+)