Skip to contentSkip to conversation

block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices

PATCH In review Konstantin Khlebnikov 5 participants 6 messages Feb 28, 2020 – Mar 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-settings.c +2 -0
index c8eda2e7b91e..66c45fd79545 100644
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
 		       top, bottom);
 	}
+
+	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);
 
Reviewed-by on v1 1/1
#1 lore raw

Dear Konstantin,

Thank you for the patch.

Quoted 4 lines · Konstantin Khlebnikov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup

The verb is spelled with a space *set up*.

Quoted 7 lines

limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

Add a Fixes: tag?

Fixes 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")
Quoted 10 lines
---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-settings.c +0 -0
index c8eda2e7b91e..66c45fd79545 100644

block/blk-settings.c void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, · line 670

Quoted 7 lines
block/blk-settings.c +2 -0
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
 		       top, bottom);
 	}
+
+	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);

Kind regards,

Paul

#2 lore raw
Quoted 17 lines · Paul Menzel

Dear Konstantin,

Thank you for the patch.

Quoted 4 lines · Konstantin Khlebnikov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup

The verb is spelled with a space *set up*.

Quoted 3 lines

limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

Quoted 8 lines
Quoted 4 lines

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

Add a Fixes: tag?

Fixes 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting")

Maybe, but this isn't fatal bug. Just incomplete fix.

Same problem exists for non-disk BDIs. I.e. network filesystem must set io_pages manually if doesn't want split read requests.

Quoted 26 lines
Quoted 11 lines
---
  block/blk-settings.c |    2 ++
  1 file changed, 2 insertions(+)
block/blk-settings.c +0 -0
index c8eda2e7b91e..66c45fd79545 100644

block/blk-settings.c void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, · line 670

Quoted 7 lines
block/blk-settings.c +2 -0
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
  		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
  		       top, bottom);
  	}
+
+	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
  }
  EXPORT_SYMBOL(disk_stack_limits);

Kind regards,

Paul

Reviewed-by on v1 1/1
#3 lore raw
In reply to Konstantin Khlebnikov
Quoted 23 lines · Konstantin Khlebnikov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-settings.c +0 -0
index c8eda2e7b91e..66c45fd79545 100644

block/blk-settings.c void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, · line 671

Quoted 8 lines
block/blk-settings.c +2 -0
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
 		printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
 		       top, bottom);
 	}
+
+	t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);
 

Nitpick.. (PAGE_SHIFT - 9)

maintainer
#4 lore raw
Quoted 35 lines · Bob Liu
Quoted 23 lines · Konstantin Khlebnikov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-settings.c +0 -0
index c8eda2e7b91e..66c45fd79545 100644

block/blk-settings.c void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, · line 671

Quoted 8 lines
block/blk-settings.c +2 -0
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
              printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
                     top, bottom);
      }
+
+     t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);
 

Nitpick.. (PAGE_SHIFT - 9)

Quoted 1 line

Thanks for the fix. I fixed it based on the comments and applied it to md-next.

Jens, I picked the patch to md-next because md is the only user of disk_stack_limits().

Please let me know if you prefer routing it via the block tree.

Thanks,
Song

maintainer
#5 lore raw
Quoted 38 lines · Song Liu
Quoted 35 lines · Bob Liu
Quoted 23 lines · Konstantin Khlebnikov

Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.

Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they setup limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.

This patch updates io_pages after merging limits in disk_stack_limits().

Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.

---
 block/blk-settings.c |    2 ++
 1 file changed, 2 insertions(+)
block/blk-settings.c +0 -0
index c8eda2e7b91e..66c45fd79545 100644

block/blk-settings.c void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, · line 671

Quoted 8 lines
block/blk-settings.c +2 -0
@@ -664,6 +664,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
              printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
                     top, bottom);
      }
+
+     t->backing_dev_info->io_pages = t->limits.max_sectors >> (PAGE_SHIFT-9);
 }
 EXPORT_SYMBOL(disk_stack_limits);
 

Nitpick.. (PAGE_SHIFT - 9)

Quoted 1 line
Quoted 6 lines

Thanks for the fix. I fixed it based on the comments and applied it to md-next.

Jens, I picked the patch to md-next because md is the only user of disk_stack_limits().

Please let me know if you prefer routing it via the block tree.

That's fine, thanks.

Signature · 1 line
Jens Axboe