From patchwork Fri Nov 8 17:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868794 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 CD0E0D64075 for ; Fri, 8 Nov 2024 17:45:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 95FA66B009E; Fri, 8 Nov 2024 12:45:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8ED196B00D6; Fri, 8 Nov 2024 12:45:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7613B6B00D7; Fri, 8 Nov 2024 12:45:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4C6546B009E for ; Fri, 8 Nov 2024 12:45:18 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 11E6440E8B for ; Fri, 8 Nov 2024 17:45:18 +0000 (UTC) X-FDA: 82763653938.28.40C1349 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf29.hostedemail.com (Postfix) with ESMTP id 17D93120025 for ; Fri, 8 Nov 2024 17:44:25 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BR9Jenhh; spf=pass (imf29.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.173 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=1731087830; 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=fZxELLVFDjwUYsFIGQEeVxILEzmt3BirwJxOvJB40G4=; b=xtBLA8Y1iEIOiv1sBgUnkPkUvRjrWkH3L8H3HtGMUN4CT7Wpi9cnjcAkPMCjg+tsGaCwkk pFAIOGthc/qatYt+rNBV1zfQK0JXYebK9GUkiSVRR9NlXArwMQKnYJlnnO6akAXox8XHEX pj4Rro2Ut4DGg8QN77qL7TSzuEYd50c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087830; a=rsa-sha256; cv=none; b=dhrn29d5aqd0yh0sWqWWeYMrAJGGkBCquzly5C4Pus6U2g3eCcF+gE8gShqTNMPMs6vWGT Gqty5W9s3qfFaTd/WygnqAf2Zyk5MlKtM7ErszT8dqsi10VZ2CcwAs4FN867zYf4fBXMLB RyttiRoxI3T4bt/mxB4DX+1dJjwhQc4= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BR9Jenhh; spf=pass (imf29.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.173 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3e5f86e59f1so1484788b6e.1 for ; Fri, 08 Nov 2024 09:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087915; x=1731692715; 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=fZxELLVFDjwUYsFIGQEeVxILEzmt3BirwJxOvJB40G4=; b=BR9JenhhvHb0OU1BwQZa7KIubk6tPhhPUTreqPQcchZsrRcuUS38Qurjd84o49FHF5 F161Ofg3eFWWuiebvP/UoqcoTKuKOtWPeGqYTzx2Gxs6IrmkZopaFQsXeFU9EwcHcctv 6+wNdwG4nly5ccdHZ47DeAdQOp4ClY+cKt9QG+pF3lXIO1z+1vXjVJKIuGLxlGEIjxFS d8D6mAqKjvRA3r3iZ/2TLaLO5pVRKHR9DnmLPaUGoyFj8f9MnR/KJaj84ZklscLiP6XL W/GfnZ7pioHXE/h54LHSXipJqZt4J/1cqnLO56JrMExXErjyAQRBwfX23j5+0huhuIGE VlNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087915; x=1731692715; 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=fZxELLVFDjwUYsFIGQEeVxILEzmt3BirwJxOvJB40G4=; b=E4nIB4BowCEowq6I70YE26EIlrIvzYV69JTw13wOT0iLCf2Ga8lsdoR/hwLaxovJw7 I8dbcWCD7cpgU812ZeXOaz0FU1WdYghliWg3lxnZNBSlO412duDMYi7bkImhmZUQMWMS ecMKc4XP6nOz7RgOYboHpHlIw6yfuDY1v4aSViCXtizFW6xu4LLkxiaBiPDr8jEUmLOg LrNOvWi08WWLajb1+wH/DvH/LsEIt/G+uz/j1IbUJxsRK+i6H4fxGPSfh/SbBLaNfl+7 B3lDtzEHzr4jbtto0+LsAw8dt7wUyXO0AGD7laHsrxzi8gB2ufa9xTvY04bfRCiUk/XZ TrNw== X-Gm-Message-State: AOJu0YxMhQeCPaWzo7FWufa/fZe+SLdHODdP1yeq7whWU4AidbL4pfgb 9kvJ9cK7+Cl5LoWSWqRNdjL0v0nurAvAZjZRO+EtKrD3fwo+ZwzTNSavo9Qs6oqH5cYbkQq8T6X mVr8= X-Google-Smtp-Source: AGHT+IES+vxslMkWIJ9Qt53dufEtarFT3S5DaOvldgjpcVbvhQDjZUhL8AdkSUoXq58a5ka/shhJOA== X-Received: by 2002:a05:6808:1524:b0:3e0:7005:3f86 with SMTP id 5614622812f47-3e7946c80d6mr4180469b6e.28.1731087914910; Fri, 08 Nov 2024 09:45:14 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3e78cd28f80sm780969b6e.39.2024.11.08.09.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:14 -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, Jens Axboe Subject: [PATCH 01/13] mm/filemap: change filemap_create_folio() to take a struct kiocb Date: Fri, 8 Nov 2024 10:43:24 -0700 Message-ID: <20241108174505.1214230-2-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241108174505.1214230-1-axboe@kernel.dk> References: <20241108174505.1214230-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: yiz91iede3ga9mm4tnzoy4qnetmrey1j X-Rspamd-Queue-Id: 17D93120025 X-Rspam-User: X-HE-Tag: 1731087865-213287 X-HE-Meta: U2FsdGVkX19xIrLuECIf0qjuD9CJ6yP1IHStbOsEm14EMB7WwWhegWrPpRo5+cjkphCjpPgk+Ks3IG9F95sdIRRCHL7gjcxEa78kJiHAWOXYTEQEjsrSjUc/2QWZJsDY0mHxarK00/9A08QT5GinwptBRGsNFO73j238awSlzmMDx9d1o0n9H21QbDlDWb8EHL/p1MncSyUObLdGdYgq3GgaZ0l+46TaMhmqItjVpV8vKupam3r+c51f3C1nHOqqhgoVLiXCFml54XAlhENIivxtDajCLNU0A54smtED0jfvacQKiOt/kvfUF3C9owxDP7l01Ter2eK0fzefa/S6p92nq9d36JMIAzA5r8iDOszs5e0OJC92XrUZE6o3jZ64SX/DLRUuV4aAWaetIc9kCoLODCIaZWB7TmvPk3s2M5Lq87OrR00gh20nyjN0e+/46iOwcYLesWpQu8po1U6DSHVjJIAj1GrJ9CqSE7eon5H7VwkTM8rDklZvyMfqlrFku6rYLexh8XGHAsfR8esDeuitG0/h2txbN+04qHKH0rg5+5wvhLeY0DiOwtomIXT3PTfkgn4A7C3gfT14VeqbMtlTkqbgI7uJuRYmPqMqbk3/NJ4O3Q3UcU1WhFqWMYK5mA5nzw7s9cqs5yYy1tHIxSnewsFoJ7NJGNGyPsC2Hmxt5NlqZE7jQ89JKTxrlnfMJ5flAMJAi8tCb+WVCeh1TCfMUqKU34N7/p89ljMjS9dfi+Brj976imDwIDQMhFeSsS2PE0s6losk3Li97twyLNn3VRBK198TIkZt3Xrvvuu63Y7lx7OXv75+6GH/fTGrSir9dWg/gba3cFquDRlPcbu8Q1S9vXKgFD1wS+9hfwzlcylKcu50WfqiB7hrJIL0V1lyMKPeAlCcewub4A4hDV8wS0P+6ARTj1RZTHL2qwOrEd+8LwJx9Jnhl99M5anLEbtukPA9+XhrIWs0V0Z MshGH3PE Ynj/Klg90cCHF4Y5nm8xOMNOXv6nWpxLsv7yJWe+p7fd8Hp6PVn68CEAscpihqSTWQSMthx8EWKczQO2cK0Z5cz+GJeRwG2MHpca5TuVvSJ1BMO/w3qdUEwFFVq3AG9tH6dnOsz+K1mzMC8kJgkJkBKWyUHK5GqUE68P4W10+Ta62XD4KrO94m7QmKrasQ/xAPr9YpG1YQYY57dEd8pqgGjc63tZa9KtBA0QhQ6F3uB9AIf6ewvhIlnMs58WUNs+gixOZWmS6ik7UKRSche10dVIKudg6VYg+3BCysosH3aGTW8zH9ZZar3wq//N88gbqC4pkqddTs4QXT9d4dAcpLyfAu17nam3DH0+p 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 pass in both the file and position directly from the kiocb, just take a struct kiocb instead. In preparation for actually needing the kiocb in the function. No functional changes in this patch. Signed-off-by: Jens Axboe --- mm/filemap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 36d22968be9a..2ae26a0f961b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2460,9 +2460,8 @@ static int filemap_update_page(struct kiocb *iocb, return error; } -static int filemap_create_folio(struct file *file, - struct address_space *mapping, loff_t pos, - struct folio_batch *fbatch) +static int filemap_create_folio(struct kiocb *iocb, + struct address_space *mapping, struct folio_batch *fbatch) { struct folio *folio; int error; @@ -2487,7 +2486,7 @@ static int filemap_create_folio(struct file *file, * well to keep locking rules simple. */ filemap_invalidate_lock_shared(mapping); - index = (pos >> (PAGE_SHIFT + min_order)) << min_order; + index = (iocb->ki_pos >> (PAGE_SHIFT + min_order)) << min_order; error = filemap_add_folio(mapping, folio, index, mapping_gfp_constraint(mapping, GFP_KERNEL)); if (error == -EEXIST) @@ -2495,7 +2494,8 @@ static int filemap_create_folio(struct file *file, if (error) goto error; - error = filemap_read_folio(file, mapping->a_ops->read_folio, folio); + error = filemap_read_folio(iocb->ki_filp, mapping->a_ops->read_folio, + folio); if (error) goto error; @@ -2553,7 +2553,7 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count, if (!folio_batch_count(fbatch)) { if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_WAITQ)) return -EAGAIN; - err = filemap_create_folio(filp, mapping, iocb->ki_pos, fbatch); + err = filemap_create_folio(iocb, mapping, fbatch); if (err == AOP_TRUNCATED_PAGE) goto retry; return err;