[PATCH 11/18] block/bdev: enable large folio support for large logical block sizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable large folio support when the logical block size is larger
than PAGE_SIZE.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 block/bdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/block/bdev.c b/block/bdev.c
index adbcf7af0b56..d5198743401a 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -133,6 +133,9 @@ static void set_init_blocksize(struct block_device *bdev)
 		bsize <<= 1;
 	}
 	bdev->bd_inode->i_blkbits = blksize_bits(bsize);
+	if (bsize > PAGE_SIZE)
+		mapping_set_folio_orders(bdev->bd_inode->i_mapping,
+					 get_order(bsize), MAX_ORDER);
 }
 
 int set_blocksize(struct block_device *bdev, int size)
@@ -149,6 +152,9 @@ int set_blocksize(struct block_device *bdev, int size)
 	if (bdev->bd_inode->i_blkbits != blksize_bits(size)) {
 		sync_blockdev(bdev);
 		bdev->bd_inode->i_blkbits = blksize_bits(size);
+		if (size > PAGE_SIZE)
+			mapping_set_folio_orders(bdev->bd_inode->i_mapping,
+						 get_order(size), MAX_ORDER);
 		kill_bdev(bdev);
 	}
 	return 0;
@@ -425,6 +431,11 @@ void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors)
 
 void bdev_add(struct block_device *bdev, dev_t dev)
 {
+	unsigned int bsize = bdev_logical_block_size(bdev);
+
+	if (bsize > PAGE_SIZE)
+		mapping_set_folio_orders(bdev->bd_inode->i_mapping,
+					 get_order(bsize), MAX_ORDER);
 	bdev->bd_dev = dev;
 	bdev->bd_inode->i_rdev = dev;
 	bdev->bd_inode->i_ino = dev;
-- 
2.35.3




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux