From patchwork Tue Jun 26 22:26:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10490251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE8E6601A0 for ; Tue, 26 Jun 2018 22:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B57C12863F for ; Tue, 26 Jun 2018 22:26:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A897E28703; Tue, 26 Jun 2018 22:26:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44F6D2863F for ; Tue, 26 Jun 2018 22:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754769AbeFZW0Z (ORCPT ); Tue, 26 Jun 2018 18:26:25 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:13968 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754759AbeFZW0Z (ORCPT ); Tue, 26 Jun 2018 18:26:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530051986; x=1561587986; h=from:to:cc:subject:date:message-id; bh=3z0+4iO/b9vTOVmgwVs3V+wTir0plV6cBJiVhWh1eYA=; b=I4ROipIVDNifdjlIt8k66CBYLlvbOjRfVh6EI5aYVHsTlfK1dphN93F5 vfHYok3yiOnGHPucahIeCZmFedMrl6xpB5NCKP2KWE5aOkQ3ZxgI6TSFj pXqVpguVlv7/DFXsl1osHQ6LGSSo8T5dbgQy4l+AwPcHju3951wcRAxYF pfAgCb5KtG3drBCIwHlW1UhtvEMBe5VkscGijO+AsjHTJ1gJe+4+KiG1a 6kcCFAneHoMlQurX/hPmhocJOGCYJUrywvjGbp27fFugZpotsK6udHo6B fTXS3f9BuONkn3Qk6pvbK76iWH4bVvAx+SudZ/Gc9BFyOOMX/2BoE4+Qh w==; X-IronPort-AV: E=Sophos;i="5.51,276,1526313600"; d="scan'208";a="83178393" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Jun 2018 06:26:25 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 26 Jun 2018 15:15:43 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Jun 2018 15:26:24 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei Subject: [PATCH] block: Simplify the bio cloning implementation Date: Tue, 26 Jun 2018 15:26:24 -0700 Message-Id: <20180626222624.11739-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no good reason to use different code paths for different request operations. Hence remove the switch/case statement from bio_clone_bioset(). Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Ming Lei --- block/bio.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/block/bio.c b/block/bio.c index f7e3d88bd0b6..4c27cc9ea55e 100644 --- a/block/bio.c +++ b/block/bio.c @@ -691,19 +691,8 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask, bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector; bio->bi_iter.bi_size = bio_src->bi_iter.bi_size; - switch (bio_op(bio)) { - case REQ_OP_DISCARD: - case REQ_OP_SECURE_ERASE: - case REQ_OP_WRITE_ZEROES: - break; - case REQ_OP_WRITE_SAME: - bio->bi_io_vec[bio->bi_vcnt++] = bio_src->bi_io_vec[0]; - break; - default: - bio_for_each_segment(bv, bio_src, iter) - bio->bi_io_vec[bio->bi_vcnt++] = bv; - break; - } + bio_for_each_segment(bv, bio_src, iter) + bio->bi_io_vec[bio->bi_vcnt++] = bv; if (bio_integrity(bio_src)) { int ret;