Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp677712lqp; Wed, 12 Jun 2024 12:47:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbRWqRhqjuDf4h98Kgj55YC/6hlIrjvuTvJsRPv+raVWu/GwUBGE3+41kau1CyGGvvMhmKrleqLEly/EBbmb90oxIFpYu89m68fzECWw== X-Google-Smtp-Source: AGHT+IEVtQ90KMZ30bN323L126WnDPYaxfSBlrgafXgwQq5TwNchPjSB66z/3JNLb7Hr3ar8jsi7 X-Received: by 2002:a05:6a21:6da8:b0:1b0:2af5:f183 with SMTP id adf61e73a8af0-1b8a9ba7c08mr3385208637.23.1718221660396; Wed, 12 Jun 2024 12:47:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718221660; cv=pass; d=google.com; s=arc-20160816; b=bmi6ssrowPh1KyHSDpztM6pMO2eaAcAtKRx2ePNuy2lAjvksq2SZ8bJ+L86H6/QwpI 9XonTGwi3D4Tc1YDN4OW+zdi+5D4m1XsGCLVdsLESgMFjeFS3Ryt3oRDhYutedxGRA9c Q2GoPUxoGVjHlA+8Pr6lANQLWLPyXOSi7wYZ3YRseepGWQRRSa/LNbSUJP+2CM+5sv3n vYLwtzT0iKcy726U2evX+oJ3lc3XhMwvnjKs7e02jm4/tv7YsWPE598HYXiHkbr6Ibvn GNHjplssJrCWGp7B38TBzTiSSIshFqKUF8HHnInbqwhqcJ3VKpwa/ejQXNO+u2ajA+2b ixKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=X0UH1PNNbMxYJZoiip95yI6EQB1bPuPhH3bLQTwKvZY=; fh=rqHW7NazYv3wAmgqDKAbZUXWTmf0VaM5epB9R4zfTUE=; b=Tir7V7GAuPOBGfb2Wi5KPQ4cDufohePke2ht5lbRZ6U2jo9M9NkZj2BC5v1wZdf3ii GKgu1AzA5/ebTeO1wmrnN2Qasomtm4SEjMPFqt950ndOzkGG+BbOWqzFpr7rbHV8V8kO gRa77tHiesuRelDiENHr26cVstDOx2iBF33W5QF+tMKoJ97zMRm3QFCNok1lFWc2kkeY ttBV4jUxS6T2/A/jN26N54PaCjjSMxk7j4NvWz+cSAlC5MYuJuX200/1dZZiykj5Io4k zcSjJErYGHB4GzhAzuvE4dbjfyviqqDo6ugDgyHS+vkcniTLrJLE2HUnBDHCmkqgprJN 6xRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sgyBIKp5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-704333cbcf9si7300449b3a.186.2024.06.12.12.47.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 12:47:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sgyBIKp5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212161-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212161-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E8064288A28 for ; Wed, 12 Jun 2024 19:38:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B15184A37; Wed, 12 Jun 2024 19:38:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sgyBIKp5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89BFA3A29F for ; Wed, 12 Jun 2024 19:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718221114; cv=none; b=NpVtBPSTOmIYUc5WUTbNf4MPDsJPm/UvTZm0UYsSYrLVwHHoR3b0yc5EK5ruOAS1R8dSxrJ12cB60M+/LBtX/36E1sRJV8ReU8F3/pG8msABySnuffktpbfobYHV+YbNk2rcJBIVzTJ5gu21GyLTfu3hnfz7uev03T1TRTaCYYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718221114; c=relaxed/simple; bh=3O2VXIYtm+77i6RAmyE/iB05l4/QfxPoP/92pVes7fo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NQmouaRt5hxfNk4vMUmZSgGMW3aV3qV/dT0nndGIET3Qiru/1iF5CgHM/7Z6oJx3NZIEsl7g1iRZBskMMgipO4As5rOz5I8H1A8/GHN25bmYbsHP4GJ4gl5mrJrt418uDtQ6QuCiBgBqGYaen9q5pJ7Wg5XUjlh7FkdjUe7plaI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sgyBIKp5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F17D6C4AF48; Wed, 12 Jun 2024 19:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718221114; bh=3O2VXIYtm+77i6RAmyE/iB05l4/QfxPoP/92pVes7fo=; h=From:To:Cc:Subject:Date:From; b=sgyBIKp54VFxMG+medder41hKEsUF9I96Q7lJMnDAIgEa2Z90m9udgd5uLeLkl+uR TWza8FdFCTK54XAb/CvhGGNfJ+FJsQI+CfjiFqGjeFS1ZecS1puBZC57agbfXef47z bLXwfQKlaT9Lpv/9KVc8q2hyzWgnYuPSEoNqr0xTNVbOkBs/5KOsgAQyjlWstvPTNX vQbSv7EkvxIM4wxwQbW+gPD9heSDvL9zY2DeLh4m79x5igjJO3QfxCHRef1mKuINww 49t/yHwvW3iT4rnhK2lgZ7ADKWaM6BcYarZ7MvHH005hqIboFvDpxGruZ6E4hH+S52 41BigPna414eA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: clean up set REQ_RAHEAD given rac Date: Wed, 12 Jun 2024 19:38:31 +0000 Message-ID: <20240612193831.106524-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let's set REQ_RAHEAD per rac by single source. Signed-off-by: Jaegeuk Kim --- fs/f2fs/compress.c | 2 +- fs/f2fs/data.c | 17 +++++++++++------ fs/f2fs/f2fs.h | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 1ef82a546391..990b93689b46 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1100,7 +1100,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc, struct bio *bio = NULL; ret = f2fs_read_multi_pages(cc, &bio, cc->cluster_size, - &last_block_in_bio, false, true); + &last_block_in_bio, NULL, true); f2fs_put_rpages(cc); f2fs_destroy_compress_ctx(cc, true); if (ret) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b9b0debc6b3d..b6dcb3bcaef7 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2067,12 +2067,17 @@ static inline loff_t f2fs_readpage_limit(struct inode *inode) return i_size_read(inode); } +static inline blk_opf_t f2fs_ra_op_flags(struct readahead_control *rac) +{ + return rac ? REQ_RAHEAD : 0; +} + static int f2fs_read_single_page(struct inode *inode, struct folio *folio, unsigned nr_pages, struct f2fs_map_blocks *map, struct bio **bio_ret, sector_t *last_block_in_bio, - bool is_readahead) + struct readahead_control *rac) { struct bio *bio = *bio_ret; const unsigned blocksize = blks_to_bytes(inode, 1); @@ -2148,7 +2153,7 @@ static int f2fs_read_single_page(struct inode *inode, struct folio *folio, } if (bio == NULL) { bio = f2fs_grab_read_bio(inode, block_nr, nr_pages, - is_readahead ? REQ_RAHEAD : 0, index, + f2fs_ra_op_flags(rac), index, false); if (IS_ERR(bio)) { ret = PTR_ERR(bio); @@ -2178,7 +2183,7 @@ static int f2fs_read_single_page(struct inode *inode, struct folio *folio, #ifdef CONFIG_F2FS_FS_COMPRESSION int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, unsigned nr_pages, sector_t *last_block_in_bio, - bool is_readahead, bool for_write) + struct readahead_control *rac, bool for_write) { struct dnode_of_data dn; struct inode *inode = cc->inode; @@ -2301,7 +2306,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, if (!bio) { bio = f2fs_grab_read_bio(inode, blkaddr, nr_pages, - is_readahead ? REQ_RAHEAD : 0, + f2fs_ra_op_flags(rac), page->index, for_write); if (IS_ERR(bio)) { ret = PTR_ERR(bio); @@ -2399,7 +2404,7 @@ static int f2fs_mpage_readpages(struct inode *inode, ret = f2fs_read_multi_pages(&cc, &bio, max_nr_pages, &last_block_in_bio, - rac != NULL, false); + rac, false); f2fs_destroy_compress_ctx(&cc, false); if (ret) goto set_error_page; @@ -2449,7 +2454,7 @@ static int f2fs_mpage_readpages(struct inode *inode, ret = f2fs_read_multi_pages(&cc, &bio, max_nr_pages, &last_block_in_bio, - rac != NULL, false); + rac, false); f2fs_destroy_compress_ctx(&cc, false); } } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 9688df332147..95d12e025786 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4297,7 +4297,7 @@ void f2fs_update_read_extent_tree_range_compressed(struct inode *inode, unsigned int llen, unsigned int c_len); int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, unsigned nr_pages, sector_t *last_block_in_bio, - bool is_readahead, bool for_write); + struct readahead_control *rac, bool for_write); struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc); void f2fs_decompress_end_io(struct decompress_io_ctx *dic, bool failed, bool in_task); -- 2.45.2.505.gda0bf45e8d-goog