From patchwork Fri Nov 22 23:23: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: 13883703 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 9BA9EE6ADCB for ; Fri, 22 Nov 2024 23:24:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF1D16B0083; Fri, 22 Nov 2024 18:24:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA1CE6B0085; Fri, 22 Nov 2024 18:24:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91AD86B0088; Fri, 22 Nov 2024 18:24:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 71A706B0083 for ; Fri, 22 Nov 2024 18:24:28 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0F32BAF633 for ; Fri, 22 Nov 2024 23:24:28 +0000 (UTC) X-FDA: 82815312216.29.414D518 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) by imf21.hostedemail.com (Postfix) with ESMTP id 024CE1C0006 for ; Fri, 22 Nov 2024 23:24:25 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Z0f3FyGd; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.178 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=1732317866; 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=t5u3R1yw+kui0tyYMObpxZCZs3WeGMww1fJq5IP8R1c=; b=H2eo+nMXn/BL749MasCVdPdMl65M6MRpwyZmnXW9IHVYSkhyrER2ABQ2LlYovzGVGrie3y /5DM4eueAY77YopooGthW/0GV6OAxRn+Go3kTyOSRgV5XCvS7cPS3xLfNnVbwcMnVtMOIA K8HkjnF8Mx4lLAHN2yVDw0KzIRDpIx8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732317866; a=rsa-sha256; cv=none; b=b32UOW+V+n1Mfqvz4QViJDTFXM4W7aCZFwpumBbbLjv62RP9CZenjEMWxTwIo3S5Ht5jLE iN4xPRceNafh+YfYFWiW0aPHWGdnKCzDmA0fxfELBdjvhBQD8P6yEnBB9np44zV/TkQZkv 1efDW2LZIWTUzTtUy8WIL0TGQu2TL3k= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Z0f3FyGd; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.128.178 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-6ee7a400647so30141617b3.1 for ; Fri, 22 Nov 2024 15:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732317865; x=1732922665; 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=t5u3R1yw+kui0tyYMObpxZCZs3WeGMww1fJq5IP8R1c=; b=Z0f3FyGdjuPotGKQfpwDjG7WxqlwrSXkcCVC5VfUP9W5afZ2qCR6ATZ93hD5w/yyUj 99lNHXwmxEbsHeNKfRYwZXJBElgP3VinFxZLz3fC03LgEmBIJAmRZGEi/2cukAfp44Pl zf5pNSAiuOQC0nFpqmCYNMXHCfF29/+hEpc98cKsvk+qMEfvqupCjOzszYCPrOPvRsHD bfYWobreML2OcgswJrTpFunQacWIK+k4/qtFa2s0ceukaBSzFwRa6VTMmWq8r780glHE 0sNn8Z3L0jKO7f7HPYMTRG5ok6UX+z40QEe6OFoeOAS0lhB0uork+AQfj6eELdfVqkgE wiWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732317865; x=1732922665; 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=t5u3R1yw+kui0tyYMObpxZCZs3WeGMww1fJq5IP8R1c=; b=ESNdV3zZo5EERgxTfk/jTocGIi/K91fmHbyfgWexooOlZh+mN6h42ZNScB3BgWk1Nc 0hKQYDeL3lxJTeUaE2LXkg0Qmr9aysR+wMmq1J0iEhkBeQILn9N3zby9WY/HdH+J+dUm 9wBylVYKkkTkkyu5ShvYU1PDoggr011XGFqmryo2qsRTWWVm2RqTYQFf1IM8m+e0KKAN Y5Xmk1tTKtNPC5SngXVZ/bH3KaWkuQoM07rOlTEdb7c6Gnz5HAkd6d0mhpFYKar7QRHy aNwsSbhSfGdE7dQl75kcwWM35GuDfeu9I6VyHuWOfTo833J1HJnerVmgukHhHnnZqCOS P8HQ== X-Forwarded-Encrypted: i=1; AJvYcCU12mkXbvxsJfflGPMIgMcIU3wdURpsmzWsPb84etebVbw95+JXUXgxQ644AVMFaPDSaDdbtKje9A==@kvack.org X-Gm-Message-State: AOJu0YwB1ykEZlb6QEkiV42o/Gclq6mEnVDv/y5Wpg6z3UCF4d1pQt64 R1mL6iXrNC+0FBGpMOQukmDol2uTcR112uFscO8kJjXHRa49M7EA X-Gm-Gg: ASbGncu5s8KYFIi5KvrmpXXtAn3YYnJCGwXzVmNm1qzXqTFS7qOd296TRBfmkxRkWN/ ScKz1w3Wxd6wxaklMRx5u2EX/oIHwOPRu+Yo8KKIFZd5r7u+cvWbmZRHC8jRVHLy+oOycQ5VD23 AQ6t9Ayy8pR0RCsA80slrxshki4p//4Vu0wsMjukdCtQybYL0rmLBWK5L0bkHJ1liNvG34ZGAUp n8xd3jKKq8jsQm8c2dRp3Wt75rExtbkEVFHBx1hA2ejMDlDiqSM6SX+04Zku0tMC6QLphPtIEQ8 Qn+UPISr X-Google-Smtp-Source: AGHT+IE31ZflB95lghWnoApBp5JoBxyoMgfn9RvO479pqfokI54v3mfaN5/ufMEOG8SbV3Cy8wagiw== X-Received: by 2002:a05:690c:6e09:b0:6ee:664e:8c03 with SMTP id 00721157ae682-6eee08b90bcmr51886217b3.19.1732317865368; Fri, 22 Nov 2024 15:24:25 -0800 (PST) Received: from localhost (fwdproxy-nha-008.fbsv.net. [2a03:2880:25ff:8::face:b00c]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6eedfe2c142sm6918817b3.48.2024.11.22.15.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 15:24:25 -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, bernd.schubert@fastmail.fm, linux-mm@kvack.org, kernel-team@meta.com Subject: [PATCH v6 1/5] mm: add AS_WRITEBACK_INDETERMINATE mapping flag Date: Fri, 22 Nov 2024 15:23:55 -0800 Message-ID: <20241122232359.429647-2-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241122232359.429647-1-joannelkoong@gmail.com> References: <20241122232359.429647-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Stat-Signature: xntgbtxgmhfd4zsk5x9z8jecsgajx8r5 X-Rspam-User: X-Rspamd-Queue-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wP9UOj1p7aCn+H5uAbcfFh+cpRzAEDXO1qM32uF9qdPKP1IAjPuQ9M/0kP/1AM8mJ2efxPz5eiooJFI7MYow+fdd/FTTOXy6GX/rDmzzOmIyU5JkxBPw+63I5mAdeBejCyclARa5fIQS7BZIOIQ2Ptw5ruCXbb7jeuIMuAiaEIjafP0760NQr7rNgtLL76kVHkQYus0AKZtFF7aEaGifzkMBEdoQ+C370X/DJEHhFY0ZoP4FJlhkrTxR5PK5KvcL+SARcOX4ArKnhxb3pAkTpKWMhYZSwy/gEVu8ebVA+et2+ncerLUvTy/NouNBnLyy5UMMBNFlrSOFVmMkDh0h+bhPn0MJv7nGQ51qwjrO7pdycIunZkQCRow== 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;