Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp727163pxb; Wed, 13 Apr 2022 10:59:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/r2lw3KuWkTxt2xM7sZpr4SM9qiHI4gfwfXxUEZCo7hxX+qvIyeHzfB6oWgB4S1NxxXVJ X-Received: by 2002:a05:6402:448a:b0:41d:793d:8252 with SMTP id er10-20020a056402448a00b0041d793d8252mr17838268edb.6.1649872770083; Wed, 13 Apr 2022 10:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649872770; cv=none; d=google.com; s=arc-20160816; b=VBkJ5CUtjZFQkovkNHxk7Yy8MHq7F9Gi16nJnhb7Wia+jVBg+b6XfVjqGGdeCZDnZs OT3Z8lZxgpfgKeoqb6/0yMSzuLDMZUm4qx25weSZkYJbagBWIpqHRr2kPlMajlTMsyxP 01QeQc04hcagtw8PS/Q7Tp3cN5yMhoK7n3tpteflQj4aCHHm3jPJMvxP9pGfZem5JPwr oLqsHV66pLzCfSiLP7/wdG6iZ/it0xyYbg8KElv35rnWZdGgu4QILTzmaZxM7w66lmtG l/HZqXhmVuybTazEzQwq2+xkMkpSQfaokL4XD0cW5fQKC6OfoQBjTBzYhkOYKtXK1RvQ lIgQ== 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=IDeNb+gWk/P4kjRsjN/+7ezEbdfplvxJFlw2bN4SlzQ=; b=LjSSuhy6PxUGv5BbQyqB2B6FlLZH9ylyS5chFZiIFfi/1FoKVlE/m7SqPpJVPsWTs7 C0ENVDcnbRGKSUckEj9Y8pv9nw6XizIJfc9rcsx4bZOTNfqfh6hNkuxJRWbYeGnKpL8F AgrgUugCRH4aDloN6ZJVyxFPVZxBYx38HQ8+EenJ+bUPlvACTeyusJi+IAYT3ff6AqE0 nTQCopEbMVSkX1QXkOTm/HyKXdqdh5yuAl0iLBHIwpUHCWFlyrpMG8ww3zB4Li4CHj+/ Q52qqptZ2TjCnDR3VXWnZgISGzY1ww8uGs/G98pWbHD6LP9diFrZTUP0BxEvcb/L07P6 Jh5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=doIhqVsn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a50d798000000b0041d7e0fd44esi1897043edi.519.2022.04.13.10.58.39; Wed, 13 Apr 2022 10:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=doIhqVsn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236686AbiDMPv6 (ORCPT + 99 others); Wed, 13 Apr 2022 11:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236695AbiDMPv4 (ORCPT ); Wed, 13 Apr 2022 11:51:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE5812AF1 for ; Wed, 13 Apr 2022 08:49:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC183B8256B for ; Wed, 13 Apr 2022 15:49:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8032FC385A4; Wed, 13 Apr 2022 15:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649864969; bh=rfY+zz0EuMCDCl5xRvtF27SM8BicRPxM1bncNrdxx0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doIhqVsnjd2JQK1auCF3NlybCIVILT6hrtkjgPvkbU9ocftiLFygYW6NGXNKbmgji lB2ClmnfaMlvTDNlz+U7O0Y+BMRuR1wjqfOX2bnUxXDhD256W7Q+yd0T/8miimjFlO jtzSAxG+NRek/wdNLYb7g5QsiyweekKbx4N7iZXlNhJHTwbz0KRgyZ+HAOnKGmr6zC S37szmfOKyxZ9ExQAIG3JrBBOJOnB/ucmLZQLBnZTlTY5gb8cBZZeS1HLxww1a+sV4 PpqFjsRiJqh/apPR4DTdtR4rcVn6nebXu51AJvwhMWlvRHL9R8CvdEtbkqgMmKe+1C l9/wpv57+ZFDQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 2/2] f2fs: keep io_flags to avoid IO split due to different op_flags in two fio holders Date: Wed, 13 Apr 2022 08:49:20 -0700 Message-Id: <20220413154920.2024872-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220413154920.2024872-1-jaegeuk@kernel.org> References: <20220413154920.2024872-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-kernel@vger.kernel.org Let's attach io_flags to bio only, so that we can merge IOs given original io_flags only. Fixes: 64bf0eef0171 ("f2fs: pass the bio operation to bio_alloc_bioset") Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index acc523f893ba..fcf0daa386de 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -387,11 +387,23 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) return 0; } -static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag) +static unsigned int f2fs_io_flags(struct f2fs_io_info *fio) { unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; - unsigned int fua_flag = io_flag & temp_mask; - unsigned int meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; + unsigned int fua_flag, meta_flag, io_flag; + unsigned int op_flags = 0; + + if (fio->op != REQ_OP_WRITE) + return 0; + if (fio->type == DATA) + io_flag = fio->sbi->data_io_flag; + else if (fio->type == NODE) + io_flag = fio->sbi->node_io_flag; + else + return 0; + + fua_flag = io_flag & temp_mask; + meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; /* * data/node io flag bits per temp: @@ -400,9 +412,10 @@ static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag) * Cold | Warm | Hot | Cold | Warm | Hot | */ if ((1 << fio->temp) & meta_flag) - fio->op_flags |= REQ_META; + op_flags |= REQ_META; if ((1 << fio->temp) & fua_flag) - fio->op_flags |= REQ_FUA; + op_flags |= REQ_FUA; + return op_flags; } static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) @@ -412,14 +425,10 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) sector_t sector; struct bio *bio; - if (fio->type == DATA) - __attach_io_flag(fio, sbi->data_io_flag); - else if (fio->type == NODE) - __attach_io_flag(fio, sbi->node_io_flag); - bdev = f2fs_target_device(sbi, fio->new_blkaddr, §or); - bio = bio_alloc_bioset(bdev, npages, fio->op | fio->op_flags, GFP_NOIO, - &f2fs_bioset); + bio = bio_alloc_bioset(bdev, npages, + fio->op | fio->op_flags | f2fs_io_flags(fio), + GFP_NOIO, &f2fs_bioset); bio->bi_iter.bi_sector = sector; if (is_read_io(fio->op)) { bio->bi_end_io = f2fs_read_end_io; -- 2.36.0.rc0.470.gd361397f0d-goog