From patchwork Mon Oct 15 20:08:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1596121 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id 1C9A53FD86 for ; Mon, 15 Oct 2012 20:16:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKBS5J010451; Mon, 15 Oct 2012 16:11:28 -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 q9FKARRT027033 for ; Mon, 15 Oct 2012 16:10:27 -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 q9FKAMEV023923 for ; Mon, 15 Oct 2012 16:10:22 -0400 Received: from mail-da0-f46.google.com (mail-da0-f46.google.com [209.85.210.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9FK9oel018987 for ; Mon, 15 Oct 2012 16:10:21 -0400 Received: by mail-da0-f46.google.com with SMTP id n41so2761046dak.33 for ; Mon, 15 Oct 2012 13:10:21 -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=sUaSjSkUuXxCJQKNDzELNlKEhRsNZVYSEClWH5XmvDY=; b=V5E204CpGpcyqrY40MbMFkQIaPIMI8X7v0xD1kbtxgZ4gE5/YpgVda/qMdmDFAOu8T RM1wHXUpbNOIJ1UDALdj9byhYpXMQXs4cttGkJVS4+h1O2Zk0GUr53kQGCQgJeQ9LhTY A7A3r+MvXWt+YR79ZVCen6cAbgxhmhtXAxbHyr4C/BH/v7Hwkmr+KZ3m3/uwcidZw+bq yuDqcC8yJ50Cg93aWES+YdMV8uks1VMgouAoJCA0bQ1kwTP1OZXF/fSJalk5om0dnXho u1UCUlEBp0/1XahnoejWhGPFHElP8XJGZBAP1GqaytnLneNzkHgKehReqdsAfB+M0mik 3mHA== 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=sUaSjSkUuXxCJQKNDzELNlKEhRsNZVYSEClWH5XmvDY=; b=mILZaiE2ZajcyGteRe5KvSfifsYO0bEEDUweBzblnX0YK7+/Iv9HVQWiKenkk3av61 wueqBJlt+URPuDFsDWBZgYwJzHe1DbdW4aTEoxHjqY9qo9L10Dwc6NJmjsyiN/2dglAS 6zurFhO3mt4U31bHY/gTKzx8/0uU0DFPgMao3Cyr9V+12XEjaWrv+Qfnuc4cgCyj5BBy iKtmWdrvFPLh6NNoQlGTspUt1o1OVk5Wsl6YLvEqDm00w8M6+J7n3R0Nt9FT923QlCwW 3sX10tpHJiO97s+q+VKa48iL1FzxjcNWIYs6bXiK9/9j48s35dRc13VztZMZRWDfsYA0 rdaQ== Received: by 10.68.225.5 with SMTP id rg5mr39907908pbc.73.1350331821136; Mon, 15 Oct 2012 13:10:21 -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.10.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:10:20 -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:08:57 -0700 Message-Id: <1350331769-14856-24-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: ALoCoQlmiSg68Voph3NE9r5r8fWJ6RTtAeErqiFM4L/nnK9L5Apeya+Q6+HK5yHR9Z7Dd1H4OsbuCZsmU5W99+l2MXhYiCs89edhaMvmigqz2zQ7rrTl4mreNTZzjXHfMfvkfxfSVdUGdqAm2q+d62E70xx9MDz6D2ktVWstAxuvi0BdrtgJLHZmVBwmZpFgwHKOgUYjq4uF 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: axboe@kernel.dk, "Martin K. Petersen" , Kent Overstreet , tj@kernel.org, vgoyal@redhat.com Subject: [dm-devel] [PATCH v4 23/24] 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 ca7b02d..8fb4291 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c @@ -97,9 +97,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) { @@ -386,6 +384,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 79f16a6..5cd26d0 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 */