Re: [PATCH v2] fs/buffer: use min folio order to calculate upper limit in __getblk_slow()

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

 



On Thu, Jun 19, 2025 at 02:10:58PM +0200, Pankaj Raghav wrote:
> +++ b/fs/buffer.c
> @@ -1121,9 +1121,10 @@ __getblk_slow(struct block_device *bdev, sector_t block,
>  	     unsigned size, gfp_t gfp)
>  {
>  	bool blocking = gfpflags_allow_blocking(gfp);
> +	int blocklog = PAGE_SHIFT + mapping_min_folio_order(bdev->bd_mapping);
>  
>  	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
> -		     (size < 512 || size > PAGE_SIZE))) {
> +		     (size < 512 || size > (1U << blocklog)))) {
>  		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
>  					size);
>  		printk(KERN_ERR "logical block size: %d\n",

Is this what we want though?  If ext4 wants to create an 8kB block size
filesystem on top of a 512 byte sector size device, shouldn't it be
allowed to?  So just drop the max:

 	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
-		     (size < 512 || size > PAGE_SIZE))) {
+		     (size < 512)))) {

(also, surely logical_block_size is always at least 512, so do we really
need this check at all?)




[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