From patchwork Thu Dec 28 07:55:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13505659 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D05694401; Thu, 28 Dec 2023 07:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sIUUno5s" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=yBEmKZVlehpTfMsqJcs5UrNKZT7aMOCpSurlpZlFZsk=; b=sIUUno5s3ItA0BiHZh1mp4seJb FmI2ePJmNtv2r8PSBvIL1KHUuJ42E75ZE/2/Q6/Nl826tMfpbyNEyRYkVRgpVmATvwdObOknGKjM/ /RBJZIFMyY+sk39NISUwuPsK7yRXnlMH+l+u5sh+cMQbvZcs9Q52YKHlVRnP5Xp43mLkGlqdgjGok b6CpuM6P/HEdvcBMV4aW0D0oA7uJ3Lb/wDPdirDwTXJ3gWYTDzNQjyIoOin+FUQ3KwsQZKJfJP1Ut CSGvByXXdI230c4HlDDykOLsTLoTzUs/orkn1slOE6iCVlBipVBwuPuO/3sxYlBU5AH0qNoEI9UE9 9EDTx7vg==; Received: from 213-147-167-209.nat.highway.webapn.at ([213.147.167.209] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rIlFE-00GMqW-1v; Thu, 28 Dec 2023 07:55:57 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Richard Weinberger , Anton Ivanov , Josef Bacik , Minchan Kim , Sergey Senozhatsky , Coly Li , Miquel Raynal , Vignesh Raghavendra , linux-um@lists.infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 1/9] block: remove two comments in bio_split_discard Date: Thu, 28 Dec 2023 07:55:37 +0000 Message-Id: <20231228075545.362768-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231228075545.362768-1-hch@lst.de> References: <20231228075545.362768-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html A zero discard_granularity is not treated the same as a single-block one, and not having any segments after taking alignment is perfectly fine and does not need a warning. Signed-off-by: Christoph Hellwig --- block/blk-merge.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 65e75efa9bd366..2d470cf2173e29 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -115,17 +115,13 @@ static struct bio *bio_split_discard(struct bio *bio, *nsegs = 1; - /* Zero-sector (unknown) and one-sector granularities are the same. */ granularity = max(lim->discard_granularity >> 9, 1U); max_discard_sectors = min(lim->max_discard_sectors, bio_allowed_max_sectors(lim)); max_discard_sectors -= max_discard_sectors % granularity; - - if (unlikely(!max_discard_sectors)) { - /* XXX: warn */ + if (unlikely(!max_discard_sectors)) return NULL; - } if (bio_sectors(bio) <= max_discard_sectors) return NULL;