summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-07-07 11:42:38 +0200
committerJens Axboe <axboe@kernel.dk>2023-07-17 08:18:17 -0600
commitc4e21bcd0f9d01f9c5d6c52007f5541871a5b1de (patch)
treed38305c508ba85f2f4a262cb6040936590c2c09a
parentffe357c868e7796f20bc0eac61f5b952731c0fa8 (diff)
block: cleanup queue_wc_store
Get rid of the local queue_wc_store variable and handling setting and clearing the QUEUE_FLAG_WC flag diretly instead the if / else if. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20230707094239.107968-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-sysfs.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index afc797fb0dfc..0cde6598fb2f 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -449,21 +449,13 @@ static ssize_t queue_wc_show(struct request_queue *q, char *page)
static ssize_t queue_wc_store(struct request_queue *q, const char *page,
size_t count)
{
- int set = -1;
-
if (!strncmp(page, "write back", 10))
- set = 1;
+ blk_queue_flag_set(QUEUE_FLAG_WC, q);
else if (!strncmp(page, "write through", 13) ||
!strncmp(page, "none", 4))
- set = 0;
-
- if (set == -1)
- return -EINVAL;
-
- if (set)
- blk_queue_flag_set(QUEUE_FLAG_WC, q);
- else
blk_queue_flag_clear(QUEUE_FLAG_WC, q);
+ else
+ return -EINVAL;
return count;
}