[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240919112952.981-2-qun-wei.lin@mediatek.com>
Date: Thu, 19 Sep 2024 19:29:51 +0800
From: Qun-Wei Lin <qun-wei.lin@...iatek.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Matthias Brugger
<matthias.bgg@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Ryan Roberts
<ryan.roberts@....com>, "Huang, Ying" <ying.huang@...el.com>, David
Hildenbrand <david@...hat.com>, Chris Li <chrisl@...nel.org>, "Matthew Wilcox
(Oracle)" <willy@...radead.org>, Al Viro <viro@...iv.linux.org.uk>, Dan
Schatzberg <schatzberg.dan@...il.com>, Kairui Song <kasong@...cent.com>,
Barry Song <baohua@...nel.org>, Jens Axboe <axboe@...nel.dk>
CC: <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mediatek@...ts.infradead.org>,
<linux-block@...r.kernel.org>, Casper Li <casper.li@...iatek.com>, Chinwen
Chang <chinwen.chang@...iatek.com>, Andrew Yang <andrew.yang@...iatek.com>,
John Hsu <john.hsu@...iatek.com>, <wsd_upstream@...iatek.com>, Qun-Wei Lin
<qun-wei.lin@...iatek.com>
Subject: [PATCH 1/2] block: add BLK_FEAT_READ_SYNCHRONOUS feature for synchronous read
This commit introduces a new feature flag, BLK_FEAT_READ_SYNCHRONOUS,
which ensures that read operations always complete in the submit context.
This is useful for scenarios where synchronous read operations are required
while allowing write operations to remain asynchronous.
This patch is preparation for optimizing of the operation of the swap
device with next patch.
Signed-off-by: Qun-Wei Lin <qun-wei.lin@...iatek.com>
---
include/linux/blkdev.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 643c9020a35a..a697db11d91c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -332,6 +332,9 @@ typedef unsigned int __bitwise blk_features_t;
#define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
((__force blk_features_t)(1u << 15))
+/* read operations always completes in submit context */
+#define BLK_FEAT_READ_SYNCHRONOUS ((__force blk_features_t)(1u << 16))
+
/*
* Flags automatically inherited when stacking limits.
*/
@@ -1310,6 +1313,11 @@ static inline bool bdev_synchronous(struct block_device *bdev)
return bdev->bd_disk->queue->limits.features & BLK_FEAT_SYNCHRONOUS;
}
+static inline bool bdev_read_synchronous(struct block_device *bdev)
+{
+ return bdev->bd_disk->queue->limits.features & BLK_FEAT_READ_SYNCHRONOUS;
+}
+
static inline bool bdev_stable_writes(struct block_device *bdev)
{
struct request_queue *q = bdev_get_queue(bdev);
--
2.45.2
Powered by blists - more mailing lists