diff mbox series

[13/18] btrfs: migrate bio.[ch] to use block size terminology

Message ID f23c7cff1aabd6a950b610da5edda7000210de25.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
Despite the regular sectorsize rename, also rename
BTRFS_MAX_BIO_SECTORS BTRFS_MAX_BIO_BLOCKS.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/bio.c       | 24 ++++++++++++------------
 fs/btrfs/bio.h       |  4 ++--
 fs/btrfs/direct-io.c |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index bc80ee4f95a5..ea327a67a2bc 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -198,7 +198,7 @@  static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio,
 	do {
 		mirror = prev_repair_mirror(fbio, mirror);
 		btrfs_repair_io_failure(fs_info, btrfs_ino(inode),
-				  repair_bbio->file_offset, fs_info->sectorsize,
+				  repair_bbio->file_offset, fs_info->blocksize,
 				  repair_bbio->saved_iter.bi_sector << SECTOR_SHIFT,
 				  page_folio(bv->bv_page), bv->bv_offset, mirror);
 	} while (mirror != fbio->bbio->mirror_num);
@@ -209,20 +209,20 @@  static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio,
 }
 
 /*
- * Try to kick off a repair read to the next available mirror for a bad sector.
+ * Try to kick off a repair read to the next available mirror for a bad block.
  *
  * This primarily tries to recover good data to serve the actual read request,
  * but also tries to write the good data back to the bad mirror(s) when a
  * read succeeded to restore the redundancy.
  */
-static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio,
+static struct btrfs_failed_bio *repair_one_block(struct btrfs_bio *failed_bbio,
 						  u32 bio_offset,
 						  struct bio_vec *bv,
 						  struct btrfs_failed_bio *fbio)
 {
 	struct btrfs_inode *inode = failed_bbio->inode;
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
-	const u32 sectorsize = fs_info->sectorsize;
+	const u32 blocksize = fs_info->blocksize;
 	const u64 logical = (failed_bbio->saved_iter.bi_sector << SECTOR_SHIFT);
 	struct btrfs_bio *repair_bbio;
 	struct bio *repair_bio;
@@ -232,7 +232,7 @@  static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio,
 	btrfs_debug(fs_info, "repair read error: read error at %llu",
 		    failed_bbio->file_offset + bio_offset);
 
-	num_copies = btrfs_num_copies(fs_info, logical, sectorsize);
+	num_copies = btrfs_num_copies(fs_info, logical, blocksize);
 	if (num_copies == 1) {
 		btrfs_debug(fs_info, "no copy to repair from");
 		failed_bbio->bio.bi_status = BLK_STS_IOERR;
@@ -268,7 +268,7 @@  static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *de
 {
 	struct btrfs_inode *inode = bbio->inode;
 	struct btrfs_fs_info *fs_info = inode->root->fs_info;
-	u32 sectorsize = fs_info->sectorsize;
+	u32 blocksize = fs_info->blocksize;
 	struct bvec_iter *iter = &bbio->saved_iter;
 	blk_status_t status = bbio->bio.bi_status;
 	struct btrfs_failed_bio *fbio = NULL;
@@ -292,12 +292,12 @@  static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *de
 	while (iter->bi_size) {
 		struct bio_vec bv = bio_iter_iovec(&bbio->bio, *iter);
 
-		bv.bv_len = min(bv.bv_len, sectorsize);
+		bv.bv_len = min(bv.bv_len, blocksize);
 		if (status || !btrfs_data_csum_ok(bbio, dev, offset, &bv))
-			fbio = repair_one_sector(bbio, offset, &bv, fbio);
+			fbio = repair_one_block(bbio, offset, &bv, fbio);
 
-		bio_advance_iter_single(&bbio->bio, iter, sectorsize);
-		offset += sectorsize;
+		bio_advance_iter_single(&bbio->bio, iter, blocksize);
+		offset += blocksize;
 	}
 
 	if (bbio->csum != bbio->csum_inline)
@@ -655,10 +655,10 @@  static u64 btrfs_append_map_length(struct btrfs_bio *bbio, u64 map_length)
 	if (sector_offset) {
 		/*
 		 * bio_split_rw_at() could split at a size smaller than our
-		 * sectorsize and thus cause unaligned I/Os.  Fix that by
+		 * blocksize and thus cause unaligned I/Os.  Fix that by
 		 * always rounding down to the nearest boundary.
 		 */
-		return ALIGN_DOWN(sector_offset << SECTOR_SHIFT, bbio->fs_info->sectorsize);
+		return ALIGN_DOWN(sector_offset << SECTOR_SHIFT, bbio->fs_info->blocksize);
 	}
 	return map_length;
 }
diff --git a/fs/btrfs/bio.h b/fs/btrfs/bio.h
index e2fe16074ad6..25a3ba7e0bfb 100644
--- a/fs/btrfs/bio.h
+++ b/fs/btrfs/bio.h
@@ -19,11 +19,11 @@  struct btrfs_inode;
 #define BTRFS_BIO_INLINE_CSUM_SIZE	64
 
 /*
- * Maximum number of sectors for a single bio to limit the size of the
+ * Maximum number of blocks for a single bio to limit the size of the
  * checksum array.  This matches the number of bio_vecs per bio and thus the
  * I/O size for buffered I/O.
  */
-#define BTRFS_MAX_BIO_SECTORS		(256)
+#define BTRFS_MAX_BIO_BLOCKS		(256)
 
 typedef void (*btrfs_bio_end_io_t)(struct btrfs_bio *bbio);
 
diff --git a/fs/btrfs/direct-io.c b/fs/btrfs/direct-io.c
index 8567af46e16f..3229f07f5d6d 100644
--- a/fs/btrfs/direct-io.c
+++ b/fs/btrfs/direct-io.c
@@ -385,7 +385,7 @@  static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
 	 * to allocate a contiguous array for the checksums.
 	 */
 	if (!write)
-		len = min_t(u64, len, fs_info->sectorsize * BTRFS_MAX_BIO_SECTORS);
+		len = min_t(u64, len, fs_info->sectorsize * BTRFS_MAX_BIO_BLOCKS);
 
 	lockstart = start;
 	lockend = start + len - 1;