From patchwork Wed Mar 27 17:39:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 2352421 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 0A608DFE82 for ; Wed, 27 Mar 2013 17:43:40 +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 r2RHeOZM030077; Wed, 27 Mar 2013 13:40:25 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2RHeLE5011529 for ; Wed, 27 Mar 2013 13:40:21 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2RHeLci009859 for ; Wed, 27 Mar 2013 13:40:21 -0400 Received: from mail-da0-f41.google.com (mail-da0-f41.google.com [209.85.210.41]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2RHeJr7017544 for ; Wed, 27 Mar 2013 13:40:20 -0400 Received: by mail-da0-f41.google.com with SMTP id w4so4211445dam.14 for ; Wed, 27 Mar 2013 10:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=1dht5i0+nqtBJY48y5z4KQngL+nQh3cb/rvZpkPbeEw=; b=E076SRJaJN667ptSs32Izvi0d7FkxAwgxoPcQoUS7bIqLCU30YNrFvq+Gq+eoLKwJG Lr/dL1O0BsxGT7IEZAIDjh2g9H8fPxd8yGrbd0rpSBcbUKrN1KDo+j04/+GL5cj0UoYR JvJmEbg29eaV3iEp8PRL/TGFSecFHk/fCHzKK3v2MRk7MbaisjXXQY0tEpyzkMlcMP8H bpKDxhzhpWhrJdvBqpkYrLw8pjBM1lhcMThoR5mvmf41+AqDX6yoUIspZEo74k0h3Wwo dTFvqPyUEEMPx+d5emNsxnESpuZgGXOYWAsAxgniRoYmD8Lip1MBow0ZDzI5nMHYXEnM 9tPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=1dht5i0+nqtBJY48y5z4KQngL+nQh3cb/rvZpkPbeEw=; b=Rww/Cc/Qd7JvlMoNZvWr3h1cVhT3FlRvuelNoJqGyr/IDnsGHeejn80HegICvEuR/Q eYMaQnXEklQkSYqNsneifoOY3qPeqIINGOiFKnTkGLmRlAIAoFKysZTdfXh4sY/8PQAs WUgZ7vHTGUr8RuJwSKkgp5TtzYVDZLJD5k2b/8tMEulZLXpozw8oberEJVy60i9o5ify HwkCKCaZbOL8kwnB3qi3dCQI1ytAUQqRy5M/h8swJ1pPy0jeosZKoXaWwjQKaRDW+XpR tQcmT5BG+3wS3MPUBxLC0d1Wa/O5+ZhQ0i3aeC8s2p9tlNMMsBUtW9BAYk+QmC2gerjE 361w== X-Received: by 10.66.84.10 with SMTP id u10mr28495578pay.199.1364406019459; Wed, 27 Mar 2013 10:40:19 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.126.133]) by mx.google.com with ESMTPS id qd8sm22195440pbc.29.2013.03.27.10.40.18 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Mar 2013 10:40:18 -0700 (PDT) From: Kent Overstreet To: axboe@kernel.dk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@vger.kernel.org Date: Wed, 27 Mar 2013 10:39:33 -0700 Message-Id: <1364405992-28424-4-git-send-email-koverstreet@google.com> In-Reply-To: <1364405992-28424-1-git-send-email-koverstreet@google.com> References: <1364405992-28424-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQk8/+WJJJu3KADz+7DOrwlDCz5Wl4xtmaXPZOmnBAaFi45iocCyAXTM0+WzY03grIYSu93sE/9W+bmez/IHgOSHyZ+bDZQtQzSfS0iZ5dmZ9hg4wivLrFAKzOstqhtXFgaHgejhATkEkLvV4JK8RvjKmM4/+JTozBqWrb/BUSl6eCQ5/bIFdQZ5R0RhAanW03wAxgAe X-RedHat-Spam-Score: -3.999 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: "Ed L. Cashin" , Kent Overstreet , "James E.J. Bottomley" , dm-devel@redhat.com, tj@kernel.org, Alasdair Kergon Subject: [dm-devel] [PATCH 03/22] block: Convert bio_iovec() to bvec_iter 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 For immutable biovecs, we'll be introducing a new bio_iovec() that uses our new bvec iterator to construct a biovec, taking into account bvec_iter->bi_bvec_done - this patch updates existing users for the new usage. Signed-off-by: Kent Overstreet Cc: Jens Axboe Cc: "Ed L. Cashin" Cc: Alasdair Kergon Cc: dm-devel@redhat.com Cc: "James E.J. Bottomley" --- drivers/block/aoe/aoecmd.c | 2 +- drivers/md/dm-verity.c | 2 +- drivers/scsi/sd.c | 2 +- fs/bio.c | 20 ++++++++++---------- include/linux/bio.h | 10 ++++++---- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 039ce17..80e5d65 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -927,7 +927,7 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio) buf->resid = bio->bi_iter.bi_size; buf->sector = bio->bi_iter.bi_sector; bio_pageinc(bio); - buf->bv = bv = bio_iovec(bio); + buf->bv = bv = __bio_iovec(bio); buf->bv_resid = bv->bv_len; WARN_ON(buf->bv_resid == 0); } diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index b17233a..782ee42 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c @@ -496,7 +496,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio) io->io_vec = io->io_vec_inline; else io->io_vec = mempool_alloc(v->vec_mempool, GFP_NOIO); - memcpy(io->io_vec, bio_iovec(bio), + memcpy(io->io_vec, __bio_iovec(bio), io->io_vec_size * sizeof(struct bio_vec)); verity_prefetch_io(v, io); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7992635..5e0d12c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -771,7 +771,7 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) if (sdkp->device->no_write_same) return BLKPREP_KILL; - BUG_ON(bio_offset(bio) || bio_iovec(bio)->bv_len != sdp->sector_size); + BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size); sector >>= ilog2(sdp->sector_size) - 9; nr_sectors >>= ilog2(sdp->sector_size) - 9; diff --git a/fs/bio.c b/fs/bio.c index 85dcc10..8543f85 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -820,12 +820,12 @@ void bio_advance(struct bio *bio, unsigned bytes) break; } - if (bytes >= bio_iovec(bio)->bv_len) { - bytes -= bio_iovec(bio)->bv_len; + if (bytes >= bio_iovec(bio).bv_len) { + bytes -= bio_iovec(bio).bv_len; bio->bi_iter.bi_idx++; } else { - bio_iovec(bio)->bv_len -= bytes; - bio_iovec(bio)->bv_offset += bytes; + bio_iovec(bio).bv_len -= bytes; + bio_iovec(bio).bv_offset += bytes; bytes = 0; } } @@ -878,8 +878,8 @@ void bio_copy_data(struct bio *dst, struct bio *src) unsigned src_offset, dst_offset, bytes; void *src_p, *dst_p; - src_bv = bio_iovec(src); - dst_bv = bio_iovec(dst); + src_bv = __bio_iovec(src); + dst_bv = __bio_iovec(dst); src_offset = src_bv->bv_offset; dst_offset = dst_bv->bv_offset; @@ -892,7 +892,7 @@ void bio_copy_data(struct bio *dst, struct bio *src) if (!src) break; - src_bv = bio_iovec(src); + src_bv = __bio_iovec(src); } src_offset = src_bv->bv_offset; @@ -905,7 +905,7 @@ void bio_copy_data(struct bio *dst, struct bio *src) if (!dst) break; - dst_bv = bio_iovec(dst); + dst_bv = __bio_iovec(dst); } dst_offset = dst_bv->bv_offset; @@ -1767,8 +1767,8 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors) bp->bio1.bi_iter.bi_size = first_sectors << 9; if (bi->bi_vcnt != 0) { - bp->bv1 = *bio_iovec(bi); - bp->bv2 = *bio_iovec(bi); + bp->bv1 = bio_iovec(bi); + bp->bv2 = bio_iovec(bi); if (bio_is_rw(bi)) { bp->bv2.bv_offset += first_sectors << 9; diff --git a/include/linux/bio.h b/include/linux/bio.h index d321e63..580c9ae 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -62,9 +62,11 @@ * on highmem page vectors */ #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) -#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) -#define bio_page(bio) bio_iovec((bio))->bv_page -#define bio_offset(bio) bio_iovec((bio))->bv_offset +#define __bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) +#define bio_iovec(bio) (*__bio_iovec(bio)) + +#define bio_page(bio) (bio_iovec((bio)).bv_page) +#define bio_offset(bio) (bio_iovec((bio)).bv_offset) #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx) #define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9) #define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) @@ -72,7 +74,7 @@ static inline unsigned int bio_cur_bytes(struct bio *bio) { if (bio->bi_vcnt) - return bio_iovec(bio)->bv_len; + return bio_iovec(bio).bv_len; else /* dataless requests such as discard */ return bio->bi_iter.bi_size; }