linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iomap: Fix conflicting values of iomap flags
@ 2025-03-27 17:01 Ritesh Harjani (IBM)
  2025-03-27 22:04 ` John Garry
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ritesh Harjani (IBM) @ 2025-03-27 17:01 UTC (permalink / raw)
  To: linux-xfs
  Cc: linux-fsdevel, Christoph Hellwig, John Garry, brauner, djwong,
	dchinner, linux-kernel, ojaswin, linux-ext4, Ritesh Harjani (IBM)

IOMAP_F_ATOMIC_BIO mistakenly took the same value as of IOMAP_F_SIZE_CHANGED
in patch '370a6de7651b ("iomap: rework IOMAP atomic flags")'.
Let's fix this and let's also create some more space for filesystem reported
flags to avoid this in future. This patch makes the core iomap flags to start
from bit 15, moving downwards. Note that "flags" member within struct iomap
is of type u16.

Fixes: 370a6de7651b ("iomap: rework IOMAP atomic flags")
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 include/linux/iomap.h | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 02fe001feebbd4..68416b135151d7 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -78,6 +78,11 @@ struct vm_fault;
 #define IOMAP_F_ANON_WRITE	(1U << 7)
 #define IOMAP_F_ATOMIC_BIO	(1U << 8)

+/*
+ * Flag reserved for file system specific usage
+ */
+#define IOMAP_F_PRIVATE		(1U << 12)
+
 /*
  * Flags set by the core iomap code during operations:
  *
@@ -88,14 +93,8 @@ struct vm_fault;
  * range it covers needs to be remapped by the high level before the operation
  * can proceed.
  */
-#define IOMAP_F_SIZE_CHANGED	(1U << 8)
-#define IOMAP_F_STALE		(1U << 9)
-
-/*
- * Flags from 0x1000 up are for file system specific usage:
- */
-#define IOMAP_F_PRIVATE		(1U << 12)
-
+#define IOMAP_F_SIZE_CHANGED	(1U << 14)
+#define IOMAP_F_STALE		(1U << 15)

 /*
  * Magic value for addr:

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: Fix conflicting values of iomap flags
  2025-03-27 17:01 [PATCH] iomap: Fix conflicting values of iomap flags Ritesh Harjani (IBM)
@ 2025-03-27 22:04 ` John Garry
  2025-03-28 10:48   ` Christoph Hellwig
  2025-03-28  9:45 ` Christian Brauner
  2025-03-28 10:47 ` Christoph Hellwig
  2 siblings, 1 reply; 5+ messages in thread
From: John Garry @ 2025-03-27 22:04 UTC (permalink / raw)
  To: Ritesh Harjani (IBM), linux-xfs
  Cc: linux-fsdevel, Christoph Hellwig, brauner, djwong, dchinner,
	linux-kernel, ojaswin, linux-ext4

On 27/03/2025 17:01, Ritesh Harjani (IBM) wrote:
> IOMAP_F_ATOMIC_BIO mistakenly took the same value as of IOMAP_F_SIZE_CHANGED
> in patch '370a6de7651b ("iomap: rework IOMAP atomic flags")'.
> Let's fix this and let's also create some more space for filesystem reported
> flags to avoid this in future. This patch makes the core iomap flags to start
> from bit 15, moving downwards. Note that "flags" member within struct iomap
> is of type u16.

Just my opinion - and others will prob disagree - but I think that the 
reason this was missed (my fault, though) was because we have separate 
grouping of flags within the same struct member. Maybe having separate 
flags altogether would help avoid this.

> 
> Fixes: 370a6de7651b ("iomap: rework IOMAP atomic flags")
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

Reviewed-by: John Garry <john.g.garry@oracle.com>

> ---
>   include/linux/iomap.h | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 02fe001feebbd4..68416b135151d7 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -78,6 +78,11 @@ struct vm_fault;
>   #define IOMAP_F_ANON_WRITE	(1U << 7)
>   #define IOMAP_F_ATOMIC_BIO	(1U << 8)
> 
> +/*
> + * Flag reserved for file system specific usage
> + */
> +#define IOMAP_F_PRIVATE		(1U << 12)
> +
>   /*
>    * Flags set by the core iomap code during operations:
>    *
> @@ -88,14 +93,8 @@ struct vm_fault;
>    * range it covers needs to be remapped by the high level before the operation
>    * can proceed.
>    */
> -#define IOMAP_F_SIZE_CHANGED	(1U << 8)
> -#define IOMAP_F_STALE		(1U << 9)
> -
> -/*
> - * Flags from 0x1000 up are for file system specific usage:
> - */
> -#define IOMAP_F_PRIVATE		(1U << 12)
> -
> +#define IOMAP_F_SIZE_CHANGED	(1U << 14)
> +#define IOMAP_F_STALE		(1U << 15)
> 
>   /*
>    * Magic value for addr:


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: Fix conflicting values of iomap flags
  2025-03-27 17:01 [PATCH] iomap: Fix conflicting values of iomap flags Ritesh Harjani (IBM)
  2025-03-27 22:04 ` John Garry
