Re: [RFC] block: avoid the unnecessary blk_bio_discard_split()

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

 



Hello!

On 06.12.2020 9:15, Tom Yan wrote:

It doesn't seem necessary to have the redundant layer of splitting.
The request size will even be more consistent / aligned to the cap.

Signed-off-by: Tom Yan <tom.ty89@xxxxxxxxx>
---
  block/blk-lib.c   | 5 ++++-
  block/blk-merge.c | 2 +-
  block/blk.h       | 8 ++++++--
  3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index e90614fd8d6a..f606184a9050 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -85,9 +85,12 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
  		 *   is split in device drive, the split ones are very probably
  		 *   to be aligned to discard_granularity of the device's queue.
  		 */
-		if (granularity_aligned_lba == sector_mapped)
+		if (granularity_aligned_lba == sector_mapped) {
  			req_sects = min_t(sector_t, nr_sects,
  					  bio_aligned_discard_max_sectors(q));
+			if (!req_sects)
+				return -EOPNOTSUPP;
+		}
  		else

   Needs to be } else { according to the CodingStyle doc...

  			req_sects = min_t(sector_t, nr_sects,
  					  granularity_aligned_lba - sector_mapped);
[...]

MBR, Sergei



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux