From patchwork Tue Feb 7 07:00:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Zhang X-Patchwork-Id: 53749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2694491wrn; Mon, 6 Feb 2023 23:09:44 -0800 (PST) X-Google-Smtp-Source: AK7set8VGSjOpxwnz6Jwx4HCtIP1+AHMpPN4JXMcPAQLxQD2IPe9On4bOLaJKKXGGelkAQ0Yx0n7 X-Received: by 2002:a05:6a21:6d8d:b0:c0:c9b8:70 with SMTP id wl13-20020a056a216d8d00b000c0c9b80070mr2865409pzb.27.1675753784568; Mon, 06 Feb 2023 23:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675753784; cv=none; d=google.com; s=arc-20160816; b=hSUMSERwmf5HYtiLIpgdS17/pjSV186TI3S/YsCytssib0sJNIEIGxvO9UsgeO/rs+ r5/8Vrp4yZzJ1y02YcQbvExUJ55obbK2LftaxdBF9h5UObAdePQfksjGF4HaHmAi0Boa K29FElKAKGRUzVPlzaPrYtoZrSjikixbtwo2nRqqiic2XOEZlAAfgZs9wu9aIVvgH05D 5E9DaPUstlSpHGiHQOT4s4idmUWXA7PbZzqes3tAK3zsATeKmSOytp7DGiCJJpXC2+dk b8fSn/ke6KbgtCnN/x/glW9kX6z1Ut7F/DfSywzhdFsgln337K5Z/mA9HFskCb9XhAnQ rMhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=D+rvyYe01sACv3wQdtVeTzm8IX7D9Mwg5Gf0Gb2yTwI=; b=SbeJpwLiJIRH4jIW+c9dnTajepxUwFiHN7qajvI9vGtqWbwapEkJ1+05+htv5QsN74 /fuWM/L+K+F4+oGT2iOlWDHoZs1IWFQXLLMNc9+K4neIRERXZQ62UP5iBAwCD+1xn9yr iCJxvuHeNoPdnSRPdSZpAWMedTg/HF2DPiUFmshMfhf600fMQFPHs441YpWuTK4ZDGmF RwrBLoh8wuo7kr7TSkPDyMuNPPKRrVF3GVBpThQnCIo0juayyd7v3EixtvyZcPEz3qsd ls/vC3Vqu8GBKr4rroRocRt7k6BcZxp4WPFGZHzPCnfM2UTwd3aSAg8u6QjWDobJg5dd WDeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020a637d13000000b004d0682f947bsi13764688pgc.669.2023.02.06.23.09.32; Mon, 06 Feb 2023 23:09:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbjBGHDc (ORCPT + 99 others); Tue, 7 Feb 2023 02:03:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbjBGHDb (ORCPT ); Tue, 7 Feb 2023 02:03:31 -0500 Received: from out199-14.us.a.mail.aliyun.com (out199-14.us.a.mail.aliyun.com [47.90.199.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7A613DDD; Mon, 6 Feb 2023 23:02:54 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=ziyangzhang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vb61Xa5_1675753320; Received: from localhost.localdomain(mailfrom:ZiyangZhang@linux.alibaba.com fp:SMTPD_---0Vb61Xa5_1675753320) by smtp.aliyun-inc.com; Tue, 07 Feb 2023 15:02:04 +0800 From: Ziyang Zhang To: axboe@kernel.dk, ming.lei@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com, Ziyang Zhang Subject: [PATCH 1/3] ublk: remove unnecessary NULL check in ublk_rq_has_data() Date: Tue, 7 Feb 2023 15:00:31 +0800 Message-Id: <20230207070033.367423-2-ZiyangZhang@linux.alibaba.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> References: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757155200627706957?= X-GMAIL-MSGID: =?utf-8?q?1757155200627706957?= bio_has_data() allows a NULL bio so the NULL check in ublk_rq_has_data() is unnecessary. Fixes: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver") Signed-off-by: Ziyang Zhang --- drivers/block/ublk_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index c932e9ea5a0f..55fccce68a9c 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -322,7 +322,7 @@ static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev, static inline bool ublk_rq_has_data(const struct request *rq) { - return rq->bio && bio_has_data(rq->bio); + return bio_has_data(rq->bio); } static inline struct ublksrv_io_desc *ublk_get_iod(struct ublk_queue *ubq, From patchwork Tue Feb 7 07:00:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Zhang X-Patchwork-Id: 53752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2694784wrn; Mon, 6 Feb 2023 23:10:34 -0800 (PST) X-Google-Smtp-Source: AK7set+S5773dZLimmneGvKUCWqq52LrVFSDlRVskoTu6Cy1nn/HGHvMSRGDkmKuBRlAiw7SlvUe X-Received: by 2002:a17:902:c40b:b0:194:9b4e:1c90 with SMTP id k11-20020a170902c40b00b001949b4e1c90mr1890464plk.57.1675753834635; Mon, 06 Feb 2023 23:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675753834; cv=none; d=google.com; s=arc-20160816; b=ve3jBW+6G3TvwCaVMaf118HLewZdS1XTotVpYz+yhXnnnj+oD3+lLkLOjSU6q9y0ru fc0+i7X9sxSdNMyJZW178/1uhIBXgW4WNsfbgD8Bsf8qiPoc2PTKtxk3gg9o7a8LlDFM kjVrKY1RTiDcAjeqPdHgYGyxth7FHBcDhAd+ZKZ5WjrFy9G29qMdAT4gg3ox071fN8E7 WKEB/IgXPU+LsAaJhCaH46MNUihbYMexU43bmJpwSJTgHKr0oIl556kOT7aS+pdHqICJ yMK4i9er9i4EdMvIRBTlvBBDqpD6uCJVP5ItdRb1A4AcO+D25+OE9kvfZ+CH0HZPv5rC yeHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=3Cx9PoSE9Bsqajb4PoKBys8BR/HgcGIcI7rw7nA0L34=; b=yDPunfffvaLR2EOkaCEzrHIM+G6vPwhc2G03/x8AxYEr6/cvwlP2JGA6fBFwVz/4kS HCjPnEXRXFUTyan8otttAS85hyoBRf2+CXbeRRonPPcNqzFJKY9/rCa5BG1DTC7/0Lv6 g9U9My/Ag3fzYKJFoPUgafkd444bFAM7sqQLpgabhaRQKhLGWokrCwHtUt12oNkACZw6 zzaFxf2sWmRwK1xnkSuAFV4Q565dX5FKwZn9gVQKf6IJ0RyS15mA3kArOf5hlRUtrUKt 0oFSQgp/3cIuslDOb+b3EFwdhQIVGYDtDULukDzynaNqCE1UlwIr3RWE0f1e7V4Xuf7D lIHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a170902ea0c00b00198fb189682si10784939plg.476.2023.02.06.23.10.22; Mon, 06 Feb 2023 23:10:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbjBGHD1 (ORCPT + 99 others); Tue, 7 Feb 2023 02:03:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbjBGHDZ (ORCPT ); Tue, 7 Feb 2023 02:03:25 -0500 Received: from out199-17.us.a.mail.aliyun.com (out199-17.us.a.mail.aliyun.com [47.90.199.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0732011653; Mon, 6 Feb 2023 23:02:50 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R901e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=ziyangzhang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vb61Xbz_1675753325; Received: from localhost.localdomain(mailfrom:ZiyangZhang@linux.alibaba.com fp:SMTPD_---0Vb61Xbz_1675753325) by smtp.aliyun-inc.com; Tue, 07 Feb 2023 15:02:07 +0800 From: Ziyang Zhang To: axboe@kernel.dk, ming.lei@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com, Ziyang Zhang Subject: [PATCH 2/3] ublk: mention WRITE_ZEROES in comment of ublk_complete_rq() Date: Tue, 7 Feb 2023 15:00:32 +0800 Message-Id: <20230207070033.367423-3-ZiyangZhang@linux.alibaba.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> References: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757155253221060062?= X-GMAIL-MSGID: =?utf-8?q?1757155253221060062?= WRITE_ZEROES won't return bytes returned just like FLUSH and DISCARD, and we can end it directly. Add missing comment for it in ublk_complete_rq(). Signed-off-by: Ziyang Zhang --- drivers/block/ublk_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 55fccce68a9c..06eddefdf02a 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -665,7 +665,7 @@ static void ublk_complete_rq(struct request *req) } /* - * FLUSH or DISCARD usually won't return bytes returned, so end them + * FLUSH, DISCARD or WRITE_ZEROES usually won't return bytes returned, so end them * directly. * * Both the two needn't unmap. From patchwork Tue Feb 7 07:00:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ziyang Zhang X-Patchwork-Id: 53753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2695183wrn; Mon, 6 Feb 2023 23:11:37 -0800 (PST) X-Google-Smtp-Source: AK7set9uVMvX5UIlw6Nfxe11smoMGzD4ZpkJa/Xqv/XuC0hlDdcXZ/cAdm2/s+R+/xrEkdb25vhE X-Received: by 2002:a17:902:db07:b0:196:13cd:a49 with SMTP id m7-20020a170902db0700b0019613cd0a49mr1937352plx.27.1675753897647; Mon, 06 Feb 2023 23:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675753897; cv=none; d=google.com; s=arc-20160816; b=AdvHBPWBJJflbgTch7+VbFI7uBofFvydIP1gkyVpANyTm/bSZCkc06/1TJB5fHZx8L nGFxtZCO8WAqFFpvPpiHt4XrVTuUqysuqNHME8VRH5MDfthSe0GJ3GqG2CXX6CK9Ojjn jzzNOwaEV6ivrZ4Ga4g4tMhqv+mUfNPJYjvqUeH126hWXiCgNdabkKDy1WR8xc1PL/Kk 2OFzAjLdfhjWsl06HwmXTxNCkfLCLvH/m7fEH302xgBXO+IdOuMYEU/mL8TEwpiqwv7H q7YPA/9XQIElbNSW+ccfL1ZCXEgwIIPzcycmmSRiVrdc1apPIXkmvAmkV+GxB+kGQL/H f2Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=KBsO9eKY1WhzZFI4Lki+br2MFrBqgB/M2Sn2xgDotMY=; b=TsNbH+hBPMeo10Vr0Q8sMnC0S3xQ6LruFiHgDnDU8MAjPizuFnJX+SJ94Orn8DSFF2 oSrLt5GvKKSm5sZl1HQCuMkbOaBb/M5DSpI8N+dMk/8gteAfUmlEK8/+TY0q9/Q16k7D U1po9MW652UUE5XLYD93WKC5kuG+G7l6WDSsieyWKUGHC8pqnFBydC+vIVqWHEblzFhK tDUW3ouJ5p0ir6do6zY3eGPrJCnMhiAmfFOjHCaph2qpdBesP/H54bEHZgFopRXYiudf 3vNLtV4FbnTvSfbVl9rdfIDUGQdDmNW1HRI10WqVf9PkHkuu2QYYZ9T6bNFfIY9uYI+q 9r7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u72-20020a63794b000000b004ec01adcfafsi14448616pgc.584.2023.02.06.23.11.25; Mon, 06 Feb 2023 23:11:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbjBGHDY (ORCPT + 99 others); Tue, 7 Feb 2023 02:03:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjBGHDW (ORCPT ); Tue, 7 Feb 2023 02:03:22 -0500 Received: from out199-2.us.a.mail.aliyun.com (out199-2.us.a.mail.aliyun.com [47.90.199.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E01DB46A4; Mon, 6 Feb 2023 23:02:49 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R941e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=ziyangzhang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vb61Xcn_1675753327; Received: from localhost.localdomain(mailfrom:ZiyangZhang@linux.alibaba.com fp:SMTPD_---0Vb61Xcn_1675753327) by smtp.aliyun-inc.com; Tue, 07 Feb 2023 15:02:08 +0800 From: Ziyang Zhang To: axboe@kernel.dk, ming.lei@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, joseph.qi@linux.alibaba.com, Ziyang Zhang Subject: [PATCH 3/3] ublk: pass NULL to blk_mq_alloc_disk() as queuedata Date: Tue, 7 Feb 2023 15:00:33 +0800 Message-Id: <20230207070033.367423-4-ZiyangZhang@linux.alibaba.com> X-Mailer: git-send-email 2.18.4 In-Reply-To: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> References: <20230207070033.367423-1-ZiyangZhang@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757155318947113093?= X-GMAIL-MSGID: =?utf-8?q?1757155318947113093?= queuedata is not referenced in ublk_drv and we can use driver_data instead. Pass NULL to blk_mq_alloc_disk() as queuedata while allocating ublk's gendisk. Fixes: 6d9e6dfdf3b2 ("ublk: defer disk allocation") Signed-off-by: Ziyang Zhang --- drivers/block/ublk_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 06eddefdf02a..d83fe2c2b3ba 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1578,7 +1578,7 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd) goto out_unlock; } - disk = blk_mq_alloc_disk(&ub->tag_set, ub); + disk = blk_mq_alloc_disk(&ub->tag_set, NULL); if (IS_ERR(disk)) { ret = PTR_ERR(disk); goto out_unlock;