From patchwork Thu Jul 11 17:53:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61F58912 for ; Thu, 11 Jul 2019 17:53:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5285928B2A for ; Thu, 11 Jul 2019 17:53:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46E8D28B35; Thu, 11 Jul 2019 17:53:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E32CC28B2A for ; Thu, 11 Jul 2019 17:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728842AbfGKRxs (ORCPT ); Thu, 11 Jul 2019 13:53:48 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:3393 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRxs (ORCPT ); Thu, 11 Jul 2019 13:53:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867628; x=1594403628; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=WhqEzSaKJFKWtttgBwqSQfhUHuC0WynErfx6eW0N6w4=; b=ck8RoSHkwYveQB6sSicsGOVKTGfcjfFd7yHyK2/M4FdvYVNajGEA7ldQ AqmoN+g8mDdSDTmjfdTkduwPumjRVMGSo9CMK/NWmyLBTZbFc6kab18bv HPQud/3xPU2Ux3nHUbnCxFKVud+3BgOZfQe5rObqHMJjT0a35ab1rMc2O eGMWs3wDcJwJwrlhD4g67MFYYkyg3VMHzCXxqwpYAiBejh5u5mTdJR8lg Bwt7pkGo+Wei2qaOwskHY83PEkfk8TO5M7HO7EQLNw+m2iqTzkeL0VIZ5 SA1ePXHgrJ7ELbPLbd4hp3RNG8Cpr6BM3EwMT5k+fvwH8LYjdJ9RQ6jWq Q==; IronPort-SDR: D8Om1/2aR6x/Xo2V4TnFMj5Mb4aZ3BEg9Gq+d9aCzFVYrV2+nRSJNTvZzBIN3/oRM8DB+Tn+8b gi3IyjeWhbqvjoN+Zatec4U/GepKyw6uztkcZCKLK3J+apy7fZCjQC4p52PELg5AqqFwuSVzv/ DUfPxM7RcHCudZM0SCE15/fNCWiYqGqdppfaGI5+p/48oJGPY7iCwh5BxfahjhMLc0ArD2JxUc 3RFIe8MNfGx+eCbMzs2FYJSQTtXtPuuzI85c+hxwOjUIAOtatEjRBBNIY6CEVjUxasjiyHJMpj xyw= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="113960838" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:53:47 +0800 IronPort-SDR: xv2VaYJh7uPCX2nMmjk8T+SGWIfk1uiMsWGeYsotiI0fFmpO7W3TSKl4/ikk0ALg219IjMr35C 182dbVI1ZWOmhyJVHQnJtIzEIkjWO0FHnU/O6ySRtlh+U6nBk5pxMrzt8A2h7mKb0C5J8c0aLL LiFd3B4CxL2V9GxZ9knKG7fv34WhZfQ2a8c3s0CPchDE2iy4xJwYj5vXQfiqV/lJ1HpkHPnZHT i5+vHAbMGuotBS+W03nNMkid6VJophItoByYTZ3hrEU6xOkYlm4B3ATnTMOzPoAIg62hogEXK5 9FqX5QRueB9GOmPQ2c7wt4O3 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:52:24 -0700 IronPort-SDR: yHeHuJWxlc4jPwPshYROlAXREPbvXs2XXtHxcIwC4kt/ojQO+2RX7DSDrqnCz+dx/Fb4vgNhVx +0rIMuYFwdyMe9R8masB6ltRKQzZ23x+rR19hS2OMUnsdCQXCBiTf4m7S47ja03Nz0liAQaQZk eSfsVH5Nje/G3YG6NqBsa3tlNZCKFc3AwzTTAomEcce7PfAwH/nG4y05hRSvoppoAfZqsBR7fV ORRKQdR8GNWxFlovqie8f9qLD+K5Kr7LKx26hKA8l5REgc5C+d69+RgPdx/iZ7MiV+M65fojA/ LAA= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:53:47 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 1/8] null_blk: add module parameter for REQ_OP_DISCARD Date: Thu, 11 Jul 2019 10:53:21 -0700 Message-Id: <20190711175328.16430-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a module parameter to configure the REQ_OP_DISCARD handling support when null_blk module is not memory-backed. This support is useful in the various scenarios such as examining REQ_OP_DISCARD path tests, blktrace and discard with priorities. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 99328ded60d1..20d60b951622 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -3,6 +3,7 @@ * Add configfs and memory store: Kyungchan Koh and * Shaohua Li */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include #include @@ -193,6 +194,10 @@ static unsigned int g_zone_nr_conv; module_param_named(zone_nr_conv, g_zone_nr_conv, uint, 0444); MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones when block device is zoned. Default: 0"); +static bool g_discard; +module_param_named(discard, g_discard, bool, 0444); +MODULE_PARM_DESC(discard, "Allow REQ_OP_DISCARD processing. Default: false"); + static struct nullb_device *null_alloc_dev(void); static void null_free_dev(struct nullb_device *dev); static void null_del_dev(struct nullb *nullb); @@ -529,6 +534,8 @@ static struct nullb_device *null_alloc_dev(void) dev->zoned = g_zoned; dev->zone_size = g_zone_size; dev->zone_nr_conv = g_zone_nr_conv; + dev->discard = g_discard; + pr_info("discard : %s\n", dev->discard ? "TRUE" : "FALSE"); return dev; } From patchwork Thu Jul 11 17:53:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4D98112C for ; Thu, 11 Jul 2019 17:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C581728B35 for ; Thu, 11 Jul 2019 17:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9B0A28B37; Thu, 11 Jul 2019 17:53:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F12E28B35 for ; Thu, 11 Jul 2019 17:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728458AbfGKRx4 (ORCPT ); Thu, 11 Jul 2019 13:53:56 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53237 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRxz (ORCPT ); Thu, 11 Jul 2019 13:53:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867712; x=1594403712; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=gWfetoeiKPzHdzvdliRZb0O5EwrxdvdVo+6ayJ+HVq4=; b=blsfSutxdaudBptF8+DOs7an4+yK4cZZBmjJFkWIZoAP4CtBXpUFdoDv I0oKq9BQ2oYBmMI2y2tkdXqyeJoGWkwei5lbPP4bp8qoHgmoYjrTu5axO iy0uJhPJCXIV1SQB5l4glEL/2EE78QzPilU9O8qjXOceg2n+CGw0wIvm6 TUf7UZLVEe6bKisUulbyTJGU0YdkxozZKEHJQPdhNqs9ScS2RZ1ItKxab N0MZWdyUAkylVO1um0sC6hoszOgx74aUcnKm4I6FXwMFJMIYOT0vJDR9c 4MVd4m6CRLASEam3C4mrDKV9/UkVqBKZGdjkzHS+ucaDbcHvh5APUS7bX Q==; IronPort-SDR: 8xNu9M0XGHeOlUdHcJdlBKl8YOWZ4d0SddHGp5wzlNPaP+XZV67AGdgxwxzweRyPHPHYe8q5yS 1P72mHdEzmrUT57+HIi6dF+IgJ7ppqko7RPu+cJmtml8VzqJ5Pdpk0Tfu1qfEv3VZppXu3YctD /RhFdeSyYKbggOLILFgXUUK8gP8ghhK7GCuSTZp4e0P4xnXl97xZl4LqBJuo7uD0zP84u9m/z0 eEbqQ6D78aIeAzH/lQT/rY0vbSFuqHKx7B+UAcvViA8E1LO/Tkn5VTMsj64kYHeTA3uEJa+ben dXI= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="212743405" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:55:12 +0800 IronPort-SDR: agCcj3Wu1ZwEJHZiA/yD6KCrNvbx5L1LrJI7E4AXKT8l08Sv7eiTAXanSvCZvGi4UlMSBhfDlq OwtceuYzlTgCzBqmlIbSZyQ7irH9DWU3Pq+gjgbLDvJM1gO2o98TTWnvKd49FwgnDM2vx30PIK G57m9zswo6LwY8Kc223h3qajZ3AG1ztL8yXurMYB1XM2JVh6fK0wRtYsAao/iVr9HEx0fdK2Rm cUpMnI3t6dpyhcqwPJhwqsK2RnPHY5QhC6jd+ZkFGLpXFwHeECJhWvgTSCSL6iS3d9hH8u5Yb5 yUtdstfdElwH5D9xqsYqLiNK Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:52:32 -0700 IronPort-SDR: UPnRcSkmbyKysCRsHnaGx6AiVRdnEmpTunped8mvb7gl93NOXyj78HwCLfipHsX8rpuPIUvLIl 18e4WOq4KALXdJkENtsyoaB3DBf4JVHAFheE9S2asSPUyDOnBYc2+JVaOrx9G+fwrzUdV2Id7i gI+cVXXn3xvSuXt/5JDX+vq/f59SICySnmnc6+bAyjlqo29KbXO0m7KdIo4ZLrwypwqdWeIUUU dIiVhlK/EHbzWX+ndcvKMUg4DjL9Od18k5SKDUDNHHhwGHmv3cKYBTnS+0y/PBnA3JrzZaG0wD mOA= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:53:55 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 2/8] null_blk: add REQ_OP_WRITE_ZEROES config property Date: Thu, 11 Jul 2019 10:53:22 -0700 Message-Id: <20190711175328.16430-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a preparation patch for implementing the support for the write-zeroes operations for null_blk. We introduce a new bool flag write-zeroes for nullb_device structure so that user can either set this value through configfs when null_blk is memory backed or use module parameter. Following two patches are implementing respective support for REQ_OP_WRITE_ZEROES. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/null_blk.h b/drivers/block/null_blk.h index 34b22d6523ba..ecd1e45f6eb9 100644 --- a/drivers/block/null_blk.h +++ b/drivers/block/null_blk.h @@ -63,6 +63,7 @@ struct nullb_device { bool power; /* power on/off the device */ bool memory_backed; /* if data is stored in memory */ bool discard; /* if support discard */ + bool write_zeroes; /* if support write_zeroes */ bool zoned; /* if device is zoned */ }; From patchwork Thu Jul 11 17:53:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FEAA912 for ; Thu, 11 Jul 2019 17:54:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11D9628B2A for ; Thu, 11 Jul 2019 17:54:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 052C428B35; Thu, 11 Jul 2019 17:54:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F96828B2A for ; Thu, 11 Jul 2019 17:54:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728757AbfGKRyF (ORCPT ); Thu, 11 Jul 2019 13:54:05 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:2232 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRyF (ORCPT ); Thu, 11 Jul 2019 13:54:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867645; x=1594403645; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rc5d1BORUsGfUd0z/ZS6DHDg5KgvcI3LpvPn05LYeEM=; b=JLOzwGCfsJB3sPBO7o5p8eWs4E40sBAe3nJQp4pJnEbx3pkExb99cmaI XyW9bqFkB9GkkGYuAP0R2IncC13wWu5sd7+OgLuOF/A9Awcu5FsDKjstK Q7LX+WDmokMble3E47vWx0h+o01M7KOaBXLUUfpLXUEXQhgqImEYeQlrK 3MHrBi4kFjxOf6OmA8JhDWZFY35GW4pEaP+eDjpHC/nHB7I//jVUDk/ue CwTu2W9Qgnh2H2lAcIuWylNUvxCAsnD99PGJF4stxsUy/F8+XFA5VgX6C n8SI+to8CAqXzmakI/WigZw7IayNGsEdwDF3RDKtDntzfIvDKLzoB9Sm7 g==; IronPort-SDR: SZaT0qaq8sLtl2n3IK8oojmfNiJMzLvxV3W1Ph6ZCHBcrHjT8THpLmazcFsEqwwWZncynPMQmQ WIv9Zn9Nwcb4tEs/KuoxLCzytX7yIdZlG6Vcj2eHV/JDYVPMBjSCWRjCxoUv4SzNh5Jk1WTeBr e/Vz82ra8R52KsaR8B2CZ5380pKt2W2thBUxKfbSmLEZ5ifszot7+zbhCdZXkRoQVzSicRbDt6 2x4Zr2dXlmf+8Q7GKp2sqE+G9JSsS8SMj75JE2kZR+GLkd2budL35xf7Srt3Y+2/2WK8eMnaae pXg= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="112812805" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:54:04 +0800 IronPort-SDR: 4VmuJ3YCcwVmJZ8wezX/9UebYvHE9vOM+EXiC4jJihLoYQR82jh52NFDpYU7uebuZK9lSw1EpF T+Ho/6jAClpSwjc8KG06bgvCRhNKbzvPi+DTXd/0T8D0Gi5iCxYkJ/iTUcqI4VXRFMQ01MrTb6 d3Va9Kr/9f1K6K/TDz/E0Pz4hlN+9sBtWpG9iF7fMTi4/ZDOup6jvVy5hP0UD0yO6UC4nncm/q 4ySxyf4dDt/NDBT74fkTTCStb9bnrUt/ETkxsVUQAjwDOAZcleZsSvgBWc+xl58+m1kWb+E6q9 VNmv+qk3TNTGXqOmyzQL9V4f Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:52:41 -0700 IronPort-SDR: 2mMyEIP42R8+9Ba9gJMRduVZWrGnRHYfzzwgFNSrSdnNySgR4bIeVVNAo1Bkczi8lm/epFHa15 8q+LpnKyCVfmJHHErrk5Ist6bDh2Zy+/u3KkrMQ/cp3howCzLPnAMrqf2jIVTFZRESW2IRb9RD lPJRxFo/Yq+w57DynMASFLjdTGe6FhUcRSet4kiLPg2rOw2zA9NyYbGfxnDME6lFHmvnp5RXVs 4IatW8z6k5HQZB/qsKJJXN3GXMunD6Pkh8whTW2XrNhxjt1rXAghNMbe8q/Yb9iHXUqIzMlsd7 lNY= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:04 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 3/8] null_blk: add support for write-zeroes Date: Thu, 11 Jul 2019 10:53:23 -0700 Message-Id: <20190711175328.16430-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support to execute REQ_OP_WRITE_ZEROES operations on the null_blk device when device is not memory-backed. Just like REQ_OP_DISCARD we add a new module parameter to enable this support. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 20d60b951622..65da7c2d93b9 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -198,6 +198,10 @@ static bool g_discard; module_param_named(discard, g_discard, bool, 0444); MODULE_PARM_DESC(discard, "Allow REQ_OP_DISCARD processing. Default: false"); +static bool g_write_zeroes; +module_param_named(write_zeroes, g_write_zeroes, bool, 0444); +MODULE_PARM_DESC(write_zeroes, "Allow REQ_OP_WRITE_ZEROES processing. Default: false"); + static struct nullb_device *null_alloc_dev(void); static void null_free_dev(struct nullb_device *dev); static void null_del_dev(struct nullb *nullb); @@ -535,7 +539,10 @@ static struct nullb_device *null_alloc_dev(void) dev->zone_size = g_zone_size; dev->zone_nr_conv = g_zone_nr_conv; dev->discard = g_discard; + dev->write_zeroes = g_write_zeroes; pr_info("discard : %s\n", dev->discard ? "TRUE" : "FALSE"); + pr_info("write-zeroes : %s\n", dev->write_zeroes ? "TRUE" : "FALSE"); + return dev; } @@ -1419,6 +1426,13 @@ static void null_config_discard(struct nullb *nullb) blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q); } +static void null_config_write_zeroes(struct nullb *nullb) +{ + if (nullb->dev->write_zeroes == false) + return; + blk_queue_max_write_zeroes_sectors(nullb->q, UINT_MAX >> SECTOR_SHIFT); +} + static int null_open(struct block_device *bdev, fmode_t mode) { return 0; @@ -1710,6 +1724,7 @@ static int null_add_dev(struct nullb_device *dev) blk_queue_physical_block_size(nullb->q, dev->blocksize); null_config_discard(nullb); + null_config_write_zeroes(nullb); sprintf(nullb->disk_name, "nullb%d", nullb->index); From patchwork Thu Jul 11 17:53:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9200A912 for ; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8331628B2B for ; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C92028B3B; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F01A28B35 for ; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728550AbfGKRyX (ORCPT ); Thu, 11 Jul 2019 13:54:23 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:7675 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRyX (ORCPT ); Thu, 11 Jul 2019 13:54:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867663; x=1594403663; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=CIKc2ffzqxk1B3QyfyXivrlbpoHofAyOZKZuuaTh18Y=; b=ZzgE0VivG0mFfY98t2VMJeqxWXgAMTjvhlipy9M+GTGR0jRZLtnCSs9G HSvuaFUFviNor4ZLozlpCIvRSA7hBnhL67mpfNv/gjEKqd+2kogmRJvQU ksS3XfOF0BG4eeP+4S97JubvcLof1fIaHFe5SxK7Em+fXx5Kh3PxdPJpa et6xxMDR3ZAmQ4c+FqYGlRWlbZHA0mYmfmzTqz3Wm02Q8x7lvEmD/1bBr 5zoiM5yooRGlGVCZuUi3fVmTdZSZfTxBayuoBSozw/Wv7Eb2DSuDGWRJC hQq11Xb8bxiaMSwMYGkSS2GoL/huL+u/8yemJ7mh1e1p00qfuZL4DRkrm Q==; IronPort-SDR: Y+rDzfdVVBbce0G86bsT1XOXxDIZzj10aQT2UsAO45B3QESpHJNUAynTlK/6tXI6231SU2O4tP +/091cV9Ta52oRMB2nLpT0v6ARIvyKKatQv1TyAU18DC4wCk1JUk2ZIXUA9vU5My9bFMhV25+l a9wZqvp7BFWx8EnP1QPL12BDNvFHENXntOhk86nbal2Bf/EHsYaa5kdeEaKEH4txOmdJkhWeVB Ebj2gHzO1pw8l7Ghoes3xqNBzcvwAkTEC04HlQBv2Yrg4haJkzaasz/jp7EBQxAwoVaDvucX7u 2vU= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="114423678" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:54:14 +0800 IronPort-SDR: eQ+mpAw+y2PboymEwHi1d/sz5TopFcK7Kh3hIcEI0eRvwosfQcd5vjw6YoZcaplwhsGN2pMfhg SN6Kw6OVaboLYpIiHZ6xLlhV905RYreIp0uvzcrsIbc6LIuR0bHP+oiauH23XynrxMjSJje16H HNQBtpHqrxvv7W9zKxkf7tNbs3DhSkfxzhautsH8lf/IngnYPdYczvAkxxrAKa7LREKt2jmMaR ZBLktbYLv5ruymI78lPA2DJNpJlYYPLBnunabWJ00ygtJY5N3VdhCG64JWruegteTEpd5344C4 XErco5ZFux1ypYdYPPdYMmgO Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:52:50 -0700 IronPort-SDR: ITcnQBtzrTT44VN/lJbo7dRq75Dy7pBGT9GN1Tm9SOjbgbQ2NvB7UPpyGHK7fSB5iQbBDwn/V1 h65WJfaukkC4GCxOS+XzafuykYAKt4lUDYVVDj28INpYuVj6Lr6wqoWNrhEVfc29xeb+QYqgk7 nJzMYTgH4RZHc2btzUtnUx07l2nXNkDCQFqE3lEH07iC8Wpu4WCPSUnYj7kAnBnHCwGH/SJWrm BngGlElbP/0lF7e10L5Uav+Ix5c2ekS7UqU90cqQkPuDIl2hN4J/LRVmoavFLnBGKl2EQicJmJ nqY= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:13 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 4/8] null_blk: allow memory-backed write-zeroes-req Date: Thu, 11 Jul 2019 10:53:24 -0700 Message-Id: <20190711175328.16430-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for memory backed REQ_OP_WRITE_ZEROES operations for the null_blk request mode. We introduce two new functions where we zeroout the sector(s) using memset which are part of the payloadless write-zeroes request. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 45 ++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 65da7c2d93b9..fca011a05277 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -725,6 +725,24 @@ static void null_free_sector(struct nullb *nullb, sector_t sector, } } +static void null_zero_sector(struct nullb_device *d, sector_t sect, + sector_t nr_sects, bool cache) +{ + struct radix_tree_root *root = cache ? &d->cache : &d->data; + struct nullb_page *t_page; + unsigned int offset; + void *dest; + + t_page = radix_tree_lookup(root, sect >> PAGE_SECTORS_SHIFT); + if (!t_page) + return; + + offset = (sect & SECTOR_MASK) << SECTOR_SHIFT; + dest = kmap_atomic(t_page->page); + memset(dest + offset, 0, SECTOR_SIZE * nr_sects); + kunmap_atomic(dest); +} + static struct nullb_page *null_radix_tree_insert(struct nullb *nullb, u64 idx, struct nullb_page *t_page, bool is_cache) { @@ -1026,6 +1044,25 @@ static void null_handle_discard(struct nullb *nullb, sector_t sector, size_t n) spin_unlock_irq(&nullb->lock); } +static void null_handle_write_zeroes(struct nullb *nullb, sector_t sector, + unsigned int bytes_left) +{ + sector_t nr_sectors; + size_t curr_bytes; + + spin_lock_irq(&nullb->lock); + while (bytes_left > 0) { + curr_bytes = min_t(size_t, bytes_left, nullb->dev->blocksize); + nr_sectors = curr_bytes >> SECTOR_SHIFT; + null_zero_sector(nullb->dev, sector, nr_sectors, false); + if (null_cache_active(nullb)) + null_zero_sector(nullb->dev, sector, nr_sectors, true); + sector += nr_sectors; + bytes_left -= curr_bytes; + } + spin_unlock_irq(&nullb->lock); +} + static int null_handle_flush(struct nullb *nullb) { int err; @@ -1075,9 +1112,15 @@ static int null_handle_rq(struct nullb_cmd *cmd) sector = blk_rq_pos(rq); - if (req_op(rq) == REQ_OP_DISCARD) { + switch (req_op(rq)) { + case REQ_OP_DISCARD: null_handle_discard(nullb, sector, blk_rq_bytes(rq)); return 0; + case REQ_OP_WRITE_ZEROES: + null_handle_write_zeroes(nullb, sector, blk_rq_bytes(rq)); + return 0; + default: + break; } spin_lock_irq(&nullb->lock); From patchwork Thu Jul 11 17:53:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78A54112C for ; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6664428B2B for ; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ACDF28B37; Thu, 11 Jul 2019 17:54:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D931928B2B for ; Thu, 11 Jul 2019 17:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728596AbfGKRyX (ORCPT ); Thu, 11 Jul 2019 13:54:23 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53271 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728550AbfGKRyX (ORCPT ); Thu, 11 Jul 2019 13:54:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867754; x=1594403754; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=NRbtIeIHaFWl344KVqwv8W6TUa6y5dakiIM6yOpWXYE=; b=H5vJrtPv+atzVgSfPGDEMcNW7YWlLHHFXcg3VSUMS97DQOWBuk9E0aHs LswRrrrBjP6ohLqvsJSGKgmtNlS4zYXDP2f+EH4C9kn29QtLhXz7WP82f aqohafIhKFGiGImBDuQr5VWjXhSrR5mQTugozsYDsaFLB1J/OzS+DBHmw iAozy2H5T5/QKHOAfm8I49yt3PTf1ZgOX1XUdp9nZzshMAYw95qoIqle0 SpVWiN5MefNz10f5+AY1SQy/k3n/zjCi7mgtcPmcygPpSooK36DptgMog EXcm0NAaESj9o+O7z1aRp2NZ/qg0r5t3iLk2w8CwSaI83XBeyxudxKtBg w==; IronPort-SDR: bpjN/uZ/RnVmGaKY4/rzjlHEYXu26mg7vK3V2TSsDCvMssjR8HXiqX+22C/nuRJR6uxsVZCyg/ hYLUQdsfWHdS+7xc+wyPVd2cdSiqfEiInDg/ZyKQC22hhGgHqx65doAwEVj+zFQvX3Xvj7oh8J GOxLulgUEf7ipf5AQaG13XyjcIOKcEJbwbwjHaOOSWkvG0Tfm/t1bjcCYmOlcJlQgCgyKV5LTo +b+Oki4UpI1s+8xDpWu7PSKAbnKFQKipilUoMmiMVkLH4B6/3oQvwQfhMz1R28yADwFDQDMduD mOU= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="212743432" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:55:54 +0800 IronPort-SDR: PGWectX0mT/CQmJH3hCPM0bsOipks+XsE7ET2H3hdHYt1tXD2a5+mohu4vZu278JUdv+fODgFl CfayT57mX2s5ozYZ2oxxJzw5GGSVvlBfmQwktP4BD0E5xWg3JR7F9dCmsMT7m/LoLDaA5SzSaD Miv3JkIRfE3E3ZJ3u5Y4BD8d2/UD4dJ0ACpz5IxXoHDFlPJmOigAmGh0GqNPSbiazezUn/1npx lMYf54EDMYhVqry5v0mVAJ7uJojpb7t81xzUHLW8vS2/khZDZt0xG9PCJypG5PLOJT5mPl637r MqEdItDErDk/R6dj8SUlUOS1 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 11 Jul 2019 10:53:06 -0700 IronPort-SDR: B7PdpoNA9DngraQgMWPjgcaOjzhWoiCX33MzhAhUW7pNesGhDblbJ53XYMO/0Qtok6hQ+igkgm Gvg7DBjLIFq8ZCLsyU/M56J0kyJ0Dq+f/aAdSbOLto6rELfOSHFtvnufVkMXllb/81ddM4IHDv 1IxhTrfQ9HNQEP9xFb4rT1eFUCNq4hncdb80n+TV1VYCazQJxOKVPM8vh2p4jzCRC73+PFZnOn sQg+87wrO7X6BfyTpAADNir+s5gMCpwTgXfEWC8fSYGjLEkZePDwmZIHb2Bl4nacwKWoTmOxtD If8= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:22 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 5/8] null_blk: code cleaup Date: Thu, 11 Jul 2019 10:53:25 -0700 Message-Id: <20190711175328.16430-6-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the null_blk for different page and sector calculation we have simple macros to make the code more redable. Similar to that this is a purely code cleanup patch where we introduce two new macros for calculating the page index from given sector and index (offset) of the sector in the page. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index fca011a05277..d463bde001b6 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -16,6 +16,11 @@ #define PAGE_SECTORS (1 << PAGE_SECTORS_SHIFT) #define SECTOR_MASK (PAGE_SECTORS - 1) +/* Gives page index for which this sector belongs to. */ +#define PAGE_IDX_FROM_SECT(sect) (sect >> PAGE_SECTORS_SHIFT) +/* Gives index (offset) of the sector within page. */ +#define SECT_IDX_IN_PAGE(sect) ((sect & SECTOR_MASK) << SECTOR_SHIFT) + #define FREE_BATCH 16 #define TICKS_PER_SEC 50ULL @@ -708,20 +713,20 @@ static void null_free_sector(struct nullb *nullb, sector_t sector, struct radix_tree_root *root; root = is_cache ? &nullb->dev->cache : &nullb->dev->data; - idx = sector >> PAGE_SECTORS_SHIFT; + idx = PAGE_IDX_FROM_SECT(sector); sector_bit = (sector & SECTOR_MASK); t_page = radix_tree_lookup(root, idx); - if (t_page) { - __clear_bit(sector_bit, t_page->bitmap); - - if (null_page_empty(t_page)) { - ret = radix_tree_delete_item(root, idx, t_page); - WARN_ON(ret != t_page); - null_free_page(ret); - if (is_cache) - nullb->dev->curr_cache -= PAGE_SIZE; - } + if (!t_page) + return; + __clear_bit(sector_bit, t_page->bitmap); + + if (null_page_empty(t_page)) { + ret = radix_tree_delete_item(root, idx, t_page); + WARN_ON(ret != t_page); + null_free_page(ret); + if (is_cache) + nullb->dev->curr_cache -= PAGE_SIZE; } } @@ -733,11 +738,11 @@ static void null_zero_sector(struct nullb_device *d, sector_t sect, unsigned int offset; void *dest; - t_page = radix_tree_lookup(root, sect >> PAGE_SECTORS_SHIFT); + t_page = radix_tree_lookup(root, PAGE_IDX_FROM_SECT(sect)); if (!t_page) return; - offset = (sect & SECTOR_MASK) << SECTOR_SHIFT; + offset = SECT_IDX_IN_PAGE(sect); dest = kmap_atomic(t_page->page); memset(dest + offset, 0, SECTOR_SIZE * nr_sects); kunmap_atomic(dest); @@ -797,7 +802,7 @@ static struct nullb_page *__null_lookup_page(struct nullb *nullb, struct nullb_page *t_page; struct radix_tree_root *root; - idx = sector >> PAGE_SECTORS_SHIFT; + idx = PAGE_IDX_FROM_SECT(sector); sector_bit = (sector & SECTOR_MASK); root = is_cache ? &nullb->dev->cache : &nullb->dev->data; @@ -973,7 +978,7 @@ static int copy_to_nullb(struct nullb *nullb, struct page *source, if (null_cache_active(nullb) && !is_fua) null_make_cache_space(nullb, PAGE_SIZE); - offset = (sector & SECTOR_MASK) << SECTOR_SHIFT; + offset = SECT_IDX_IN_PAGE(sector); t_page = null_insert_page(nullb, sector, !null_cache_active(nullb) || is_fua); if (!t_page) @@ -1007,7 +1012,7 @@ static int copy_from_nullb(struct nullb *nullb, struct page *dest, while (count < n) { temp = min_t(size_t, nullb->dev->blocksize, n - count); - offset = (sector & SECTOR_MASK) << SECTOR_SHIFT; + offset = SECT_IDX_IN_PAGE(sector); t_page = null_lookup_page(nullb, sector, false, !null_cache_active(nullb)); From patchwork Thu Jul 11 17:53:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EB7B912 for ; Thu, 11 Jul 2019 17:54:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B60928B2B for ; Thu, 11 Jul 2019 17:54:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C92028B36; Thu, 11 Jul 2019 17:54:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1BEA28B2B for ; Thu, 11 Jul 2019 17:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbfGKRyd (ORCPT ); Thu, 11 Jul 2019 13:54:33 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53301 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRyd (ORCPT ); Thu, 11 Jul 2019 13:54:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867769; x=1594403769; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=xrgkkYLUKVLCTDTwKNTbpRzC6EwM3DU/hQAYgk+n1J4=; b=b/h00G9VFgadBFb3R0HtLu4bdwzuqLHYg5gO0cY7dG1fs89vlgwgq2UB XjhfvoPCVu/7MaZ0ARNlPqmJL6uE9mMs4hy/KSBtQbgmxLf7HJm6GjpY0 EG/XBOrEVoFZl5NP7YXkjVw19GQ9gHdirip+t7Gu4uRed1Y4QTb9GsOAQ lWmz/kDwNMhy0ojAc+7XdWP61x/OTCJZMFmQU7GFauGaKvNKfanq75Eqs 9wJIIKIvRY0VPpPAvkkEjNLKvhA42xsnuFYLJ2RbETACw3s2P4fR4dgS5 NwFwLuheCoR+tUtE8jUprGi/HEr5wTjW16pJHLj4SOY101bYSoOrSeSkU A==; IronPort-SDR: 8UI4XCNqD9v63f13FewAF6ggrfUnMraGPoqBJdj8qASaCsX/4M2126U64/yJm3cZbGYE2GJdQD pgXB1DY1obkEExZBmoZXCGk+dQvYl8t+H0Rv6juVCSnnhsR7Un8lXXyJnHRNJ76bi4tjWpmKbQ 6EspIkJsN2m55WbVae7Ff6+hmNVHdu/6HOSOHcWGnAAw4ek+cGv4zJs5F4TCvlbHPN3U0e8vCs QVGATNpzmYiVcadTpV2Y9j+B4QT/MOI5S7un03KfNNkL8f/rrsR8/DouL/My7anfcGrJA5GZhM 5Ek= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="212743446" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:56:08 +0800 IronPort-SDR: bqeYdJIeJe9ZgszCaudr6HdozAFlzgdjghmEBuST0K33X3AaiaAUaNAzc+0+PcQYM81EmRy3Ar bS0EkjaTsJW8/FJjq413SiMXDZURVi/7p7ERN4WqFyOQDj4AbCFqS4ESIT8LQTN6LnGSOGEIET YvSkG5tvaVJMm3nOGQSTdxI7qVcieeyG7jZN010+kkoLDaRsd/wbJMAbxopU4APoVGGgDbRm7v 582jz5bs9fCSagqRQekyOw8zHwsvSA4Bzpf4s+/a8Rzx2ww8UQZQI7g7zLhbU/76LLDnnoun61 7Jir6WPZ3fwc/iwsaBXhp/MP Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 11 Jul 2019 10:53:16 -0700 IronPort-SDR: cJND6v91UWnie+1rKxNkYwLBmGccRkTfU9LuMWxTzQ/c/1pPRT+IZmjRjHO5VONEsGmS+cB4ib MxKtYXcypQMUvk0tioeh9zDWD1eBM3xYE+Blzhy+rs1+tQllMJSJc2XBiT3NYRtYQoZ/eMa/5T 56rhGJRtXsxs0hQ7ux9oQK6WGzRkehFwQw/Cgy9f8CPUWQ26fDFQnFXRmIWuGMWH4y7NB0xIWc NNcpjahytKaMb3iMkRTey73at2LbpgBTRjuWUy8tD1u98C4JR7TuOV1E5H6QWPDUXgPguQCd+j kN8= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:32 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 6/8] null_blk: allow memory-backed write-zeroes-bio Date: Thu, 11 Jul 2019 10:53:26 -0700 Message-Id: <20190711175328.16430-7-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for memory backed REQ_OP_WRITE_ZEROES operations for the null_blk bio mode. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index d463bde001b6..30cb90553167 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1147,6 +1147,7 @@ static int null_handle_rq(struct nullb_cmd *cmd) static int null_handle_bio(struct nullb_cmd *cmd) { + unsigned int blk_bio_bytes = bio_sectors(cmd->bio) << SECTOR_SHIFT; struct bio *bio = cmd->bio; struct nullb *nullb = cmd->nq->dev->nullb; int err; @@ -1157,10 +1158,15 @@ static int null_handle_bio(struct nullb_cmd *cmd) sector = bio->bi_iter.bi_sector; - if (bio_op(bio) == REQ_OP_DISCARD) { - null_handle_discard(nullb, sector, - bio_sectors(bio) << SECTOR_SHIFT); + switch (bio_op(bio)) { + case REQ_OP_DISCARD: + null_handle_discard(nullb, sector, blk_bio_bytes); + return 0; + case REQ_OP_WRITE_ZEROES: + null_handle_write_zeroes(nullb, sector, blk_bio_bytes); return 0; + default: + break; } spin_lock_irq(&nullb->lock); From patchwork Thu Jul 11 17:53:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 284FE112C for ; Thu, 11 Jul 2019 17:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19C8728B35 for ; Thu, 11 Jul 2019 17:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E31828B38; Thu, 11 Jul 2019 17:54:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AACA228B35 for ; Thu, 11 Jul 2019 17:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbfGKRyl (ORCPT ); Thu, 11 Jul 2019 13:54:41 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53317 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfGKRyl (ORCPT ); Thu, 11 Jul 2019 13:54:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867781; x=1594403781; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0kR/LVp4gkK7dEG1CCXX7pXv456iO8kz4Pv9gPI+EsM=; b=Z0MwpfaEpiYibZaE7UoklfoLLD/VCN2sSit7AdvRog8Cfas4SI7RVhJ3 KRlFz4vazPE+DPBd8ODcOdhIn0YprQfd+d9aZtxjeE2+n3hXh7yAwJwRv 99dsEm+IQFKT55bjCLSoO06uos3GN0eEI+ku6dmT6LA0bj1nCabRLTWoL IdVdm5UgWJeHTIrsEE5UtgP/zx5KzksNhzPfuwGeLzsonkMnhCHTYzmct 6xyGXoytLsrRsB/zcVegraZQtA8pu5BJ1vx1wpjqZo/Q/d64n0CczBP1j iDwKjPspepjMUWlAa+Cqhi9sUlAnB9b3TWH7+z6LYBfTBBbQcNVT/134f g==; IronPort-SDR: PDikRJ7bDr/KZFo7LGKvKb5BCoOlVZ2JbTMIIgvkRo4dC2b6fNIKrT2IyIKC0UNpCmnpKwcWvO qcvbBl/8eZv27Do//OWCVwJUbkGVzANdchDwdjMQm2V/p3SfjpgsXAL3PM/k/9//p2rznMfbiF 7cEklCkzQOgcImbp8EtvteAKWYo4LZr2neZ5T4mBWZAW0bM9gOjbrlFzm48fzTD5rzKeOwBAOG zUQJgofChjBAcqLRT03Uh/WKI/aDVpKyHvhGF5Z9Eu8uX68wKpw3Gmxw7SUP8ehDh9cAe9vXyF +HE= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="212743457" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:56:21 +0800 IronPort-SDR: marXlQ5+XwECqVPBUMoocqVjQsuMoVE6Kq763GtAzTAD4wocXQMhPMXWKbUmxn5RBjiL582Ltp nVVFU0n/LU1vpDl25K6nspMjv6dDlAHMTyE9wagLVNGXoUVQYEDcr83zcoJ8Jw/ez2o11G4Iw1 tpAnERptYVPXgw9JNjXB0di6ZbxssDnDBqRCNJHZyiiKcBdh9CENjil4wNotXCX/PdgqYSSmoo BSfaON+QMnqqrMbfxF9r8YhPlYEKytKxWRElm2k4X3GFc1kwif4jFiWxYRux7Y/Mpl33AtVjKG 7/Kd3oiLafONaRh2t74H06sY Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:53:17 -0700 IronPort-SDR: qI3xwlKL3Y0mzoBWFCOUX962FlyEf26e/QeDjsupfoxlnGJNjEnGXZscuSdMzRrN/LJkdUFUgs WcSeJSu4rOPw8XPr/bgAlaxezMF8WHXprKRkV1Ypsrim7SyJ8papAfah7eU1aEg/EEcxNY+aXF Fa8IKBGxnQBSFBSNLOr7LzB75plBwIm7HjCuvroRtZR8Ol9JTc5pHtngfx193fJfhY/XOzq+GU M0BxQ4+xovOlV7hYIotVRH3cEN2kfAw0XkLjVKrPFEI3eFh22Ubk+S/BkgojJQTPjLuOyzglrc 8Ps= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:40 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 7/8] null_blk: add support for configfs write_zeroes Date: Thu, 11 Jul 2019 10:53:27 -0700 Message-Id: <20190711175328.16430-8-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a new configfs parameter to enable REQ_OP_WRITE_ZEROES feature for null_blk similar to REQ_OP_DISCARD when device is memory backed. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 30cb90553167..c734ddaa697f 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -308,6 +308,7 @@ NULLB_DEVICE_ATTR(blocking, bool); NULLB_DEVICE_ATTR(use_per_node_hctx, bool); NULLB_DEVICE_ATTR(memory_backed, bool); NULLB_DEVICE_ATTR(discard, bool); +NULLB_DEVICE_ATTR(write_zeroes, bool); NULLB_DEVICE_ATTR(mbps, uint); NULLB_DEVICE_ATTR(cache_size, ulong); NULLB_DEVICE_ATTR(zoned, bool); @@ -423,6 +424,7 @@ static struct configfs_attribute *nullb_device_attrs[] = { &nullb_device_attr_power, &nullb_device_attr_memory_backed, &nullb_device_attr_discard, + &nullb_device_attr_write_zeroes, &nullb_device_attr_mbps, &nullb_device_attr_cache_size, &nullb_device_attr_badblocks, @@ -481,7 +483,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item) static ssize_t memb_group_features_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size\n"); + return snprintf(page, PAGE_SIZE, "memory_backed,discard,write_zeroes,bandwidth,cache,badblocks,zoned,zone_size\n"); } CONFIGFS_ATTR_RO(memb_group_, features); From patchwork Thu Jul 11 17:53:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11040611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C50A112C for ; Thu, 11 Jul 2019 17:54:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C61228B35 for ; Thu, 11 Jul 2019 17:54:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10E1028B37; Thu, 11 Jul 2019 17:54:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9A3A28B35 for ; Thu, 11 Jul 2019 17:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728859AbfGKRys (ORCPT ); Thu, 11 Jul 2019 13:54:48 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:2298 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728818AbfGKRys (ORCPT ); Thu, 11 Jul 2019 13:54:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562867688; x=1594403688; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=GgnbhpLZF0KyyFkEePLjnFNiF4QdHVem34UKsj46o2o=; b=Vrqq+ibJfeqWhCTUYqVlrVSD7zDNRbnHWJomz3ziFfRyegr3kSQ98MQH 2Wh2TtrEXWm6/maPaW9pMvLO7+qebp5fNtDMc34mMfXYPpd+QZNBzv6xv 7ITgYK0gGYQGFlc3SuC+6oINBU2WIOZOui+/D7Yh15KcRDZVQETo7dsYU 7+d57BD58Z/IuXydPEeyseDI/lUU7bqVwITA04hwx8ktE2fq1++tXqdBW qD4dmB2UYvC3VbA7eE2g6+1aR/kPRTkmQ4xkrdJmp63E43OYz8Gjfld2K qJL6dbOYDK+hPKpQ8a9iMLLaoZalLZOJhruxk9sbLePfqg/J+A4NkBCWC g==; IronPort-SDR: Bm0Xb4TxpoXYS8MDJqwVCWotBkIzB9NxEkgeeLFZHZfp64lxZvn5bKFRUbrtfcufn0p++XTRRt 8qacjwU0zWVMvY1I3N8ggU2MZ8JehVB+1re+5p74FNBxUMBrrUGQSrcCyh1+74ty4TTXwzJzk4 8/iMcvLlEGdmBzojtA1GvE4kxIiaK+zlw1KJgtH90FYwwdKfSVWDDRP1CYpniqHBEWHE+/AzSD 3O2BMBa1An0Ecbvg1Ngplx9P8WNncvYZRkqI+v5pl3W6jCDkqpgxD4nBR3u5NYl31h79fd5rvA xIs= X-IronPort-AV: E=Sophos;i="5.63,479,1557158400"; d="scan'208";a="112812840" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2019 01:54:47 +0800 IronPort-SDR: z2/kN1NktJ/L2tW3N2hbdc16iXA6w4JhPvS6WqCu6/I5N07RXGWmwTPq/rbfwyi9H7MDSUJgOj YBFAoW1E8ViChUfPGWejvGpYpHIRHopFYZMgtNGog6TrYtO2+IXGoAifFAhydMa1td+XNYsH4o N9oIdoZWkXQi9D+FjNqCTDgsUn1NsFGJHEgagdesBNF1uu0desA5xJRdyH/PZ9nv86hDBdNq9y frLknMiQLlDrIVpbjGV5rUWsBIR04TvlmpNZvbKp9D4hr11s/eavbpyTJMFjd+3kggb2WGn1Qs 2fmOklpqfvfmgBEAVVZGP8vP Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Jul 2019 10:53:24 -0700 IronPort-SDR: wnKYkHcDYSfEPs3mqnQeeOzf+oN3AVGtQEfEVjoIdw17dS+lT/bllDB79bOK9cujx99+OT26RH p9ccIHBxW76znIj4d+6yStJ1BKFFtoCMVgJtwGs4ew89pOgaqDt8vOPvSekZrHWZiqrDU4+01N vO3mX5HjIAymXV4PW0D/5O24cLQnQhUHhDIcbBkmTyIJ/QMbppDWc52PRIC1Z4pzAza9mVi8u8 +yhzXqpy2K7FZlhZ6eu8yf88QUEGf4CkDZBZtxATVm18CZahYyHE4PsCCtyAE2uU/W9s0AN9wr Ews= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Jul 2019 10:54:47 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, Chaitanya Kulkarni Subject: [PATCH 8/8] null_blk: adjusts the code with latest changes Date: Thu, 11 Jul 2019 10:53:28 -0700 Message-Id: <20190711175328.16430-9-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> References: <20190711175328.16430-1-chaitanya.kulkarni@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have support for more than on special operations REQ_OP_DISCARD and REQ_OP_WRITE_ZEROES create a helper to isolate the code common code. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk_main.c | 41 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index c734ddaa697f..f59a05bcf56f 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1107,28 +1107,36 @@ static int null_transfer(struct nullb *nullb, struct page *page, return err; } +static inline bool null_handle_special_op(struct nullb *nullb, sector_t sector, + unsigned int bytes, enum req_opf op) +{ + switch (op) { + case REQ_OP_DISCARD: + null_handle_discard(nullb, sector, bytes); + return true; + case REQ_OP_WRITE_ZEROES: + null_handle_write_zeroes(nullb, sector, bytes); + return true; + default: + break; + } + return false; +} + static int null_handle_rq(struct nullb_cmd *cmd) { struct request *rq = cmd->rq; struct nullb *nullb = cmd->nq->dev->nullb; int err; - unsigned int len; + unsigned int len = blk_rq_bytes(rq); sector_t sector; struct req_iterator iter; struct bio_vec bvec; sector = blk_rq_pos(rq); - switch (req_op(rq)) { - case REQ_OP_DISCARD: - null_handle_discard(nullb, sector, blk_rq_bytes(rq)); + if (null_handle_special_op(nullb, sector, len, req_op(rq))) return 0; - case REQ_OP_WRITE_ZEROES: - null_handle_write_zeroes(nullb, sector, blk_rq_bytes(rq)); - return 0; - default: - break; - } spin_lock_irq(&nullb->lock); rq_for_each_segment(bvec, rq, iter) { @@ -1149,27 +1157,18 @@ static int null_handle_rq(struct nullb_cmd *cmd) static int null_handle_bio(struct nullb_cmd *cmd) { - unsigned int blk_bio_bytes = bio_sectors(cmd->bio) << SECTOR_SHIFT; + unsigned int len = bio_sectors(cmd->bio) << SECTOR_SHIFT; struct bio *bio = cmd->bio; struct nullb *nullb = cmd->nq->dev->nullb; int err; - unsigned int len; sector_t sector; struct bio_vec bvec; struct bvec_iter iter; sector = bio->bi_iter.bi_sector; - switch (bio_op(bio)) { - case REQ_OP_DISCARD: - null_handle_discard(nullb, sector, blk_bio_bytes); + if (null_handle_special_op(nullb, sector, len, bio_op(bio))) return 0; - case REQ_OP_WRITE_ZEROES: - null_handle_write_zeroes(nullb, sector, blk_bio_bytes); - return 0; - default: - break; - } spin_lock_irq(&nullb->lock); bio_for_each_segment(bvec, bio, iter) {