From patchwork Mon Nov 11 23:37:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13871488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C19F2D3ABFA for ; Mon, 11 Nov 2024 23:49:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE1296B00DB; Mon, 11 Nov 2024 18:48:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A670E6B00DC; Mon, 11 Nov 2024 18:48:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B9BE6B00DD; Mon, 11 Nov 2024 18:48:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6A3F36B00DB for ; Mon, 11 Nov 2024 18:48:58 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2691E161B31 for ; Mon, 11 Nov 2024 23:48:58 +0000 (UTC) X-FDA: 82775456736.28.A6E9B1E Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf13.hostedemail.com (Postfix) with ESMTP id 1058B2001D for ; Mon, 11 Nov 2024 23:48:13 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=rQetA09N; spf=pass (imf13.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.181 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731368704; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=573A7VIJaN7Phef7EPro6/84rHuXaF2Ar2GUBUbETSc=; b=qtnwF19OWeF902E8lM3CPHdHHJ3pC8TjWYP1IyjlnoTT1xHhkiDJpmA5sHCgbqeQtq5ZN4 vWEdCc1lELqk6J/vzKoyvA3tKLb3du8qV87L0RS0wPNx0SDUb1VqipXjCaEJNbIeDwAqjI WoLU0ScAF/v0Nt8L1CEcKTGxwGfYC8E= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=rQetA09N; spf=pass (imf13.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.181 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731368704; a=rsa-sha256; cv=none; b=LhJTKjqux5euJeJBmD6C5aZrv9FzOC+M+IHUbiHuHiRUJ92oLcnSc5Ch25k3K8bKpjvma2 9SPkeUBh4xzxDIe7HmKGb2IwP1inuDNTvps3oOsAZV0cQfRvScgDZ7o4LuewMKtvK95nqJ SPzFMvFRzM+ov4QwCwus5xmKmhm/+sk= Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-720aa3dbda5so3585110b3a.1 for ; Mon, 11 Nov 2024 15:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731368935; x=1731973735; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=573A7VIJaN7Phef7EPro6/84rHuXaF2Ar2GUBUbETSc=; b=rQetA09Nx5h0a0iBQCt6HPt+BXA1ILYxse88Qeksz04OLtL5eVN26/xsfRPKRh3iIi mLPvYwqdU/xul/KQWsO93rWTyV+9iZTwj/NsqHrXLrNCz0MGG2vvvrSm2qTP+AxmpJt4 qZT4zN2rS2KwTE654wsDeCMVOyjr3/meHD/Xp/qMhztMVuNk3SuDXJf7C4XQ0QM1IZHq O/4nQZZj4k+JGbQ9zKbRCyfUa18WQ6lHOvODCPbXVNIZsLOU/ekJnP5q8ixrBWctfss7 hXQqPdGNpt10uOyt+D3OVmr6CtPFbbo0XLL2sXXsaWBSznev37AJimoyBzakdxy9HVkW zOTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731368935; x=1731973735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=573A7VIJaN7Phef7EPro6/84rHuXaF2Ar2GUBUbETSc=; b=BcwJcdCDBLPDncBL/GXuvch78AswiSP/BZwhcmZZbyCxm41QvMopQejfPb89hpfIcF /4/JR0d3+GXgOA7s6O2Th6+oUc6fiz3CbsdIvgbTyB7BB23Hg7JG+h1ZiwYakfBddGMA eB6ghXLBEtdVsqxTi5m9+xLrxIICJrgLtf6Yp2Y9NzU7RAmb3FltYSNGWp3jrOvMUv3/ aLbJ2NkF+LX/LF3aVPwBGj5A+00vgMu9U1JuEaXiEyoFUsKCuixSwx9Q1K3FJb8jJfH2 HhtKFNqW4oI8NjGrfY0JFPdggpg1bSlnpq8Sic0+ClugEQHSSbAmAvgtYsG0c60KhIaX C9oA== X-Gm-Message-State: AOJu0YyMg1jNxVYO4DXxI5DDVVOLlCjvWZvd+2rHWMj0RmvyATabFGxQ K4VkIluKyW4CypvScnP5dafSbvHbZqUfDGVdlN7N8+uQGI5Q2OiPbgP08kdL118ystWCg9H5Q9h irbs= X-Google-Smtp-Source: AGHT+IFFv9yEg9ETjAil4BLRBKswDm5bw1d1rwvQrtFRdIgpywcgln1Dsm8EO2zN3a/ZuXT+tu0A8A== X-Received: by 2002:a05:6a00:460e:b0:71e:75c0:2545 with SMTP id d2e1a72fcca58-7244a5d480fmr1035562b3a.25.1731368934821; Mon, 11 Nov 2024 15:48:54 -0800 (PST) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a7ee9sm10046057b3a.64.2024.11.11.15.48.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 15:48:54 -0800 (PST) From: Jens Axboe To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, willy@infradead.org, kirill@shutemov.name, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, Jens Axboe Subject: [PATCH 05/16] mm/filemap: use page_cache_sync_ra() to kick off read-ahead Date: Mon, 11 Nov 2024 16:37:32 -0700 Message-ID: <20241111234842.2024180-6-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241111234842.2024180-1-axboe@kernel.dk> References: <20241111234842.2024180-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1058B2001D X-Stat-Signature: i5zfa7kzqisyx9eena58uqeqn8nyfg4a X-Rspam-User: X-HE-Tag: 1731368893-268526 X-HE-Meta: U2FsdGVkX19roNJ0kh4zAsou9DghE41fQKcfAGKYjMTzfdzr1CzfaWQOAMEy6JNKFlXxWSE3H3Tz0y9DxP5ayViKIc+2BQvugIPhm2X8c2M+6vHiC7O1bxFcdbUs6942E8ndpYJf6wzN1F99PibC19I5pfbMSWRG7h/C1/c1fbR6KAMakz7Ap2EHwe8YcXT1FQdxbR+bvmn8NdCp92dd6fPkc7LOkex8j1d1BBmOi1PypBGXPWM0gOMPimYh1LOzelHERtZdfrv11R5HZjmoIlx3lpGZWmkhCJOZaUZJLEGFFu2cPrg3HXwodUd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14KVy2mkTU2c/G97FA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Rather than use the page_cache_sync_readahead() helper, define our own ractl and use page_cache_sync_ra() directly. In preparation for needing to modify ractl inside filemap_get_pages(). No functional changes in this patch. Signed-off-by: Jens Axboe --- mm/filemap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 91974308e9bf..02d9cb585195 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2528,7 +2528,6 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, { struct file *filp = iocb->ki_filp; struct address_space *mapping = filp->f_mapping; - struct file_ra_state *ra = &filp->f_ra; pgoff_t index = iocb->ki_pos >> PAGE_SHIFT; pgoff_t last_index; struct folio *folio; @@ -2543,12 +2542,13 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, filemap_get_read_batch(mapping, index, last_index - 1, fbatch); if (!folio_batch_count(fbatch)) { + DEFINE_READAHEAD(ractl, filp, &filp->f_ra, mapping, index); + if (iocb->ki_flags & IOCB_NOIO) return -EAGAIN; if (iocb->ki_flags & IOCB_NOWAIT) flags = memalloc_noio_save(); - page_cache_sync_readahead(mapping, ra, filp, index, - last_index - index); + page_cache_sync_ra(&ractl, last_index - index); if (iocb->ki_flags & IOCB_NOWAIT) memalloc_noio_restore(flags); filemap_get_read_batch(mapping, index, last_index - 1, fbatch);