Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp800324pxu; Thu, 3 Dec 2020 13:01:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKPBG/mubP2wPgDYw9wxYfDnuZikdCSUjaIc70P6jv/AL28zwwk1L0qqR9cE9kEGr9I667 X-Received: by 2002:aa7:c248:: with SMTP id y8mr4699304edo.344.1607029270246; Thu, 03 Dec 2020 13:01:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607029270; cv=none; d=google.com; s=arc-20160816; b=slq8Q3jAeRX9Vp7hQMfSrq0m7PcTl7HsnvMDuRGlOmMogHZejdzKMHFCTEM5+bzIiD fyf/cKHagJCw0a/UbOjyUrSZ6Q3e+5PHN9hXIs2lnR8LWh6E0s0H2YH0iYspNeml21xe xoi4nc9Jq7Ixg9CBls0w9CZWKjFMMv626xn3eCH+P9MrNYPyYbPMGisZo4L/b3HnzlwG 0fNRaAR80rwAUKapgA/LJupA6lfGw1mV82S/dQFo/ddAy8S5rmaZ+JD4Zzlp/HExJevr 7a1M8vV7GDK7UwYVdY8ZCa5GSI4EMyEMB+oKtCbQ+RBXWtU4pN8FYTXHm5z/pAtud57O Ib5Q== 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; bh=6nEPHg8bIlPARy2qYNOOErM+y84LDqr81I7urzbkpko=; b=byxAB+8AFLgYZ0deDWHwNdshBTShEY1U6yhbBkwkpqRm2Z1SLu1VBWhqpE12ORU22c o+zwLZscccpNF7zqL6zwkBcrMzCNxN8cRcPZH78kprOLaYsKmWcEutP/AuqZ1DlcuDkY QHM/GBcgTj+faXacRmnsRSpk22Khcb3iJszVUkkTBkhPs6EvgzZoMJVx95tKSyXAcBK0 4nCl8JmfMkZy2QMOsG5a8o4Cjzktjb1Tp++Efbn1igCzAs2dflo89bl3pTTNQr5tHKTI Ls38/hj9yP2H4g0Egtgv5ZoVvJ/0/tLH6+MSQM4NE1zn+uxxA86zB0T6Gb6YxH1Antsa iocQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb2si90316ejb.489.2020.12.03.13.00.46; Thu, 03 Dec 2020 13:01:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729441AbgLCU4N (ORCPT + 99 others); Thu, 3 Dec 2020 15:56:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:53312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgLCU4N (ORCPT ); Thu, 3 Dec 2020 15:56:13 -0500 From: Jaegeuk Kim Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Jaegeuk Kim Subject: [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size Date: Thu, 3 Dec 2020 12:55:22 -0800 Message-Id: <20201203205522.891082-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog In-Reply-To: <20201203205522.891082-1-jaegeuk@kernel.org> References: <20201203205522.891082-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds max_io_bytes to limit bio size when f2fs tries to merge consecutive IOs. This can give a testing point to split out bios and check end_io handles those bios correctly. This is used to capture a recent bug on the decompression and fsverity flow. Signed-off-by: Jaegeuk Kim --- Documentation/ABI/testing/sysfs-fs-f2fs | 7 +++++++ fs/f2fs/data.c | 3 +++ fs/f2fs/f2fs.h | 1 + fs/f2fs/sysfs.c | 2 ++ 4 files changed, 13 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 67b3ed8e8c2f..3dfee94e0618 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -370,3 +370,10 @@ Date: April 2020 Contact: "Daeho Jeong" Description: Give a way to change iostat_period time. 3secs by default. The new iostat trace gives stats gap given the period. +What: /sys/fs/f2fs//max_io_bytes +Date: December 2020 +Contact: "Jaegeuk Kim" +Description: This gives a control to limit the bio size in f2fs. + Default is zero, which will follow underlying block layer limit, + whereas, if it has a certain bytes value, f2fs won't submit a + bio larger than that size. diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e85fd8f77f3f..cb28089e1eff 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -736,6 +736,9 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) static bool page_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio, block_t last_blkaddr, block_t cur_blkaddr) { + if (unlikely(sbi->max_io_bytes && + bio->bi_iter.bi_size >= sbi->max_io_bytes)) + return false; if (last_blkaddr + 1 != cur_blkaddr) return false; return __same_bdev(sbi, cur_blkaddr, bio); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 36090cd09011..594df6391390 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1446,6 +1446,7 @@ struct f2fs_sb_info { loff_t max_file_blocks; /* max block index of file */ int dir_level; /* directory level */ int readdir_ra; /* readahead inode in readdir */ + u64 max_io_bytes; /* max io bytes to merge IOs */ block_t user_block_count; /* # of user blocks */ block_t total_valid_block_count; /* # of valid blocks */ diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index fce2997382af..989a649cfa8b 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -567,6 +567,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra); +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold); F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list); #ifdef CONFIG_F2FS_FAULT_INJECTION @@ -651,6 +652,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(iostat_enable), ATTR_LIST(iostat_period_ms), ATTR_LIST(readdir_ra), + ATTR_LIST(max_io_bytes), ATTR_LIST(gc_pin_file_thresh), ATTR_LIST(extension_list), #ifdef CONFIG_F2FS_FAULT_INJECTION -- 2.29.2.576.ga3fc446d84-goog