All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig via Ocfs2-devel <ocfs2-devel@oss.oracle.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: jfs-discussion@lists.sourceforge.net,
	linux-nvme@lists.infradead.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	dm-devel@redhat.com, target-devel@vger.kernel.org,
	linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-scsi@vger.kernel.org, cluster-devel@redhat.com,
	xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org,
	linux-um@lists.infradead.org, nbd@other.debian.org,
	linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org,
	linux-mmc@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev,
	linux-btrfs@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2


_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel

WARNING: multiple messages have this Message-ID
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org,
	linux-block@vger.kernel.org, drbd-dev@lists.linbit.com,
	nbd@other.debian.org, ceph-devel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	jfs-discussion@lists.sourceforge.net,
	linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
	ocfs2-devel@oss.oracle.com, linux-mm@kvack.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2


WARNING: multiple messages have this Message-ID
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: jfs-discussion@lists.sourceforge.net,
	linux-nvme@lists.infradead.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	dm-devel@redhat.com, target-devel@vger.kernel.org,
	linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-scsi@vger.kernel.org, cluster-devel@redhat.com,
	xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org,
	linux-um@lists.infradead.org, nbd@other.debian.org,
	linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-mmc@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev,
	linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: jfs-discussion@lists.sourceforge.net,
	linux-nvme@lists.infradead.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	dm-devel@redhat.com, target-devel@vger.kernel.org,
	linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-scsi@vger.kernel.org, cluster-devel@redhat.com,
	xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org,
	linux-um@lists.infradead.org, nbd@other.debian.org,
	linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-mmc@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev,
	linux-btrfs@vger.kernel.org
Subject: [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org,
	linux-block@vger.kernel.org, drbd-dev@lists.linbit.com,
	nbd@other.debian.org, ceph-devel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	jfs-discussion@lists.sourceforge.net,
	linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev,
	ocfs2-devel@oss.oracle.com, linux-mm@kvack.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: jfs-discussion@lists.sourceforge.net,
	linux-nvme@lists.infradead.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org,
	dm-devel@redhat.com, target-devel@vger.kernel.org,
	linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-scsi@vger.kernel.org, cluster-devel@redhat.com,
	xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org,
	linux-um@lists.infradead.org, nbd@other.debian.org,
	linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
	ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-mmc@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com,
	linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev,
	linux-btrfs@vger.kernel.org
Subject: [dm-devel] [PATCH 14/27] block: add a bdev_stable_writes helper
Date: Sat,  9 Apr 2022 06:50:30 +0200	[thread overview]
Message-ID: <20220409045043.23593-15-hch@lst.de> (raw)
In-Reply-To: <20220409045043.23593-1-hch@lst.de>

Add a helper to check the stable writes flag based on the block_device
instead of having to poke into the block layer internal request_queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/md/dm-table.c  | 4 +---
 fs/super.c             | 2 +-
 include/linux/blkdev.h | 6 ++++++
 mm/swapfile.c          | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5e38d0dd009d5..d46839faa0ca5 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1950,9 +1950,7 @@ static int device_requires_stable_pages(struct dm_target *ti,
 					struct dm_dev *dev, sector_t start,
 					sector_t len, void *data)
 {
-	struct request_queue *q = bdev_get_queue(dev->bdev);
-
-	return blk_queue_stable_writes(q);
+	return bdev_stable_writes(dev->bdev);
 }
 
 int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/fs/super.c b/fs/super.c
index f1d4a193602d6..60f57c7bc0a69 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1204,7 +1204,7 @@ static int set_bdev_super(struct super_block *s, void *data)
 	s->s_dev = s->s_bdev->bd_dev;
 	s->s_bdi = bdi_get(s->s_bdev->bd_disk->bdi);
 
-	if (blk_queue_stable_writes(s->s_bdev->bd_disk->queue))
+	if (bdev_stable_writes(s->s_bdev))
 		s->s_iflags |= SB_I_STABLE_WRITES;
 	return 0;
 }
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 075b16d4560e7..a433798c3343e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1330,6 +1330,12 @@ static inline bool bdev_nonrot(struct block_device *bdev)
 	return blk_queue_nonrot(bdev_get_queue(bdev));
 }
 
+static inline bool bdev_stable_writes(struct block_device *bdev)
+{
+	return test_bit(QUEUE_FLAG_STABLE_WRITES,
+			&bdev_get_queue(bdev)->queue_flags);
+}
+
 static inline bool bdev_write_cache(struct block_device *bdev)
 {
 	return test_bit(QUEUE_FLAG_WC, &bdev_get_queue(bdev)->queue_flags);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d5ab7ec4d92ca..4069f17a82c8e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3065,7 +3065,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 		goto bad_swap_unlock_inode;
 	}
 
-	if (p->bdev && blk_queue_stable_writes(p->bdev->bd_disk->queue))
+	if (p->bdev && bdev_stable_writes(p->bdev))
 		p->flags |= SWP_STABLE_WRITES;
 
 	if (p->bdev && p->bdev->bd_disk->fops->rw_page)
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2022-04-09  4:52 UTC|newest]