@ 2025-03-28  9:45 ` Christian Brauner
  2025-03-28 10:47 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2025-03-28  9:45 UTC (permalink / raw)
  To: linux-xfs, Ritesh Harjani (IBM)
  Cc: Christian Brauner, linux-fsdevel, Christoph Hellwig, John Garry,
	djwong, dchinner, linux-kernel, ojaswin, linux-ext4

On Fri, 28 Mar 2025 01:01:19 +0800, Ritesh Harjani (IBM) wrote:
> IOMAP_F_ATOMIC_BIO mistakenly took the same value as of IOMAP_F_SIZE_CHANGED
> in patch '370a6de7651b ("iomap: rework IOMAP atomic flags")'.
> Let's fix this and let's also create some more space for filesystem reported
> flags to avoid this in future. This patch makes the core iomap flags to start
> from bit 15, moving downwards. Note that "flags" member within struct iomap
> is of type u16.
> 
> [...]

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] iomap: Fix conflicting values of iomap flags
      https://git.kernel.org/vfs/vfs/c/923936efeb74

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: Fix conflicting values of iomap flags
  2025-03-27 17:01 [PATCH] iomap: Fix conflicting values of iomap flags Ritesh Harjani (IBM)
  2025-03-27 22:04 ` John Garry
  2025-03-28  9:45 ` Christian Brauner
@ 2025-03-28 10:47 ` Christoph Hellwig
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2025-03-28 10:47 UTC (permalink / raw)
  To: Ritesh Harjani (IBM)
  Cc: linux-xfs, linux-fsdevel, Christoph Hellwig, John Garry, brauner,
	djwong, dchinner, linux-kernel, ojaswin, linux-ext4

On Fri, Mar 28, 2025 at 01:01:19AM +0800, Ritesh Harjani (IBM) wrote:
> IOMAP_F_ATOMIC_BIO mistakenly took the same value as of IOMAP_F_SIZE_CHANGED
> in patch '370a6de7651b ("iomap: rework IOMAP atomic flags")'.
> Let's fix this and let's also create some more space for filesystem reported
> flags to avoid this in future. This patch makes the core iomap flags to start
> from bit 15, moving downwards. Note that "flags" member within struct iomap
> is of type u16.
> 
> Fixes: 370a6de7651b ("iomap: rework IOMAP atomic flags")
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: Fix conflicting values of iomap flags
  2025-03-27 22:04 ` John Garry
@ 2025-03-28 10:48   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2025-03-28 10:48 UTC (permalink / raw)
  To: John Garry
  Cc: Ritesh Harjani (IBM), linux-xfs, linux-fsdevel, Christoph Hellwig,
	brauner, djwong, dchinner, linux-kernel, ojaswin, linux-ext4

On Thu, Mar 27, 2025 at 10:04:14PM +0000, John Garry wrote:
> Just my opinion - and others will prob disagree - but I think that the 
> reason this was missed (my fault, though) was because we have separate 
> grouping of flags within the same struct member. Maybe having separate 
> flags altogether would help avoid this.

Yes.  But going down to less than 16 bit fields also has downsides, as
does growing the struture.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-28 10:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 17:01 [PATCH] iomap: Fix conflicting values of iomap flags Ritesh Harjani (IBM)
2025-03-27 22:04 ` John Garry
2025-03-28 10:48   ` Christoph Hellwig
2025-03-28  9:45 ` Christian Brauner
2025-03-28 10:47 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).