From patchwork Mon Sep 24 22:35:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1500751 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork2.kernel.org (Postfix) with ESMTP id B769FDF280 for ; Mon, 24 Sep 2012 22:39:04 +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 q8OMb9hR030562; Mon, 24 Sep 2012 18:37:09 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMa7J7009375 for ; Mon, 24 Sep 2012 18:36:07 -0400 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMa2XN019554 for ; Mon, 24 Sep 2012 18:36:02 -0400 Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8OMZWDf031435 for ; Mon, 24 Sep 2012 18:36:00 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so7786719pbb.33 for ; Mon, 24 Sep 2012 15:36:00 -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=BlGsWDfOcfMvVhRETMyMvkyW5YrijfuRoi6+K+f6F8o=; b=NYBEJqrce1JNdmTZcy/c8QEDWhiWwpptPRU7AAB1PV/+NtZd7tF6LgJ4MyYu7CPo4d lzX/Zi1kHG3sHOo82jmghHb/AttkXijUfi8A8tKh9X0X5yZCslvonCnbUbQnD165gkAB kDq5IGVAEeAd+Pezv4vK+y8mLn5QR9X5t85PkaXdE3+xwTn/6xyx+JMjKUy4ll3bA0rh 0y5IssWO1+NVJGxQy31bSIxSf7vRzGYyaDiUoyRWKaysBqxFhQBq6PuUXwyuHZTFBvIT sc5LswTxDosoRQfSGsOGGsM5U1B/sS/jcW/tkcDWFn79DUB39Sl+bc4vRHYUiwtol5jZ bZFA== 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=BlGsWDfOcfMvVhRETMyMvkyW5YrijfuRoi6+K+f6F8o=; b=kog6QhtgjI4YoJQsNAXYABhI/An9b6F09S5bNome3l/re56/c9vqCz1qnxX4rvuBHh kHhiJezgI5SYd4b+lOm9VXvTPUqI++Hv82cXQWw6/KV0U4U2INYBZ9bm+zwZcbYiwIGf wT3ap9Nlu7st+Q6y+HL6ZgY7qMxdiSUggLxK8AipM1qY+Km/e2FiSufBVSTdyNquf2O9 vbIT57MTMzuX1x6h3RyT4JMR1YrnHbZogNrI+azou/zxMlqjqy5229rQ9mKqeAvj/I13 vtl59QaVyeqDFI+PXNOr5jOUgFA9Lc4BtLaM1CLBPB36fJkMu49SzndD+YQqjSUYWJ8c GyKQ== Received: by 10.68.138.163 with SMTP id qr3mr40376873pbb.161.1348526160817; Mon, 24 Sep 2012 15:36:00 -0700 (PDT) Received: by 10.68.138.163 with SMTP id qr3mr40376857pbb.161.1348526160646; Mon, 24 Sep 2012 15:36:00 -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 nu8sm133316pbc.45.2012.09.24.15.35.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 15:36:00 -0700 (PDT) From: Kent Overstreet To: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Date: Mon, 24 Sep 2012 15:35:05 -0700 Message-Id: <1348526106-17074-26-git-send-email-koverstreet@google.com> In-Reply-To: <1348526106-17074-1-git-send-email-koverstreet@google.com> References: <1348526106-17074-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQn3GKH7uymu1vFlMs7ITvA7FUTbvlT5bjcPaSYsOOeo7cEw5pXUNSTDpZugTka583Xksg0cjU/S8c1aw9TxTpZAyWp6LjRzDWjVnvAAIGtzwv4R8G6dK+liGsYQwo9b27JTiyqsSsl3Pz6EF5r7E3KI3c/qmg43qVpB8NOLvzOPAIiul+azYDdyB/vVLmcjI61d9k9h X-RedHat-Spam-Score: -3.512 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 v3 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 f175814..c5f33b4 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c @@ -95,9 +95,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) { @@ -384,6 +382,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 bd130b6..d316fb3 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 */