From patchwork Wed Nov 4 22:08:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 7555171 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B8189F2F7 for ; Wed, 4 Nov 2015 22:20:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDB8620691 for ; Wed, 4 Nov 2015 22:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B48D3206BE for ; Wed, 4 Nov 2015 22:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031111AbbKDWUh (ORCPT ); Wed, 4 Nov 2015 17:20:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38098 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031096AbbKDWI4 (ORCPT ); Wed, 4 Nov 2015 17:08:56 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id B50F7C100450; Wed, 4 Nov 2015 22:08:56 +0000 (UTC) Received: from rh2.redhat.com (vpn-60-96.rdu2.redhat.com [10.10.60.96]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA4M8UTo008885; Wed, 4 Nov 2015 17:08:55 -0500 From: mchristi@redhat.com To: linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, drbd-dev@lists.linbit.com Cc: Mike Christie Subject: [PATCH 17/32] block: add operation field to bio struct Date: Wed, 4 Nov 2015 16:08:14 -0600 Message-Id: <1446674909-5371-18-git-send-email-mchristi@redhat.com> In-Reply-To: <1446674909-5371-1-git-send-email-mchristi@redhat.com> References: <1446674909-5371-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mike Christie This patch adds field to the bio to store the REQ_OP, and it has the block layer code set it. The next patches will modify the other drivers and filesystems to also set the bi_op. We are still ORing the op into the bi_rw. When I am done with the conversion, that will be dropped. Signed-off-by: Mike Christie --- block/bio.c | 11 +++++++++-- block/blk-core.c | 1 + block/blk-map.c | 4 +++- include/linux/blk_types.h | 8 +++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index ae91ccb..1cf8428 100644 --- a/block/bio.c +++ b/block/bio.c @@ -582,6 +582,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) bio->bi_bdev = bio_src->bi_bdev; bio_set_flag(bio, BIO_CLONED); bio->bi_rw = bio_src->bi_rw; + bio->bi_op = bio_src->bi_op; bio->bi_iter = bio_src->bi_iter; bio->bi_io_vec = bio_src->bi_io_vec; } @@ -664,6 +665,7 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask, bio->bi_bdev = bio_src->bi_bdev; bio->bi_rw = bio_src->bi_rw; + bio->bi_op = bio_src->bi_op; bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; @@ -1168,8 +1170,10 @@ struct bio *bio_copy_user_iov(struct request_queue *q, if (!bio) goto out_bmd; - if (iter->type & WRITE) + if (iter->type & WRITE) { bio->bi_rw |= REQ_WRITE; + bio->bi_op = REQ_OP_WRITE; + } ret = 0; @@ -1338,8 +1342,10 @@ struct bio *bio_map_user_iov(struct request_queue *q, /* * set data direction, and check if mapped pages need bouncing */ - if (iter->type & WRITE) + if (iter->type & WRITE) { bio->bi_rw |= REQ_WRITE; + bio->bi_op = REQ_OP_WRITE; + } bio_set_flag(bio, BIO_USER_MAPPED); @@ -1533,6 +1539,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, } else { bio->bi_end_io = bio_copy_kern_endio; bio->bi_rw |= REQ_WRITE; + bio->bi_op = REQ_OP_WRITE; } return bio; diff --git a/block/blk-core.c b/block/blk-core.c index d325ece..c8672f2 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1988,6 +1988,7 @@ EXPORT_SYMBOL(generic_make_request); void submit_bio(int op, int flags, struct bio *bio) { bio->bi_rw |= op | flags; + bio->bi_op = op; /* * If it's a regular read/write or a barrier with data attached, diff --git a/block/blk-map.c b/block/blk-map.c index f565e11..4a91dc4 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -223,8 +223,10 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, if (IS_ERR(bio)) return PTR_ERR(bio); - if (!reading) + if (!reading) { bio->bi_rw |= REQ_WRITE; + bio->bi_op = REQ_OP_WRITE; + } if (do_copy) rq->cmd_flags |= REQ_COPY_USER; diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index d7b6009..b974aea 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -48,9 +48,15 @@ struct bio { struct block_device *bi_bdev; unsigned int bi_flags; /* status, command, etc */ int bi_error; - unsigned long bi_rw; /* bottom bits READ/WRITE, + unsigned long bi_rw; /* bottom bits rq_flags_bits * top bits priority */ + /* + * this will be a u8 in the next patches and bi_rw can be shrunk to + * a u32. For compat in these transistional patches op is a int here. + */ + int bi_op; /* REQ_OP */ + struct bvec_iter bi_iter;