From patchwork Thu Aug 3 14:06:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Hindborg X-Patchwork-Id: 130698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1243474vqx; Thu, 3 Aug 2023 08:59:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFkSWcpOJjSjjoNmqHmmfVGi8j5zvYexTVxZ3kRjr6RrI34lYEjfcb3prKk77nYJChpkD4Y X-Received: by 2002:a17:90b:388:b0:263:d1f4:77b7 with SMTP id ga8-20020a17090b038800b00263d1f477b7mr17417451pjb.6.1691078341706; Thu, 03 Aug 2023 08:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691078341; cv=none; d=google.com; s=arc-20160816; b=UFHLci6GcE/UyJQr48kt5C4Jh+OFFaL6RH43EXH7TAtqP8CgDGxFLefW2getpEEp40 KPTLK1wjRm2AKxyJ9AhxqdLTIHs4EPdiUzuWMtzcB24j8MsKlfNvAz/YemnRDn9yjqS+ ydiOSs+KyeI9Iw/O0anTuLNjd7oYecX3qxwsUsaH/9vYG8hDGzR+Ah9jgjZH64NQUdjk Nzm8xcEU/XDBtjGsXQFiMEbTvJLwMjvofKg2n3i83wrAcg+QOkhIOLzHpvPpWJJyonQC S5WyLz3f4kir9Ge7vOmq14O4HADHaUzJWobE6/y/JXPLTCe6arC1vnXAfFny+Nfltydf n3WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ydP3wnsF1pXfr8UcrivUcEsOvukWSLMo7a415cMrAHs=; fh=QJW5L728sGFmhbcrtK66zzIJZnMDyKTrS0wh75j5NKs=; b=s/Di6/c8fEecj85YXgo/fC/f9uBfJ4mTXxKi1YWEgUJKEHp60T0oH0BCnFpXcpZrEu 0Fd0iPhEmjM2FJhE96heWCLPzWwxdzlHa/+jdxBDO70JU9mjouW/x90NjcbgTeI2xVP4 Cgiit4ViIXmuZWElbV/vvong13yJx/S80PKacq/BKLytMXMG2esT+rEP6xbT1EcMdn1A s7+zFGJtnN0D6D6MqRInfyNUhw2UZvo/OBGPC4dh3aBbjjCX3+B+XWolVduV9JvYutQD CJ5exNFK5wCRscSsM+pn5a7lNBxb8PAW9650E7B94i3Z8HHx/ikmwF2ssz5bUuTUoMfJ tv9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metaspace-dk.20221208.gappssmtp.com header.s=20221208 header.b="OjtJM/nk"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mv19-20020a17090b199300b00263a643aaacsi192319pjb.11.2023.08.03.08.58.45; Thu, 03 Aug 2023 08:59:01 -0700 (PDT) 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; dkim=pass header.i=@metaspace-dk.20221208.gappssmtp.com header.s=20221208 header.b="OjtJM/nk"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236391AbjHCOJZ (ORCPT + 99 others); Thu, 3 Aug 2023 10:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjHCOHj (ORCPT ); Thu, 3 Aug 2023 10:07:39 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2549E173F for ; Thu, 3 Aug 2023 07:07:04 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fe1d462762so10266285e9.0 for ; Thu, 03 Aug 2023 07:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20221208.gappssmtp.com; s=20221208; t=1691071623; x=1691676423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ydP3wnsF1pXfr8UcrivUcEsOvukWSLMo7a415cMrAHs=; b=OjtJM/nkriW9jx50qLggedJ+U1aQRSLZyEGsiGSnvEfeE5QZQyIzzSsC2k/epCIE/o idc1C4rRKbMJqyvBEnauXWdgXYMFQVOphMhCbCrNcFQQ4T1IAGTNJle1GQpvzg2nopde wsAcyKHbbWu3mTB43z7E3aVUeSo3V/quADfX6prtI1NQDwMr6Mzmm3LKJmoLr+C7nBSl 8cDUxeRroI7FIXdzz6i88afLO+zOiJ7eYpMWeV1+10wVP4T446Ta1kpaNSiIc7MPXj+q ITEO2ctuvBjhdRC7ocip47GtHNHag4yKuR4WF/18X4Yo5Xhndy598klglTrcKfyIMC05 lSbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691071623; x=1691676423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ydP3wnsF1pXfr8UcrivUcEsOvukWSLMo7a415cMrAHs=; b=CYWVxtGV3yaN5qZuTfcgMaqD2m0yJnUUjM6wsu6PomBsqa3IURY55Em8MGE9iZhKgt 1FJuxbLzx64pBAt/p6DQgnxRxxgmpe6uC/lc9CaJnyBsOaTgrq/8+pARk7e5R5EEnMdA rPJKBAR4AM3SRRIA7Wbmi8esiYMrStP5AfUXqA3pmUOL2P/jKnnpgnMVoC+XaTllvbJR l6sOYRiV17ofy2NzkU896d8g6URoqmekswsxiSMZdowNFG6gP2RUoEE+Taab2ld4bvVy /Br8+FEhjdyzzuVrwtsADfgzFEBXkEEKP9BBtldFNYCydvMK4mx0d95laeeY7UeJFKyI X6+A== X-Gm-Message-State: ABy/qLapfD3SYfvhwJW2puzcntJiNueUrT7Xg1rpIoVKEbQ1r+HUx5xG GDwdTDWSq1Y0khvOrdvMq6bWRQ== X-Received: by 2002:a05:600c:20cb:b0:3f8:2777:15e with SMTP id y11-20020a05600c20cb00b003f82777015emr6971357wmm.31.1691071623450; Thu, 03 Aug 2023 07:07:03 -0700 (PDT) Received: from localhost ([147.161.155.117]) by smtp.gmail.com with ESMTPSA id u6-20020a05600c210600b003fbc0a49b57sm24351wml.6.2023.08.03.07.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 07:07:03 -0700 (PDT) From: "Andreas Hindborg (Samsung)" To: Ming Lei Cc: Christoph Hellwig , gost.dev@samsung.com, linux-block@vger.kernel.org (open list:BLOCK LAYER), Hans Holmberg , Matias Bjorling , Andreas Hindborg , Minwoo Im , Jens Axboe , Johannes Thumshirn , Aravind Ramesh , Damien Le Moal , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v10 1/3] ublk: add helper to check if device supports user copy Date: Thu, 3 Aug 2023 16:06:59 +0200 Message-ID: <20230803140701.18515-2-nmi@metaspace.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230803140701.18515-1-nmi@metaspace.dk> References: <20230803140701.18515-1-nmi@metaspace.dk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773224163478682849 X-GMAIL-MSGID: 1773224163478682849 From: Andreas Hindborg This will be used by ublk zoned storage support. Signed-off-by: Andreas Hindborg Reviewed-by: Ming Lei Reviewed-by: Damien Le Moal Reviewed-by: Johannes Thumshirn --- drivers/block/ublk_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 21d2e71c5514..db3523e281a6 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -185,6 +185,11 @@ struct ublk_params_header { __u32 types; }; +static inline bool ublk_dev_is_user_copy(const struct ublk_device *ub) +{ + return ub->dev_info.flags & UBLK_F_USER_COPY; +} + static inline void __ublk_complete_rq(struct request *req); static void ublk_complete_rq(struct kref *ref); @@ -2038,7 +2043,7 @@ static int ublk_ctrl_add_dev(struct io_uring_cmd *cmd) UBLK_F_URING_CMD_COMP_IN_TASK; /* GET_DATA isn't needed any more with USER_COPY */ - if (ub->dev_info.flags & UBLK_F_USER_COPY) + if (ublk_dev_is_user_copy(ub)) ub->dev_info.flags &= ~UBLK_F_NEED_GET_DATA; /* We are not ready to support zero copy */