Re: Block device's sysfs setting getting lost after suspend-resume cycle

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

 



On 2025-04-23 08:35, Christoph Hellwig wrote:
Hi Holger,

can you try the patch below?  It fixes losing the read-ahead value in
my little test.

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 6b2dbe645d23..4817e7ca03f8 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -61,8 +61,14 @@ void blk_apply_bdi_limits(struct backing_dev_info *bdi,
  	/*
  	 * For read-ahead of large files to be effective, we need to read ahead
  	 * at least twice the optimal I/O size.
+	 *
+	 * There is no hardware limitation for the read-ahead size and the user
+	 * might have increased the read-ahead size through sysfs, so don't ever
+	 * decrease it.
  	 */
-	bdi->ra_pages = max(lim->io_opt * 2 / PAGE_SIZE, VM_READAHEAD_PAGES);
+	bdi->ra_pages = max3(bdi->ra_pages,
+				lim->io_opt * 2 / PAGE_SIZE,
+				VM_READAHEAD_PAGES);
  	bdi->io_pages = lim->max_sectors >> PAGE_SECTORS_SHIFT;
  }

Tried several different readahead values across multiple
suspend/resume cycles and it retained them properly again.

Tested-by: Holger Hoffstätte <holger@xxxxxxxxxxxxxxxxxxxxxx>

Thank you!

cheers
Holger




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux