From patchwork Tue Oct 13 10:30:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11835347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 859D4109B for ; Tue, 13 Oct 2020 10:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55ADE20872 for ; Tue, 13 Oct 2020 10:30:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="Tg/l4JTi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730637AbgJMKay (ORCPT ); Tue, 13 Oct 2020 06:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730456AbgJMKay (ORCPT ); Tue, 13 Oct 2020 06:30:54 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 218B5C0613D0 for ; Tue, 13 Oct 2020 03:30:54 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id t9so23362139wrq.11 for ; Tue, 13 Oct 2020 03:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GevoxMiSfxAK6DWxOjcnTXy4acQvtt6FLw9M5kaA7GE=; b=Tg/l4JTilvQW/5dLDy4GUMFoeU5ko5zVicRICfYtkbJuhIXBMx+12jgDCoYnFK0CsZ Gx6YGgDipYR2FsiAExjdXsC4R6/KCNySNFTDz7RlvlLbbF5enMf8UuPSShGnTipZEHq7 VbeZ9LRbbvJNQ9gI2PGbLSC+tvMzYh7Rt11hJl+GNeNZ/iTfyRz9bYBhLHn6CV+iv7KW AN9CMwlP6SDjlfI/CltxJYHXQ17FqeCg0BTOH8IbxvENI3/ClYU9B0iFdO6s70cZ+ls3 7/md1sr7bxy23QtBxeKZrIqTEc/7bbkUCs2vZ9UxFyCU3HfvMt6/ki/Wnhaq9fjQz9cr iyaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GevoxMiSfxAK6DWxOjcnTXy4acQvtt6FLw9M5kaA7GE=; b=E027Lbw1E7fx0WxoGhC26CSzmU5YcxLqHIBdmzHYrOr6dPFzlUYZatnETvciZ2iZot JtwTn1o1XPrTodEGs1pcjRz3DEMh0ysw2tqFj1UsUoVV9YqR8bCqOqckqvceho7070wr Cy9PAoTNlMqZ0mYLUgGJFROTW7+ma5VJylaJP5ZDxaP5H7CKqStFKwTI2Buys612eITG UjK4JOZuEAt6w8umuwqtCvNidZh5Nxppd6lg7ZLW4XrGakCBRLadVxgP63qCqIA3gzUO RXuQorG+/QV5RqO6JQaTfbyRB3TCCIdY3o+W8fGbTPTXBPqepyajdFzfgl64y+H2E0dd umsQ== X-Gm-Message-State: AOAM5307bd2dLdFX9Wueh2sFXtXpCamW8Lg6qfjkUyPL5AlC/FPvzmwx OQyLBTup7UMqOJ3oi38i/A1HrglhazX9gQ== X-Google-Smtp-Source: ABdhPJwgZZd6Bd0z84qMNricPpxhUMa9QRg6Igl29sY8Qw3jgTBUDQyNLZp2hVfjpkUPzTohtWzkXw== X-Received: by 2002:adf:9e43:: with SMTP id v3mr35896441wre.306.1602585052655; Tue, 13 Oct 2020 03:30:52 -0700 (PDT) Received: from jwang-Latitude-5491.fritz.box ([2001:16b8:4969:6200:8c9c:36cf:ff31:229e]) by smtp.gmail.com with ESMTPSA id p4sm28458634wru.39.2020.10.13.03.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 03:30:52 -0700 (PDT) From: Jack Wang To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@infradead.org, bvanassche@acm.org, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Guoqing Jiang Subject: [PATCH for-next 1/3] block/rnbd-clt: remove nr argument from send_usr_msg Date: Tue, 13 Oct 2020 12:30:48 +0200 Message-Id: <20201013103050.33269-2-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> References: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Guoqing Jiang The argument is not needed since all callers pass 1 for it. Signed-off-by: Guoqing Jiang Signed-off-by: Jack Wang --- drivers/block/rnbd/rnbd-clt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index cc6a4e2587ae..cffb750db7a4 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -433,7 +433,7 @@ enum wait_type { }; static int send_usr_msg(struct rtrs_clt *rtrs, int dir, - struct rnbd_iu *iu, struct kvec *vec, size_t nr, + struct rnbd_iu *iu, struct kvec *vec, size_t len, struct scatterlist *sg, unsigned int sg_len, void (*conf)(struct work_struct *work), int *errno, enum wait_type wait) @@ -447,7 +447,7 @@ static int send_usr_msg(struct rtrs_clt *rtrs, int dir, .conf_fn = msg_conf, }; err = rtrs_clt_request(dir, &req_ops, rtrs, iu->permit, - vec, nr, len, sg, sg_len); + vec, 1, len, sg, sg_len); if (!err && wait) { wait_event(iu->comp.wait, iu->comp.errno != INT_MAX); *errno = iu->comp.errno; @@ -492,7 +492,7 @@ static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id, bool wait) msg.device_id = cpu_to_le32(device_id); WARN_ON(!rnbd_clt_get_dev(dev)); - err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 1, 0, NULL, 0, + err = send_usr_msg(sess->rtrs, WRITE, iu, &vec, 0, NULL, 0, msg_close_conf, &errno, wait); if (err) { rnbd_clt_put_dev(dev); @@ -581,7 +581,7 @@ static int send_msg_open(struct rnbd_clt_dev *dev, bool wait) WARN_ON(!rnbd_clt_get_dev(dev)); err = send_usr_msg(sess->rtrs, READ, iu, - &vec, 1, sizeof(*rsp), iu->sglist, 1, + &vec, sizeof(*rsp), iu->sglist, 1, msg_open_conf, &errno, wait); if (err) { rnbd_clt_put_dev(dev); @@ -635,7 +635,7 @@ static int send_msg_sess_info(struct rnbd_clt_session *sess, bool wait) goto put_iu; } err = send_usr_msg(sess->rtrs, READ, iu, - &vec, 1, sizeof(*rsp), iu->sglist, 1, + &vec, sizeof(*rsp), iu->sglist, 1, msg_sess_info_conf, &errno, wait); if (err) { rnbd_clt_put_sess(sess); From patchwork Tue Oct 13 10:30:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11835349 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 770C31592 for ; Tue, 13 Oct 2020 10:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F7F020872 for ; Tue, 13 Oct 2020 10:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="RsJH7UvH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730649AbgJMKaz (ORCPT ); Tue, 13 Oct 2020 06:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730429AbgJMKaz (ORCPT ); Tue, 13 Oct 2020 06:30:55 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D097C0613D0 for ; Tue, 13 Oct 2020 03:30:55 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id e18so23356377wrw.9 for ; Tue, 13 Oct 2020 03:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m8NhYOoVB9Nf2uKF0P9dlPP87rVMd52Szhw4LJlmJqg=; b=RsJH7UvHJHQr39cHmUlxsVOWUKfLQhQ4q6Gwyygr53QdSwmPqkrxbEmLZlJJETerBp Tg8OGJ7XsmOuGMZmPhP18CQ43lLLM8sbq7TR3+sAzWjr6XNx9UYn91Eym1o/VQqXzNS/ qjYCGsSIMAUeLClTtGrELTbUrkzziOMXJGVAIKaL3FzAB5ZXoFYvWmm6Gri7leL2tXic 6QXYoZcB8szkmAm2vR/w6rmG7MtWu6xcQRV4UsUhnCZolcw4MVd8qUAqRyDtkPcuZYl1 3DMpQCr5+kfWwJSt6XkIZXTS8HVk+Kbgh+Tp3WHe3Gh698BxsFv+NsyCdWH1pXITv69p 2S7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m8NhYOoVB9Nf2uKF0P9dlPP87rVMd52Szhw4LJlmJqg=; b=M69+F0R8OgKK5pGqP49nxUo2spH3SBaEjLMRJcOPltHMtaXK9bq15unLAAfr1fsEmY 0A7uJDBM6Z/+kkXBZnc1lp2Ypan3Z8gQS8lJM5pt+0XRx2ADQPm3k9JqZQF6mj2u8KWq LhGoej10pl7JTu/cuPk9bAHxsNCSwVwri1GTAckAy6t/ohaHWh8IHMxB1r1ULwFxooQV 3jNRqH9R/fALy/gsZr6Q4IfFP15ji4wfHxsxvqUCb70uqtepIYIPgc1z9uDOXnK2p+0l lrWun+Xq2OSnYKZp3HqctyaJFeSNR6TeVMk8NKajpVZnph4qzw9uck3uZqzOBzCCxa07 WR0A== X-Gm-Message-State: AOAM531Q2vBigNqhIHJmOiiyQVMfRcD2vLYZlMf80FiPoSQrSzDbNBu+ rMB+12oVrTHv0xR+NMr1fXn/da550V06Wg== X-Google-Smtp-Source: ABdhPJzRu4AvsHW13mfY+Bfa3Tam0kqA2rzno1nvc4prUFn+xKaC0d70elO8fObaIxbQVm0fIbcpKQ== X-Received: by 2002:adf:eb41:: with SMTP id u1mr26801081wrn.94.1602585053639; Tue, 13 Oct 2020 03:30:53 -0700 (PDT) Received: from jwang-Latitude-5491.fritz.box ([2001:16b8:4969:6200:8c9c:36cf:ff31:229e]) by smtp.gmail.com with ESMTPSA id p4sm28458634wru.39.2020.10.13.03.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 03:30:53 -0700 (PDT) From: Jack Wang To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@infradead.org, bvanassche@acm.org, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com Subject: [PATCH for-next 2/3] block/rnbd-clt: do not cap max_hw_sectors & max_segments with remote device Date: Tue, 13 Oct 2020 12:30:49 +0200 Message-Id: <20201013103050.33269-3-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> References: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The max_hw_secotrs is only limited by the transport, not remote device, block layer on server side will split to the device limit if it's too big. The max_segments, similar, and rtrs server will submit single buffer, so no need to cap. Signed-off-by: Jack Wang --- drivers/block/rnbd/rnbd-clt.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index cffb750db7a4..22381aee1cf4 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -91,11 +91,6 @@ static int rnbd_clt_set_dev_attr(struct rnbd_clt_dev *dev, dev->max_hw_sectors = sess->max_io_size / SECTOR_SIZE; dev->max_segments = BMAX_SEGMENTS; - dev->max_hw_sectors = min_t(u32, dev->max_hw_sectors, - le32_to_cpu(rsp->max_hw_sectors)); - dev->max_segments = min_t(u16, dev->max_segments, - le16_to_cpu(rsp->max_segments)); - return 0; } From patchwork Tue Oct 13 10:30:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11835351 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A34171592 for ; Tue, 13 Oct 2020 10:30:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7956A20878 for ; Tue, 13 Oct 2020 10:30:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="QR9G5qPg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730429AbgJMKa4 (ORCPT ); Tue, 13 Oct 2020 06:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730322AbgJMKa4 (ORCPT ); Tue, 13 Oct 2020 06:30:56 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06774C0613D0 for ; Tue, 13 Oct 2020 03:30:56 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id t9so23362241wrq.11 for ; Tue, 13 Oct 2020 03:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mkcSdHk5HTR7MlJZO8r78NsxY1UaKI0aJwFJpY0/hM4=; b=QR9G5qPgSyvURJ/SEi2utg2YDMqzDE9lKaocv+ULFlMt6i5CU2ouAfNXMuDpPaKmwO QLAoPQyeG/eVJ+pILTFlGhtjAkfTyQzMdQ70HOE/9UZ4IiPy6GSl6n/5IrtqwuU8dM/F ++deUWIW/4qkfoq0jUF0ZuLG9OlVwc7mHzrv1zXwOhF6S4htgq+tjmPcD0jUIVvSmt3F uglrFq7i5rHJd6GXN7egvHXD08uBw+t9J7S/NpZnjMtQ80LcCl5rJB0yRsOPUMh3aZeH im60czhm5zgh5WAxIoB+ddAJVIMI68RwjFh+Mwe2RhysRrFmktvD4RM8utoroFxznEJI YXYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mkcSdHk5HTR7MlJZO8r78NsxY1UaKI0aJwFJpY0/hM4=; b=CEHVBVExXpETEdbDK+H4PXvzh7vWpQ4AJgU80ENF+G4vjNkc2K18ja5vMZevq55GSO QihmL5OcWzsPwGymF/JHx2tYceEoVwefKbalL/Hu/aEc4JRBQPrqWRuTCImLpjrNJRR7 +o++pQZ+9nHZ42pyxE61/Ga58/4JD7OE52N6iiVK4fTsIv85HlDvsidWIdwsp7D54Ep2 PDLM90ZqaF9UhWKAJrghZTLW8jqw2rH12HLwEuuQGS3Y5crCWmvnBpEW8WQBDrp65SVw xXcfR596JIORfrfHKkCF2FufNKBvfBJTONawObfSCQB6JrZRcDkHmf9wSowQdHLSHa34 eRlA== X-Gm-Message-State: AOAM530TOOnWY6z0xLxfB4Qno4z/92SAISkeLClBFOGxEPAtee1GDxCc Bjkcd/UWNAUtk5hsUUdBUGQ7ofmijxyJPQ== X-Google-Smtp-Source: ABdhPJyBYZvqm9jumZh35CckGAGyqGUiK5i933hKAS4wN4X5wL+nqPBvREArs4F9mWecTl4rSD21iw== X-Received: by 2002:adf:f1cd:: with SMTP id z13mr8338221wro.197.1602585054687; Tue, 13 Oct 2020 03:30:54 -0700 (PDT) Received: from jwang-Latitude-5491.fritz.box ([2001:16b8:4969:6200:8c9c:36cf:ff31:229e]) by smtp.gmail.com with ESMTPSA id p4sm28458634wru.39.2020.10.13.03.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 03:30:54 -0700 (PDT) From: Jack Wang To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@infradead.org, bvanassche@acm.org, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 3/3] block/rnbd-clt: send_msg_close if any error occurs after send_msg_open Date: Tue, 13 Oct 2020 12:30:50 +0200 Message-Id: <20201013103050.33269-4-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> References: <20201013103050.33269-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Gioh Kim After send_msg_open is done, send_msg_close should be done if any error occurs and it is necessary to recover what has been done. Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/block/rnbd/rnbd-clt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index 22381aee1cf4..9ab9c467f272 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -1515,7 +1515,7 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, "map_device: Failed to configure device, err: %d\n", ret); mutex_unlock(&dev->lock); - goto del_dev; + goto send_close; } rnbd_clt_info(dev, @@ -1534,6 +1534,8 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname, return dev; +send_close: + send_msg_close(dev, dev->device_id, WAIT); del_dev: delete_dev(dev); put_dev: