From patchwork Mon Sep 24 22:34:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1500931 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 4AF803FE80 for ; Mon, 24 Sep 2012 22:40:33 +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 q8OMb6CC025991; Mon, 24 Sep 2012 18:37:06 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.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 q8OMZvT7009273 for ; Mon, 24 Sep 2012 18:35:57 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8OMZqKJ006348 for ; Mon, 24 Sep 2012 18:35:52 -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 q8OMZU57013957 for ; Mon, 24 Sep 2012 18:35:51 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so7786683pbb.33 for ; Mon, 24 Sep 2012 15:35:51 -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=eWoCfk/YOjc7PAfloJkWw4vF+N4iRzHeHL7kLANHdDY=; b=Vl5fkrYAv0apC1YyTqQEnxT7c6Fw5yeBcPnaD8a0gXLyrA3U/bJOtLiE9ogU7hcZ/5 MLya2uEM2ryTvHVIgsaVBl77nx1MJd9OZhHLSk3AZ2ciWB8gntzjgw4yFmhKLpfKIxE+ VEukkFiRuS45/pFCy05iBZujklGW3hs5dHB7wuY4qFx/XSje2SYmVEnvmE7zmUOhaoFz 9khUT2X4R0CSS29OjGOHCWTqBc66FRMpY1M43msEeyEupu6bh3feTVbGHA8oEB7JmDJQ Mqcm9P+kpA0YrRhFKAJ/WtEtpvSsgEtcMuG/wkZSEpP6W49+v6fbSnuP8X4KUcEZ+npU kITA== 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=eWoCfk/YOjc7PAfloJkWw4vF+N4iRzHeHL7kLANHdDY=; b=XMVRNIe6Mj/0c3UB37IAjF939TxJ4nGKvH16LrdpzwAyjicHqN6PUpghlcyt0ponQG P+Px3Qn2KQGq9bWeCd3LCiMglJ6yvu/fFyB7WXNAZW6eg5rv8bvpr04XsLFVoI4T5aPV XxCkkVHaE2Yg0fJDilKKsK4a4KI2cjFIPu+cBHmhj/wb/PfATcRMcXs9pqFrCO5n2bFZ Vvjxx2hRWrgZ21mmMfvXuE7p3afSmx1DBpnigV1yIY80Rn/TyxmIGuB6cHgicJVfmBog N+UjCjNMGRu6n2mMPG5C5ZmLTHCNdHA8be/WcEWV+WwjUSx+/3U3YSi/0YutanFiGGZ0 6F5w== Received: by 10.68.189.70 with SMTP id gg6mr40930682pbc.125.1348526151224; Mon, 24 Sep 2012 15:35:51 -0700 (PDT) Received: by 10.68.189.70 with SMTP id gg6mr40930660pbc.125.1348526151118; Mon, 24 Sep 2012 15:35:51 -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.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 15:35:50 -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:34:58 -0700 Message-Id: <1348526106-17074-19-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: ALoCoQmJNOAAbNPxtOcG7JoNSAV/Yh3LtDF6HDo9qGw5qFU4qMWK36WN1fBTYFu8DoEw4mT24u6Gx906l9nzJEr1pvGeiBelcA99Lire0Y38dz5CBO6taRE5Flkpk5l0CMhNJXYcI2I7IeWyFfXRzvFY3VLOX1mjMs+6Khj36gEmjgUGNTJOeJ7FNo6U7omGH/SkOVAGsWZJ 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.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, Jiri Kosina , Kent Overstreet , tj@kernel.org, vgoyal@redhat.com Subject: [dm-devel] [PATCH v3 18/26] pktcdvd: Use bio_reset() in disabled code to kill bi_idx usage 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 In the short term this'll help with code auditing, and if this code ever gets used now it's converted :) Signed-off-by: Kent Overstreet CC: Jiri Kosina --- drivers/block/pktcdvd.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 783c96c..1119042 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -1156,16 +1156,15 @@ static int pkt_start_recovery(struct packet_data *pkt) new_sector = new_block * (CD_FRAMESIZE >> 9); pkt->sector = new_sector; + bio_reset(pkt->bio); + pkt->bio->bi_bdev = pd->bdev; + pkt->bio->bi_rw = REQ_WRITE; pkt->bio->bi_sector = new_sector; - pkt->bio->bi_next = NULL; - pkt->bio->bi_flags = 1 << BIO_UPTODATE; - pkt->bio->bi_idx = 0; - - BUG_ON(pkt->bio->bi_rw != REQ_WRITE); - BUG_ON(pkt->bio->bi_vcnt != pkt->frames); - BUG_ON(pkt->bio->bi_size != pkt->frames * CD_FRAMESIZE); - BUG_ON(pkt->bio->bi_end_io != pkt_end_io_packet_write); - BUG_ON(pkt->bio->bi_private != pkt); + pkt->bio->bi_size = pkt->frames * CD_FRAMESIZE; + pkt->bio->bi_vcnt = pkt->frames; + + pkt->bio->bi_end_io = pkt_end_io_packet_write; + pkt->bio->bi_private = pkt; drop_super(sb); return 1;