Thread overview: 207+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  4:50 use block_device based APIs in block layer consumers v2 Christoph Hellwig
2022-04-09  4:50 ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50 ` Christoph Hellwig
2022-04-09  4:50 ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50 ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 01/27] target: remove an incorrect unmap zeroes data deduction Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 02/27] target: pass a block_device to target_configure_unmap_from_queue Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 03/27] target: fix discard alignment on partitions Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 04/27] drbd: remove assign_p_sizes_qlim Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  8:16   ` [Drbd-dev] " Christoph Böhmwalder
2022-04-09  8:16     ` [dm-devel] " Christoph Böhmwalder
2022-04-09  8:16     ` [f2fs-dev] " Christoph Böhmwalder
2022-04-09  8:16     ` Christoph Böhmwalder
2022-04-09  4:50 ` [PATCH 05/27] drbd: use bdev based limit helpers in drbd_send_sizes Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 06/27] drbd: use bdev_alignment_offset instead of queue_alignment_offset Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 07/27] drbd: cleanup decide_on_discard_support Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 08/27] btrfs: use bdev_max_active_zones instead of open coding it Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-11 17:22   ` David Sterba
2022-04-11 17:22     ` [dm-devel] " David Sterba
2022-04-11 17:22     ` David Sterba
2022-04-11 17:22     ` [f2fs-dev] " David Sterba
2022-04-11 17:22     ` David Sterba
2022-04-09  4:50 ` [PATCH 09/27] ntfs3: use bdev_logical_block_size " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 10/27] mm: use bdev_is_zoned in claim_swapfile Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50 ` [PATCH 11/27] block: add a bdev_nonrot helper Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 12/27] block: add a bdev_write_cache helper Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 13/27] block: add a bdev_fua helper Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` Christoph Hellwig via Ocfs2-devel [this message]
2022-04-09  4:50   ` [dm-devel] [PATCH 14/27] block: add a bdev_stable_writes helper Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 15/27] block: add a bdev_max_zone_append_sectors helper Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 16/27] block: use bdev_alignment_offset in part_alignment_offset_show Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 17/27] block: use bdev_alignment_offset in disk_alignment_offset_show Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 18/27] block: move bdev_alignment_offset and queue_limit_alignment_offset out of line Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 19/27] block: remove queue_discard_alignment Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 20/27] block: use bdev_discard_alignment in part_discard_alignment_show Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [Ocfs2-devel] [PATCH 21/27] block: move {bdev, queue_limit}_discard_alignment out of line Christoph Hellwig via Ocfs2-devel
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [PATCH 21/27] block: move {bdev,queue_limit}_discard_alignment " Christoph Hellwig
2022-04-09  4:50 ` [PATCH 22/27] block: refactor discard bio size limiting Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 23/27] block: add a bdev_max_discard_sectors helper Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50 ` [PATCH 24/27] block: remove QUEUE_FLAG_DISCARD Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  8:15   ` Christoph Böhmwalder
2022-04-09  8:15     ` [dm-devel] " Christoph Böhmwalder
2022-04-09  8:15     ` [f2fs-dev] " Christoph Böhmwalder
2022-04-09  8:15     ` Christoph Böhmwalder
2022-04-10  6:26     ` Christoph Hellwig
2022-04-10  6:26       ` [dm-devel] " Christoph Hellwig
2022-04-10  6:26       ` Christoph Hellwig
2022-04-10  6:26       ` Christoph Hellwig
2022-04-10  6:26       ` [f2fs-dev] " Christoph Hellwig
2022-04-11 12:03   ` Jan Höppner
2022-04-11 12:03     ` [dm-devel] " Jan Höppner
2022-04-11 12:03     ` [f2fs-dev] " Jan Höppner
2022-04-11 12:03     ` Jan Höppner
2022-04-11 14:01   ` Keith Busch
2022-04-11 14:01     ` [dm-devel] " Keith Busch
2022-04-11 14:01     ` Keith Busch
2022-04-11 14:01     ` [f2fs-dev] " Keith Busch
2022-04-11 17:24   ` David Sterba
2022-04-11 17:24     ` [dm-devel] " David Sterba
2022-04-11 17:24     ` David Sterba
2022-04-11 17:24     ` [f2fs-dev] " David Sterba
2022-04-11 17:24     ` David Sterba
2022-04-09  4:50 ` [PATCH 25/27] block: add a bdev_discard_granularity helper Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-11 17:25   ` David Sterba
2022-04-11 17:25     ` [dm-devel] " David Sterba
2022-04-11 17:25     ` David Sterba
2022-04-11 17:25     ` David Sterba
2022-04-11 17:25     ` [f2fs-dev] " David Sterba
2022-04-09  4:50 ` [PATCH 26/27] block: decouple REQ_OP_SECURE_ERASE from REQ_OP_DISCARD Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09 14:32   ` Coly Li
2022-04-09 14:32     ` Coly Li
2022-04-09 14:32     ` [dm-devel] " Coly Li
2022-04-09 14:32     ` [f2fs-dev] " Coly Li
2022-04-10  6:27     ` Christoph Hellwig
2022-04-10  6:27       ` [dm-devel] " Christoph Hellwig
2022-04-10  6:27       ` Christoph Hellwig
2022-04-10  6:27       ` Christoph Hellwig
2022-04-10  6:27       ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50 ` [PATCH 27/27] direct-io: remove random prefetches Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [dm-devel] " Christoph Hellwig
2022-04-09  4:50   ` Christoph Hellwig
2022-04-09  4:50   ` [f2fs-dev] " Christoph Hellwig
2022-04-09  4:50   ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
2022-04-15  4:52 use block_device based APIs in block layer consumers v3 Christoph Hellwig
2022-04-15  4:52 ` [Ocfs2-devel] [PATCH 14/27] block: add a bdev_stable_writes helper Christoph Hellwig via Ocfs2-devel

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=20220409045043.23593-15-hch@lst.de \
    --to=ocfs2-devel@oss.oracle.com \
    --cc=axboe@kernel.dk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=cluster-devel@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=hch@lst.de \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-nilfs@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.