Re: [RFC v2 09/11] block/bdev: lift block size restrictions and use common definition

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

 



On 16/12/2024 09:19, Ming Lei wrote:
On Mon, Dec 16, 2024 at 4:58 PM John Garry <john.g.garry@xxxxxxxxxx> wrote:

On 14/12/2024 03:10, Luis Chamberlain wrote:
index 167d82b46781..b57dc4bff81b 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -157,8 +157,7 @@ int set_blocksize(struct file *file, int size)
       struct inode *inode = file->f_mapping->host;
       struct block_device *bdev = I_BDEV(inode);

-     /* Size must be a power of two, and between 512 and PAGE_SIZE */
-     if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
+     if (blk_validate_block_size(size))
               return -EINVAL;

I suppose that this can be sent as a separate patch to be merged now.

There have been some bugs found in case that PAGE_SIZE == 64K, and I
think it is bad to use PAGE_SIZE for validating many hw/queue limits, we might
have to fix them first.

I am just suggesting to remove duplicated code, as these checks are same as blk_validate_block_size()


Such as:

Aren't the below list just enforcing block layer requirements? And so only block drivers need fixing for PAGE_SIZE > 4K (or cannot be used for PAGE_SIZE > 4K), right?


1) blk_validate_limits()

- failure if max_segment_size is less than 64K
> > - max_user_sectors

if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
        return -EINVAL;

2) bio_may_need_split()

- max_segment_size may be less than 64K

Thanks,









[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