From patchwork Thu Apr 3 18:22:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 14037066 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 693102500C9; Thu, 3 Apr 2025 18:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743704566; cv=none; b=iPu9EG0Gl4PFbg3l+PS0hYu87Qt+i/LlAj9VYEuBsBNQJ6wOLdTF9cnsqfdWOTXHbgij5Lb4tgH93eCRPXlW3nuxH2ZA4lY9ynX1EYZjSCjIbdU7UORROi0OmAK7Pf8lzdsKRaDWONgK06RcAafhdSgefbfNGE9WoKoAKKJvKPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743704566; c=relaxed/simple; bh=rLzrT0AKkwsRD9XYAXkmvKNsoTJxfDta1FbB94KlwGA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YB628hvrj9SQb5/GSFURiSLn/1MlDOdBQUneOmjCJgSLou+CWc6uPMC9dvRV41dM9nt5blFFdJIQYoEVfhBibKEJhK6HkC33ueQhj/R9/bBXJgI5xMSYjrHhWgsBF7ixLnq1tomQ9G3wTAnaS/RMsl1aTruiDHvzaHoNce2mc80= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gEav+yLy; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gEav+yLy" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-aee773df955so1238337a12.1; Thu, 03 Apr 2025 11:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743704564; x=1744309364; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3A3lnmeTpY7k39SfGomsdy/TAtCo406v7O674RosIRo=; b=gEav+yLyxk/rNOTh69FRBr/uj8IDjvz4davYkgxL19aV24PI8wT2NHgSgaw7VhzeI8 XmgTxOJdesRArNgfkx7dOJl+1LyU1xaYJXMBvYsnP6uThIc8nq5flbpSCXhglIrcJM4A vW0RakN6XSaRdjTNaqrSpSx3bCYWNpTd3A8y0zo9QYZVEnqhpxCNWp/cxB+PUz5Iv6E3 x9CIlmCc7lEp5VggFGHqMA1z2UAzQbKkMQEcQqudWsQ9UGK0EJEKnw2LSXaM7pruKlxZ ORMQieBPKAe8Kln5P0DsxByP7vELsZzlWRstZLK+/HX4r4twdoIAhVkJMNbFGnSdsY8y AnJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743704564; x=1744309364; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3A3lnmeTpY7k39SfGomsdy/TAtCo406v7O674RosIRo=; b=RKhPHgmHQ59na7dZTMKkvKGXajfm6Mdb5d6kNSEjLlJRJaiW9uMnI+IUkESDXK1qza oHTXqtRPuQcM1G73XQ+Zmub2ypMZVdTdaktjk9MarQqsRozvzCatkk0/0bLDmmPc1tw8 oyG6fp1F1/Y90AQeKUAS0fPhtAvZom0UgECgpcME++gSfPw9q2rUnkaJJ5kaJdfVMQme AhaM9f2JNh4N3Iz9V8RPdBCXOA0Kt/OOPz/nCyEwr2jE3tw4usD1EEy+CfzxMnylIClr VpbK+KwsQGpnRB/6G8idEDKD4TZkc2T9V7y1YkI3Iby8SRN46nwDJmpLKWt/CGW6V2PX nUUQ== X-Forwarded-Encrypted: i=1; AJvYcCW1d0DtuySPz3J6xGMGGbSEr55jJHZEBkTKloK8fVqj4GfoaXUdcOLCxfpq1IOU7Pxc8zVIvLdVf83W2/2z@vger.kernel.org X-Gm-Message-State: AOJu0Yze+WSLK6yLKGII6YCqC8cvLjQFou4rNZTLsPJ7JXfZd5iXzeYb rtVxcl2TQzkpwQIkEc73BHAjeiClrRnoo3c75KOU6I7U4fk6x7+AkzHdO/wD X-Gm-Gg: ASbGncv4G1TH071d5Inh/YFNzUHUSj9T28ZzpTD+2nv9njt9z4Y5licarXu1mETcNNQ jTRnSRuF7XPL05B+Fy/GHz+lZg6Y4V+dNKfskMF6BMYqSd0cMB34JXa2kQJgwLAK0No0VOYhXs0 VKu05JT5Wpg6mXur8fjGK5euCbMWh6XLIiTMFjSvcf8MouHpX47Gul6zZpbxdmmGjay3WrLhuBH QMiRkVCDwaLfEdDb8/HXrhVJWAPgoC9JNstCTwmOzDoZIQHL2ttY/Io0/v+StwzPnndOg8HeoOO kV1zUo+t4wIEDVIND7cqmRioxaqJ91i6DpuqWYWSm9DVVcDDBA== X-Google-Smtp-Source: AGHT+IG1MKXIPYBOjSxG7VAk/REv0Tjn6bRi2iIpXOG6wtUFqdb5cORjJrW8EWact1WZXqC3K9wd3Q== X-Received: by 2002:a17:90b:3d44:b0:2f1:2e10:8160 with SMTP id 98e67ed59e1d1-306a4eb58famr417670a91.11.1743704564005; Thu, 03 Apr 2025 11:22:44 -0700 (PDT) Received: from dw-tp.ibmuc.com ([171.76.86.91]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30561cac698sm3944261a91.0.2025.04.03.11.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Apr 2025 11:22:43 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linux-xfs@vger.kernel.org Cc: John Garry , djwong@kernel.org, ojaswin@linux.ibm.com, linux-fsdevel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH 1/2] Documentation: iomap: Add missing flags description Date: Thu, 3 Apr 2025 23:52:27 +0530 Message-ID: <3170ab367b5b350c60564886a72719ccf573d01c.1743691371.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Let's document the use of these flags in iomap design doc where other flags are defined too - - IOMAP_F_BOUNDARY was added by XFS to prevent merging of ioends across RTG boundaries. - IOMAP_F_ATOMIC_BIO was added for supporting atomic I/O operations for filesystems to inform the iomap that it needs HW-offload based mechanism for torn-write protection Signed-off-by: Ritesh Harjani (IBM) --- Documentation/filesystems/iomap/design.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/filesystems/iomap/design.rst b/Documentation/filesystems/iomap/design.rst index e29651a42eec..b916e85bc930 100644 --- a/Documentation/filesystems/iomap/design.rst +++ b/Documentation/filesystems/iomap/design.rst @@ -243,6 +243,11 @@ The fields are as follows: regular file data. This is only useful for FIEMAP. + * **IOMAP_F_BOUNDARY**: This indicates that I/O and I/O completions + for this iomap must never be merged with the mapping before it. + Currently XFS uses this to prevent merging of ioends across RTG + (realtime group) boundaries. + * **IOMAP_F_PRIVATE**: Starting with this value, the upper bits can be set by the filesystem for its own purposes. @@ -250,6 +255,11 @@ The fields are as follows: block assigned to it yet and the file system will do that in the bio submission handler, splitting the I/O as needed. + * **IOMAP_F_ATOMIC_BIO**: Indicates that write I/O must be submitted + with the ``REQ_ATOMIC`` flag set in the bio. Filesystems need to set + this flag to inform iomap that the write I/O operation requires + torn-write protection based on HW-offload mechanism. + These flags can be set by iomap itself during file operations. The filesystem should supply an ``->iomap_end`` function if it needs to observe these flags: From patchwork Thu Apr 3 18:22:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 14037067 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1E8F2505B4; Thu, 3 Apr 2025 18:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743704571; cv=none; b=rOOa/K0jqqLVIkCwsm99use4SIM3vs69ONtUf67SVM6NMT6u2Ny1G/1FlgP45Rb3BAdwshGzQowIEHs5hgLFySu8kcdqGkzIrjIsU+tgPTj2+C5fMLc94aoQJTmXh2fpWRKPjALkhi65D9ZGLUBN2IswNivhezEdUPX4CZkHfOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743704571; c=relaxed/simple; bh=I+qlaTkXhUlE4q9qdEv6vUSsTsZJ11SRFo6Y4qVOpWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hIljmU/rMJ3XnXL6Ttq+KOyhBvQHhynq1G+sdsB9FL7Q7CWz/RtY47pTwSZcJAMYDguSw+YwhZPltb+7rKZdfS+zcEioPpQD1ImVr9ZL9rEHULmUPmkL8llmAC/GHaT9FBhQurL4L181FB8yTLFIPP35PK8xJowCsyJUruaffyo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jcA1QyxJ; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jcA1QyxJ" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-301d6cbbd5bso1183408a91.3; Thu, 03 Apr 2025 11:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743704568; x=1744309368; darn=vger.kernel.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=yMY2JO69QVx2Wu0X2qKl4ytMfG7YtUpaV5pegBwQdA4=; b=jcA1QyxJCJew8oZvsGNK7N2R/tJialLSnjY5mrXb+MZPv6f06au/5hfhAakJNVHsuO hMSoGCHxfkgNXB8w0qEJY6/wFz2F5wzvNvEmH4FDF3r+glC/0rgBnESW6stRQCmh6/WZ /wlKzR1YJkjudfHMgtiUX8jHZmHjZyv1+YvPtiTbCKVwev1frHnuVwUR9S73MrfRDh4K pckb0g49w1n0s7OKHtU1PVin/s0nCzxdkVhnMNSGWGESfH00bsWULY/uW2wtf5RNrO4u FEipMjH6h4Nm0ouLL1Zew4lo2X6pbFL6UNntAWz1zYEL7YpF0FetchKNpvCM6121Flah cfeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743704568; x=1744309368; 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=yMY2JO69QVx2Wu0X2qKl4ytMfG7YtUpaV5pegBwQdA4=; b=NVh+m9hPYC8xz1jzaadY1a9edvl0YAXlBSG3KbuLEUCwYaMhuUq6GG2x37AVTdbzby TcwjKM26ztz5pbImk6azjaIDN0ETnwmPmRuXe9G8vfWCaBdcEVFDVym/X2HF/cU5OM24 O+aw+uRw90CHUUAvHE15w3EUGQEsDEyJB/j8lanSIFw/JFN+pDbRZA95uOC1gfsd2pUU wQKAwF8e1zDwAhpXfLuGDU1PzwUSzlFmYXYS/Y7pGnrTERtInBRyuhguFYvkf59eCcqZ yxP3UH9VwDK5N7u9zIpFttWnO0dSQ/8oe2fPYQpKm4/vwccz/U3K8TY2vQZhmG/rCl95 ZjpQ== X-Forwarded-Encrypted: i=1; AJvYcCXQlEH6WPYZX69Tsn3PyEg027SSZBqGNBGTV+1Wp84PNfeUVoTtg/Ot4FVY3/FzdLmpT+G/8VWwoiantekQ@vger.kernel.org X-Gm-Message-State: AOJu0YykMFfanUlY4CdwgxLfxZYnoMaA8ZLc9UYDcRnknYKQXaxpyhU4 P3sB154ENajYUYKnjdiV4QoZs+Ny3RHNA6K5Vh0jJud0gOrodHIWXQPpXlUG X-Gm-Gg: ASbGncvNl1FcoVV6rXP3EGH6csP6Sj0/Ou6bB8iJheEgjbrgSSCiFSLljlNWLn9nJ1R 80EFA16lRVuvsBQmwAhOZSiv5KtJkfEtwwOKKnwojcf5ehnmBwIc0I9BFA0Gxi1rSnDmKiTpqFs cw4viJCH/rhakrG+AKclhs/gyGP+M42YtHpwNAqKZ2VOcqgjrbdt2UPW6eXsnQL80CATtc44wsO wrrslNlKE7X0yAdhXu/q9TL0Tx83LVMP8pEu6zlq/zBDXWibuvecguUWaX2yxyakNV8Sotu/Qzh dV4f873/gNXjyafOS7wcaF2NaqOYtpc6RIoaJC9SvDYOV7Jpsg== X-Google-Smtp-Source: AGHT+IEefrjyj11kimR4NhNpwR5DlQi7GDYEqOaX306yLeq+7dHdfyJDADPT9LIlVwKE+YvrKPZW1A== X-Received: by 2002:a17:90b:224d:b0:2ff:4f04:4261 with SMTP id 98e67ed59e1d1-306a48b308cmr566823a91.34.1743704567892; Thu, 03 Apr 2025 11:22:47 -0700 (PDT) Received: from dw-tp.ibmuc.com ([171.76.86.91]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30561cac698sm3944261a91.0.2025.04.03.11.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Apr 2025 11:22:47 -0700 (PDT) From: "Ritesh Harjani (IBM)" To: linux-xfs@vger.kernel.org Cc: John Garry , djwong@kernel.org, ojaswin@linux.ibm.com, linux-fsdevel@vger.kernel.org, "Ritesh Harjani (IBM)" Subject: [PATCH 2/2] iomap: trace: Add missing flags to [IOMAP_|IOMAP_F_]FLAGS_STRINGS Date: Thu, 3 Apr 2025 23:52:28 +0530 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: <3170ab367b5b350c60564886a72719ccf573d01c.1743691371.git.ritesh.list@gmail.com> References: <3170ab367b5b350c60564886a72719ccf573d01c.1743691371.git.ritesh.list@gmail.com> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds missing iomap flags to IOMAP_FLAGS_STRINGS & IOMAP_F_FLAGS_STRINGS for tracing. While we are at it, let's also print values of iomap->type & iomap->flags. e.g. trace for ATOMIC_BIO flag set xfs_io-1203 [000] ..... 183.001559: iomap_iter_dstmap: dev 8:32 ino 0xc bdev 8:32 addr 0x84200000 offset 0x0 length 0x10000 type MAPPED (0x2) flags DIRTY|ATOMIC_BIO (0x102) e.g. trace with DONTCACHE flag set xfs_io-1110 [007] ..... 238.780532: iomap_iter: dev 8:16 ino 0x83 pos 0x1000 length 0x1000 status 0 flags WRITE|DONTCACHE (0x401) ops xfs_buffered_write_iomap_ops caller iomap_file_buffered_write+0xab/0x0 Signed-off-by: Ritesh Harjani (IBM) --- fs/iomap/trace.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) -- 2.48.1 diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h index 9eab2c8ac3c5..455cc6f90be0 100644 --- a/fs/iomap/trace.h +++ b/fs/iomap/trace.h @@ -99,7 +99,11 @@ DEFINE_RANGE_EVENT(iomap_dio_rw_queued); { IOMAP_FAULT, "FAULT" }, \ { IOMAP_DIRECT, "DIRECT" }, \ { IOMAP_NOWAIT, "NOWAIT" }, \ - { IOMAP_ATOMIC, "ATOMIC" } + { IOMAP_OVERWRITE_ONLY, "OVERWRITE_ONLY" }, \ + { IOMAP_UNSHARE, "UNSHARE" }, \ + { IOMAP_DAX, "DAX" }, \ + { IOMAP_ATOMIC, "ATOMIC" }, \ + { IOMAP_DONTCACHE, "DONTCACHE" } #define IOMAP_F_FLAGS_STRINGS \ { IOMAP_F_NEW, "NEW" }, \ @@ -107,7 +111,14 @@ DEFINE_RANGE_EVENT(iomap_dio_rw_queued); { IOMAP_F_SHARED, "SHARED" }, \ { IOMAP_F_MERGED, "MERGED" }, \ { IOMAP_F_BUFFER_HEAD, "BH" }, \ - { IOMAP_F_SIZE_CHANGED, "SIZE_CHANGED" } + { IOMAP_F_XATTR, "XATTR" }, \ + { IOMAP_F_BOUNDARY, "BOUNDARY" }, \ + { IOMAP_F_ANON_WRITE, "ANON_WRITE" }, \ + { IOMAP_F_ATOMIC_BIO, "ATOMIC_BIO" }, \ + { IOMAP_F_PRIVATE, "PRIVATE" }, \ + { IOMAP_F_SIZE_CHANGED, "SIZE_CHANGED" }, \ + { IOMAP_F_STALE, "STALE" } + #define IOMAP_DIO_STRINGS \ {IOMAP_DIO_FORCE_WAIT, "DIO_FORCE_WAIT" }, \ @@ -138,7 +149,7 @@ DECLARE_EVENT_CLASS(iomap_class, __entry->bdev = iomap->bdev ? iomap->bdev->bd_dev : 0; ), TP_printk("dev %d:%d ino 0x%llx bdev %d:%d addr 0x%llx offset 0x%llx " - "length 0x%llx type %s flags %s", + "length 0x%llx type %s (0x%x) flags %s (0x%x)", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, MAJOR(__entry->bdev), MINOR(__entry->bdev), @@ -146,7 +157,9 @@ DECLARE_EVENT_CLASS(iomap_class, __entry->offset, __entry->length, __print_symbolic(__entry->type, IOMAP_TYPE_STRINGS), - __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS)) + __entry->type, + __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS), + __entry->flags) ) #define DEFINE_IOMAP_EVENT(name) \ @@ -185,7 +198,7 @@ TRACE_EVENT(iomap_writepage_map, __entry->bdev = iomap->bdev ? iomap->bdev->bd_dev : 0; ), TP_printk("dev %d:%d ino 0x%llx bdev %d:%d pos 0x%llx dirty len 0x%llx " - "addr 0x%llx offset 0x%llx length 0x%llx type %s flags %s", + "addr 0x%llx offset 0x%llx length 0x%llx type %s (0x%x) flags %s (0x%x)", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, MAJOR(__entry->bdev), MINOR(__entry->bdev), @@ -195,7 +208,9 @@ TRACE_EVENT(iomap_writepage_map, __entry->offset, __entry->length, __print_symbolic(__entry->type, IOMAP_TYPE_STRINGS), - __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS)) + __entry->type, + __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS), + __entry->flags) ); TRACE_EVENT(iomap_iter,