linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>,
	Daejun Park <daejun7.park@samsung.com>,
	Kanchan Joshi <joshi.k@samsung.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
	Jeff Layton <jlayton@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v8 04/19] fs: Move enum rw_hint into a new header file
Date: Mon, 18 Dec 2023 16:07:37 -0800	[thread overview]
Message-ID: <20231219000815.2739120-5-bvanassche@acm.org> (raw)
In-Reply-To: <20231219000815.2739120-1-bvanassche@acm.org>

Move enum rw_hint into a new header file to prepare for using this data
type in the block layer. Add the attribute __packed to reduce the space
occupied by instances of this data type from four bytes to one byte.
Change the data type of i_write_hint from u8 into enum rw_hint.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 fs/f2fs/f2fs.h          |  1 +
 fs/fcntl.c              |  1 +
 fs/inode.c              |  1 +
 include/linux/fs.h      | 16 ++--------------
 include/linux/rw_hint.h | 21 +++++++++++++++++++++
 5 files changed, 26 insertions(+), 14 deletions(-)
 create mode 100644 include/linux/rw_hint.h

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 9043cedfa12b..8e0c66a6b097 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -24,6 +24,7 @@
 #include <linux/blkdev.h>
 #include <linux/quotaops.h>
 #include <linux/part_stat.h>
+#include <linux/rw_hint.h>
 #include <crypto/hash.h>
 
 #include <linux/fscrypt.h>
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 5fa2d95114bf..fc73c5fae43c 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -27,6 +27,7 @@
 #include <linux/memfd.h>
 #include <linux/compat.h>
 #include <linux/mount.h>
+#include <linux/rw_hint.h>
 
 #include <linux/poll.h>
 #include <asm/siginfo.h>
diff --git a/fs/inode.c b/fs/inode.c
index edcd8a61975f..a1384807ab58 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -20,6 +20,7 @@
 #include <linux/ratelimit.h>
 #include <linux/list_lru.h>
 #include <linux/iversion.h>
+#include <linux/rw_hint.h>
 #include <trace/events/writeback.h>
 #include "internal.h"
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 98b7a7a8c42e..a08014b68d6e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -43,6 +43,7 @@
 #include <linux/cred.h>
 #include <linux/mnt_idmapping.h>
 #include <linux/slab.h>
+#include <linux/rw_hint.h>
 
 #include <asm/byteorder.h>
 #include <uapi/linux/fs.h>
@@ -309,19 +310,6 @@ struct address_space;
 struct writeback_control;
 struct readahead_control;
 
-/*
- * Write life time hint values.
- * Stored in struct inode as u8.
- */
-enum rw_hint {
-	WRITE_LIFE_NOT_SET	= 0,
-	WRITE_LIFE_NONE		= RWH_WRITE_LIFE_NONE,
-	WRITE_LIFE_SHORT	= RWH_WRITE_LIFE_SHORT,
-	WRITE_LIFE_MEDIUM	= RWH_WRITE_LIFE_MEDIUM,
-	WRITE_LIFE_LONG		= RWH_WRITE_LIFE_LONG,
-	WRITE_LIFE_EXTREME	= RWH_WRITE_LIFE_EXTREME,
-};
-
 /* Match RWF_* bits to IOCB bits */
 #define IOCB_HIPRI		(__force int) RWF_HIPRI
 #define IOCB_DSYNC		(__force int) RWF_DSYNC
@@ -677,7 +665,7 @@ struct inode {
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
-	u8			i_write_hint;
+	enum rw_hint		i_write_hint;
 	blkcnt_t		i_blocks;
 
 #ifdef __NEED_I_SIZE_ORDERED
diff --git a/include/linux/rw_hint.h b/include/linux/rw_hint.h
new file mode 100644
index 000000000000..6334ec6e6663
--- /dev/null
+++ b/include/linux/rw_hint.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_RW_HINT_H
+#define _LINUX_RW_HINT_H
+
+#include <linux/build_bug.h>
+#include <linux/compiler_attributes.h>
+#include <uapi/linux/fcntl.h>
+
+/* Block storage write lifetime hint values. */
+enum rw_hint {
+	WRITE_LIFE_NOT_SET	= RWH_WRITE_LIFE_NOT_SET,
+	WRITE_LIFE_NONE		= RWH_WRITE_LIFE_NONE,
+	WRITE_LIFE_SHORT	= RWH_WRITE_LIFE_SHORT,
+	WRITE_LIFE_MEDIUM	= RWH_WRITE_LIFE_MEDIUM,
+	WRITE_LIFE_LONG		= RWH_WRITE_LIFE_LONG,
+	WRITE_LIFE_EXTREME	= RWH_WRITE_LIFE_EXTREME,
+} __packed;
+
+static_assert(sizeof(enum rw_hint) == 1);
+
+#endif /* _LINUX_RW_HINT_H */

  parent reply	other threads:[~2023-12-19  0:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  0:07 [PATCH v8 00/19] Pass data lifetime information to SCSI disk devices Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 01/19] fs: Fix rw_hint validation Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 02/19] fs: Verify write lifetime constants at compile time Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 03/19] fs: Split fcntl_rw_hint() Bart Van Assche
2023-12-19  0:07 ` Bart Van Assche [this message]
2023-12-19  0:07 ` [PATCH v8 05/19] block, fs: Restore the per-bio/request data lifetime fields Bart Van Assche
2024-01-22  9:23   ` Kanchan Joshi
2024-01-22 20:05     ` Bart Van Assche
2024-01-23 12:35       ` Kanchan Joshi
2024-01-23 15:59         ` Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 06/19] block, fs: Propagate write hints to the block device inode Bart Van Assche
2023-12-28  7:12   ` Christoph Hellwig
2023-12-28 22:41     ` Bart Van Assche
2024-01-03  9:02       ` Christoph Hellwig
2024-01-03 23:09         ` Bart Van Assche
2024-01-04  6:08           ` Christoph Hellwig
2024-01-18 18:51           ` Kanchan Joshi
2024-01-18 18:54             ` Bart Van Assche
2024-01-19 13:56               ` Kanchan Joshi
2024-01-22  9:31                 ` Kanchan Joshi
2024-01-22 20:09                   ` Bart Van Assche
2024-01-23 12:16                     ` Kanchan Joshi
2024-01-23 15:29                       ` Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 07/19] fs/f2fs: Restore the whint_mode mount option Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 08/19] fs/f2fs: Restore support for tracing data lifetimes Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 09/19] scsi: core: Query the Block Limits Extension VPD page Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 10/19] scsi: scsi_proto: Add structures and constants related to I/O groups and streams Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 11/19] scsi: sd: Translate data lifetime information Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 12/19] scsi: scsi_debug: Reduce code duplication Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 13/19] scsi: scsi_debug: Support the block limits extension VPD page Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 14/19] scsi: scsi_debug: Rework page code error handling Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 15/19] scsi: scsi_debug: Rework subpage " Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 16/19] scsi: scsi_debug: Allocate the MODE SENSE response from the heap Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 17/19] scsi: scsi_debug: Implement the IO Advice Hints Grouping mode page Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 18/19] scsi: scsi_debug: Implement GET STREAM STATUS Bart Van Assche
2023-12-19  0:07 ` [PATCH v8 19/19] scsi: scsi_debug: Maintain write statistics per group number Bart Van Assche
2023-12-19  1:12 ` [PATCH v8 00/19] Pass data lifetime information to SCSI disk devices Jens Axboe
2023-12-27 16:25   ` Bart Van Assche

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=20231219000815.2739120-5-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=chao@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=daejun7.park@samsung.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=joshi.k@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).