On 12/10/25 07:22, Damien Le Moal wrote:
On 2025/12/09 17:41, sw.prabhu6@gmail.com wrote:
From: Swarna Prabhu sw.prabhu6@gmail.com
The WRITE SAME(16) and WRITE SAME(10) scsi commands uses a page from a dedicated mempool('sd_page_pool') for its payload. This pool was initialized to allocate single pages, which was sufficient as long as the device sector size did not exceed the PAGE_SIZE.
Given that block layer now supports block size upto 64K ie beyond PAGE_SIZE, adapt sd_set_special_bvec() to accommodate that.
With the above fix, enable sector sizes > PAGE_SIZE in scsi sd driver.
Cc: stable@vger.kernel.org Signed-off-by: Swarna Prabhu s.prabhu@samsung.com Co-developed-by: Pankaj Raghav p.raghav@samsung.com Signed-off-by: Pankaj Raghav p.raghav@samsung.com
Note: We are allocating pages of order aligned to BLK_MAX_BLOCK_SIZE for the mempool page allocator 'sd_page_pool' all the time. This is because we only know that a bigger sector size device is attached at sd_probe and it might be too late to reallocate mempool with order >0.
That is a lot heavier on the memory for the vast majority of devices which are 512B or 4K block size... It may be better to have the special "large block" mempool attached to the scsi disk struct and keep the default single page mempool for all other regular devices.
We had the same feeling as well and we mentioned it in the 1st RFC.
But when will you initialize the mempool for the large block devices? I don't think it makes sense to unconditionally initialize it in init_sd. Do we do it during the sd_probe() when we first encounter a large block device? That way we may not waste any memory if no large block devices are attached.
-- Pankaj