From patchwork Wed Nov 4 22:08:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 7555531 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A576BEEA4 for ; Wed, 4 Nov 2015 22:28:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8CBDA206BE for ; Wed, 4 Nov 2015 22:28:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76F97206D2 for ; Wed, 4 Nov 2015 22:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031479AbbKDW2C (ORCPT ); Wed, 4 Nov 2015 17:28:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63797 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031037AbbKDWIo (ORCPT ); Wed, 4 Nov 2015 17:08:44 -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 074137F6A2; Wed, 4 Nov 2015 22:08:44 +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 tA4M8UTf008885; Wed, 4 Nov 2015 17:08:42 -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 08/32] target: prepare for bi_rw split Date: Wed, 4 Nov 2015 16:08:05 -0600 Message-Id: <1446674909-5371-9-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 prepares lio's submit_bio use for the next patches that split bi_rw into a operation and flags field. Instead of passing in a bitmap with both the operation and flags mixed in, the callers will now pass them in seperately. This patch modifies the code related to the submit_bio calls so the flags and operation are seperated. When this is done for all code, one of the later patches in the series will the actual submit_bio call, so the patches are bisectable. Signed-off-by: Mike Christie --- drivers/target/target_core_iblock.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 0f19e11..25f75ab 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -354,14 +354,14 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num) return bio; } -static void iblock_submit_bios(struct bio_list *list, int rw) +static void iblock_submit_bios(struct bio_list *list, int op, int op_flags) { struct blk_plug plug; struct bio *bio; blk_start_plug(&plug); while ((bio = bio_list_pop(list))) - submit_bio(rw, bio); + submit_bio(op | op_flags, bio); blk_finish_plug(&plug); } @@ -480,7 +480,7 @@ iblock_execute_write_same(struct se_cmd *cmd) sectors -= 1; } - iblock_submit_bios(&list, WRITE); + iblock_submit_bios(&list, REQ_OP_WRITE, 0); return 0; fail_put_bios: @@ -653,7 +653,8 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, u32 sg_num = sgl_nents; sector_t block_lba; unsigned bio_cnt; - int rw = 0; + int op_flags = 0; + int op = 0; int i; if (data_direction == DMA_TO_DEVICE) { @@ -664,17 +665,20 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, * is not enabled, or if initiator set the Force Unit Access bit. */ if (q->flush_flags & REQ_FUA) { - if (cmd->se_cmd_flags & SCF_FUA) - rw = WRITE_FUA; - else if (!(q->flush_flags & REQ_FLUSH)) - rw = WRITE_FUA; - else - rw = WRITE; + if (cmd->se_cmd_flags & SCF_FUA) { + op = REQ_OP_WRITE; + op_flags = WRITE_FUA; + } else if (!(q->flush_flags & REQ_FLUSH)) { + op = REQ_OP_WRITE; + op_flags = WRITE_FUA; + } else { + op = REQ_OP_WRITE; + } } else { - rw = WRITE; + op = REQ_OP_WRITE; } } else { - rw = READ; + op = REQ_OP_READ; } /* @@ -726,7 +730,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset) != sg->length) { if (bio_cnt >= IBLOCK_MAX_BIO_PER_TASK) { - iblock_submit_bios(&list, rw); + iblock_submit_bios(&list, op, op_flags); bio_cnt = 0; } @@ -750,7 +754,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, goto fail_put_bios; } - iblock_submit_bios(&list, rw); + iblock_submit_bios(&list, op, op_flags); iblock_complete_cmd(cmd); return 0;