From patchwork Mon Oct 15 20:09:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595951 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id 0E1A43FD86 for ; Mon, 15 Oct 2012 20:14:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKBXcq007023; Mon, 15 Oct 2012 16:11:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKB8sG027394 for ; Mon, 15 Oct 2012 16:11:08 -0400 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9FKB3rc024085 for ; Mon, 15 Oct 2012 16:11:03 -0400 Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9FK9j4c018962 for ; Mon, 15 Oct 2012 16:11:02 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so5214154pad.33 for ; Mon, 15 Oct 2012 13:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=QJPJBUYc2WlKfyrCNRq7ht6q6G+bW0V10WvhznhkP1s=; b=OkQFveaa/nEU5CgZNUb58Auqcu4Nsuv7l+hgpDlrbgep20XsYg4PEX6MVs09tSs9Wz 4nr/cwCQ9PlLSDdsPoDFD+5jV2pBIUkeVVecloeqqTvAU8zraWoKZumkO9l9Jj6fwZFL 1aJBuI3jwQCQKjLVcEq/J0wDDwKh+GOXpd/aDVQuiLAjL6ivQccHZMcFs37d3OcVhMAZ FjcSuHHb+6zAv3q5WV60kmRO1EvM6e6PGm6Xs9CTWMAWcpVCfs7rI0CW1Pf+3+zD85Pv yznuuOJGKMnxR2XYyYFqfN+bXTmDQzzpPGXgioAzLdJjFiri/BsH+shRxW4cA3itwvUK lUrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=QJPJBUYc2WlKfyrCNRq7ht6q6G+bW0V10WvhznhkP1s=; b=K942qgtbmnDjBmOoToUc+WHklDfSFA9me21K8oXoAKJxGbPd8YqmrwImshLsdWDoMb KohflTFSsySZ2YI10J3sRQQfs+FRJDJc9TXfmvoCex5utOmorcU7zqfapk0Vxrxc+NlI /1aI3oOmKn7bWqy4fALYxMnYIQ3cAIALvBj9g2q+twyVVvZrrHI7QKp5FHte3Se1Iw9J Ti71sSBnYqRTaezy8pHnRJ6h5lGN/XWcca8pBOjIDHdngO6cfmTf2v0s0Btt/KnTF6sm zGG/cdgow7nnazMUGnx7uFIw7IvhE27Ff/kgntuCBIlgCixnJngq5A3b2Pnx8q8tHTU9 OS2Q== Received: by 10.66.77.199 with SMTP id u7mr35777892paw.7.1350331862751; Mon, 15 Oct 2012 13:11:02 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.110.66]) by mx.google.com with ESMTPS id k9sm3021703paz.22.2012.10.15.13.11.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:11:01 -0700 (PDT) From: Kent Overstreet To: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Date: Mon, 15 Oct 2012 13:09:28 -0700 Message-Id: <1350331769-14856-55-git-send-email-koverstreet@google.com> In-Reply-To: <1350331769-14856-1-git-send-email-koverstreet@google.com> References: <1350331769-14856-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQncZYn/NGk7IGK6n62DQckd+rlxUWehYhaPGmacW8igr7137Qx1/sOeDEpF++E6aFUDowyVjdVGG7jg4lrLlrNDK8fEMxsXpPJ7zqOUKx/X6GNS+ZE1syptI5lB1VRCcXgGa5Uhz7zlS3N0eNOz17jWscdHB1iABsmAmd2YqjZUF6sfjOAKpMexqPRUBo4GnUFhCM5Z X-RedHat-Spam-Score: -3.072 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-loop: dm-devel@redhat.com Cc: tj@kernel.org, axboe@kernel.dk, Kent Overstreet , "Martin K. Petersen" Subject: [dm-devel] [PATCH v2 25/26] bio-integrity: Add explicit field for owner of bip_buf X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com This was the only real user of BIO_CLONED, which didn't have very clear semantics. Convert to its own flag so we can get rid of BIO_CLONED. Signed-off-by: Kent Overstreet CC: Jens Axboe CC: Martin K. Petersen --- fs/bio-integrity.c | 5 ++--- include/linux/bio.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index e8555a5..462a131 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c @@ -94,9 +94,7 @@ void bio_integrity_free(struct bio *bio) struct bio_integrity_payload *bip = bio->bi_integrity; struct bio_set *bs = bio->bi_pool; - /* A cloned bio doesn't own the integrity metadata */ - if (!bio_flagged(bio, BIO_CLONED) && !bio_flagged(bio, BIO_FS_INTEGRITY) - && bip->bip_buf != NULL) + if (bip->bip_owns_buf) kfree(bip->bip_buf); if (bs) { @@ -382,6 +380,7 @@ int bio_integrity_prep(struct bio *bio) return -EIO; } + bip->bip_owns_buf = 1; bip->bip_buf = buf; bip->bip_size = len; bip->bip_sector = bio->bi_sector; diff --git a/include/linux/bio.h b/include/linux/bio.h index edd66f3..f429d0f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -178,6 +178,7 @@ struct bio_integrity_payload { unsigned short bip_slab; /* slab the bip came from */ unsigned short bip_vcnt; /* # of integrity bio_vecs */ unsigned short bip_idx; /* current bip_vec index */ + unsigned bip_owns_buf:1; /* should free bip_buf */ struct work_struct bip_work; /* I/O completion */