diff mbox series

[18/18] btrfs: migrate the ioctl interfaces to use block size terminology

Message ID bbf3aa03fb4b4089d00b945e34a6eb7cbf50e0a0.1734514696.git.wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs: migrate to "block size" to describe the | expand

Commit Message

Qu Wenruo Dec. 18, 2024, 9:41 a.m. UTC
This rename really only affects btrfs_ioctl_fs_info_args structure, but
since we're here, also update the comments in the ioctl header.

To keep compatibility for old programs which may still access
btrfs_ioctl_fs_info_args::sectorsize, use a union so @blocksize and
@sectorsize can both access the same @blocksize value.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/ioctl.c           |  2 +-
 include/uapi/linux/btrfs.h | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 888f7b97434c..bbaac3d8a36d 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2781,7 +2781,7 @@  static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
 
 	memcpy(&fi_args->fsid, fs_devices->fsid, sizeof(fi_args->fsid));
 	fi_args->nodesize = fs_info->nodesize;
-	fi_args->sectorsize = fs_info->blocksize;
+	fi_args->blocksize = fs_info->blocksize;
 	fi_args->clone_alignment = fs_info->blocksize;
 
 	if (flags_in & BTRFS_FS_INFO_FLAG_CSUM_INFO) {
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index d3b222d7af24..16ea8266b26d 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -278,7 +278,16 @@  struct btrfs_ioctl_fs_info_args {
 	__u64 num_devices;			/* out */
 	__u8 fsid[BTRFS_FSID_SIZE];		/* out */
 	__u32 nodesize;				/* out */
-	__u32 sectorsize;			/* out */
+	union {					/* out */
+		/*
+		 * The minimum data block size.
+		 *
+		 * The old name "sectorsize" is no longer recommended,
+		 * only for compatibility usage.
+		 */
+		__u32 blocksize;
+		__u32 sectorsize;
+	};
 	__u32 clone_alignment;			/* out */
 	/* See BTRFS_FS_INFO_FLAG_* */
 	__u16 csum_type;			/* out */
@@ -965,7 +974,7 @@  struct btrfs_ioctl_encoded_io_args {
 	/*
 	 * Offset in file.
 	 *
-	 * For writes, must be aligned to the sector size of the filesystem.
+	 * For writes, must be aligned to the block size of the filesystem.
 	 */
 	__s64 offset;
 	/* Currently must be zero. */
@@ -982,7 +991,7 @@  struct btrfs_ioctl_encoded_io_args {
 	 * Length of the data in the file.
 	 *
 	 * Must be less than or equal to unencoded_len - unencoded_offset. For
-	 * writes, must be aligned to the sector size of the filesystem unless
+	 * writes, must be aligned to the block size of the filesystem unless
 	 * the data ends at or beyond the current end of the file.
 	 */
 	__u64 len;
@@ -1033,10 +1042,10 @@  struct btrfs_ioctl_encoded_io_args {
  */
 #define BTRFS_ENCODED_IO_COMPRESSION_ZSTD 2
 /*
- * Data is compressed sector by sector (using the sector size indicated by the
+ * Data is compressed block by block (using the block size indicated by the
  * name of the constant) with LZO1X and wrapped in the format documented in
- * fs/btrfs/lzo.c. For writes, the compression sector size must match the
- * filesystem sector size.
+ * fs/btrfs/lzo.c. For writes, the compression block size must match the
+ * filesystem block size.
  */
 #define BTRFS_ENCODED_IO_COMPRESSION_LZO_4K 3
 #define BTRFS_ENCODED_IO_COMPRESSION_LZO_8K 4