From patchwork Fri Nov 15 22:44:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13877386 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 91B60D68BDA for ; Fri, 15 Nov 2024 22:46:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19BF86B00B9; Fri, 15 Nov 2024 17:46:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14BDB6B00BA; Fri, 15 Nov 2024 17:46:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F05A96B00BC; Fri, 15 Nov 2024 17:46:58 -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 CF7906B00B9 for ; Fri, 15 Nov 2024 17:46:58 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9992A1A0706 for ; Fri, 15 Nov 2024 22:46:58 +0000 (UTC) X-FDA: 82789812924.20.6B7E671 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf11.hostedemail.com (Postfix) with ESMTP id A72AB40006 for ; Fri, 15 Nov 2024 22:45:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=kXH68CDx; spf=pass (imf11.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731710639; 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=KaJOCXiq+oAY6E09D60BMxslFUVmtN8uELYvwrLg+b4=; b=a6DzDJJn74J/BIo9TSiNXZ0AEgjAbABoy1PLEkmf3bz0ksEqDe80xPSD2cNiEawmqvZTOi tzIDbwz07CJ/8LgaBZed3ljnucBdL5lDFlvMGOM1yGQZ4GoUBfY2SRqxHHlb5y3s+HV53X RKlKM7bkSClnFADbohqzobKkdW76Jlk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=kXH68CDx; spf=pass (imf11.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731710639; a=rsa-sha256; cv=none; b=JWFN8G1npxO/1VI4zTGtY40iJmUmtxiGnFrIut1gg0e38CwHt4oD1UD6pNMrCcvVPDIX8j AuGc8Z8L4wFU8/kqQNu/ES+jBRXkaWXbE2C+jhgZD3aQYrbKYdNsPGV9GjJlCoCMWMIW3N mADfFAC4rru/ypQI8oE47C9w8SP1vv8= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e3876e6bae2so852113276.1 for ; Fri, 15 Nov 2024 14:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731710815; x=1732315615; 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=KaJOCXiq+oAY6E09D60BMxslFUVmtN8uELYvwrLg+b4=; b=kXH68CDxBz2bu39KrYUlYieVqJRWEMc+erkaBC1xow5u+Ljtk4yVwNPHuCiudaRRp2 kCJpax620ZTY7efGEg5q7KWEHldYtrvRuyOKnLMX0f/FTO8Dmy/Qnn4AUVccDgxlaWLo ERWrfAynuQBiBGo+/36v396BWC2Qfatk356BHSAko1b1mizoVz6f07rjwRPszcQxKr1l 5hvLEUTgzYOhhFhmMWZRlCohbgmTFTRnIqxK+zN7yRVRt+QC3vQNeAO4Nora8qh6xkNy 24VzJlOFLGw7RdzpcuZ7IBd4UJO17qI/A80QIOLbctmseEOwNGzuAb7xlHUqhnBbWGhC KLAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731710815; x=1732315615; 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=KaJOCXiq+oAY6E09D60BMxslFUVmtN8uELYvwrLg+b4=; b=Bgyqo30GKxKB7fkFV57+05oDCqCooPu64VlvT8J8QzPikBQRjM6ENy7xBTWQXMRWod Pzcxg1HT+/rVTa9BN9ZaxrrkkomDX7mvfwyHhhcURcIjlwql92eArdaPp+qZamwtyyS5 JWt7vlNHyveNsdSklJaPMFTfJpQ0g6s6AsHXvm2MxdXUd8goEziB6FVsB9vpC9UidXUS nrjXc4ExrYxD4rG/likUi8ollpcYKFA9V//DLaWb7kk5jadKNCYPZkCsMPRPpmGfjdFw FdYD4t4mOoOHcxGCBs+FXlleZAtDaJcMDptsAe/8/Rx1f7V+Bb8/G4WZDT4YZknu2oOu 5WkA== X-Forwarded-Encrypted: i=1; AJvYcCWmCDloYviOrBPI7Cu62ll+BNR+qO/8ARffgPynqSLW7SZ9Z7SBEnLgzOOqcL7KAoI+wLKkydMCXg==@kvack.org X-Gm-Message-State: AOJu0YzE7KuGJyvknS4GHLudFsZ1IxpLeg3sMytMI8ks2kwTWAmWx15M OcYfalThuo+BSP56HG2MnQQyPIC/BUwPn0gD5aIWGISZXuORUFXI X-Google-Smtp-Source: AGHT+IFmiXgnWZZs1gqt0JF4hZXzFNRdwrn1XSh3VQKDL/elFzc3Ebo+JLJ62nqDeTWVLJwJ3hwfzw== X-Received: by 2002:a05:690c:9682:b0:6db:db51:c02d with SMTP id 00721157ae682-6ee55c53b57mr48257857b3.25.1731710815490; Fri, 15 Nov 2024 14:46:55 -0800 (PST) Received: from localhost (fwdproxy-nha-011.fbsv.net. [2a03:2880:25ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6ee712c2c9fsm857617b3.54.2024.11.15.14.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 14:46:55 -0800 (PST) From: Joanne Koong To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org Cc: shakeel.butt@linux.dev, jefflexu@linux.alibaba.com, josef@toxicpanda.com, linux-mm@kvack.org, bernd.schubert@fastmail.fm, kernel-team@meta.com Subject: [PATCH v5 1/5] mm: add AS_WRITEBACK_INDETERMINATE mapping flag Date: Fri, 15 Nov 2024 14:44:55 -0800 Message-ID: <20241115224459.427610-2-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241115224459.427610-1-joannelkoong@gmail.com> References: <20241115224459.427610-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A72AB40006 X-Stat-Signature: gkbj1yn7yr1epbpq7dykgt7jjodinko6 X-Rspam-User: X-HE-Tag: 1731710759-144799 X-HE-Meta: U2FsdGVkX18mEpeos8Z9PzGEOk4riKCCVGpobJ3EWNMD7mwi4duA/iLC405Cl4lML2CeW+UIHlYm1aSlmLhJCMswhG/7uE5OFlOKEOKvcrcXe8hH5dQSJ3wbqJsDojbYlvcdVqW+62hj12LqbvQT+WIhZaiDe+RDwJPdgz8qcJ5r7A0rX5lahEviZ/9xsCmi5zUuGYLjSVgNScDZ5HNN0n8gEq2fcBbaf169KkD6isNDim8n14askapqNNijBMZB889d1qrjCn0sNf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wq37THRYZRa/8k2y4HZtAreJiWiDbM5ULQPVSoqDCp8mIRxB0t7BrYM8k45IePenWkQ== 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: Add a new mapping flag AS_WRITEBACK_INDETERMINATE which filesystems may set to indicate that writing back to disk may take an indeterminate amount of time to complete. Extra caution should be taken when waiting on writeback for folios belonging to mappings where this flag is set. Signed-off-by: Joanne Koong Reviewed-by: Shakeel Butt --- include/linux/pagemap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 68a5f1ff3301..fcf7d4dd7e2b 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -210,6 +210,7 @@ enum mapping_flags { AS_STABLE_WRITES = 7, /* must wait for writeback before modifying folio contents */ AS_INACCESSIBLE = 8, /* Do not attempt direct R/W access to the mapping */ + AS_WRITEBACK_INDETERMINATE = 9, /* Use caution when waiting on writeback */ /* Bits 16-25 are used for FOLIO_ORDER */ AS_FOLIO_ORDER_BITS = 5, AS_FOLIO_ORDER_MIN = 16, @@ -335,6 +336,16 @@ static inline bool mapping_inaccessible(struct address_space *mapping) return test_bit(AS_INACCESSIBLE, &mapping->flags); } +static inline void mapping_set_writeback_indeterminate(struct address_space *mapping) +{ + set_bit(AS_WRITEBACK_INDETERMINATE, &mapping->flags); +} + +static inline bool mapping_writeback_indeterminate(struct address_space *mapping) +{ + return test_bit(AS_WRITEBACK_INDETERMINATE, &mapping->flags); +} + static inline gfp_t mapping_gfp_mask(struct address_space * mapping) { return mapping->gfp_mask;