Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp366060pxm; Tue, 22 Feb 2022 12:29:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJykdV3OxCmSoFKmH+tNP8VxFUiwNcCJdF3G/BjoJWQXc4tMt2Lxr7GgE1eDooZsukrICFPj X-Received: by 2002:a17:906:360a:b0:6b9:1f8:9cdd with SMTP id q10-20020a170906360a00b006b901f89cddmr20933059ejb.461.1645561763597; Tue, 22 Feb 2022 12:29:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645561763; cv=none; d=google.com; s=arc-20160816; b=FGfoP5HnKnX9KOJhJz3OuT3npu8e1quJ9c8JrFl3ckRxEoPsI4Gis+cvh2oLUz6UPL EwkjBD3g9Qx42MhUmdTJPw93yQTz2tpbT/G7AVjK4oBfTSpWDa0oUH2sgZsJmCv7g4cH mznhvf3tAXc9CpLCqMpRRivkVST4k3WwRswKDURwnSMw8h7ifmMysB0qV0hj/0oAe+Gu HToMxMJmaHLMWz431HAYGk0mVN+HmOZ3jMRlizMO8nvsm6jiUwTsLsWVl/JaJioFyefR XPu6zr7P1v01VuTMx+XNTycyGlmo0oiXnxYW+u3tUi8FrQBjfLjqSTgNA91jn1Yv0dzd 94LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+U8cxPvWKrvxpKekOCC5dqw8suy2lTzpNt0Z4iXLejo=; b=xS+95ebvZ7k5pGgjJ/AOu/55agBV1ImmL7rngrFqQDV2Bi6pciU7vO145zn2Fr/6O2 lCa8DCw6FJPOn0roEETVuujUQVnakS5o1+S8m+KcOt0HrOIwdRiP2Kl8uuRxyZjFvNYT kGsrnoSDl/9efktNlbZEo9ZjOOMkwxytWd4g9TBICc/NxJAYnbRV5Nw2Oi54sSbd50wq Hd6Wk48jcnAaisCwyol5mQx3rHGbijUsAqKH5/PyU+Bdm/R92zfKGVUZtGL4PkH0Kyg1 85j1cnpKfZ8DAoTOM5wfC58qUpPMUDAmAWGS39QyfDXkQzcWugqoGDCsQBY5UM3u1FXf e8dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mQLRZJy2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr4si14470759ejc.321.2022.02.22.12.28.47; Tue, 22 Feb 2022 12:29:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=mQLRZJy2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233523AbiBVPrR (ORCPT + 99 others); Tue, 22 Feb 2022 10:47:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbiBVPrO (ORCPT ); Tue, 22 Feb 2022 10:47:14 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BADAF2A711; Tue, 22 Feb 2022 07:46:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=+U8cxPvWKrvxpKekOCC5dqw8suy2lTzpNt0Z4iXLejo=; b=mQLRZJy2Jqv/KuVeCdT4HHJA2U LzZMFpfze3cdBygMl4Y+GIuFDPE9conHrq+1Z67JdBTeJj7tbFMFHwQBw02hHjZNk2R2w+IBOjxLV mDcJGmbFGfRqceK5/HLSqQEhbj07Vd3QDvMYzJcI/7hJaC6ftH6nJOQlsViYOp9x/4YdDgWEliOpw z2mY5ccVq7YrV1/UHe+ZHKWRYa92h5bPSz65+tl2q49fTAEsM+VebGcYK+oP6oi9fCFvjUOKFmSuL 0bn4Ine/T86sqivRxd7n6ifRuO0eeMbVVn2BsO53n2b/01OqxIpBN50r5w9eOTHvyf1KA6kBYYEP0 mVB0lqOQ==; Received: from [2001:4bb8:198:f8fc:c22a:ebfc:be8d:63c2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMXNE-00ANbH-Lr; Tue, 22 Feb 2022 15:46:45 +0000 From: Christoph Hellwig To: Jens Axboe , "Theodore Ts'o" , Ryusuke Konishi Cc: Andrew Morton , linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org Subject: [PATCH 3/3] nilfs2: pass the operation to bio_alloc Date: Tue, 22 Feb 2022 16:46:34 +0100 Message-Id: <20220222154634.597067-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220222154634.597067-1-hch@lst.de> References: <20220222154634.597067-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Refactor the segbuf write code to pass the op to bio_alloc instead of setting it just before the submission. Signed-off-by: Christoph Hellwig --- fs/nilfs2/segbuf.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 4f71faacd8253..a3bb0c856ec80 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c @@ -337,8 +337,7 @@ static void nilfs_end_bio_write(struct bio *bio) } static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, - struct nilfs_write_info *wi, int mode, - int mode_flags) + struct nilfs_write_info *wi) { struct bio *bio = wi->bio; int err; @@ -356,7 +355,6 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, bio->bi_end_io = nilfs_end_bio_write; bio->bi_private = segbuf; - bio_set_op_attrs(bio, mode, mode_flags); submit_bio(bio); segbuf->sb_nbio++; @@ -384,15 +382,15 @@ static void nilfs_segbuf_prepare_write(struct nilfs_segment_buffer *segbuf, static int nilfs_segbuf_submit_bh(struct nilfs_segment_buffer *segbuf, struct nilfs_write_info *wi, - struct buffer_head *bh, int mode) + struct buffer_head *bh) { int len, err; BUG_ON(wi->nr_vecs <= 0); repeat: if (!wi->bio) { - wi->bio = bio_alloc(wi->nilfs->ns_bdev, wi->nr_vecs, 0, - GFP_NOIO); + wi->bio = bio_alloc(wi->nilfs->ns_bdev, wi->nr_vecs, + REQ_OP_WRITE, GFP_NOIO); wi->bio->bi_iter.bi_sector = (wi->blocknr + wi->end) << (wi->nilfs->ns_blocksize_bits - 9); } @@ -403,7 +401,7 @@ static int nilfs_segbuf_submit_bh(struct nilfs_segment_buffer *segbuf, return 0; } /* bio is FULL */ - err = nilfs_segbuf_submit_bio(segbuf, wi, mode, 0); + err = nilfs_segbuf_submit_bio(segbuf, wi); /* never submit current bh */ if (likely(!err)) goto repeat; @@ -433,13 +431,13 @@ static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, nilfs_segbuf_prepare_write(segbuf, &wi); list_for_each_entry(bh, &segbuf->sb_segsum_buffers, b_assoc_buffers) { - res = nilfs_segbuf_submit_bh(segbuf, &wi, bh, REQ_OP_WRITE); + res = nilfs_segbuf_submit_bh(segbuf, &wi, bh); if (unlikely(res)) goto failed_bio; } list_for_each_entry(bh, &segbuf->sb_payload_buffers, b_assoc_buffers) { - res = nilfs_segbuf_submit_bh(segbuf, &wi, bh, REQ_OP_WRITE); + res = nilfs_segbuf_submit_bh(segbuf, &wi, bh); if (unlikely(res)) goto failed_bio; } @@ -449,8 +447,8 @@ static int nilfs_segbuf_write(struct nilfs_segment_buffer *segbuf, * Last BIO is always sent through the following * submission. */ - res = nilfs_segbuf_submit_bio(segbuf, &wi, REQ_OP_WRITE, - REQ_SYNC); + wi.bio->bi_opf |= REQ_SYNC; + res = nilfs_segbuf_submit_bio(segbuf, &wi); } failed_bio: -- 2.30.2