From patchwork Sun Oct 27 14:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 11214131 X-Patchwork-Delegate: snitzer@redhat.com 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 6C39D1747 for ; Sun, 27 Oct 2019 14:07:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CDDA21726 for ; Sun, 27 Oct 2019 14:07:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GXnGuFOs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CDDA21726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572185263; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=3aggEo/hGoWFuFT/hsYyTq2rBsrVvoG4AX1zMUYx1fY=; b=GXnGuFOs19P6J5lGMCbG3CjVPHYM/UWyTGREx8sHt+BFWouKwOba4mGN+l61LWcBhnC13L 7sksJHSImmJjgM1WMxfVjmIXutctc5VMDSHgspgnezkQ9rHOqVGvvvaPUJWWaWdImatX96 RW3XRt10fgQtTvVQxkA8d8a44u4WHuY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-U5KHgV4iMqqTCFJnQoRLWg-1; Sun, 27 Oct 2019 10:07:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52C761800D53; Sun, 27 Oct 2019 14:07:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F0425C1D4; Sun, 27 Oct 2019 14:07:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EFE7D1803B4B; Sun, 27 Oct 2019 14:07:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9RE7ZWL007733 for ; Sun, 27 Oct 2019 10:07:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2213F3DE0; Sun, 27 Oct 2019 14:07:35 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx21.extmail.prod.ext.phx2.redhat.com [10.5.110.62]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1916719C68; Sun, 27 Oct 2019 14:07:32 +0000 (UTC) Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45AB518C4267; Sun, 27 Oct 2019 14:07:07 +0000 (UTC) IronPort-SDR: 529BX8sWxSmDZWFJzv6GJAjQp+hnupg0DUz3bv+urxO3a0OxbSuKN+sYwTjD//4RTIjr4V9ykU zjAAVDQMqxeoFKUtCu42rYmgFjaCLsQRhsgiZ5kALL/cmHYGR2M/2NQm+3Vw4eeW0hnVwPNeNB eKRo18lPOdvpW10xs+K2D98SA/mEBNnUthT5xBY3zR16maobUPSm4iVY0psAhb+Ef/QBm96lGs G9SnGvl99/jl4/saGRpxz7zKxh9k/J5jdH4yDIldYgzxPqjvm80BeMcYq049FueKO7tMtYob1R m1M= X-IronPort-AV: E=Sophos;i="5.68,236,1569254400"; d="scan'208";a="122197772" 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; 27 Oct 2019 22:06:05 +0800 IronPort-SDR: k/aah0RUl5KaWcLmTs+KTUmxQeoqTJwkFDv7YvWS3bQKU0o6vaDg+ToN2prV+5wxa5get7rBdL 1pDSANrb0e2GftCmwvlgL+ZwmiX06Rxq/KJ2b6c7zrRcCAciwQgAeiQjD6c/CXR9OVlO5abveu HuhqiY7TKoCsQXDS9m65Wkl3m8NJZM5mxkVl8WUufa0kxDZ1j63ahfIMySHB36uUxwbGv47gd1 zwBFNln9HhYFavf7mwg7JWtRcMJnrEkxVWGmw/4cBVgZwBsjl4kmCaYP4dPxOwjvAD+zZTOZO4 ogwV/61HEWTVfQqk3IJLQES9 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2019 07:01:34 -0700 IronPort-SDR: YCvuQJ0KJZaaS7VQV7JrO6VOOK0XqmnAIZPpCjeCB1f3SBrHammem3xiraVvye+soPyS3Vjrf7 XN2wVgcC8yqf7tcL0QK4A/otP4oX8f2Z4zgkj6bSrOMrECzAuRmL2oyKxm0OqTi5qIsfQ1kh/J LlzV1e1saprX7eW6oaPjzGzu7b1XWQ8cl6UXUHPl+O9D2d+2FDJHkRyboTg+nNbV9z8IgNA+j3 A/AhfbyfHkwZGJrpmtd8vpMOJenchm46j4hGLs6bS+cowRC3jbWmXrBTTStumGKnDKKt/WFjvM Vjs= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 27 Oct 2019 07:06:03 -0700 From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@redhat.com, Mike Snitzer Date: Sun, 27 Oct 2019 23:05:48 +0900 Message-Id: <20191027140549.26272-8-damien.lemoal@wdc.com> In-Reply-To: <20191027140549.26272-1-damien.lemoal@wdc.com> References: <20191027140549.26272-1-damien.lemoal@wdc.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Sun, 27 Oct 2019 14:07:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Sun, 27 Oct 2019 14:07:23 +0000 (UTC) for IP:'216.71.153.144' DOMAIN:'esa5.hgst.iphmx.com' HELO:'esa5.hgst.iphmx.com' FROM:'damien.lemoal@wdc.com' RCPT:'' X-RedHat-Spam-Score: -2.399 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED, SPF_HELO_NONE) 216.71.153.144 esa5.hgst.iphmx.com 216.71.153.144 esa5.hgst.iphmx.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.62 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: Dmitry Fomichev , Keith Busch , Hans Holmberg , Ajay Joshi , Matias Bjorling Subject: [dm-devel] [PATCH 7/8] dm: add zone open, close and finish support X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: U5KHgV4iMqqTCFJnQoRLWg-1 X-Mimecast-Spam-Score: 0 From: Ajay Joshi Implement REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH support to allow explicit control of zone states. Contains contributions from Matias Bjorling, Hans Holmberg and Damien Le Moal. Signed-off-by: Ajay Joshi Signed-off-by: Matias Bjorling Signed-off-by: Hans Holmberg Signed-off-by: Damien Le Moal Acked-by: Mike Snitzer Reviewed-by: Christoph Hellwig --- drivers/md/dm-flakey.c | 7 +++---- drivers/md/dm-linear.c | 2 +- drivers/md/dm.c | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c index 2900fbde89b3..76587e9af0ef 100644 --- a/drivers/md/dm-flakey.c +++ b/drivers/md/dm-flakey.c @@ -280,7 +280,7 @@ static void flakey_map_bio(struct dm_target *ti, struct bio *bio) struct flakey_c *fc = ti->private; bio_set_dev(bio, fc->dev->bdev); - if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET) + if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio))) bio->bi_iter.bi_sector = flakey_map_sector(ti, bio->bi_iter.bi_sector); } @@ -322,8 +322,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); pb->bio_submitted = false; - /* Do not fail reset zone */ - if (bio_op(bio) == REQ_OP_ZONE_RESET) + if (op_is_zone_mgmt(bio_op(bio))) goto map_bio; /* Are we alive ? */ @@ -384,7 +383,7 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, struct flakey_c *fc = ti->private; struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); - if (bio_op(bio) == REQ_OP_ZONE_RESET) + if (op_is_zone_mgmt(bio_op(bio))) return DM_ENDIO_DONE; if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index ecefe6703736..97acafd48c85 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -90,7 +90,7 @@ static void linear_map_bio(struct dm_target *ti, struct bio *bio) struct linear_c *lc = ti->private; bio_set_dev(bio, lc->dev->bdev); - if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET) + if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio))) bio->bi_iter.bi_sector = linear_map_sector(ti, bio->bi_iter.bi_sector); } diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 1a5e328c443a..bc143c1b2333 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1174,7 +1174,8 @@ static size_t dm_dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, /* * A target may call dm_accept_partial_bio only from the map routine. It is - * allowed for all bio types except REQ_PREFLUSH and REQ_OP_ZONE_RESET. + * allowed for all bio types except REQ_PREFLUSH, REQ_OP_ZONE_RESET, + * REQ_OP_ZONE_OPEN, REQ_OP_ZONE_CLOSE and REQ_OP_ZONE_FINISH. * * dm_accept_partial_bio informs the dm that the target only wants to process * additional n_sectors sectors of the bio and the rest of the data should be @@ -1627,7 +1628,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, ci.sector_count = 0; error = __send_empty_flush(&ci); /* dec_pending submits any data associated with flush */ - } else if (bio_op(bio) == REQ_OP_ZONE_RESET) { + } else if (op_is_zone_mgmt(bio_op(bio))) { ci.bio = bio; ci.sector_count = 0; error = __split_and_process_non_flush(&ci);