* [PATCH 01/17] xfs: convert buffer flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 10:05 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 02/17] xfs: convert attr type " Dave Chinner
` (15 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned. This manifests as a compiler error such as:
/kisskb/src/fs/xfs/./xfs_trace.h:432:2: note: in expansion of macro 'TP_printk'
TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
^
/kisskb/src/fs/xfs/./xfs_trace.h:440:5: note: in expansion of macro '__print_flags'
__print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
^
/kisskb/src/fs/xfs/xfs_buf.h:67:4: note: in expansion of macro 'XBF_UNMAPPED'
{ XBF_UNMAPPED, "UNMAPPED" }
^
/kisskb/src/fs/xfs/./xfs_trace.h:440:40: note: in expansion of macro 'XFS_BUF_FLAGS'
__print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
^
/kisskb/src/fs/xfs/./xfs_trace.h: In function 'trace_raw_output_xfs_buf_flags_class':
/kisskb/src/fs/xfs/xfs_buf.h:46:23: error: initializer element is not constant
#define XBF_UNMAPPED (1 << 31)/* do not map the buffer */
as __print_flags assigns XFS_BUF_FLAGS to a structure that uses an
unsigned long for the flag. Since this results in the value of
XBF_UNMAPPED causing a signed integer overflow, the result is
technically undefined behavior, which gcc-5 does not accept as an
integer constant.
This is based on a patch from Arnd Bergman <arnd@arndb.de>.
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_buf.c | 6 +++---
fs/xfs/xfs_buf.h | 42 +++++++++++++++++++++---------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index e1afb9e503e1..bf4e60871068 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -406,7 +406,7 @@ xfs_buf_alloc_pages(
STATIC int
_xfs_buf_map_pages(
struct xfs_buf *bp,
- uint flags)
+ xfs_buf_flags_t flags)
{
ASSERT(bp->b_flags & _XBF_PAGES);
if (bp->b_page_count == 1) {
@@ -868,7 +868,7 @@ xfs_buf_read_uncached(
struct xfs_buftarg *target,
xfs_daddr_t daddr,
size_t numblks,
- int flags,
+ xfs_buf_flags_t flags,
struct xfs_buf **bpp,
const struct xfs_buf_ops *ops)
{
@@ -903,7 +903,7 @@ int
xfs_buf_get_uncached(
struct xfs_buftarg *target,
size_t numblks,
- int flags,
+ xfs_buf_flags_t flags,
struct xfs_buf **bpp)
{
int error;
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index edcb6254fa6a..1ee3056ff9cf 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -22,28 +22,28 @@ struct xfs_buf;
#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
-#define XBF_READ (1 << 0) /* buffer intended for reading from device */
-#define XBF_WRITE (1 << 1) /* buffer intended for writing to device */
-#define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */
-#define XBF_NO_IOACCT (1 << 3) /* bypass I/O accounting (non-LRU bufs) */
-#define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */
-#define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */
-#define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */
-#define XBF_WRITE_FAIL (1 << 7) /* async writes have failed on this buffer */
+#define XBF_READ (1u << 0) /* buffer intended for reading from device */
+#define XBF_WRITE (1u << 1) /* buffer intended for writing to device */
+#define XBF_READ_AHEAD (1u << 2) /* asynchronous read-ahead */
+#define XBF_NO_IOACCT (1u << 3) /* bypass I/O accounting (non-LRU bufs) */
+#define XBF_ASYNC (1u << 4) /* initiator will not wait for completion */
+#define XBF_DONE (1u << 5) /* all pages in the buffer uptodate */
+#define XBF_STALE (1u << 6) /* buffer has been staled, do not find it */
+#define XBF_WRITE_FAIL (1u << 7) /* async writes have failed on this buffer */
/* buffer type flags for write callbacks */
-#define _XBF_INODES (1 << 16)/* inode buffer */
-#define _XBF_DQUOTS (1 << 17)/* dquot buffer */
-#define _XBF_LOGRECOVERY (1 << 18)/* log recovery buffer */
+#define _XBF_INODES (1u << 16)/* inode buffer */
+#define _XBF_DQUOTS (1u << 17)/* dquot buffer */
+#define _XBF_LOGRECOVERY (1u << 18)/* log recovery buffer */
/* flags used only internally */
-#define _XBF_PAGES (1 << 20)/* backed by refcounted pages */
-#define _XBF_KMEM (1 << 21)/* backed by heap memory */
-#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */
+#define _XBF_PAGES (1u << 20)/* backed by refcounted pages */
+#define _XBF_KMEM (1u << 21)/* backed by heap memory */
+#define _XBF_DELWRI_Q (1u << 22)/* buffer on a delwri queue */
/* flags used only as arguments to access routines */
-#define XBF_TRYLOCK (1 << 30)/* lock requested, but do not wait */
-#define XBF_UNMAPPED (1 << 31)/* do not map the buffer */
+#define XBF_TRYLOCK (1u << 30)/* lock requested, but do not wait */
+#define XBF_UNMAPPED (1u << 31)/* do not map the buffer */
typedef unsigned int xfs_buf_flags_t;
@@ -58,7 +58,7 @@ typedef unsigned int xfs_buf_flags_t;
{ XBF_WRITE_FAIL, "WRITE_FAIL" }, \
{ _XBF_INODES, "INODES" }, \
{ _XBF_DQUOTS, "DQUOTS" }, \
- { _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \
+ { _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \
{ _XBF_PAGES, "PAGES" }, \
{ _XBF_KMEM, "KMEM" }, \
{ _XBF_DELWRI_Q, "DELWRI_Q" }, \
@@ -247,11 +247,11 @@ xfs_buf_readahead(
return xfs_buf_readahead_map(target, &map, 1, ops);
}
-int xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, int flags,
- struct xfs_buf **bpp);
+int xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
+ xfs_buf_flags_t flags, struct xfs_buf **bpp);
int xfs_buf_read_uncached(struct xfs_buftarg *target, xfs_daddr_t daddr,
- size_t numblks, int flags, struct xfs_buf **bpp,
- const struct xfs_buf_ops *ops);
+ size_t numblks, xfs_buf_flags_t flags, struct xfs_buf **bpp,
+ const struct xfs_buf_ops *ops);
int _xfs_buf_read(struct xfs_buf *bp, xfs_buf_flags_t flags);
void xfs_buf_hold(struct xfs_buf *bp);
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 01/17] xfs: convert buffer flags to unsigned.
2022-04-11 0:31 ` [PATCH 01/17] xfs: convert buffer flags to unsigned Dave Chinner
@ 2022-04-11 10:05 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 10:05 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned. This manifests as a compiler error such as:
>
> /kisskb/src/fs/xfs/./xfs_trace.h:432:2: note: in expansion of macro 'TP_printk'
> TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
> ^
> /kisskb/src/fs/xfs/./xfs_trace.h:440:5: note: in expansion of macro '__print_flags'
> __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
> ^
> /kisskb/src/fs/xfs/xfs_buf.h:67:4: note: in expansion of macro 'XBF_UNMAPPED'
> { XBF_UNMAPPED, "UNMAPPED" }
> ^
> /kisskb/src/fs/xfs/./xfs_trace.h:440:40: note: in expansion of macro 'XFS_BUF_FLAGS'
> __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
> ^
> /kisskb/src/fs/xfs/./xfs_trace.h: In function 'trace_raw_output_xfs_buf_flags_class':
> /kisskb/src/fs/xfs/xfs_buf.h:46:23: error: initializer element is not constant
> #define XBF_UNMAPPED (1 << 31)/* do not map the buffer */
>
> as __print_flags assigns XFS_BUF_FLAGS to a structure that uses an
> unsigned long for the flag. Since this results in the value of
> XBF_UNMAPPED causing a signed integer overflow, the result is
> technically undefined behavior, which gcc-5 does not accept as an
> integer constant.
>
> This is based on a patch from Arnd Bergman <arnd@arndb.de>.
>
Although the underlying data type is the same, may be the type of the fifth
argument to xfs_trans_get_buf() should be changed to xfs_buf_flags_t as well.
With that fixed,
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_buf.c | 6 +++---
> fs/xfs/xfs_buf.h | 42 +++++++++++++++++++++---------------------
> 2 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index e1afb9e503e1..bf4e60871068 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -406,7 +406,7 @@ xfs_buf_alloc_pages(
> STATIC int
> _xfs_buf_map_pages(
> struct xfs_buf *bp,
> - uint flags)
> + xfs_buf_flags_t flags)
> {
> ASSERT(bp->b_flags & _XBF_PAGES);
> if (bp->b_page_count == 1) {
> @@ -868,7 +868,7 @@ xfs_buf_read_uncached(
> struct xfs_buftarg *target,
> xfs_daddr_t daddr,
> size_t numblks,
> - int flags,
> + xfs_buf_flags_t flags,
> struct xfs_buf **bpp,
> const struct xfs_buf_ops *ops)
> {
> @@ -903,7 +903,7 @@ int
> xfs_buf_get_uncached(
> struct xfs_buftarg *target,
> size_t numblks,
> - int flags,
> + xfs_buf_flags_t flags,
> struct xfs_buf **bpp)
> {
> int error;
> diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
> index edcb6254fa6a..1ee3056ff9cf 100644
> --- a/fs/xfs/xfs_buf.h
> +++ b/fs/xfs/xfs_buf.h
> @@ -22,28 +22,28 @@ struct xfs_buf;
>
> #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
>
> -#define XBF_READ (1 << 0) /* buffer intended for reading from device */
> -#define XBF_WRITE (1 << 1) /* buffer intended for writing to device */
> -#define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */
> -#define XBF_NO_IOACCT (1 << 3) /* bypass I/O accounting (non-LRU bufs) */
> -#define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */
> -#define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */
> -#define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */
> -#define XBF_WRITE_FAIL (1 << 7) /* async writes have failed on this buffer */
> +#define XBF_READ (1u << 0) /* buffer intended for reading from device */
> +#define XBF_WRITE (1u << 1) /* buffer intended for writing to device */
> +#define XBF_READ_AHEAD (1u << 2) /* asynchronous read-ahead */
> +#define XBF_NO_IOACCT (1u << 3) /* bypass I/O accounting (non-LRU bufs) */
> +#define XBF_ASYNC (1u << 4) /* initiator will not wait for completion */
> +#define XBF_DONE (1u << 5) /* all pages in the buffer uptodate */
> +#define XBF_STALE (1u << 6) /* buffer has been staled, do not find it */
> +#define XBF_WRITE_FAIL (1u << 7) /* async writes have failed on this buffer */
>
> /* buffer type flags for write callbacks */
> -#define _XBF_INODES (1 << 16)/* inode buffer */
> -#define _XBF_DQUOTS (1 << 17)/* dquot buffer */
> -#define _XBF_LOGRECOVERY (1 << 18)/* log recovery buffer */
> +#define _XBF_INODES (1u << 16)/* inode buffer */
> +#define _XBF_DQUOTS (1u << 17)/* dquot buffer */
> +#define _XBF_LOGRECOVERY (1u << 18)/* log recovery buffer */
>
> /* flags used only internally */
> -#define _XBF_PAGES (1 << 20)/* backed by refcounted pages */
> -#define _XBF_KMEM (1 << 21)/* backed by heap memory */
> -#define _XBF_DELWRI_Q (1 << 22)/* buffer on a delwri queue */
> +#define _XBF_PAGES (1u << 20)/* backed by refcounted pages */
> +#define _XBF_KMEM (1u << 21)/* backed by heap memory */
> +#define _XBF_DELWRI_Q (1u << 22)/* buffer on a delwri queue */
>
> /* flags used only as arguments to access routines */
> -#define XBF_TRYLOCK (1 << 30)/* lock requested, but do not wait */
> -#define XBF_UNMAPPED (1 << 31)/* do not map the buffer */
> +#define XBF_TRYLOCK (1u << 30)/* lock requested, but do not wait */
> +#define XBF_UNMAPPED (1u << 31)/* do not map the buffer */
>
> typedef unsigned int xfs_buf_flags_t;
>
> @@ -58,7 +58,7 @@ typedef unsigned int xfs_buf_flags_t;
> { XBF_WRITE_FAIL, "WRITE_FAIL" }, \
> { _XBF_INODES, "INODES" }, \
> { _XBF_DQUOTS, "DQUOTS" }, \
> - { _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \
> + { _XBF_LOGRECOVERY, "LOG_RECOVERY" }, \
> { _XBF_PAGES, "PAGES" }, \
> { _XBF_KMEM, "KMEM" }, \
> { _XBF_DELWRI_Q, "DELWRI_Q" }, \
> @@ -247,11 +247,11 @@ xfs_buf_readahead(
> return xfs_buf_readahead_map(target, &map, 1, ops);
> }
>
> -int xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks, int flags,
> - struct xfs_buf **bpp);
> +int xfs_buf_get_uncached(struct xfs_buftarg *target, size_t numblks,
> + xfs_buf_flags_t flags, struct xfs_buf **bpp);
> int xfs_buf_read_uncached(struct xfs_buftarg *target, xfs_daddr_t daddr,
> - size_t numblks, int flags, struct xfs_buf **bpp,
> - const struct xfs_buf_ops *ops);
> + size_t numblks, xfs_buf_flags_t flags, struct xfs_buf **bpp,
> + const struct xfs_buf_ops *ops);
> int _xfs_buf_read(struct xfs_buf *bp, xfs_buf_flags_t flags);
> void xfs_buf_hold(struct xfs_buf *bp);
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 02/17] xfs: convert attr type flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
2022-04-11 0:31 ` [PATCH 01/17] xfs: convert buffer flags to unsigned Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 10:23 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 03/17] xfs: convert scrub " Dave Chinner
` (14 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_da_format.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index 5a49caa5c9df..4c6561baf9e9 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -688,10 +688,10 @@ struct xfs_attr3_leafblock {
#define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
#define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */
#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
-#define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
-#define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
-#define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT)
-#define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT)
+#define XFS_ATTR_LOCAL (1u << XFS_ATTR_LOCAL_BIT)
+#define XFS_ATTR_ROOT (1u << XFS_ATTR_ROOT_BIT)
+#define XFS_ATTR_SECURE (1u << XFS_ATTR_SECURE_BIT)
+#define XFS_ATTR_INCOMPLETE (1u << XFS_ATTR_INCOMPLETE_BIT)
#define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE)
/*
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 02/17] xfs: convert attr type flags to unsigned.
2022-04-11 0:31 ` [PATCH 02/17] xfs: convert attr type " Dave Chinner
@ 2022-04-11 10:23 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 10:23 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good to me.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_da_format.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
> index 5a49caa5c9df..4c6561baf9e9 100644
> --- a/fs/xfs/libxfs/xfs_da_format.h
> +++ b/fs/xfs/libxfs/xfs_da_format.h
> @@ -688,10 +688,10 @@ struct xfs_attr3_leafblock {
> #define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted attrs */
> #define XFS_ATTR_SECURE_BIT 2 /* limit access to secure attrs */
> #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
> -#define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
> -#define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
> -#define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT)
> -#define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT)
> +#define XFS_ATTR_LOCAL (1u << XFS_ATTR_LOCAL_BIT)
> +#define XFS_ATTR_ROOT (1u << XFS_ATTR_ROOT_BIT)
> +#define XFS_ATTR_SECURE (1u << XFS_ATTR_SECURE_BIT)
> +#define XFS_ATTR_INCOMPLETE (1u << XFS_ATTR_INCOMPLETE_BIT)
> #define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE)
>
> /*
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 03/17] xfs: convert scrub type flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
2022-04-11 0:31 ` [PATCH 01/17] xfs: convert buffer flags to unsigned Dave Chinner
2022-04-11 0:31 ` [PATCH 02/17] xfs: convert attr type " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 10:33 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 04/17] xfs: convert bmap extent " Dave Chinner
` (13 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
This touches xfs_fs.h so affects the user API, but the user API
fields are also unsigned so the flags should really be unsigned,
too.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_fs.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 505533c43a92..52c9d8676fa3 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -699,34 +699,34 @@ struct xfs_scrub_metadata {
#define XFS_SCRUB_TYPE_NR 25
/* i: Repair this metadata. */
-#define XFS_SCRUB_IFLAG_REPAIR (1 << 0)
+#define XFS_SCRUB_IFLAG_REPAIR (1u << 0)
/* o: Metadata object needs repair. */
-#define XFS_SCRUB_OFLAG_CORRUPT (1 << 1)
+#define XFS_SCRUB_OFLAG_CORRUPT (1u << 1)
/*
* o: Metadata object could be optimized. It's not corrupt, but
* we could improve on it somehow.
*/
-#define XFS_SCRUB_OFLAG_PREEN (1 << 2)
+#define XFS_SCRUB_OFLAG_PREEN (1u << 2)
/* o: Cross-referencing failed. */
-#define XFS_SCRUB_OFLAG_XFAIL (1 << 3)
+#define XFS_SCRUB_OFLAG_XFAIL (1u << 3)
/* o: Metadata object disagrees with cross-referenced metadata. */
-#define XFS_SCRUB_OFLAG_XCORRUPT (1 << 4)
+#define XFS_SCRUB_OFLAG_XCORRUPT (1u << 4)
/* o: Scan was not complete. */
-#define XFS_SCRUB_OFLAG_INCOMPLETE (1 << 5)
+#define XFS_SCRUB_OFLAG_INCOMPLETE (1u << 5)
/* o: Metadata object looked funny but isn't corrupt. */
-#define XFS_SCRUB_OFLAG_WARNING (1 << 6)
+#define XFS_SCRUB_OFLAG_WARNING (1u << 6)
/*
* o: IFLAG_REPAIR was set but metadata object did not need fixing or
* optimization and has therefore not been altered.
*/
-#define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1 << 7)
+#define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1u << 7)
#define XFS_SCRUB_FLAGS_IN (XFS_SCRUB_IFLAG_REPAIR)
#define XFS_SCRUB_FLAGS_OUT (XFS_SCRUB_OFLAG_CORRUPT | \
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 03/17] xfs: convert scrub type flags to unsigned.
2022-04-11 0:31 ` [PATCH 03/17] xfs: convert scrub " Dave Chinner
@ 2022-04-11 10:33 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 10:33 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
> This touches xfs_fs.h so affects the user API, but the user API
> fields are also unsigned so the flags should really be unsigned,
> too.
>
Looks good to me.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_fs.h | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> index 505533c43a92..52c9d8676fa3 100644
> --- a/fs/xfs/libxfs/xfs_fs.h
> +++ b/fs/xfs/libxfs/xfs_fs.h
> @@ -699,34 +699,34 @@ struct xfs_scrub_metadata {
> #define XFS_SCRUB_TYPE_NR 25
>
> /* i: Repair this metadata. */
> -#define XFS_SCRUB_IFLAG_REPAIR (1 << 0)
> +#define XFS_SCRUB_IFLAG_REPAIR (1u << 0)
>
> /* o: Metadata object needs repair. */
> -#define XFS_SCRUB_OFLAG_CORRUPT (1 << 1)
> +#define XFS_SCRUB_OFLAG_CORRUPT (1u << 1)
>
> /*
> * o: Metadata object could be optimized. It's not corrupt, but
> * we could improve on it somehow.
> */
> -#define XFS_SCRUB_OFLAG_PREEN (1 << 2)
> +#define XFS_SCRUB_OFLAG_PREEN (1u << 2)
>
> /* o: Cross-referencing failed. */
> -#define XFS_SCRUB_OFLAG_XFAIL (1 << 3)
> +#define XFS_SCRUB_OFLAG_XFAIL (1u << 3)
>
> /* o: Metadata object disagrees with cross-referenced metadata. */
> -#define XFS_SCRUB_OFLAG_XCORRUPT (1 << 4)
> +#define XFS_SCRUB_OFLAG_XCORRUPT (1u << 4)
>
> /* o: Scan was not complete. */
> -#define XFS_SCRUB_OFLAG_INCOMPLETE (1 << 5)
> +#define XFS_SCRUB_OFLAG_INCOMPLETE (1u << 5)
>
> /* o: Metadata object looked funny but isn't corrupt. */
> -#define XFS_SCRUB_OFLAG_WARNING (1 << 6)
> +#define XFS_SCRUB_OFLAG_WARNING (1u << 6)
>
> /*
> * o: IFLAG_REPAIR was set but metadata object did not need fixing or
> * optimization and has therefore not been altered.
> */
> -#define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1 << 7)
> +#define XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED (1u << 7)
>
> #define XFS_SCRUB_FLAGS_IN (XFS_SCRUB_IFLAG_REPAIR)
> #define XFS_SCRUB_FLAGS_OUT (XFS_SCRUB_OFLAG_CORRUPT | \
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 04/17] xfs: convert bmap extent type flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (2 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 03/17] xfs: convert scrub " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 10:42 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 05/17] xfs: convert bmapi " Dave Chinner
` (12 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_bmap.c | 14 +++++++-------
fs/xfs/libxfs/xfs_bmap.h | 22 +++++++++++-----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 74198dd82b03..d53dfe8db8f2 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1399,7 +1399,7 @@ xfs_bmap_add_extent_delay_real(
xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
/* left is 0, right is 1, prev is 2 */
int rval=0; /* return value (logging flags) */
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
xfs_filblks_t da_new; /* new count del alloc blocks used */
xfs_filblks_t da_old; /* old count del alloc blocks used */
xfs_filblks_t temp=0; /* value for da_new calculations */
@@ -1950,7 +1950,7 @@ xfs_bmap_add_extent_unwritten_real(
xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
/* left is 0, right is 1, prev is 2 */
int rval=0; /* return value (logging flags) */
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
struct xfs_mount *mp = ip->i_mount;
struct xfs_bmbt_irec old;
@@ -2479,7 +2479,7 @@ xfs_bmap_add_extent_hole_delay(
xfs_filblks_t newlen=0; /* new indirect size */
xfs_filblks_t oldlen=0; /* old indirect size */
xfs_bmbt_irec_t right; /* right neighbor extent entry */
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
xfs_filblks_t temp; /* temp for indirect calculations */
ifp = XFS_IFORK_PTR(ip, whichfork);
@@ -2626,7 +2626,7 @@ xfs_bmap_add_extent_hole_real(
xfs_bmbt_irec_t left; /* left neighbor extent entry */
xfs_bmbt_irec_t right; /* right neighbor extent entry */
int rval=0; /* return value (logging flags) */
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
struct xfs_bmbt_irec old;
ASSERT(!isnullstartblock(new->br_startblock));
@@ -4801,7 +4801,7 @@ xfs_bmap_del_extent_delay(
int64_t da_old, da_new, da_diff = 0;
xfs_fileoff_t del_endoff, got_endoff;
xfs_filblks_t got_indlen, new_indlen, stolen;
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
int error = 0;
bool isrt;
@@ -4926,7 +4926,7 @@ xfs_bmap_del_extent_cow(
struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
struct xfs_bmbt_irec new;
xfs_fileoff_t del_endoff, got_endoff;
- int state = BMAP_COWFORK;
+ uint32_t state = BMAP_COWFORK;
XFS_STATS_INC(mp, xs_del_exlist);
@@ -5015,7 +5015,7 @@ xfs_bmap_del_extent_real(
xfs_bmbt_irec_t new; /* new record to be inserted */
/* REFERENCED */
uint qfield; /* quota field to update */
- int state = xfs_bmap_fork_to_state(whichfork);
+ uint32_t state = xfs_bmap_fork_to_state(whichfork);
struct xfs_bmbt_irec old;
mp = ip->i_mount;
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 03d9aaf87413..29d38c3c2607 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -124,16 +124,16 @@ static inline int xfs_bmapi_whichfork(int bmapi_flags)
/*
* Flags for xfs_bmap_add_extent*.
*/
-#define BMAP_LEFT_CONTIG (1 << 0)
-#define BMAP_RIGHT_CONTIG (1 << 1)
-#define BMAP_LEFT_FILLING (1 << 2)
-#define BMAP_RIGHT_FILLING (1 << 3)
-#define BMAP_LEFT_DELAY (1 << 4)
-#define BMAP_RIGHT_DELAY (1 << 5)
-#define BMAP_LEFT_VALID (1 << 6)
-#define BMAP_RIGHT_VALID (1 << 7)
-#define BMAP_ATTRFORK (1 << 8)
-#define BMAP_COWFORK (1 << 9)
+#define BMAP_LEFT_CONTIG (1u << 0)
+#define BMAP_RIGHT_CONTIG (1u << 1)
+#define BMAP_LEFT_FILLING (1u << 2)
+#define BMAP_RIGHT_FILLING (1u << 3)
+#define BMAP_LEFT_DELAY (1u << 4)
+#define BMAP_RIGHT_DELAY (1u << 5)
+#define BMAP_LEFT_VALID (1u << 6)
+#define BMAP_RIGHT_VALID (1u << 7)
+#define BMAP_ATTRFORK (1u << 8)
+#define BMAP_COWFORK (1u << 9)
#define XFS_BMAP_EXT_FLAGS \
{ BMAP_LEFT_CONTIG, "LC" }, \
@@ -243,7 +243,7 @@ void xfs_bmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
void xfs_bmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
struct xfs_bmbt_irec *imap);
-static inline int xfs_bmap_fork_to_state(int whichfork)
+static inline uint32_t xfs_bmap_fork_to_state(int whichfork)
{
switch (whichfork) {
case XFS_ATTR_FORK:
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 04/17] xfs: convert bmap extent type flags to unsigned.
2022-04-11 0:31 ` [PATCH 04/17] xfs: convert bmap extent " Dave Chinner
@ 2022-04-11 10:42 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 10:42 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good to me.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 14 +++++++-------
> fs/xfs/libxfs/xfs_bmap.h | 22 +++++++++++-----------
> 2 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 74198dd82b03..d53dfe8db8f2 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -1399,7 +1399,7 @@ xfs_bmap_add_extent_delay_real(
> xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
> /* left is 0, right is 1, prev is 2 */
> int rval=0; /* return value (logging flags) */
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> xfs_filblks_t da_new; /* new count del alloc blocks used */
> xfs_filblks_t da_old; /* old count del alloc blocks used */
> xfs_filblks_t temp=0; /* value for da_new calculations */
> @@ -1950,7 +1950,7 @@ xfs_bmap_add_extent_unwritten_real(
> xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
> /* left is 0, right is 1, prev is 2 */
> int rval=0; /* return value (logging flags) */
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_mount *mp = ip->i_mount;
> struct xfs_bmbt_irec old;
>
> @@ -2479,7 +2479,7 @@ xfs_bmap_add_extent_hole_delay(
> xfs_filblks_t newlen=0; /* new indirect size */
> xfs_filblks_t oldlen=0; /* old indirect size */
> xfs_bmbt_irec_t right; /* right neighbor extent entry */
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> xfs_filblks_t temp; /* temp for indirect calculations */
>
> ifp = XFS_IFORK_PTR(ip, whichfork);
> @@ -2626,7 +2626,7 @@ xfs_bmap_add_extent_hole_real(
> xfs_bmbt_irec_t left; /* left neighbor extent entry */
> xfs_bmbt_irec_t right; /* right neighbor extent entry */
> int rval=0; /* return value (logging flags) */
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_bmbt_irec old;
>
> ASSERT(!isnullstartblock(new->br_startblock));
> @@ -4801,7 +4801,7 @@ xfs_bmap_del_extent_delay(
> int64_t da_old, da_new, da_diff = 0;
> xfs_fileoff_t del_endoff, got_endoff;
> xfs_filblks_t got_indlen, new_indlen, stolen;
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> int error = 0;
> bool isrt;
>
> @@ -4926,7 +4926,7 @@ xfs_bmap_del_extent_cow(
> struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
> struct xfs_bmbt_irec new;
> xfs_fileoff_t del_endoff, got_endoff;
> - int state = BMAP_COWFORK;
> + uint32_t state = BMAP_COWFORK;
>
> XFS_STATS_INC(mp, xs_del_exlist);
>
> @@ -5015,7 +5015,7 @@ xfs_bmap_del_extent_real(
> xfs_bmbt_irec_t new; /* new record to be inserted */
> /* REFERENCED */
> uint qfield; /* quota field to update */
> - int state = xfs_bmap_fork_to_state(whichfork);
> + uint32_t state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_bmbt_irec old;
>
> mp = ip->i_mount;
> diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
> index 03d9aaf87413..29d38c3c2607 100644
> --- a/fs/xfs/libxfs/xfs_bmap.h
> +++ b/fs/xfs/libxfs/xfs_bmap.h
> @@ -124,16 +124,16 @@ static inline int xfs_bmapi_whichfork(int bmapi_flags)
> /*
> * Flags for xfs_bmap_add_extent*.
> */
> -#define BMAP_LEFT_CONTIG (1 << 0)
> -#define BMAP_RIGHT_CONTIG (1 << 1)
> -#define BMAP_LEFT_FILLING (1 << 2)
> -#define BMAP_RIGHT_FILLING (1 << 3)
> -#define BMAP_LEFT_DELAY (1 << 4)
> -#define BMAP_RIGHT_DELAY (1 << 5)
> -#define BMAP_LEFT_VALID (1 << 6)
> -#define BMAP_RIGHT_VALID (1 << 7)
> -#define BMAP_ATTRFORK (1 << 8)
> -#define BMAP_COWFORK (1 << 9)
> +#define BMAP_LEFT_CONTIG (1u << 0)
> +#define BMAP_RIGHT_CONTIG (1u << 1)
> +#define BMAP_LEFT_FILLING (1u << 2)
> +#define BMAP_RIGHT_FILLING (1u << 3)
> +#define BMAP_LEFT_DELAY (1u << 4)
> +#define BMAP_RIGHT_DELAY (1u << 5)
> +#define BMAP_LEFT_VALID (1u << 6)
> +#define BMAP_RIGHT_VALID (1u << 7)
> +#define BMAP_ATTRFORK (1u << 8)
> +#define BMAP_COWFORK (1u << 9)
>
> #define XFS_BMAP_EXT_FLAGS \
> { BMAP_LEFT_CONTIG, "LC" }, \
> @@ -243,7 +243,7 @@ void xfs_bmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
> void xfs_bmap_unmap_extent(struct xfs_trans *tp, struct xfs_inode *ip,
> struct xfs_bmbt_irec *imap);
>
> -static inline int xfs_bmap_fork_to_state(int whichfork)
> +static inline uint32_t xfs_bmap_fork_to_state(int whichfork)
> {
> switch (whichfork) {
> case XFS_ATTR_FORK:
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 05/17] xfs: convert bmapi flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (3 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 04/17] xfs: convert bmap extent " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 12:53 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 06/17] xfs: convert AGF log " Dave Chinner
` (11 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_bmap.c | 22 +++++++++++-----------
fs/xfs/libxfs/xfs_bmap.h | 36 ++++++++++++++++++------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index d53dfe8db8f2..ad938e6e23aa 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -485,7 +485,7 @@ STATIC void
xfs_bmap_validate_ret(
xfs_fileoff_t bno,
xfs_filblks_t len,
- int flags,
+ uint32_t flags,
xfs_bmbt_irec_t *mval,
int nmap,
int ret_nmap)
@@ -2616,7 +2616,7 @@ xfs_bmap_add_extent_hole_real(
struct xfs_btree_cur **curp,
struct xfs_bmbt_irec *new,
int *logflagsp,
- int flags)
+ uint32_t flags)
{
struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork);
struct xfs_mount *mp = ip->i_mount;
@@ -3766,7 +3766,7 @@ xfs_bmapi_trim_map(
xfs_fileoff_t obno,
xfs_fileoff_t end,
int n,
- int flags)
+ uint32_t flags)
{
if ((flags & XFS_BMAPI_ENTIRE) ||
got->br_startoff + got->br_blockcount <= obno) {
@@ -3811,7 +3811,7 @@ xfs_bmapi_update_map(
xfs_fileoff_t obno,
xfs_fileoff_t end,
int *n,
- int flags)
+ uint32_t flags)
{
xfs_bmbt_irec_t *mval = *map;
@@ -3864,7 +3864,7 @@ xfs_bmapi_read(
xfs_filblks_t len,
struct xfs_bmbt_irec *mval,
int *nmap,
- int flags)
+ uint32_t flags)
{
struct xfs_mount *mp = ip->i_mount;
int whichfork = xfs_bmapi_whichfork(flags);
@@ -4184,7 +4184,7 @@ xfs_bmapi_convert_unwritten(
struct xfs_bmalloca *bma,
struct xfs_bmbt_irec *mval,
xfs_filblks_t len,
- int flags)
+ uint32_t flags)
{
int whichfork = xfs_bmapi_whichfork(flags);
struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
@@ -4312,7 +4312,7 @@ xfs_bmapi_write(
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t bno, /* starting file offs. mapped */
xfs_filblks_t len, /* length to map in file */
- int flags, /* XFS_BMAPI_... */
+ uint32_t flags, /* XFS_BMAPI_... */
xfs_extlen_t total, /* total blocks needed */
struct xfs_bmbt_irec *mval, /* output: map values */
int *nmap) /* i/o: mval size/count */
@@ -4629,7 +4629,7 @@ xfs_bmapi_remap(
xfs_fileoff_t bno,
xfs_filblks_t len,
xfs_fsblock_t startblock,
- int flags)
+ uint32_t flags)
{
struct xfs_mount *mp = ip->i_mount;
struct xfs_ifork *ifp;
@@ -4999,7 +4999,7 @@ xfs_bmap_del_extent_real(
xfs_bmbt_irec_t *del, /* data to remove from extents */
int *logflagsp, /* inode logging flags */
int whichfork, /* data or attr fork */
- int bflags) /* bmapi flags */
+ uint32_t bflags) /* bmapi flags */
{
xfs_fsblock_t del_endblock=0; /* first block past del */
xfs_fileoff_t del_endoff; /* first offset past del */
@@ -5281,7 +5281,7 @@ __xfs_bunmapi(
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t start, /* first file offset deleted */
xfs_filblks_t *rlen, /* i/o: amount remaining */
- int flags, /* misc flags */
+ uint32_t flags, /* misc flags */
xfs_extnum_t nexts) /* number of extents max */
{
struct xfs_btree_cur *cur; /* bmap btree cursor */
@@ -5609,7 +5609,7 @@ xfs_bunmapi(
struct xfs_inode *ip,
xfs_fileoff_t bno,
xfs_filblks_t len,
- int flags,
+ uint32_t flags,
xfs_extnum_t nexts,
int *done)
{
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 29d38c3c2607..16db95b11589 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -39,7 +39,7 @@ struct xfs_bmalloca {
bool aeof; /* allocated space at eof */
bool conv; /* overwriting unwritten extents */
int datatype;/* data type being allocated */
- int flags;
+ uint32_t flags;
};
#define XFS_BMAP_MAX_NMAP 4
@@ -47,17 +47,17 @@ struct xfs_bmalloca {
/*
* Flags for xfs_bmapi_*
*/
-#define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed */
-#define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */
-#define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */
-#define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space */
-#define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */
+#define XFS_BMAPI_ENTIRE (1u << 0) /* return entire extent untrimmed */
+#define XFS_BMAPI_METADATA (1u << 1) /* mapping metadata not user data */
+#define XFS_BMAPI_ATTRFORK (1u << 2) /* use attribute fork not data */
+#define XFS_BMAPI_PREALLOC (1u << 3) /* preallocating unwritten space */
+#define XFS_BMAPI_CONTIG (1u << 4) /* must allocate only one extent */
/*
* unwritten extent conversion - this needs write cache flushing and no additional
* allocation alignments. When specified with XFS_BMAPI_PREALLOC it converts
* from written to unwritten, otherwise convert from unwritten to written.
*/
-#define XFS_BMAPI_CONVERT 0x040
+#define XFS_BMAPI_CONVERT (1u << 5)
/*
* allocate zeroed extents - this requires all newly allocated user data extents
@@ -65,7 +65,7 @@ struct xfs_bmalloca {
* Use in conjunction with XFS_BMAPI_CONVERT to convert unwritten extents found
* during the allocation range to zeroed written extents.
*/
-#define XFS_BMAPI_ZERO 0x080
+#define XFS_BMAPI_ZERO (1u << 6)
/*
* Map the inode offset to the block given in ap->firstblock. Primarily
@@ -75,16 +75,16 @@ struct xfs_bmalloca {
* For bunmapi, this flag unmaps the range without adjusting quota, reducing
* refcount, or freeing the blocks.
*/
-#define XFS_BMAPI_REMAP 0x100
+#define XFS_BMAPI_REMAP (1u << 7)
/* Map something in the CoW fork. */
-#define XFS_BMAPI_COWFORK 0x200
+#define XFS_BMAPI_COWFORK (1u << 8)
/* Skip online discard of freed extents */
-#define XFS_BMAPI_NODISCARD 0x1000
+#define XFS_BMAPI_NODISCARD (1u << 9)
/* Do not update the rmap btree. Used for reconstructing bmbt from rmapbt. */
-#define XFS_BMAPI_NORMAP 0x2000
+#define XFS_BMAPI_NORMAP (1u << 10)
#define XFS_BMAPI_FLAGS \
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \
@@ -106,7 +106,7 @@ static inline int xfs_bmapi_aflag(int w)
(w == XFS_COW_FORK ? XFS_BMAPI_COWFORK : 0));
}
-static inline int xfs_bmapi_whichfork(int bmapi_flags)
+static inline int xfs_bmapi_whichfork(uint32_t bmapi_flags)
{
if (bmapi_flags & XFS_BMAPI_COWFORK)
return XFS_COW_FORK;
@@ -183,15 +183,15 @@ int xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
int whichfork);
int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
xfs_filblks_t len, struct xfs_bmbt_irec *mval,
- int *nmap, int flags);
+ int *nmap, uint32_t flags);
int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
- xfs_fileoff_t bno, xfs_filblks_t len, int flags,
+ xfs_fileoff_t bno, xfs_filblks_t len, uint32_t flags,
xfs_extlen_t total, struct xfs_bmbt_irec *mval, int *nmap);
int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
- xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
+ xfs_fileoff_t bno, xfs_filblks_t *rlen, uint32_t flags,
xfs_extnum_t nexts);
int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
- xfs_fileoff_t bno, xfs_filblks_t len, int flags,
+ xfs_fileoff_t bno, xfs_filblks_t len, uint32_t flags,
xfs_extnum_t nexts, int *done);
int xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork,
struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
@@ -260,7 +260,7 @@ xfs_failaddr_t xfs_bmap_validate_extent(struct xfs_inode *ip, int whichfork,
int xfs_bmapi_remap(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_fileoff_t bno, xfs_filblks_t len, xfs_fsblock_t startblock,
- int flags);
+ uint32_t flags);
extern struct kmem_cache *xfs_bmap_intent_cache;
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 05/17] xfs: convert bmapi flags to unsigned.
2022-04-11 0:31 ` [PATCH 05/17] xfs: convert bmapi " Dave Chinner
@ 2022-04-11 12:53 ` Chandan Babu R
2022-04-11 13:44 ` Chandan Babu R
0 siblings, 1 reply; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 12:53 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
The fourth argument of xfs_itruncate_extents_flags() and the return type of
xfs_bmapi_aflag() must be unsigned int.
Also, the data type of bmapi_flags variable in xfs_iomap_write_direct() and
xfs_fs_map_blocks() should be unsigned int.
The remaining changes look good to me.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 22 +++++++++++-----------
> fs/xfs/libxfs/xfs_bmap.h | 36 ++++++++++++++++++------------------
> 2 files changed, 29 insertions(+), 29 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index d53dfe8db8f2..ad938e6e23aa 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -485,7 +485,7 @@ STATIC void
> xfs_bmap_validate_ret(
> xfs_fileoff_t bno,
> xfs_filblks_t len,
> - int flags,
> + uint32_t flags,
> xfs_bmbt_irec_t *mval,
> int nmap,
> int ret_nmap)
> @@ -2616,7 +2616,7 @@ xfs_bmap_add_extent_hole_real(
> struct xfs_btree_cur **curp,
> struct xfs_bmbt_irec *new,
> int *logflagsp,
> - int flags)
> + uint32_t flags)
> {
> struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork);
> struct xfs_mount *mp = ip->i_mount;
> @@ -3766,7 +3766,7 @@ xfs_bmapi_trim_map(
> xfs_fileoff_t obno,
> xfs_fileoff_t end,
> int n,
> - int flags)
> + uint32_t flags)
> {
> if ((flags & XFS_BMAPI_ENTIRE) ||
> got->br_startoff + got->br_blockcount <= obno) {
> @@ -3811,7 +3811,7 @@ xfs_bmapi_update_map(
> xfs_fileoff_t obno,
> xfs_fileoff_t end,
> int *n,
> - int flags)
> + uint32_t flags)
> {
> xfs_bmbt_irec_t *mval = *map;
>
> @@ -3864,7 +3864,7 @@ xfs_bmapi_read(
> xfs_filblks_t len,
> struct xfs_bmbt_irec *mval,
> int *nmap,
> - int flags)
> + uint32_t flags)
> {
> struct xfs_mount *mp = ip->i_mount;
> int whichfork = xfs_bmapi_whichfork(flags);
> @@ -4184,7 +4184,7 @@ xfs_bmapi_convert_unwritten(
> struct xfs_bmalloca *bma,
> struct xfs_bmbt_irec *mval,
> xfs_filblks_t len,
> - int flags)
> + uint32_t flags)
> {
> int whichfork = xfs_bmapi_whichfork(flags);
> struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
> @@ -4312,7 +4312,7 @@ xfs_bmapi_write(
> struct xfs_inode *ip, /* incore inode */
> xfs_fileoff_t bno, /* starting file offs. mapped */
> xfs_filblks_t len, /* length to map in file */
> - int flags, /* XFS_BMAPI_... */
> + uint32_t flags, /* XFS_BMAPI_... */
> xfs_extlen_t total, /* total blocks needed */
> struct xfs_bmbt_irec *mval, /* output: map values */
> int *nmap) /* i/o: mval size/count */
> @@ -4629,7 +4629,7 @@ xfs_bmapi_remap(
> xfs_fileoff_t bno,
> xfs_filblks_t len,
> xfs_fsblock_t startblock,
> - int flags)
> + uint32_t flags)
> {
> struct xfs_mount *mp = ip->i_mount;
> struct xfs_ifork *ifp;
> @@ -4999,7 +4999,7 @@ xfs_bmap_del_extent_real(
> xfs_bmbt_irec_t *del, /* data to remove from extents */
> int *logflagsp, /* inode logging flags */
> int whichfork, /* data or attr fork */
> - int bflags) /* bmapi flags */
> + uint32_t bflags) /* bmapi flags */
> {
> xfs_fsblock_t del_endblock=0; /* first block past del */
> xfs_fileoff_t del_endoff; /* first offset past del */
> @@ -5281,7 +5281,7 @@ __xfs_bunmapi(
> struct xfs_inode *ip, /* incore inode */
> xfs_fileoff_t start, /* first file offset deleted */
> xfs_filblks_t *rlen, /* i/o: amount remaining */
> - int flags, /* misc flags */
> + uint32_t flags, /* misc flags */
> xfs_extnum_t nexts) /* number of extents max */
> {
> struct xfs_btree_cur *cur; /* bmap btree cursor */
> @@ -5609,7 +5609,7 @@ xfs_bunmapi(
> struct xfs_inode *ip,
> xfs_fileoff_t bno,
> xfs_filblks_t len,
> - int flags,
> + uint32_t flags,
> xfs_extnum_t nexts,
> int *done)
> {
> diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
> index 29d38c3c2607..16db95b11589 100644
> --- a/fs/xfs/libxfs/xfs_bmap.h
> +++ b/fs/xfs/libxfs/xfs_bmap.h
> @@ -39,7 +39,7 @@ struct xfs_bmalloca {
> bool aeof; /* allocated space at eof */
> bool conv; /* overwriting unwritten extents */
> int datatype;/* data type being allocated */
> - int flags;
> + uint32_t flags;
> };
>
> #define XFS_BMAP_MAX_NMAP 4
> @@ -47,17 +47,17 @@ struct xfs_bmalloca {
> /*
> * Flags for xfs_bmapi_*
> */
> -#define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed */
> -#define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */
> -#define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */
> -#define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space */
> -#define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */
> +#define XFS_BMAPI_ENTIRE (1u << 0) /* return entire extent untrimmed */
> +#define XFS_BMAPI_METADATA (1u << 1) /* mapping metadata not user data */
> +#define XFS_BMAPI_ATTRFORK (1u << 2) /* use attribute fork not data */
> +#define XFS_BMAPI_PREALLOC (1u << 3) /* preallocating unwritten space */
> +#define XFS_BMAPI_CONTIG (1u << 4) /* must allocate only one extent */
> /*
> * unwritten extent conversion - this needs write cache flushing and no additional
> * allocation alignments. When specified with XFS_BMAPI_PREALLOC it converts
> * from written to unwritten, otherwise convert from unwritten to written.
> */
> -#define XFS_BMAPI_CONVERT 0x040
> +#define XFS_BMAPI_CONVERT (1u << 5)
>
> /*
> * allocate zeroed extents - this requires all newly allocated user data extents
> @@ -65,7 +65,7 @@ struct xfs_bmalloca {
> * Use in conjunction with XFS_BMAPI_CONVERT to convert unwritten extents found
> * during the allocation range to zeroed written extents.
> */
> -#define XFS_BMAPI_ZERO 0x080
> +#define XFS_BMAPI_ZERO (1u << 6)
>
> /*
> * Map the inode offset to the block given in ap->firstblock. Primarily
> @@ -75,16 +75,16 @@ struct xfs_bmalloca {
> * For bunmapi, this flag unmaps the range without adjusting quota, reducing
> * refcount, or freeing the blocks.
> */
> -#define XFS_BMAPI_REMAP 0x100
> +#define XFS_BMAPI_REMAP (1u << 7)
>
> /* Map something in the CoW fork. */
> -#define XFS_BMAPI_COWFORK 0x200
> +#define XFS_BMAPI_COWFORK (1u << 8)
>
> /* Skip online discard of freed extents */
> -#define XFS_BMAPI_NODISCARD 0x1000
> +#define XFS_BMAPI_NODISCARD (1u << 9)
>
> /* Do not update the rmap btree. Used for reconstructing bmbt from rmapbt. */
> -#define XFS_BMAPI_NORMAP 0x2000
> +#define XFS_BMAPI_NORMAP (1u << 10)
>
> #define XFS_BMAPI_FLAGS \
> { XFS_BMAPI_ENTIRE, "ENTIRE" }, \
> @@ -106,7 +106,7 @@ static inline int xfs_bmapi_aflag(int w)
> (w == XFS_COW_FORK ? XFS_BMAPI_COWFORK : 0));
> }
>
> -static inline int xfs_bmapi_whichfork(int bmapi_flags)
> +static inline int xfs_bmapi_whichfork(uint32_t bmapi_flags)
> {
> if (bmapi_flags & XFS_BMAPI_COWFORK)
> return XFS_COW_FORK;
> @@ -183,15 +183,15 @@ int xfs_bmap_last_offset(struct xfs_inode *ip, xfs_fileoff_t *unused,
> int whichfork);
> int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
> xfs_filblks_t len, struct xfs_bmbt_irec *mval,
> - int *nmap, int flags);
> + int *nmap, uint32_t flags);
> int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
> - xfs_fileoff_t bno, xfs_filblks_t len, int flags,
> + xfs_fileoff_t bno, xfs_filblks_t len, uint32_t flags,
> xfs_extlen_t total, struct xfs_bmbt_irec *mval, int *nmap);
> int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
> - xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
> + xfs_fileoff_t bno, xfs_filblks_t *rlen, uint32_t flags,
> xfs_extnum_t nexts);
> int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
> - xfs_fileoff_t bno, xfs_filblks_t len, int flags,
> + xfs_fileoff_t bno, xfs_filblks_t len, uint32_t flags,
> xfs_extnum_t nexts, int *done);
> int xfs_bmap_del_extent_delay(struct xfs_inode *ip, int whichfork,
> struct xfs_iext_cursor *cur, struct xfs_bmbt_irec *got,
> @@ -260,7 +260,7 @@ xfs_failaddr_t xfs_bmap_validate_extent(struct xfs_inode *ip, int whichfork,
>
> int xfs_bmapi_remap(struct xfs_trans *tp, struct xfs_inode *ip,
> xfs_fileoff_t bno, xfs_filblks_t len, xfs_fsblock_t startblock,
> - int flags);
> + uint32_t flags);
>
> extern struct kmem_cache *xfs_bmap_intent_cache;
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 05/17] xfs: convert bmapi flags to unsigned.
2022-04-11 12:53 ` Chandan Babu R
@ 2022-04-11 13:44 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 13:44 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 18:23, Chandan Babu R wrote:
> On 11 Apr 2022 at 06:01, Dave Chinner wrote:
>> From: Dave Chinner <dchinner@redhat.com>
>>
>> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
>> fields to be unsigned.
>>
>
> The fourth argument of xfs_itruncate_extents_flags() and the return type of
> xfs_bmapi_aflag() must be unsigned int.
>
> Also, the data type of bmapi_flags variable in xfs_iomap_write_direct() and
> xfs_fs_map_blocks() should be unsigned int.
Please ignore the above two statements. The corresponding code has values
being assigned to a signed int variable rather than an unsigned int variable.
>
> The remaining changes look good to me.
>
> Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
>
>> Signed-off-by: Dave Chinner <dchinner@redhat.com>
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 06/17] xfs: convert AGF log flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (4 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 05/17] xfs: convert bmapi " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 13:27 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 07/17] xfs: convert AGI " Dave Chinner
` (10 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_alloc.c | 10 +++++-----
fs/xfs/libxfs/xfs_alloc.h | 2 +-
fs/xfs/libxfs/xfs_format.h | 38 +++++++++++++++++++-------------------
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index b52ed339727f..1ff3fa67d4c9 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2777,7 +2777,7 @@ xfs_alloc_get_freelist(
xfs_agblock_t bno;
__be32 *agfl_bno;
int error;
- int logflags;
+ uint32_t logflags;
struct xfs_mount *mp = tp->t_mountp;
struct xfs_perag *pag;
@@ -2830,9 +2830,9 @@ xfs_alloc_get_freelist(
*/
void
xfs_alloc_log_agf(
- xfs_trans_t *tp, /* transaction pointer */
- struct xfs_buf *bp, /* buffer for a.g. freelist header */
- int fields) /* mask of fields to be logged (XFS_AGF_...) */
+ struct xfs_trans *tp,
+ struct xfs_buf *bp,
+ uint32_t fields)
{
int first; /* first byte offset */
int last; /* last byte offset */
@@ -2902,7 +2902,7 @@ xfs_alloc_put_freelist(
struct xfs_perag *pag;
__be32 *blockp;
int error;
- int logflags;
+ uint32_t logflags;
__be32 *agfl_bno;
int startoff;
diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
index d4c057b764f9..84ca09b2223f 100644
--- a/fs/xfs/libxfs/xfs_alloc.h
+++ b/fs/xfs/libxfs/xfs_alloc.h
@@ -121,7 +121,7 @@ void
xfs_alloc_log_agf(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_buf *bp, /* buffer for a.g. freelist header */
- int fields);/* mask of fields to be logged (XFS_AGF_...) */
+ uint32_t fields);/* mask of fields to be logged (XFS_AGF_...) */
/*
* Interface for inode allocation to force the pag data to be initialized.
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index d665c04e69dd..65e24847841e 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -525,26 +525,26 @@ typedef struct xfs_agf {
#define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)
-#define XFS_AGF_MAGICNUM 0x00000001
-#define XFS_AGF_VERSIONNUM 0x00000002
-#define XFS_AGF_SEQNO 0x00000004
-#define XFS_AGF_LENGTH 0x00000008
-#define XFS_AGF_ROOTS 0x00000010
-#define XFS_AGF_LEVELS 0x00000020
-#define XFS_AGF_FLFIRST 0x00000040
-#define XFS_AGF_FLLAST 0x00000080
-#define XFS_AGF_FLCOUNT 0x00000100
-#define XFS_AGF_FREEBLKS 0x00000200
-#define XFS_AGF_LONGEST 0x00000400
-#define XFS_AGF_BTREEBLKS 0x00000800
-#define XFS_AGF_UUID 0x00001000
-#define XFS_AGF_RMAP_BLOCKS 0x00002000
-#define XFS_AGF_REFCOUNT_BLOCKS 0x00004000
-#define XFS_AGF_REFCOUNT_ROOT 0x00008000
-#define XFS_AGF_REFCOUNT_LEVEL 0x00010000
-#define XFS_AGF_SPARE64 0x00020000
+#define XFS_AGF_MAGICNUM (1u << 0)
+#define XFS_AGF_VERSIONNUM (1u << 1)
+#define XFS_AGF_SEQNO (1u << 2)
+#define XFS_AGF_LENGTH (1u << 3)
+#define XFS_AGF_ROOTS (1u << 4)
+#define XFS_AGF_LEVELS (1u << 5)
+#define XFS_AGF_FLFIRST (1u << 6)
+#define XFS_AGF_FLLAST (1u << 7)
+#define XFS_AGF_FLCOUNT (1u << 8)
+#define XFS_AGF_FREEBLKS (1u << 9)
+#define XFS_AGF_LONGEST (1u << 10)
+#define XFS_AGF_BTREEBLKS (1u << 11)
+#define XFS_AGF_UUID (1u << 12)
+#define XFS_AGF_RMAP_BLOCKS (1u << 13)
+#define XFS_AGF_REFCOUNT_BLOCKS (1u << 14)
+#define XFS_AGF_REFCOUNT_ROOT (1u << 15)
+#define XFS_AGF_REFCOUNT_LEVEL (1u << 16)
+#define XFS_AGF_SPARE64 (1u << 17)
#define XFS_AGF_NUM_BITS 18
-#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
+#define XFS_AGF_ALL_BITS ((1u << XFS_AGF_NUM_BITS) - 1)
#define XFS_AGF_FLAGS \
{ XFS_AGF_MAGICNUM, "MAGICNUM" }, \
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 06/17] xfs: convert AGF log flags to unsigned.
2022-04-11 0:31 ` [PATCH 06/17] xfs: convert AGF log " Dave Chinner
@ 2022-04-11 13:27 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 13:27 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks correct.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_alloc.c | 10 +++++-----
> fs/xfs/libxfs/xfs_alloc.h | 2 +-
> fs/xfs/libxfs/xfs_format.h | 38 +++++++++++++++++++-------------------
> 3 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index b52ed339727f..1ff3fa67d4c9 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2777,7 +2777,7 @@ xfs_alloc_get_freelist(
> xfs_agblock_t bno;
> __be32 *agfl_bno;
> int error;
> - int logflags;
> + uint32_t logflags;
> struct xfs_mount *mp = tp->t_mountp;
> struct xfs_perag *pag;
>
> @@ -2830,9 +2830,9 @@ xfs_alloc_get_freelist(
> */
> void
> xfs_alloc_log_agf(
> - xfs_trans_t *tp, /* transaction pointer */
> - struct xfs_buf *bp, /* buffer for a.g. freelist header */
> - int fields) /* mask of fields to be logged (XFS_AGF_...) */
> + struct xfs_trans *tp,
> + struct xfs_buf *bp,
> + uint32_t fields)
> {
> int first; /* first byte offset */
> int last; /* last byte offset */
> @@ -2902,7 +2902,7 @@ xfs_alloc_put_freelist(
> struct xfs_perag *pag;
> __be32 *blockp;
> int error;
> - int logflags;
> + uint32_t logflags;
> __be32 *agfl_bno;
> int startoff;
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
> index d4c057b764f9..84ca09b2223f 100644
> --- a/fs/xfs/libxfs/xfs_alloc.h
> +++ b/fs/xfs/libxfs/xfs_alloc.h
> @@ -121,7 +121,7 @@ void
> xfs_alloc_log_agf(
> struct xfs_trans *tp, /* transaction pointer */
> struct xfs_buf *bp, /* buffer for a.g. freelist header */
> - int fields);/* mask of fields to be logged (XFS_AGF_...) */
> + uint32_t fields);/* mask of fields to be logged (XFS_AGF_...) */
>
> /*
> * Interface for inode allocation to force the pag data to be initialized.
> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index d665c04e69dd..65e24847841e 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -525,26 +525,26 @@ typedef struct xfs_agf {
>
> #define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)
>
> -#define XFS_AGF_MAGICNUM 0x00000001
> -#define XFS_AGF_VERSIONNUM 0x00000002
> -#define XFS_AGF_SEQNO 0x00000004
> -#define XFS_AGF_LENGTH 0x00000008
> -#define XFS_AGF_ROOTS 0x00000010
> -#define XFS_AGF_LEVELS 0x00000020
> -#define XFS_AGF_FLFIRST 0x00000040
> -#define XFS_AGF_FLLAST 0x00000080
> -#define XFS_AGF_FLCOUNT 0x00000100
> -#define XFS_AGF_FREEBLKS 0x00000200
> -#define XFS_AGF_LONGEST 0x00000400
> -#define XFS_AGF_BTREEBLKS 0x00000800
> -#define XFS_AGF_UUID 0x00001000
> -#define XFS_AGF_RMAP_BLOCKS 0x00002000
> -#define XFS_AGF_REFCOUNT_BLOCKS 0x00004000
> -#define XFS_AGF_REFCOUNT_ROOT 0x00008000
> -#define XFS_AGF_REFCOUNT_LEVEL 0x00010000
> -#define XFS_AGF_SPARE64 0x00020000
> +#define XFS_AGF_MAGICNUM (1u << 0)
> +#define XFS_AGF_VERSIONNUM (1u << 1)
> +#define XFS_AGF_SEQNO (1u << 2)
> +#define XFS_AGF_LENGTH (1u << 3)
> +#define XFS_AGF_ROOTS (1u << 4)
> +#define XFS_AGF_LEVELS (1u << 5)
> +#define XFS_AGF_FLFIRST (1u << 6)
> +#define XFS_AGF_FLLAST (1u << 7)
> +#define XFS_AGF_FLCOUNT (1u << 8)
> +#define XFS_AGF_FREEBLKS (1u << 9)
> +#define XFS_AGF_LONGEST (1u << 10)
> +#define XFS_AGF_BTREEBLKS (1u << 11)
> +#define XFS_AGF_UUID (1u << 12)
> +#define XFS_AGF_RMAP_BLOCKS (1u << 13)
> +#define XFS_AGF_REFCOUNT_BLOCKS (1u << 14)
> +#define XFS_AGF_REFCOUNT_ROOT (1u << 15)
> +#define XFS_AGF_REFCOUNT_LEVEL (1u << 16)
> +#define XFS_AGF_SPARE64 (1u << 17)
> #define XFS_AGF_NUM_BITS 18
> -#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
> +#define XFS_AGF_ALL_BITS ((1u << XFS_AGF_NUM_BITS) - 1)
>
> #define XFS_AGF_FLAGS \
> { XFS_AGF_MAGICNUM, "MAGICNUM" }, \
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 07/17] xfs: convert AGI log flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (5 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 06/17] xfs: convert AGF log " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 13:49 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 08/17] xfs: convert btree buffer " Dave Chinner
` (9 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_format.h | 30 +++++++++++++++---------------
fs/xfs/libxfs/xfs_ialloc.c | 6 +++---
fs/xfs/libxfs/xfs_ialloc.h | 2 +-
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 65e24847841e..0d6fa199a896 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -619,22 +619,22 @@ typedef struct xfs_agi {
#define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)
-#define XFS_AGI_MAGICNUM (1 << 0)
-#define XFS_AGI_VERSIONNUM (1 << 1)
-#define XFS_AGI_SEQNO (1 << 2)
-#define XFS_AGI_LENGTH (1 << 3)
-#define XFS_AGI_COUNT (1 << 4)
-#define XFS_AGI_ROOT (1 << 5)
-#define XFS_AGI_LEVEL (1 << 6)
-#define XFS_AGI_FREECOUNT (1 << 7)
-#define XFS_AGI_NEWINO (1 << 8)
-#define XFS_AGI_DIRINO (1 << 9)
-#define XFS_AGI_UNLINKED (1 << 10)
+#define XFS_AGI_MAGICNUM (1u << 0)
+#define XFS_AGI_VERSIONNUM (1u << 1)
+#define XFS_AGI_SEQNO (1u << 2)
+#define XFS_AGI_LENGTH (1u << 3)
+#define XFS_AGI_COUNT (1u << 4)
+#define XFS_AGI_ROOT (1u << 5)
+#define XFS_AGI_LEVEL (1u << 6)
+#define XFS_AGI_FREECOUNT (1u << 7)
+#define XFS_AGI_NEWINO (1u << 8)
+#define XFS_AGI_DIRINO (1u << 9)
+#define XFS_AGI_UNLINKED (1u << 10)
#define XFS_AGI_NUM_BITS_R1 11 /* end of the 1st agi logging region */
-#define XFS_AGI_ALL_BITS_R1 ((1 << XFS_AGI_NUM_BITS_R1) - 1)
-#define XFS_AGI_FREE_ROOT (1 << 11)
-#define XFS_AGI_FREE_LEVEL (1 << 12)
-#define XFS_AGI_IBLOCKS (1 << 13) /* both inobt/finobt block counters */
+#define XFS_AGI_ALL_BITS_R1 ((1u << XFS_AGI_NUM_BITS_R1) - 1)
+#define XFS_AGI_FREE_ROOT (1u << 11)
+#define XFS_AGI_FREE_LEVEL (1u << 12)
+#define XFS_AGI_IBLOCKS (1u << 13) /* both inobt/finobt block counters */
#define XFS_AGI_NUM_BITS_R2 14
/* disk block (xfs_daddr_t) in the AG */
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index b418fe0c0679..54c2be6a2972 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2414,9 +2414,9 @@ xfs_imap(
*/
void
xfs_ialloc_log_agi(
- xfs_trans_t *tp, /* transaction pointer */
- struct xfs_buf *bp, /* allocation group header buffer */
- int fields) /* bitmask of fields to log */
+ struct xfs_trans *tp,
+ struct xfs_buf *bp,
+ uint32_t fields)
{
int first; /* first byte number */
int last; /* last byte number */
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
index 8b5c2b709022..a7705b6a1fd3 100644
--- a/fs/xfs/libxfs/xfs_ialloc.h
+++ b/fs/xfs/libxfs/xfs_ialloc.h
@@ -60,7 +60,7 @@ void
xfs_ialloc_log_agi(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_buf *bp, /* allocation group header buffer */
- int fields); /* bitmask of fields to log */
+ uint32_t fields); /* bitmask of fields to log */
/*
* Read in the allocation group header (inode allocation section)
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 07/17] xfs: convert AGI log flags to unsigned.
2022-04-11 0:31 ` [PATCH 07/17] xfs: convert AGI " Dave Chinner
@ 2022-04-11 13:49 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 13:49 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks correct.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_format.h | 30 +++++++++++++++---------------
> fs/xfs/libxfs/xfs_ialloc.c | 6 +++---
> fs/xfs/libxfs/xfs_ialloc.h | 2 +-
> 3 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index 65e24847841e..0d6fa199a896 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -619,22 +619,22 @@ typedef struct xfs_agi {
>
> #define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)
>
> -#define XFS_AGI_MAGICNUM (1 << 0)
> -#define XFS_AGI_VERSIONNUM (1 << 1)
> -#define XFS_AGI_SEQNO (1 << 2)
> -#define XFS_AGI_LENGTH (1 << 3)
> -#define XFS_AGI_COUNT (1 << 4)
> -#define XFS_AGI_ROOT (1 << 5)
> -#define XFS_AGI_LEVEL (1 << 6)
> -#define XFS_AGI_FREECOUNT (1 << 7)
> -#define XFS_AGI_NEWINO (1 << 8)
> -#define XFS_AGI_DIRINO (1 << 9)
> -#define XFS_AGI_UNLINKED (1 << 10)
> +#define XFS_AGI_MAGICNUM (1u << 0)
> +#define XFS_AGI_VERSIONNUM (1u << 1)
> +#define XFS_AGI_SEQNO (1u << 2)
> +#define XFS_AGI_LENGTH (1u << 3)
> +#define XFS_AGI_COUNT (1u << 4)
> +#define XFS_AGI_ROOT (1u << 5)
> +#define XFS_AGI_LEVEL (1u << 6)
> +#define XFS_AGI_FREECOUNT (1u << 7)
> +#define XFS_AGI_NEWINO (1u << 8)
> +#define XFS_AGI_DIRINO (1u << 9)
> +#define XFS_AGI_UNLINKED (1u << 10)
> #define XFS_AGI_NUM_BITS_R1 11 /* end of the 1st agi logging region */
> -#define XFS_AGI_ALL_BITS_R1 ((1 << XFS_AGI_NUM_BITS_R1) - 1)
> -#define XFS_AGI_FREE_ROOT (1 << 11)
> -#define XFS_AGI_FREE_LEVEL (1 << 12)
> -#define XFS_AGI_IBLOCKS (1 << 13) /* both inobt/finobt block counters */
> +#define XFS_AGI_ALL_BITS_R1 ((1u << XFS_AGI_NUM_BITS_R1) - 1)
> +#define XFS_AGI_FREE_ROOT (1u << 11)
> +#define XFS_AGI_FREE_LEVEL (1u << 12)
> +#define XFS_AGI_IBLOCKS (1u << 13) /* both inobt/finobt block counters */
> #define XFS_AGI_NUM_BITS_R2 14
>
> /* disk block (xfs_daddr_t) in the AG */
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index b418fe0c0679..54c2be6a2972 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2414,9 +2414,9 @@ xfs_imap(
> */
> void
> xfs_ialloc_log_agi(
> - xfs_trans_t *tp, /* transaction pointer */
> - struct xfs_buf *bp, /* allocation group header buffer */
> - int fields) /* bitmask of fields to log */
> + struct xfs_trans *tp,
> + struct xfs_buf *bp,
> + uint32_t fields)
> {
> int first; /* first byte number */
> int last; /* last byte number */
> diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
> index 8b5c2b709022..a7705b6a1fd3 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.h
> +++ b/fs/xfs/libxfs/xfs_ialloc.h
> @@ -60,7 +60,7 @@ void
> xfs_ialloc_log_agi(
> struct xfs_trans *tp, /* transaction pointer */
> struct xfs_buf *bp, /* allocation group header buffer */
> - int fields); /* bitmask of fields to log */
> + uint32_t fields); /* bitmask of fields to log */
>
> /*
> * Read in the allocation group header (inode allocation section)
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 08/17] xfs: convert btree buffer log flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (6 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 07/17] xfs: convert AGI " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-11 14:03 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 09/17] xfs: convert buffer log item " Dave Chinner
` (8 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
We also pass the fields to log to xfs_btree_offsets() as a uint32_t
all cases now. I have no idea why we made that parameter a int64_t
in the first place, but while we are fixing this up change it to
a uint32_t field, too.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_btree.c | 10 +++++-----
fs/xfs/libxfs/xfs_btree.h | 26 +++++++++++++-------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index c1500b238520..a8c79e760d8a 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -751,20 +751,20 @@ xfs_btree_lastrec(
*/
void
xfs_btree_offsets(
- int64_t fields, /* bitmask of fields */
+ uint32_t fields, /* bitmask of fields */
const short *offsets, /* table of field offsets */
int nbits, /* number of bits to inspect */
int *first, /* output: first byte offset */
int *last) /* output: last byte offset */
{
int i; /* current bit number */
- int64_t imask; /* mask for current bit number */
+ uint32_t imask; /* mask for current bit number */
ASSERT(fields != 0);
/*
* Find the lowest bit, so the first byte offset.
*/
- for (i = 0, imask = 1LL; ; i++, imask <<= 1) {
+ for (i = 0, imask = 1u; ; i++, imask <<= 1) {
if (imask & fields) {
*first = offsets[i];
break;
@@ -773,7 +773,7 @@ xfs_btree_offsets(
/*
* Find the highest bit, so the last byte offset.
*/
- for (i = nbits - 1, imask = 1LL << i; ; i--, imask >>= 1) {
+ for (i = nbits - 1, imask = 1u << i; ; i--, imask >>= 1) {
if (imask & fields) {
*last = offsets[i + 1] - 1;
break;
@@ -1456,7 +1456,7 @@ void
xfs_btree_log_block(
struct xfs_btree_cur *cur, /* btree cursor */
struct xfs_buf *bp, /* buffer containing btree block */
- int fields) /* mask of fields: XFS_BB_... */
+ uint32_t fields) /* mask of fields: XFS_BB_... */
{
int first; /* first byte offset logged */
int last; /* last byte offset logged */
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index 22d9f411fde6..eef27858a013 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -68,19 +68,19 @@ uint32_t xfs_btree_magic(int crc, xfs_btnum_t btnum);
/*
* For logging record fields.
*/
-#define XFS_BB_MAGIC (1 << 0)
-#define XFS_BB_LEVEL (1 << 1)
-#define XFS_BB_NUMRECS (1 << 2)
-#define XFS_BB_LEFTSIB (1 << 3)
-#define XFS_BB_RIGHTSIB (1 << 4)
-#define XFS_BB_BLKNO (1 << 5)
-#define XFS_BB_LSN (1 << 6)
-#define XFS_BB_UUID (1 << 7)
-#define XFS_BB_OWNER (1 << 8)
+#define XFS_BB_MAGIC (1u << 0)
+#define XFS_BB_LEVEL (1u << 1)
+#define XFS_BB_NUMRECS (1u << 2)
+#define XFS_BB_LEFTSIB (1u << 3)
+#define XFS_BB_RIGHTSIB (1u << 4)
+#define XFS_BB_BLKNO (1u << 5)
+#define XFS_BB_LSN (1u << 6)
+#define XFS_BB_UUID (1u << 7)
+#define XFS_BB_OWNER (1u << 8)
#define XFS_BB_NUM_BITS 5
-#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
+#define XFS_BB_ALL_BITS ((1u << XFS_BB_NUM_BITS) - 1)
#define XFS_BB_NUM_BITS_CRC 9
-#define XFS_BB_ALL_BITS_CRC ((1 << XFS_BB_NUM_BITS_CRC) - 1)
+#define XFS_BB_ALL_BITS_CRC ((1u << XFS_BB_NUM_BITS_CRC) - 1)
/*
* Generic stats interface
@@ -345,7 +345,7 @@ xfs_btree_dup_cursor(
*/
void
xfs_btree_offsets(
- int64_t fields, /* bitmask of fields */
+ uint32_t fields, /* bitmask of fields */
const short *offsets,/* table of field offsets */
int nbits, /* number of bits to inspect */
int *first, /* output: first byte offset */
@@ -435,7 +435,7 @@ bool xfs_btree_sblock_verify_crc(struct xfs_buf *);
/*
* Internal btree helpers also used by xfs_bmap.c.
*/
-void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
+void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, uint32_t);
void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int);
/*
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 08/17] xfs: convert btree buffer log flags to unsigned.
2022-04-11 0:31 ` [PATCH 08/17] xfs: convert btree buffer " Dave Chinner
@ 2022-04-11 14:03 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-11 14:03 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
> We also pass the fields to log to xfs_btree_offsets() as a uint32_t
> all cases now. I have no idea why we made that parameter a int64_t
> in the first place, but while we are fixing this up change it to
> a uint32_t field, too.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_btree.c | 10 +++++-----
> fs/xfs/libxfs/xfs_btree.h | 26 +++++++++++++-------------
> 2 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index c1500b238520..a8c79e760d8a 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -751,20 +751,20 @@ xfs_btree_lastrec(
> */
> void
> xfs_btree_offsets(
> - int64_t fields, /* bitmask of fields */
> + uint32_t fields, /* bitmask of fields */
> const short *offsets, /* table of field offsets */
> int nbits, /* number of bits to inspect */
> int *first, /* output: first byte offset */
> int *last) /* output: last byte offset */
> {
> int i; /* current bit number */
> - int64_t imask; /* mask for current bit number */
> + uint32_t imask; /* mask for current bit number */
>
> ASSERT(fields != 0);
> /*
> * Find the lowest bit, so the first byte offset.
> */
> - for (i = 0, imask = 1LL; ; i++, imask <<= 1) {
> + for (i = 0, imask = 1u; ; i++, imask <<= 1) {
> if (imask & fields) {
> *first = offsets[i];
> break;
> @@ -773,7 +773,7 @@ xfs_btree_offsets(
> /*
> * Find the highest bit, so the last byte offset.
> */
> - for (i = nbits - 1, imask = 1LL << i; ; i--, imask >>= 1) {
> + for (i = nbits - 1, imask = 1u << i; ; i--, imask >>= 1) {
> if (imask & fields) {
> *last = offsets[i + 1] - 1;
> break;
> @@ -1456,7 +1456,7 @@ void
> xfs_btree_log_block(
> struct xfs_btree_cur *cur, /* btree cursor */
> struct xfs_buf *bp, /* buffer containing btree block */
> - int fields) /* mask of fields: XFS_BB_... */
> + uint32_t fields) /* mask of fields: XFS_BB_... */
> {
> int first; /* first byte offset logged */
> int last; /* last byte offset logged */
> diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
> index 22d9f411fde6..eef27858a013 100644
> --- a/fs/xfs/libxfs/xfs_btree.h
> +++ b/fs/xfs/libxfs/xfs_btree.h
> @@ -68,19 +68,19 @@ uint32_t xfs_btree_magic(int crc, xfs_btnum_t btnum);
> /*
> * For logging record fields.
> */
> -#define XFS_BB_MAGIC (1 << 0)
> -#define XFS_BB_LEVEL (1 << 1)
> -#define XFS_BB_NUMRECS (1 << 2)
> -#define XFS_BB_LEFTSIB (1 << 3)
> -#define XFS_BB_RIGHTSIB (1 << 4)
> -#define XFS_BB_BLKNO (1 << 5)
> -#define XFS_BB_LSN (1 << 6)
> -#define XFS_BB_UUID (1 << 7)
> -#define XFS_BB_OWNER (1 << 8)
> +#define XFS_BB_MAGIC (1u << 0)
> +#define XFS_BB_LEVEL (1u << 1)
> +#define XFS_BB_NUMRECS (1u << 2)
> +#define XFS_BB_LEFTSIB (1u << 3)
> +#define XFS_BB_RIGHTSIB (1u << 4)
> +#define XFS_BB_BLKNO (1u << 5)
> +#define XFS_BB_LSN (1u << 6)
> +#define XFS_BB_UUID (1u << 7)
> +#define XFS_BB_OWNER (1u << 8)
> #define XFS_BB_NUM_BITS 5
> -#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
> +#define XFS_BB_ALL_BITS ((1u << XFS_BB_NUM_BITS) - 1)
> #define XFS_BB_NUM_BITS_CRC 9
> -#define XFS_BB_ALL_BITS_CRC ((1 << XFS_BB_NUM_BITS_CRC) - 1)
> +#define XFS_BB_ALL_BITS_CRC ((1u << XFS_BB_NUM_BITS_CRC) - 1)
>
> /*
> * Generic stats interface
> @@ -345,7 +345,7 @@ xfs_btree_dup_cursor(
> */
> void
> xfs_btree_offsets(
> - int64_t fields, /* bitmask of fields */
> + uint32_t fields, /* bitmask of fields */
> const short *offsets,/* table of field offsets */
> int nbits, /* number of bits to inspect */
> int *first, /* output: first byte offset */
> @@ -435,7 +435,7 @@ bool xfs_btree_sblock_verify_crc(struct xfs_buf *);
> /*
> * Internal btree helpers also used by xfs_bmap.c.
> */
> -void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
> +void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, uint32_t);
> void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int);
>
> /*
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 09/17] xfs: convert buffer log item flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (7 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 08/17] xfs: convert btree buffer " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:25 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 10/17] xfs: convert da btree operations " Dave Chinner
` (7 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_buf_item.h | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
index e11e9ef2338f..4d8a6aece995 100644
--- a/fs/xfs/xfs_buf_item.h
+++ b/fs/xfs/xfs_buf_item.h
@@ -8,15 +8,18 @@
/* kernel only definitions */
+struct xfs_buf;
+struct xfs_mount;
+
/* buf log item flags */
-#define XFS_BLI_HOLD 0x01
-#define XFS_BLI_DIRTY 0x02
-#define XFS_BLI_STALE 0x04
-#define XFS_BLI_LOGGED 0x08
-#define XFS_BLI_INODE_ALLOC_BUF 0x10
-#define XFS_BLI_STALE_INODE 0x20
-#define XFS_BLI_INODE_BUF 0x40
-#define XFS_BLI_ORDERED 0x80
+#define XFS_BLI_HOLD (1u << 0)
+#define XFS_BLI_DIRTY (1u << 1)
+#define XFS_BLI_STALE (1u << 2)
+#define XFS_BLI_LOGGED (1u << 3)
+#define XFS_BLI_INODE_ALLOC_BUF (1u << 4)
+#define XFS_BLI_STALE_INODE (1u << 5)
+#define XFS_BLI_INODE_BUF (1u << 6)
+#define XFS_BLI_ORDERED (1u << 7)
#define XFS_BLI_FLAGS \
{ XFS_BLI_HOLD, "HOLD" }, \
@@ -28,11 +31,6 @@
{ XFS_BLI_INODE_BUF, "INODE_BUF" }, \
{ XFS_BLI_ORDERED, "ORDERED" }
-
-struct xfs_buf;
-struct xfs_mount;
-struct xfs_buf_log_item;
-
/*
* This is the in core log item structure used to track information
* needed to log buffers. It tracks how many times the lock has been
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 09/17] xfs: convert buffer log item flags to unsigned.
2022-04-11 0:31 ` [PATCH 09/17] xfs: convert buffer log item " Dave Chinner
@ 2022-04-12 7:25 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:25 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_buf_item.h | 24 +++++++++++-------------
> 1 file changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
> index e11e9ef2338f..4d8a6aece995 100644
> --- a/fs/xfs/xfs_buf_item.h
> +++ b/fs/xfs/xfs_buf_item.h
> @@ -8,15 +8,18 @@
>
> /* kernel only definitions */
>
> +struct xfs_buf;
> +struct xfs_mount;
> +
> /* buf log item flags */
> -#define XFS_BLI_HOLD 0x01
> -#define XFS_BLI_DIRTY 0x02
> -#define XFS_BLI_STALE 0x04
> -#define XFS_BLI_LOGGED 0x08
> -#define XFS_BLI_INODE_ALLOC_BUF 0x10
> -#define XFS_BLI_STALE_INODE 0x20
> -#define XFS_BLI_INODE_BUF 0x40
> -#define XFS_BLI_ORDERED 0x80
> +#define XFS_BLI_HOLD (1u << 0)
> +#define XFS_BLI_DIRTY (1u << 1)
> +#define XFS_BLI_STALE (1u << 2)
> +#define XFS_BLI_LOGGED (1u << 3)
> +#define XFS_BLI_INODE_ALLOC_BUF (1u << 4)
> +#define XFS_BLI_STALE_INODE (1u << 5)
> +#define XFS_BLI_INODE_BUF (1u << 6)
> +#define XFS_BLI_ORDERED (1u << 7)
>
> #define XFS_BLI_FLAGS \
> { XFS_BLI_HOLD, "HOLD" }, \
> @@ -28,11 +31,6 @@
> { XFS_BLI_INODE_BUF, "INODE_BUF" }, \
> { XFS_BLI_ORDERED, "ORDERED" }
>
> -
> -struct xfs_buf;
> -struct xfs_mount;
> -struct xfs_buf_log_item;
> -
> /*
> * This is the in core log item structure used to track information
> * needed to log buffers. It tracks how many times the lock has been
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 10/17] xfs: convert da btree operations flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (8 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 09/17] xfs: convert buffer log item " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:25 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 11/17] xfs: convert dquot " Dave Chinner
` (6 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_da_btree.h | 16 ++++++++--------
fs/xfs/xfs_trace.h | 8 ++++----
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
index 0faf7d9ac241..7b0f986e5cb5 100644
--- a/fs/xfs/libxfs/xfs_da_btree.h
+++ b/fs/xfs/libxfs/xfs_da_btree.h
@@ -76,19 +76,19 @@ typedef struct xfs_da_args {
xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
int rmtblkcnt2; /* remote attr value block count */
int rmtvaluelen2; /* remote attr value length in bytes */
- int op_flags; /* operation flags */
+ uint32_t op_flags; /* operation flags */
enum xfs_dacmp cmpresult; /* name compare result for lookups */
} xfs_da_args_t;
/*
* Operation flags:
*/
-#define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */
-#define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */
-#define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
-#define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
-#define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
-#define XFS_DA_OP_NOTIME 0x0020 /* don't update inode timestamps */
+#define XFS_DA_OP_JUSTCHECK (1u << 0) /* check for ok with no space */
+#define XFS_DA_OP_RENAME (1u << 1) /* this is an atomic rename op */
+#define XFS_DA_OP_ADDNAME (1u << 2) /* this is an add operation */
+#define XFS_DA_OP_OKNOENT (1u << 3) /* lookup op, ENOENT ok, else die */
+#define XFS_DA_OP_CILOOKUP (1u << 4) /* lookup returns CI name if found */
+#define XFS_DA_OP_NOTIME (1u << 5) /* don't update inode timestamps */
#define XFS_DA_OP_FLAGS \
{ XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
@@ -197,7 +197,7 @@ int xfs_da3_node_read_mapped(struct xfs_trans *tp, struct xfs_inode *dp,
* Utility routines.
*/
-#define XFS_DABUF_MAP_HOLE_OK (1 << 0)
+#define XFS_DABUF_MAP_HOLE_OK (1u << 0)
int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index b141ef78c755..989ecda904db 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1924,7 +1924,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
__field(int, namelen)
__field(xfs_dahash_t, hashval)
__field(xfs_ino_t, inumber)
- __field(int, op_flags)
+ __field(uint32_t, op_flags)
),
TP_fast_assign(
__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
@@ -1990,7 +1990,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
__field(xfs_dahash_t, hashval)
__field(unsigned int, attr_filter)
__field(unsigned int, attr_flags)
- __field(int, op_flags)
+ __field(uint32_t, op_flags)
),
TP_fast_assign(
__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
@@ -2097,7 +2097,7 @@ DECLARE_EVENT_CLASS(xfs_dir2_space_class,
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_ino_t, ino)
- __field(int, op_flags)
+ __field(uint32_t, op_flags)
__field(int, idx)
),
TP_fast_assign(
@@ -2128,7 +2128,7 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_ino_t, ino)
- __field(int, op_flags)
+ __field(uint32_t, op_flags)
__field(int, src_idx)
__field(int, dst_idx)
__field(int, count)
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 10/17] xfs: convert da btree operations flags to unsigned.
2022-04-11 0:31 ` [PATCH 10/17] xfs: convert da btree operations " Dave Chinner
@ 2022-04-12 7:25 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:25 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_da_btree.h | 16 ++++++++--------
> fs/xfs/xfs_trace.h | 8 ++++----
> 2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
> index 0faf7d9ac241..7b0f986e5cb5 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.h
> +++ b/fs/xfs/libxfs/xfs_da_btree.h
> @@ -76,19 +76,19 @@ typedef struct xfs_da_args {
> xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
> int rmtblkcnt2; /* remote attr value block count */
> int rmtvaluelen2; /* remote attr value length in bytes */
> - int op_flags; /* operation flags */
> + uint32_t op_flags; /* operation flags */
> enum xfs_dacmp cmpresult; /* name compare result for lookups */
> } xfs_da_args_t;
>
> /*
> * Operation flags:
> */
> -#define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */
> -#define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */
> -#define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
> -#define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
> -#define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
> -#define XFS_DA_OP_NOTIME 0x0020 /* don't update inode timestamps */
> +#define XFS_DA_OP_JUSTCHECK (1u << 0) /* check for ok with no space */
> +#define XFS_DA_OP_RENAME (1u << 1) /* this is an atomic rename op */
> +#define XFS_DA_OP_ADDNAME (1u << 2) /* this is an add operation */
> +#define XFS_DA_OP_OKNOENT (1u << 3) /* lookup op, ENOENT ok, else die */
> +#define XFS_DA_OP_CILOOKUP (1u << 4) /* lookup returns CI name if found */
> +#define XFS_DA_OP_NOTIME (1u << 5) /* don't update inode timestamps */
>
> #define XFS_DA_OP_FLAGS \
> { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
> @@ -197,7 +197,7 @@ int xfs_da3_node_read_mapped(struct xfs_trans *tp, struct xfs_inode *dp,
> * Utility routines.
> */
>
> -#define XFS_DABUF_MAP_HOLE_OK (1 << 0)
> +#define XFS_DABUF_MAP_HOLE_OK (1u << 0)
>
> int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
> int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index b141ef78c755..989ecda904db 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -1924,7 +1924,7 @@ DECLARE_EVENT_CLASS(xfs_da_class,
> __field(int, namelen)
> __field(xfs_dahash_t, hashval)
> __field(xfs_ino_t, inumber)
> - __field(int, op_flags)
> + __field(uint32_t, op_flags)
> ),
> TP_fast_assign(
> __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
> @@ -1990,7 +1990,7 @@ DECLARE_EVENT_CLASS(xfs_attr_class,
> __field(xfs_dahash_t, hashval)
> __field(unsigned int, attr_filter)
> __field(unsigned int, attr_flags)
> - __field(int, op_flags)
> + __field(uint32_t, op_flags)
> ),
> TP_fast_assign(
> __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
> @@ -2097,7 +2097,7 @@ DECLARE_EVENT_CLASS(xfs_dir2_space_class,
> TP_STRUCT__entry(
> __field(dev_t, dev)
> __field(xfs_ino_t, ino)
> - __field(int, op_flags)
> + __field(uint32_t, op_flags)
> __field(int, idx)
> ),
> TP_fast_assign(
> @@ -2128,7 +2128,7 @@ TRACE_EVENT(xfs_dir2_leafn_moveents,
> TP_STRUCT__entry(
> __field(dev_t, dev)
> __field(xfs_ino_t, ino)
> - __field(int, op_flags)
> + __field(uint32_t, op_flags)
> __field(int, src_idx)
> __field(int, dst_idx)
> __field(int, count)
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 11/17] xfs: convert dquot flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (9 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 10/17] xfs: convert da btree operations " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:26 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 12/17] xfs: convert log item tracepoint " Dave Chinner
` (5 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_format.h | 8 ++++----
fs/xfs/libxfs/xfs_quota_defs.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 0d6fa199a896..f524736d811e 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -1085,10 +1085,10 @@ static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip)
#define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
#define XFS_DQUOT_VERSION (uint8_t)0x01 /* latest version number */
-#define XFS_DQTYPE_USER 0x01 /* user dquot record */
-#define XFS_DQTYPE_PROJ 0x02 /* project dquot record */
-#define XFS_DQTYPE_GROUP 0x04 /* group dquot record */
-#define XFS_DQTYPE_BIGTIME 0x80 /* large expiry timestamps */
+#define XFS_DQTYPE_USER (1u << 0) /* user dquot record */
+#define XFS_DQTYPE_PROJ (1u << 1) /* project dquot record */
+#define XFS_DQTYPE_GROUP (1u << 2) /* group dquot record */
+#define XFS_DQTYPE_BIGTIME (1u << 7) /* large expiry timestamps */
/* bitmask to determine if this is a user/group/project dquot */
#define XFS_DQTYPE_REC_MASK (XFS_DQTYPE_USER | \
diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
index a02c5062f9b2..fdfe3cc6f15c 100644
--- a/fs/xfs/libxfs/xfs_quota_defs.h
+++ b/fs/xfs/libxfs/xfs_quota_defs.h
@@ -29,8 +29,8 @@ typedef uint8_t xfs_dqtype_t;
/*
* flags for q_flags field in the dquot.
*/
-#define XFS_DQFLAG_DIRTY (1 << 0) /* dquot is dirty */
-#define XFS_DQFLAG_FREEING (1 << 1) /* dquot is being torn down */
+#define XFS_DQFLAG_DIRTY (1u << 0) /* dquot is dirty */
+#define XFS_DQFLAG_FREEING (1u << 1) /* dquot is being torn down */
#define XFS_DQFLAG_STRINGS \
{ XFS_DQFLAG_DIRTY, "DIRTY" }, \
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 11/17] xfs: convert dquot flags to unsigned.
2022-04-11 0:31 ` [PATCH 11/17] xfs: convert dquot " Dave Chinner
@ 2022-04-12 7:26 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_format.h | 8 ++++----
> fs/xfs/libxfs/xfs_quota_defs.h | 4 ++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index 0d6fa199a896..f524736d811e 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -1085,10 +1085,10 @@ static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip)
> #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
> #define XFS_DQUOT_VERSION (uint8_t)0x01 /* latest version number */
>
> -#define XFS_DQTYPE_USER 0x01 /* user dquot record */
> -#define XFS_DQTYPE_PROJ 0x02 /* project dquot record */
> -#define XFS_DQTYPE_GROUP 0x04 /* group dquot record */
> -#define XFS_DQTYPE_BIGTIME 0x80 /* large expiry timestamps */
> +#define XFS_DQTYPE_USER (1u << 0) /* user dquot record */
> +#define XFS_DQTYPE_PROJ (1u << 1) /* project dquot record */
> +#define XFS_DQTYPE_GROUP (1u << 2) /* group dquot record */
> +#define XFS_DQTYPE_BIGTIME (1u << 7) /* large expiry timestamps */
>
> /* bitmask to determine if this is a user/group/project dquot */
> #define XFS_DQTYPE_REC_MASK (XFS_DQTYPE_USER | \
> diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
> index a02c5062f9b2..fdfe3cc6f15c 100644
> --- a/fs/xfs/libxfs/xfs_quota_defs.h
> +++ b/fs/xfs/libxfs/xfs_quota_defs.h
> @@ -29,8 +29,8 @@ typedef uint8_t xfs_dqtype_t;
> /*
> * flags for q_flags field in the dquot.
> */
> -#define XFS_DQFLAG_DIRTY (1 << 0) /* dquot is dirty */
> -#define XFS_DQFLAG_FREEING (1 << 1) /* dquot is being torn down */
> +#define XFS_DQFLAG_DIRTY (1u << 0) /* dquot is dirty */
> +#define XFS_DQFLAG_FREEING (1u << 1) /* dquot is being torn down */
>
> #define XFS_DQFLAG_STRINGS \
> { XFS_DQFLAG_DIRTY, "DIRTY" }, \
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 12/17] xfs: convert log item tracepoint flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (10 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 11/17] xfs: convert dquot " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:26 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 13/17] xfs: convert inode lock " Dave Chinner
` (4 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_trans.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index de177842b951..569b68fc6912 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -58,10 +58,10 @@ struct xfs_log_item {
#define XFS_LI_DIRTY 3 /* log item dirty in transaction */
#define XFS_LI_FLAGS \
- { (1 << XFS_LI_IN_AIL), "IN_AIL" }, \
- { (1 << XFS_LI_ABORTED), "ABORTED" }, \
- { (1 << XFS_LI_FAILED), "FAILED" }, \
- { (1 << XFS_LI_DIRTY), "DIRTY" }
+ { (1u << XFS_LI_IN_AIL), "IN_AIL" }, \
+ { (1u << XFS_LI_ABORTED), "ABORTED" }, \
+ { (1u << XFS_LI_FAILED), "FAILED" }, \
+ { (1u << XFS_LI_DIRTY), "DIRTY" }
struct xfs_item_ops {
unsigned flags;
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 12/17] xfs: convert log item tracepoint flags to unsigned.
2022-04-11 0:31 ` [PATCH 12/17] xfs: convert log item tracepoint " Dave Chinner
@ 2022-04-12 7:26 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_trans.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
> index de177842b951..569b68fc6912 100644
> --- a/fs/xfs/xfs_trans.h
> +++ b/fs/xfs/xfs_trans.h
> @@ -58,10 +58,10 @@ struct xfs_log_item {
> #define XFS_LI_DIRTY 3 /* log item dirty in transaction */
>
> #define XFS_LI_FLAGS \
> - { (1 << XFS_LI_IN_AIL), "IN_AIL" }, \
> - { (1 << XFS_LI_ABORTED), "ABORTED" }, \
> - { (1 << XFS_LI_FAILED), "FAILED" }, \
> - { (1 << XFS_LI_DIRTY), "DIRTY" }
> + { (1u << XFS_LI_IN_AIL), "IN_AIL" }, \
> + { (1u << XFS_LI_ABORTED), "ABORTED" }, \
> + { (1u << XFS_LI_FAILED), "FAILED" }, \
> + { (1u << XFS_LI_DIRTY), "DIRTY" }
>
> struct xfs_item_ops {
> unsigned flags;
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 13/17] xfs: convert inode lock flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (11 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 12/17] xfs: convert log item tracepoint " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:26 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 14/17] xfs: convert ptag " Dave Chinner
` (3 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_file.c | 12 ++++++------
fs/xfs/xfs_inode.c | 21 ++++++++++++---------
fs/xfs/xfs_inode.h | 16 ++++++++--------
3 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 5bddb1e9e0b3..f3e878408747 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -310,7 +310,7 @@ STATIC ssize_t
xfs_file_write_checks(
struct kiocb *iocb,
struct iov_iter *from,
- int *iolock)
+ unsigned int *iolock)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
@@ -513,7 +513,7 @@ xfs_file_dio_write_aligned(
struct kiocb *iocb,
struct iov_iter *from)
{
- int iolock = XFS_IOLOCK_SHARED;
+ unsigned int iolock = XFS_IOLOCK_SHARED;
ssize_t ret;
ret = xfs_ilock_iocb(iocb, iolock);
@@ -566,7 +566,7 @@ xfs_file_dio_write_unaligned(
{
size_t isize = i_size_read(VFS_I(ip));
size_t count = iov_iter_count(from);
- int iolock = XFS_IOLOCK_SHARED;
+ unsigned int iolock = XFS_IOLOCK_SHARED;
unsigned int flags = IOMAP_DIO_OVERWRITE_ONLY;
ssize_t ret;
@@ -655,7 +655,7 @@ xfs_file_dax_write(
{
struct inode *inode = iocb->ki_filp->f_mapping->host;
struct xfs_inode *ip = XFS_I(inode);
- int iolock = XFS_IOLOCK_EXCL;
+ unsigned int iolock = XFS_IOLOCK_EXCL;
ssize_t ret, error = 0;
loff_t pos;
@@ -700,7 +700,7 @@ xfs_file_buffered_write(
struct xfs_inode *ip = XFS_I(inode);
ssize_t ret;
bool cleared_space = false;
- int iolock;
+ unsigned int iolock;
if (iocb->ki_flags & IOCB_NOWAIT)
return -EOPNOTSUPP;
@@ -1181,7 +1181,7 @@ xfs_dir_open(
struct file *file)
{
struct xfs_inode *ip = XFS_I(inode);
- int mode;
+ unsigned int mode;
int error;
error = xfs_file_open(inode, file);
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 9de6205fe134..5ea460f62201 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -416,10 +416,12 @@ xfs_lockdep_subclass_ok(
* parent locking. Care must be taken to ensure we don't overrun the subclass
* storage fields in the class mask we build.
*/
-static inline int
-xfs_lock_inumorder(int lock_mode, int subclass)
+static inline uint
+xfs_lock_inumorder(
+ uint lock_mode,
+ uint subclass)
{
- int class = 0;
+ uint class = 0;
ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
XFS_ILOCK_RTSUM)));
@@ -464,7 +466,10 @@ xfs_lock_inodes(
int inodes,
uint lock_mode)
{
- int attempts = 0, i, j, try_lock;
+ int attempts = 0;
+ uint i;
+ int j;
+ bool try_lock;
struct xfs_log_item *lp;
/*
@@ -489,9 +494,9 @@ xfs_lock_inodes(
} else if (lock_mode & XFS_MMAPLOCK_EXCL)
ASSERT(!(lock_mode & XFS_ILOCK_EXCL));
- try_lock = 0;
- i = 0;
again:
+ try_lock = false;
+ i = 0;
for (; i < inodes; i++) {
ASSERT(ips[i]);
@@ -506,7 +511,7 @@ xfs_lock_inodes(
for (j = (i - 1); j >= 0 && !try_lock; j--) {
lp = &ips[j]->i_itemp->ili_item;
if (lp && test_bit(XFS_LI_IN_AIL, &lp->li_flags))
- try_lock++;
+ try_lock = true;
}
}
@@ -546,8 +551,6 @@ xfs_lock_inodes(
if ((attempts % 5) == 0) {
delay(1); /* Don't just spin the CPU */
}
- i = 0;
- try_lock = 0;
goto again;
}
}
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 740ab13d1aa2..172dba285c37 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -278,12 +278,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
* Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
* 1<<16 - 1<<32-1 -- lockdep annotation (integers)
*/
-#define XFS_IOLOCK_EXCL (1<<0)
-#define XFS_IOLOCK_SHARED (1<<1)
-#define XFS_ILOCK_EXCL (1<<2)
-#define XFS_ILOCK_SHARED (1<<3)
-#define XFS_MMAPLOCK_EXCL (1<<4)
-#define XFS_MMAPLOCK_SHARED (1<<5)
+#define XFS_IOLOCK_EXCL (1u << 0)
+#define XFS_IOLOCK_SHARED (1u << 1)
+#define XFS_ILOCK_EXCL (1u << 2)
+#define XFS_ILOCK_SHARED (1u << 3)
+#define XFS_MMAPLOCK_EXCL (1u << 4)
+#define XFS_MMAPLOCK_SHARED (1u << 5)
#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
@@ -350,12 +350,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
*/
#define XFS_IOLOCK_SHIFT 16
#define XFS_IOLOCK_MAX_SUBCLASS 3
-#define XFS_IOLOCK_DEP_MASK 0x000f0000
+#define XFS_IOLOCK_DEP_MASK 0x000f0000u
#define XFS_MMAPLOCK_SHIFT 20
#define XFS_MMAPLOCK_NUMORDER 0
#define XFS_MMAPLOCK_MAX_SUBCLASS 3
-#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
+#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
#define XFS_ILOCK_SHIFT 24
#define XFS_ILOCK_PARENT_VAL 5
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 13/17] xfs: convert inode lock flags to unsigned.
2022-04-11 0:31 ` [PATCH 13/17] xfs: convert inode lock " Dave Chinner
@ 2022-04-12 7:26 ` Chandan Babu R
2022-04-12 8:43 ` Dave Chinner
0 siblings, 1 reply; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
[...]
> @@ -350,12 +350,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
> */
> #define XFS_IOLOCK_SHIFT 16
> #define XFS_IOLOCK_MAX_SUBCLASS 3
> -#define XFS_IOLOCK_DEP_MASK 0x000f0000
> +#define XFS_IOLOCK_DEP_MASK 0x000f0000u
>
> #define XFS_MMAPLOCK_SHIFT 20
> #define XFS_MMAPLOCK_NUMORDER 0
> #define XFS_MMAPLOCK_MAX_SUBCLASS 3
> -#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
> +#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
>
> #define XFS_ILOCK_SHIFT 24
> #define XFS_ILOCK_PARENT_VAL 5
Why isn't the value of XFS_ILOCK_DEP_MASK marked as unsigned?
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 13/17] xfs: convert inode lock flags to unsigned.
2022-04-12 7:26 ` Chandan Babu R
@ 2022-04-12 8:43 ` Dave Chinner
2022-04-21 0:44 ` [PATCH 13/17 v2] " Dave Chinner
0 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-12 8:43 UTC (permalink / raw)
To: Chandan Babu R; +Cc: linux-xfs
On Tue, Apr 12, 2022 at 12:56:30PM +0530, Chandan Babu R wrote:
> On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> > fields to be unsigned.
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
>
> [...]
>
> > @@ -350,12 +350,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
> > */
> > #define XFS_IOLOCK_SHIFT 16
> > #define XFS_IOLOCK_MAX_SUBCLASS 3
> > -#define XFS_IOLOCK_DEP_MASK 0x000f0000
> > +#define XFS_IOLOCK_DEP_MASK 0x000f0000u
> >
> > #define XFS_MMAPLOCK_SHIFT 20
> > #define XFS_MMAPLOCK_NUMORDER 0
> > #define XFS_MMAPLOCK_MAX_SUBCLASS 3
> > -#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
> > +#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
> >
> > #define XFS_ILOCK_SHIFT 24
> > #define XFS_ILOCK_PARENT_VAL 5
>
> Why isn't the value of XFS_ILOCK_DEP_MASK marked as unsigned?
Because I'm blind as a bat at the best of times... :)
Good catch - I'll fix it up.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 13/17 v2] xfs: convert inode lock flags to unsigned.
2022-04-12 8:43 ` Dave Chinner
@ 2022-04-21 0:44 ` Dave Chinner
2022-04-21 3:07 ` Alli
2022-04-21 9:15 ` Chandan Babu R
0 siblings, 2 replies; 40+ messages in thread
From: Dave Chinner @ 2022-04-21 0:44 UTC (permalink / raw)
To: Chandan Babu R; +Cc: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
V2:
- convert the missed ILOCK bit values and masks to unsigned.
fs/xfs/xfs_file.c | 12 ++++++------
fs/xfs/xfs_inode.c | 21 ++++++++++++---------
fs/xfs/xfs_inode.h | 24 ++++++++++++------------
3 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 5bddb1e9e0b3..f3e878408747 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -310,7 +310,7 @@ STATIC ssize_t
xfs_file_write_checks(
struct kiocb *iocb,
struct iov_iter *from,
- int *iolock)
+ unsigned int *iolock)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
@@ -513,7 +513,7 @@ xfs_file_dio_write_aligned(
struct kiocb *iocb,
struct iov_iter *from)
{
- int iolock = XFS_IOLOCK_SHARED;
+ unsigned int iolock = XFS_IOLOCK_SHARED;
ssize_t ret;
ret = xfs_ilock_iocb(iocb, iolock);
@@ -566,7 +566,7 @@ xfs_file_dio_write_unaligned(
{
size_t isize = i_size_read(VFS_I(ip));
size_t count = iov_iter_count(from);
- int iolock = XFS_IOLOCK_SHARED;
+ unsigned int iolock = XFS_IOLOCK_SHARED;
unsigned int flags = IOMAP_DIO_OVERWRITE_ONLY;
ssize_t ret;
@@ -655,7 +655,7 @@ xfs_file_dax_write(
{
struct inode *inode = iocb->ki_filp->f_mapping->host;
struct xfs_inode *ip = XFS_I(inode);
- int iolock = XFS_IOLOCK_EXCL;
+ unsigned int iolock = XFS_IOLOCK_EXCL;
ssize_t ret, error = 0;
loff_t pos;
@@ -700,7 +700,7 @@ xfs_file_buffered_write(
struct xfs_inode *ip = XFS_I(inode);
ssize_t ret;
bool cleared_space = false;
- int iolock;
+ unsigned int iolock;
if (iocb->ki_flags & IOCB_NOWAIT)
return -EOPNOTSUPP;
@@ -1181,7 +1181,7 @@ xfs_dir_open(
struct file *file)
{
struct xfs_inode *ip = XFS_I(inode);
- int mode;
+ unsigned int mode;
int error;
error = xfs_file_open(inode, file);
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 9de6205fe134..5ea460f62201 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -416,10 +416,12 @@ xfs_lockdep_subclass_ok(
* parent locking. Care must be taken to ensure we don't overrun the subclass
* storage fields in the class mask we build.
*/
-static inline int
-xfs_lock_inumorder(int lock_mode, int subclass)
+static inline uint
+xfs_lock_inumorder(
+ uint lock_mode,
+ uint subclass)
{
- int class = 0;
+ uint class = 0;
ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
XFS_ILOCK_RTSUM)));
@@ -464,7 +466,10 @@ xfs_lock_inodes(
int inodes,
uint lock_mode)
{
- int attempts = 0, i, j, try_lock;
+ int attempts = 0;
+ uint i;
+ int j;
+ bool try_lock;
struct xfs_log_item *lp;
/*
@@ -489,9 +494,9 @@ xfs_lock_inodes(
} else if (lock_mode & XFS_MMAPLOCK_EXCL)
ASSERT(!(lock_mode & XFS_ILOCK_EXCL));
- try_lock = 0;
- i = 0;
again:
+ try_lock = false;
+ i = 0;
for (; i < inodes; i++) {
ASSERT(ips[i]);
@@ -506,7 +511,7 @@ xfs_lock_inodes(
for (j = (i - 1); j >= 0 && !try_lock; j--) {
lp = &ips[j]->i_itemp->ili_item;
if (lp && test_bit(XFS_LI_IN_AIL, &lp->li_flags))
- try_lock++;
+ try_lock = true;
}
}
@@ -546,8 +551,6 @@ xfs_lock_inodes(
if ((attempts % 5) == 0) {
delay(1); /* Don't just spin the CPU */
}
- i = 0;
- try_lock = 0;
goto again;
}
}
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 740ab13d1aa2..b67ab9f10cf9 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -278,12 +278,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
* Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
* 1<<16 - 1<<32-1 -- lockdep annotation (integers)
*/
-#define XFS_IOLOCK_EXCL (1<<0)
-#define XFS_IOLOCK_SHARED (1<<1)
-#define XFS_ILOCK_EXCL (1<<2)
-#define XFS_ILOCK_SHARED (1<<3)
-#define XFS_MMAPLOCK_EXCL (1<<4)
-#define XFS_MMAPLOCK_SHARED (1<<5)
+#define XFS_IOLOCK_EXCL (1u << 0)
+#define XFS_IOLOCK_SHARED (1u << 1)
+#define XFS_ILOCK_EXCL (1u << 2)
+#define XFS_ILOCK_SHARED (1u << 3)
+#define XFS_MMAPLOCK_EXCL (1u << 4)
+#define XFS_MMAPLOCK_SHARED (1u << 5)
#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
@@ -350,19 +350,19 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
*/
#define XFS_IOLOCK_SHIFT 16
#define XFS_IOLOCK_MAX_SUBCLASS 3
-#define XFS_IOLOCK_DEP_MASK 0x000f0000
+#define XFS_IOLOCK_DEP_MASK 0x000f0000u
#define XFS_MMAPLOCK_SHIFT 20
#define XFS_MMAPLOCK_NUMORDER 0
#define XFS_MMAPLOCK_MAX_SUBCLASS 3
-#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
+#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
#define XFS_ILOCK_SHIFT 24
-#define XFS_ILOCK_PARENT_VAL 5
+#define XFS_ILOCK_PARENT_VAL 5u
#define XFS_ILOCK_MAX_SUBCLASS (XFS_ILOCK_PARENT_VAL - 1)
-#define XFS_ILOCK_RTBITMAP_VAL 6
-#define XFS_ILOCK_RTSUM_VAL 7
-#define XFS_ILOCK_DEP_MASK 0xff000000
+#define XFS_ILOCK_RTBITMAP_VAL 6u
+#define XFS_ILOCK_RTSUM_VAL 7u
+#define XFS_ILOCK_DEP_MASK 0xff000000u
#define XFS_ILOCK_PARENT (XFS_ILOCK_PARENT_VAL << XFS_ILOCK_SHIFT)
#define XFS_ILOCK_RTBITMAP (XFS_ILOCK_RTBITMAP_VAL << XFS_ILOCK_SHIFT)
#define XFS_ILOCK_RTSUM (XFS_ILOCK_RTSUM_VAL << XFS_ILOCK_SHIFT)
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 13/17 v2] xfs: convert inode lock flags to unsigned.
2022-04-21 0:44 ` [PATCH 13/17 v2] " Dave Chinner
@ 2022-04-21 3:07 ` Alli
2022-04-21 9:15 ` Chandan Babu R
1 sibling, 0 replies; 40+ messages in thread
From: Alli @ 2022-04-21 3:07 UTC (permalink / raw)
To: Dave Chinner, Chandan Babu R; +Cc: linux-xfs
On Thu, 2022-04-21 at 10:44 +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> V2:
> - convert the missed ILOCK bit values and masks to unsigned.
>
Looks ok now
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
> fs/xfs/xfs_file.c | 12 ++++++------
> fs/xfs/xfs_inode.c | 21 ++++++++++++---------
> fs/xfs/xfs_inode.h | 24 ++++++++++++------------
> 3 files changed, 30 insertions(+), 27 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 5bddb1e9e0b3..f3e878408747 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -310,7 +310,7 @@ STATIC ssize_t
> xfs_file_write_checks(
> struct kiocb *iocb,
> struct iov_iter *from,
> - int *iolock)
> + unsigned int *iolock)
> {
> struct file *file = iocb->ki_filp;
> struct inode *inode = file->f_mapping->host;
> @@ -513,7 +513,7 @@ xfs_file_dio_write_aligned(
> struct kiocb *iocb,
> struct iov_iter *from)
> {
> - int iolock = XFS_IOLOCK_SHARED;
> + unsigned int iolock = XFS_IOLOCK_SHARED;
> ssize_t ret;
>
> ret = xfs_ilock_iocb(iocb, iolock);
> @@ -566,7 +566,7 @@ xfs_file_dio_write_unaligned(
> {
> size_t isize = i_size_read(VFS_I(ip));
> size_t count = iov_iter_count(from);
> - int iolock = XFS_IOLOCK_SHARED;
> + unsigned int iolock = XFS_IOLOCK_SHARED;
> unsigned int flags = IOMAP_DIO_OVERWRITE_ONLY;
> ssize_t ret;
>
> @@ -655,7 +655,7 @@ xfs_file_dax_write(
> {
> struct inode *inode = iocb->ki_filp->f_mapping-
> >host;
> struct xfs_inode *ip = XFS_I(inode);
> - int iolock = XFS_IOLOCK_EXCL;
> + unsigned int iolock = XFS_IOLOCK_EXCL;
> ssize_t ret, error = 0;
> loff_t pos;
>
> @@ -700,7 +700,7 @@ xfs_file_buffered_write(
> struct xfs_inode *ip = XFS_I(inode);
> ssize_t ret;
> bool cleared_space = false;
> - int iolock;
> + unsigned int iolock;
>
> if (iocb->ki_flags & IOCB_NOWAIT)
> return -EOPNOTSUPP;
> @@ -1181,7 +1181,7 @@ xfs_dir_open(
> struct file *file)
> {
> struct xfs_inode *ip = XFS_I(inode);
> - int mode;
> + unsigned int mode;
> int error;
>
> error = xfs_file_open(inode, file);
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 9de6205fe134..5ea460f62201 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -416,10 +416,12 @@ xfs_lockdep_subclass_ok(
> * parent locking. Care must be taken to ensure we don't overrun the
> subclass
> * storage fields in the class mask we build.
> */
> -static inline int
> -xfs_lock_inumorder(int lock_mode, int subclass)
> +static inline uint
> +xfs_lock_inumorder(
> + uint lock_mode,
> + uint subclass)
> {
> - int class = 0;
> + uint class = 0;
>
> ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
> XFS_ILOCK_RTSUM)));
> @@ -464,7 +466,10 @@ xfs_lock_inodes(
> int inodes,
> uint lock_mode)
> {
> - int attempts = 0, i, j, try_lock;
> + int attempts = 0;
> + uint i;
> + int j;
> + bool try_lock;
> struct xfs_log_item *lp;
>
> /*
> @@ -489,9 +494,9 @@ xfs_lock_inodes(
> } else if (lock_mode & XFS_MMAPLOCK_EXCL)
> ASSERT(!(lock_mode & XFS_ILOCK_EXCL));
>
> - try_lock = 0;
> - i = 0;
> again:
> + try_lock = false;
> + i = 0;
> for (; i < inodes; i++) {
> ASSERT(ips[i]);
>
> @@ -506,7 +511,7 @@ xfs_lock_inodes(
> for (j = (i - 1); j >= 0 && !try_lock; j--) {
> lp = &ips[j]->i_itemp->ili_item;
> if (lp && test_bit(XFS_LI_IN_AIL, &lp-
> >li_flags))
> - try_lock++;
> + try_lock = true;
> }
> }
>
> @@ -546,8 +551,6 @@ xfs_lock_inodes(
> if ((attempts % 5) == 0) {
> delay(1); /* Don't just spin the CPU */
> }
> - i = 0;
> - try_lock = 0;
> goto again;
> }
> }
> diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
> index 740ab13d1aa2..b67ab9f10cf9 100644
> --- a/fs/xfs/xfs_inode.h
> +++ b/fs/xfs/xfs_inode.h
> @@ -278,12 +278,12 @@ static inline bool xfs_inode_has_bigtime(struct
> xfs_inode *ip)
> * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes
> (bitfield)
> * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
> */
> -#define XFS_IOLOCK_EXCL (1<<0)
> -#define XFS_IOLOCK_SHARED (1<<1)
> -#define XFS_ILOCK_EXCL (1<<2)
> -#define XFS_ILOCK_SHARED (1<<3)
> -#define XFS_MMAPLOCK_EXCL (1<<4)
> -#define XFS_MMAPLOCK_SHARED (1<<5)
> +#define XFS_IOLOCK_EXCL (1u << 0)
> +#define XFS_IOLOCK_SHARED (1u << 1)
> +#define XFS_ILOCK_EXCL (1u << 2)
> +#define XFS_ILOCK_SHARED (1u << 3)
> +#define XFS_MMAPLOCK_EXCL (1u << 4)
> +#define XFS_MMAPLOCK_SHARED (1u << 5)
>
> #define XFS_LOCK_MASK (XFS_IOLOCK_EXCL |
> XFS_IOLOCK_SHARED \
> | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
> @@ -350,19 +350,19 @@ static inline bool xfs_inode_has_bigtime(struct
> xfs_inode *ip)
> */
> #define XFS_IOLOCK_SHIFT 16
> #define XFS_IOLOCK_MAX_SUBCLASS 3
> -#define XFS_IOLOCK_DEP_MASK 0x000f0000
> +#define XFS_IOLOCK_DEP_MASK 0x000f0000u
>
> #define XFS_MMAPLOCK_SHIFT 20
> #define XFS_MMAPLOCK_NUMORDER 0
> #define XFS_MMAPLOCK_MAX_SUBCLASS 3
> -#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
> +#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
>
> #define XFS_ILOCK_SHIFT 24
> -#define XFS_ILOCK_PARENT_VAL 5
> +#define XFS_ILOCK_PARENT_VAL 5u
> #define XFS_ILOCK_MAX_SUBCLASS (XFS_ILOCK_PARENT_VAL -
> 1)
> -#define XFS_ILOCK_RTBITMAP_VAL 6
> -#define XFS_ILOCK_RTSUM_VAL 7
> -#define XFS_ILOCK_DEP_MASK 0xff000000
> +#define XFS_ILOCK_RTBITMAP_VAL 6u
> +#define XFS_ILOCK_RTSUM_VAL 7u
> +#define XFS_ILOCK_DEP_MASK 0xff000000u
> #define XFS_ILOCK_PARENT (XFS_ILOCK_PARENT_VAL <<
> XFS_ILOCK_SHIFT)
> #define XFS_ILOCK_RTBITMAP (XFS_ILOCK_RTBITMAP_V
> AL << XFS_ILOCK_SHIFT)
> #define XFS_ILOCK_RTSUM (XFS_ILOCK_RTSUM_VAL
> << XFS_ILOCK_SHIFT)
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH 13/17 v2] xfs: convert inode lock flags to unsigned.
2022-04-21 0:44 ` [PATCH 13/17 v2] " Dave Chinner
2022-04-21 3:07 ` Alli
@ 2022-04-21 9:15 ` Chandan Babu R
1 sibling, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-21 9:15 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 21 Apr 2022 at 06:14, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> V2:
> - convert the missed ILOCK bit values and masks to unsigned.
>
> fs/xfs/xfs_file.c | 12 ++++++------
> fs/xfs/xfs_inode.c | 21 ++++++++++++---------
> fs/xfs/xfs_inode.h | 24 ++++++++++++------------
> 3 files changed, 30 insertions(+), 27 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 5bddb1e9e0b3..f3e878408747 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -310,7 +310,7 @@ STATIC ssize_t
> xfs_file_write_checks(
> struct kiocb *iocb,
> struct iov_iter *from,
> - int *iolock)
> + unsigned int *iolock)
> {
> struct file *file = iocb->ki_filp;
> struct inode *inode = file->f_mapping->host;
> @@ -513,7 +513,7 @@ xfs_file_dio_write_aligned(
> struct kiocb *iocb,
> struct iov_iter *from)
> {
> - int iolock = XFS_IOLOCK_SHARED;
> + unsigned int iolock = XFS_IOLOCK_SHARED;
> ssize_t ret;
>
> ret = xfs_ilock_iocb(iocb, iolock);
> @@ -566,7 +566,7 @@ xfs_file_dio_write_unaligned(
> {
> size_t isize = i_size_read(VFS_I(ip));
> size_t count = iov_iter_count(from);
> - int iolock = XFS_IOLOCK_SHARED;
> + unsigned int iolock = XFS_IOLOCK_SHARED;
> unsigned int flags = IOMAP_DIO_OVERWRITE_ONLY;
> ssize_t ret;
>
> @@ -655,7 +655,7 @@ xfs_file_dax_write(
> {
> struct inode *inode = iocb->ki_filp->f_mapping->host;
> struct xfs_inode *ip = XFS_I(inode);
> - int iolock = XFS_IOLOCK_EXCL;
> + unsigned int iolock = XFS_IOLOCK_EXCL;
> ssize_t ret, error = 0;
> loff_t pos;
>
> @@ -700,7 +700,7 @@ xfs_file_buffered_write(
> struct xfs_inode *ip = XFS_I(inode);
> ssize_t ret;
> bool cleared_space = false;
> - int iolock;
> + unsigned int iolock;
>
> if (iocb->ki_flags & IOCB_NOWAIT)
> return -EOPNOTSUPP;
> @@ -1181,7 +1181,7 @@ xfs_dir_open(
> struct file *file)
> {
> struct xfs_inode *ip = XFS_I(inode);
> - int mode;
> + unsigned int mode;
> int error;
>
> error = xfs_file_open(inode, file);
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 9de6205fe134..5ea460f62201 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -416,10 +416,12 @@ xfs_lockdep_subclass_ok(
> * parent locking. Care must be taken to ensure we don't overrun the subclass
> * storage fields in the class mask we build.
> */
> -static inline int
> -xfs_lock_inumorder(int lock_mode, int subclass)
> +static inline uint
> +xfs_lock_inumorder(
> + uint lock_mode,
> + uint subclass)
> {
> - int class = 0;
> + uint class = 0;
>
> ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
> XFS_ILOCK_RTSUM)));
> @@ -464,7 +466,10 @@ xfs_lock_inodes(
> int inodes,
> uint lock_mode)
> {
> - int attempts = 0, i, j, try_lock;
> + int attempts = 0;
> + uint i;
> + int j;
> + bool try_lock;
> struct xfs_log_item *lp;
>
> /*
> @@ -489,9 +494,9 @@ xfs_lock_inodes(
> } else if (lock_mode & XFS_MMAPLOCK_EXCL)
> ASSERT(!(lock_mode & XFS_ILOCK_EXCL));
>
> - try_lock = 0;
> - i = 0;
> again:
> + try_lock = false;
> + i = 0;
> for (; i < inodes; i++) {
> ASSERT(ips[i]);
>
> @@ -506,7 +511,7 @@ xfs_lock_inodes(
> for (j = (i - 1); j >= 0 && !try_lock; j--) {
> lp = &ips[j]->i_itemp->ili_item;
> if (lp && test_bit(XFS_LI_IN_AIL, &lp->li_flags))
> - try_lock++;
> + try_lock = true;
> }
> }
>
> @@ -546,8 +551,6 @@ xfs_lock_inodes(
> if ((attempts % 5) == 0) {
> delay(1); /* Don't just spin the CPU */
> }
> - i = 0;
> - try_lock = 0;
> goto again;
> }
> }
> diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
> index 740ab13d1aa2..b67ab9f10cf9 100644
> --- a/fs/xfs/xfs_inode.h
> +++ b/fs/xfs/xfs_inode.h
> @@ -278,12 +278,12 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
> * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
> * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
> */
> -#define XFS_IOLOCK_EXCL (1<<0)
> -#define XFS_IOLOCK_SHARED (1<<1)
> -#define XFS_ILOCK_EXCL (1<<2)
> -#define XFS_ILOCK_SHARED (1<<3)
> -#define XFS_MMAPLOCK_EXCL (1<<4)
> -#define XFS_MMAPLOCK_SHARED (1<<5)
> +#define XFS_IOLOCK_EXCL (1u << 0)
> +#define XFS_IOLOCK_SHARED (1u << 1)
> +#define XFS_ILOCK_EXCL (1u << 2)
> +#define XFS_ILOCK_SHARED (1u << 3)
> +#define XFS_MMAPLOCK_EXCL (1u << 4)
> +#define XFS_MMAPLOCK_SHARED (1u << 5)
>
> #define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
> | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
> @@ -350,19 +350,19 @@ static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
> */
> #define XFS_IOLOCK_SHIFT 16
> #define XFS_IOLOCK_MAX_SUBCLASS 3
> -#define XFS_IOLOCK_DEP_MASK 0x000f0000
> +#define XFS_IOLOCK_DEP_MASK 0x000f0000u
>
> #define XFS_MMAPLOCK_SHIFT 20
> #define XFS_MMAPLOCK_NUMORDER 0
> #define XFS_MMAPLOCK_MAX_SUBCLASS 3
> -#define XFS_MMAPLOCK_DEP_MASK 0x00f00000
> +#define XFS_MMAPLOCK_DEP_MASK 0x00f00000u
>
> #define XFS_ILOCK_SHIFT 24
> -#define XFS_ILOCK_PARENT_VAL 5
> +#define XFS_ILOCK_PARENT_VAL 5u
> #define XFS_ILOCK_MAX_SUBCLASS (XFS_ILOCK_PARENT_VAL - 1)
> -#define XFS_ILOCK_RTBITMAP_VAL 6
> -#define XFS_ILOCK_RTSUM_VAL 7
> -#define XFS_ILOCK_DEP_MASK 0xff000000
> +#define XFS_ILOCK_RTBITMAP_VAL 6u
> +#define XFS_ILOCK_RTSUM_VAL 7u
> +#define XFS_ILOCK_DEP_MASK 0xff000000u
> #define XFS_ILOCK_PARENT (XFS_ILOCK_PARENT_VAL << XFS_ILOCK_SHIFT)
> #define XFS_ILOCK_RTBITMAP (XFS_ILOCK_RTBITMAP_VAL << XFS_ILOCK_SHIFT)
> #define XFS_ILOCK_RTSUM (XFS_ILOCK_RTSUM_VAL << XFS_ILOCK_SHIFT)
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 14/17] xfs: convert ptag flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (12 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 13/17] xfs: convert inode lock " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:26 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 15/17] xfs: convert quota options " Dave Chinner
` (2 subsequent siblings)
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_error.h | 20 ++++++++++----------
fs/xfs/xfs_message.c | 2 +-
fs/xfs/xfs_message.h | 3 ++-
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 5735d5ea87ee..5191e9145e55 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -64,16 +64,16 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp);
* XFS panic tags -- allow a call to xfs_alert_tag() be turned into
* a panic by setting xfs_panic_mask in a sysctl.
*/
-#define XFS_NO_PTAG 0
-#define XFS_PTAG_IFLUSH 0x00000001
-#define XFS_PTAG_LOGRES 0x00000002
-#define XFS_PTAG_AILDELETE 0x00000004
-#define XFS_PTAG_ERROR_REPORT 0x00000008
-#define XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
-#define XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
-#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
-#define XFS_PTAG_FSBLOCK_ZERO 0x00000080
-#define XFS_PTAG_VERIFIER_ERROR 0x00000100
+#define XFS_NO_PTAG 0u
+#define XFS_PTAG_IFLUSH (1u << 0)
+#define XFS_PTAG_LOGRES (1u << 1)
+#define XFS_PTAG_AILDELETE (1u << 2)
+#define XFS_PTAG_ERROR_REPORT (1u << 3)
+#define XFS_PTAG_SHUTDOWN_CORRUPT (1u << 4)
+#define XFS_PTAG_SHUTDOWN_IOERROR (1u << 5)
+#define XFS_PTAG_SHUTDOWN_LOGERROR (1u << 6)
+#define XFS_PTAG_FSBLOCK_ZERO (1u << 7)
+#define XFS_PTAG_VERIFIER_ERROR (1u << 8)
#define XFS_PTAG_STRINGS \
{ XFS_NO_PTAG, "none" }, \
diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index bc66d95c8d4c..c5084dce75cd 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -62,7 +62,7 @@ define_xfs_printk_level(xfs_debug, KERN_DEBUG);
void
xfs_alert_tag(
const struct xfs_mount *mp,
- int panic_tag,
+ uint32_t panic_tag,
const char *fmt, ...)
{
struct va_format vaf;
diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
index bb9860ec9a93..dee98e9ccc3d 100644
--- a/fs/xfs/xfs_message.h
+++ b/fs/xfs/xfs_message.h
@@ -11,7 +11,8 @@ void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
extern __printf(2, 3)
void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
extern __printf(3, 4)
-void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
+void xfs_alert_tag(const struct xfs_mount *mp, uint32_t tag,
+ const char *fmt, ...);
extern __printf(2, 3)
void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
extern __printf(2, 3)
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 14/17] xfs: convert ptag flags to unsigned.
2022-04-11 0:31 ` [PATCH 14/17] xfs: convert ptag " Dave Chinner
@ 2022-04-12 7:26 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_error.h | 20 ++++++++++----------
> fs/xfs/xfs_message.c | 2 +-
> fs/xfs/xfs_message.h | 3 ++-
> 3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
> index 5735d5ea87ee..5191e9145e55 100644
> --- a/fs/xfs/xfs_error.h
> +++ b/fs/xfs/xfs_error.h
> @@ -64,16 +64,16 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp);
> * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
> * a panic by setting xfs_panic_mask in a sysctl.
> */
> -#define XFS_NO_PTAG 0
> -#define XFS_PTAG_IFLUSH 0x00000001
> -#define XFS_PTAG_LOGRES 0x00000002
> -#define XFS_PTAG_AILDELETE 0x00000004
> -#define XFS_PTAG_ERROR_REPORT 0x00000008
> -#define XFS_PTAG_SHUTDOWN_CORRUPT 0x00000010
> -#define XFS_PTAG_SHUTDOWN_IOERROR 0x00000020
> -#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
> -#define XFS_PTAG_FSBLOCK_ZERO 0x00000080
> -#define XFS_PTAG_VERIFIER_ERROR 0x00000100
> +#define XFS_NO_PTAG 0u
> +#define XFS_PTAG_IFLUSH (1u << 0)
> +#define XFS_PTAG_LOGRES (1u << 1)
> +#define XFS_PTAG_AILDELETE (1u << 2)
> +#define XFS_PTAG_ERROR_REPORT (1u << 3)
> +#define XFS_PTAG_SHUTDOWN_CORRUPT (1u << 4)
> +#define XFS_PTAG_SHUTDOWN_IOERROR (1u << 5)
> +#define XFS_PTAG_SHUTDOWN_LOGERROR (1u << 6)
> +#define XFS_PTAG_FSBLOCK_ZERO (1u << 7)
> +#define XFS_PTAG_VERIFIER_ERROR (1u << 8)
>
> #define XFS_PTAG_STRINGS \
> { XFS_NO_PTAG, "none" }, \
> diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
> index bc66d95c8d4c..c5084dce75cd 100644
> --- a/fs/xfs/xfs_message.c
> +++ b/fs/xfs/xfs_message.c
> @@ -62,7 +62,7 @@ define_xfs_printk_level(xfs_debug, KERN_DEBUG);
> void
> xfs_alert_tag(
> const struct xfs_mount *mp,
> - int panic_tag,
> + uint32_t panic_tag,
> const char *fmt, ...)
> {
> struct va_format vaf;
> diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
> index bb9860ec9a93..dee98e9ccc3d 100644
> --- a/fs/xfs/xfs_message.h
> +++ b/fs/xfs/xfs_message.h
> @@ -11,7 +11,8 @@ void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
> extern __printf(2, 3)
> void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
> extern __printf(3, 4)
> -void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
> +void xfs_alert_tag(const struct xfs_mount *mp, uint32_t tag,
> + const char *fmt, ...);
> extern __printf(2, 3)
> void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
> extern __printf(2, 3)
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 15/17] xfs: convert quota options flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (13 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 14/17] xfs: convert ptag " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:26 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 16/17] xfs: convert shutdown reasons " Dave Chinner
2022-04-11 0:31 ` [PATCH 17/17] xfs: convert log ticket and iclog flags " Dave Chinner
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_quota_defs.h | 45 +++++++++++++++++++++++-----------
fs/xfs/xfs_trace.h | 16 ------------
2 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
index fdfe3cc6f15c..3076cd74fcaa 100644
--- a/fs/xfs/libxfs/xfs_quota_defs.h
+++ b/fs/xfs/libxfs/xfs_quota_defs.h
@@ -73,29 +73,45 @@ typedef uint8_t xfs_dqtype_t;
* to a single function. None of these XFS_QMOPT_* flags are meant to have
* persistent values (ie. their values can and will change between versions)
*/
-#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
-#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
-#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
-#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
-#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
+#define XFS_QMOPT_UQUOTA (1u << 0) /* user dquot requested */
+#define XFS_QMOPT_GQUOTA (1u << 1) /* group dquot requested */
+#define XFS_QMOPT_PQUOTA (1u << 2) /* project dquot requested */
+#define XFS_QMOPT_FORCE_RES (1u << 3) /* ignore quota limits */
+#define XFS_QMOPT_SBVERSION (1u << 4) /* change superblock version num */
/*
* flags to xfs_trans_mod_dquot to indicate which field needs to be
* modified.
*/
-#define XFS_QMOPT_RES_REGBLKS 0x0010000
-#define XFS_QMOPT_RES_RTBLKS 0x0020000
-#define XFS_QMOPT_BCOUNT 0x0040000
-#define XFS_QMOPT_ICOUNT 0x0080000
-#define XFS_QMOPT_RTBCOUNT 0x0100000
-#define XFS_QMOPT_DELBCOUNT 0x0200000
-#define XFS_QMOPT_DELRTBCOUNT 0x0400000
-#define XFS_QMOPT_RES_INOS 0x0800000
+#define XFS_QMOPT_RES_REGBLKS (1u << 7)
+#define XFS_QMOPT_RES_RTBLKS (1u << 8)
+#define XFS_QMOPT_BCOUNT (1u << 9)
+#define XFS_QMOPT_ICOUNT (1u << 10)
+#define XFS_QMOPT_RTBCOUNT (1u << 11)
+#define XFS_QMOPT_DELBCOUNT (1u << 12)
+#define XFS_QMOPT_DELRTBCOUNT (1u << 13)
+#define XFS_QMOPT_RES_INOS (1u << 14)
/*
* flags for dqalloc.
*/
-#define XFS_QMOPT_INHERIT 0x1000000
+#define XFS_QMOPT_INHERIT (1u << 31)
+
+#define XFS_QMOPT_FLAGS \
+ { XFS_QMOPT_UQUOTA, "UQUOTA" }, \
+ { XFS_QMOPT_PQUOTA, "PQUOTA" }, \
+ { XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
+ { XFS_QMOPT_SBVERSION, "SBVERSION" }, \
+ { XFS_QMOPT_GQUOTA, "GQUOTA" }, \
+ { XFS_QMOPT_INHERIT, "INHERIT" }, \
+ { XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
+ { XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
+ { XFS_QMOPT_BCOUNT, "BCOUNT" }, \
+ { XFS_QMOPT_ICOUNT, "ICOUNT" }, \
+ { XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
+ { XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
+ { XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
+ { XFS_QMOPT_RES_INOS, "RES_INOS" }
/*
* flags to xfs_trans_mod_dquot.
@@ -114,6 +130,7 @@ typedef uint8_t xfs_dqtype_t;
(XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
+
extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
struct xfs_disk_dquot *ddq, xfs_dqid_t id);
extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 989ecda904db..b88bd45da27a 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1096,22 +1096,6 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_done);
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
-#define XFS_QMOPT_FLAGS \
- { XFS_QMOPT_UQUOTA, "UQUOTA" }, \
- { XFS_QMOPT_PQUOTA, "PQUOTA" }, \
- { XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
- { XFS_QMOPT_SBVERSION, "SBVERSION" }, \
- { XFS_QMOPT_GQUOTA, "GQUOTA" }, \
- { XFS_QMOPT_INHERIT, "INHERIT" }, \
- { XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
- { XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
- { XFS_QMOPT_BCOUNT, "BCOUNT" }, \
- { XFS_QMOPT_ICOUNT, "ICOUNT" }, \
- { XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
- { XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
- { XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
- { XFS_QMOPT_RES_INOS, "RES_INOS" }
-
TRACE_EVENT(xfs_trans_mod_dquot,
TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
unsigned int field, int64_t delta),
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 15/17] xfs: convert quota options flags to unsigned.
2022-04-11 0:31 ` [PATCH 15/17] xfs: convert quota options " Dave Chinner
@ 2022-04-12 7:26 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_quota_defs.h | 45 +++++++++++++++++++++++-----------
> fs/xfs/xfs_trace.h | 16 ------------
> 2 files changed, 31 insertions(+), 30 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
> index fdfe3cc6f15c..3076cd74fcaa 100644
> --- a/fs/xfs/libxfs/xfs_quota_defs.h
> +++ b/fs/xfs/libxfs/xfs_quota_defs.h
> @@ -73,29 +73,45 @@ typedef uint8_t xfs_dqtype_t;
> * to a single function. None of these XFS_QMOPT_* flags are meant to have
> * persistent values (ie. their values can and will change between versions)
> */
> -#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
> -#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
> -#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
> -#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
> -#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
> +#define XFS_QMOPT_UQUOTA (1u << 0) /* user dquot requested */
> +#define XFS_QMOPT_GQUOTA (1u << 1) /* group dquot requested */
> +#define XFS_QMOPT_PQUOTA (1u << 2) /* project dquot requested */
> +#define XFS_QMOPT_FORCE_RES (1u << 3) /* ignore quota limits */
> +#define XFS_QMOPT_SBVERSION (1u << 4) /* change superblock version num */
>
> /*
> * flags to xfs_trans_mod_dquot to indicate which field needs to be
> * modified.
> */
> -#define XFS_QMOPT_RES_REGBLKS 0x0010000
> -#define XFS_QMOPT_RES_RTBLKS 0x0020000
> -#define XFS_QMOPT_BCOUNT 0x0040000
> -#define XFS_QMOPT_ICOUNT 0x0080000
> -#define XFS_QMOPT_RTBCOUNT 0x0100000
> -#define XFS_QMOPT_DELBCOUNT 0x0200000
> -#define XFS_QMOPT_DELRTBCOUNT 0x0400000
> -#define XFS_QMOPT_RES_INOS 0x0800000
> +#define XFS_QMOPT_RES_REGBLKS (1u << 7)
> +#define XFS_QMOPT_RES_RTBLKS (1u << 8)
> +#define XFS_QMOPT_BCOUNT (1u << 9)
> +#define XFS_QMOPT_ICOUNT (1u << 10)
> +#define XFS_QMOPT_RTBCOUNT (1u << 11)
> +#define XFS_QMOPT_DELBCOUNT (1u << 12)
> +#define XFS_QMOPT_DELRTBCOUNT (1u << 13)
> +#define XFS_QMOPT_RES_INOS (1u << 14)
>
> /*
> * flags for dqalloc.
> */
> -#define XFS_QMOPT_INHERIT 0x1000000
> +#define XFS_QMOPT_INHERIT (1u << 31)
> +
> +#define XFS_QMOPT_FLAGS \
> + { XFS_QMOPT_UQUOTA, "UQUOTA" }, \
> + { XFS_QMOPT_PQUOTA, "PQUOTA" }, \
> + { XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
> + { XFS_QMOPT_SBVERSION, "SBVERSION" }, \
> + { XFS_QMOPT_GQUOTA, "GQUOTA" }, \
> + { XFS_QMOPT_INHERIT, "INHERIT" }, \
> + { XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
> + { XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
> + { XFS_QMOPT_BCOUNT, "BCOUNT" }, \
> + { XFS_QMOPT_ICOUNT, "ICOUNT" }, \
> + { XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
> + { XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
> + { XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
> + { XFS_QMOPT_RES_INOS, "RES_INOS" }
>
> /*
> * flags to xfs_trans_mod_dquot.
> @@ -114,6 +130,7 @@ typedef uint8_t xfs_dqtype_t;
> (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
> #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
>
> +
> extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
> struct xfs_disk_dquot *ddq, xfs_dqid_t id);
> extern xfs_failaddr_t xfs_dqblk_verify(struct xfs_mount *mp,
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 989ecda904db..b88bd45da27a 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -1096,22 +1096,6 @@ DEFINE_DQUOT_EVENT(xfs_dqflush_done);
> DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
> DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
>
> -#define XFS_QMOPT_FLAGS \
> - { XFS_QMOPT_UQUOTA, "UQUOTA" }, \
> - { XFS_QMOPT_PQUOTA, "PQUOTA" }, \
> - { XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
> - { XFS_QMOPT_SBVERSION, "SBVERSION" }, \
> - { XFS_QMOPT_GQUOTA, "GQUOTA" }, \
> - { XFS_QMOPT_INHERIT, "INHERIT" }, \
> - { XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
> - { XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
> - { XFS_QMOPT_BCOUNT, "BCOUNT" }, \
> - { XFS_QMOPT_ICOUNT, "ICOUNT" }, \
> - { XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
> - { XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
> - { XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
> - { XFS_QMOPT_RES_INOS, "RES_INOS" }
> -
> TRACE_EVENT(xfs_trans_mod_dquot,
> TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
> unsigned int field, int64_t delta),
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 16/17] xfs: convert shutdown reasons to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (14 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 15/17] xfs: convert quota options " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:27 ` Chandan Babu R
2022-04-11 0:31 ` [PATCH 17/17] xfs: convert log ticket and iclog flags " Dave Chinner
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_fsops.c | 2 +-
fs/xfs/xfs_log.c | 2 +-
fs/xfs/xfs_log.h | 2 +-
fs/xfs/xfs_mount.h | 11 +++++------
4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 68f74549fa22..e4cc6b7cae0f 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -512,7 +512,7 @@ xfs_fs_goingdown(
void
xfs_do_force_shutdown(
struct xfs_mount *mp,
- int flags,
+ uint32_t flags,
char *fname,
int lnnum)
{
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 499e15b24215..3c216140a1c4 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3829,7 +3829,7 @@ xlog_verify_iclog(
bool
xlog_force_shutdown(
struct xlog *log,
- int shutdown_flags)
+ uint32_t shutdown_flags)
{
bool log_error = (shutdown_flags & SHUTDOWN_LOG_IO_ERROR);
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index dc1b77b92fc1..3ecf891f34c4 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -140,7 +140,7 @@ void xfs_log_clean(struct xfs_mount *mp);
bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
xfs_lsn_t xlog_grant_push_threshold(struct xlog *log, int need_bytes);
-bool xlog_force_shutdown(struct xlog *log, int shutdown_flags);
+bool xlog_force_shutdown(struct xlog *log, uint32_t shutdown_flags);
void xlog_use_incompat_feat(struct xlog *log);
void xlog_drop_incompat_feat(struct xlog *log);
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index f6dc19de8322..e5629e7c5aaf 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -425,16 +425,15 @@ __XFS_IS_OPSTATE(blockgc_enabled, BLOCKGC_ENABLED)
#define XFS_MAX_IO_LOG 30 /* 1G */
#define XFS_MIN_IO_LOG PAGE_SHIFT
-#define xfs_is_shutdown(mp) xfs_is_shutdown(mp)
-void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
+void xfs_do_force_shutdown(struct xfs_mount *mp, uint32_t flags, char *fname,
int lnnum);
#define xfs_force_shutdown(m,f) \
xfs_do_force_shutdown(m, f, __FILE__, __LINE__)
-#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
-#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
-#define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
-#define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */
+#define SHUTDOWN_META_IO_ERROR (1u << 0) /* write attempt to metadata failed */
+#define SHUTDOWN_LOG_IO_ERROR (1u << 1) /* write attempt to the log failed */
+#define SHUTDOWN_FORCE_UMOUNT (1u << 2) /* shutdown from a forced unmount */
+#define SHUTDOWN_CORRUPT_INCORE (1u << 3) /* corrupt in-memory structures */
#define XFS_SHUTDOWN_STRINGS \
{ SHUTDOWN_META_IO_ERROR, "metadata_io" }, \
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 16/17] xfs: convert shutdown reasons to unsigned.
2022-04-11 0:31 ` [PATCH 16/17] xfs: convert shutdown reasons " Dave Chinner
@ 2022-04-12 7:27 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:27 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_fsops.c | 2 +-
> fs/xfs/xfs_log.c | 2 +-
> fs/xfs/xfs_log.h | 2 +-
> fs/xfs/xfs_mount.h | 11 +++++------
> 4 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 68f74549fa22..e4cc6b7cae0f 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -512,7 +512,7 @@ xfs_fs_goingdown(
> void
> xfs_do_force_shutdown(
> struct xfs_mount *mp,
> - int flags,
> + uint32_t flags,
> char *fname,
> int lnnum)
> {
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 499e15b24215..3c216140a1c4 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3829,7 +3829,7 @@ xlog_verify_iclog(
> bool
> xlog_force_shutdown(
> struct xlog *log,
> - int shutdown_flags)
> + uint32_t shutdown_flags)
> {
> bool log_error = (shutdown_flags & SHUTDOWN_LOG_IO_ERROR);
>
> diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
> index dc1b77b92fc1..3ecf891f34c4 100644
> --- a/fs/xfs/xfs_log.h
> +++ b/fs/xfs/xfs_log.h
> @@ -140,7 +140,7 @@ void xfs_log_clean(struct xfs_mount *mp);
> bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
>
> xfs_lsn_t xlog_grant_push_threshold(struct xlog *log, int need_bytes);
> -bool xlog_force_shutdown(struct xlog *log, int shutdown_flags);
> +bool xlog_force_shutdown(struct xlog *log, uint32_t shutdown_flags);
>
> void xlog_use_incompat_feat(struct xlog *log);
> void xlog_drop_incompat_feat(struct xlog *log);
> diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
> index f6dc19de8322..e5629e7c5aaf 100644
> --- a/fs/xfs/xfs_mount.h
> +++ b/fs/xfs/xfs_mount.h
> @@ -425,16 +425,15 @@ __XFS_IS_OPSTATE(blockgc_enabled, BLOCKGC_ENABLED)
> #define XFS_MAX_IO_LOG 30 /* 1G */
> #define XFS_MIN_IO_LOG PAGE_SHIFT
>
> -#define xfs_is_shutdown(mp) xfs_is_shutdown(mp)
> -void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
> +void xfs_do_force_shutdown(struct xfs_mount *mp, uint32_t flags, char *fname,
> int lnnum);
> #define xfs_force_shutdown(m,f) \
> xfs_do_force_shutdown(m, f, __FILE__, __LINE__)
>
> -#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */
> -#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */
> -#define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
> -#define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */
> +#define SHUTDOWN_META_IO_ERROR (1u << 0) /* write attempt to metadata failed */
> +#define SHUTDOWN_LOG_IO_ERROR (1u << 1) /* write attempt to the log failed */
> +#define SHUTDOWN_FORCE_UMOUNT (1u << 2) /* shutdown from a forced unmount */
> +#define SHUTDOWN_CORRUPT_INCORE (1u << 3) /* corrupt in-memory structures */
>
> #define XFS_SHUTDOWN_STRINGS \
> { SHUTDOWN_META_IO_ERROR, "metadata_io" }, \
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread
* [PATCH 17/17] xfs: convert log ticket and iclog flags to unsigned.
2022-04-11 0:31 [PATCH 00/17] xfs: unsigned flags conversion for c11 Dave Chinner
` (15 preceding siblings ...)
2022-04-11 0:31 ` [PATCH 16/17] xfs: convert shutdown reasons " Dave Chinner
@ 2022-04-11 0:31 ` Dave Chinner
2022-04-12 7:27 ` Chandan Babu R
16 siblings, 1 reply; 40+ messages in thread
From: Dave Chinner @ 2022-04-11 0:31 UTC (permalink / raw)
To: linux-xfs
From: Dave Chinner <dchinner@redhat.com>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
fields to be unsigned.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_log_priv.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 401cdc400980..438df48a84c4 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -51,8 +51,8 @@ enum xlog_iclog_state {
/*
* In core log flags
*/
-#define XLOG_ICL_NEED_FLUSH (1 << 0) /* iclog needs REQ_PREFLUSH */
-#define XLOG_ICL_NEED_FUA (1 << 1) /* iclog needs REQ_FUA */
+#define XLOG_ICL_NEED_FLUSH (1u << 0) /* iclog needs REQ_PREFLUSH */
+#define XLOG_ICL_NEED_FUA (1u << 1) /* iclog needs REQ_FUA */
#define XLOG_ICL_STRINGS \
{ XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \
@@ -62,7 +62,7 @@ enum xlog_iclog_state {
/*
* Log ticket flags
*/
-#define XLOG_TIC_PERM_RESERV 0x1 /* permanent reservation */
+#define XLOG_TIC_PERM_RESERV (1u << 0) /* permanent reservation */
#define XLOG_TIC_FLAGS \
{ XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" }
@@ -165,7 +165,7 @@ typedef struct xlog_ticket {
char t_ocnt; /* original count : 1 */
char t_cnt; /* current count : 1 */
char t_clientid; /* who does this belong to; : 1 */
- char t_flags; /* properties of reservation : 1 */
+ uint8_t t_flags; /* properties of reservation : 1 */
/* reservation array fields */
uint t_res_num; /* num in array : 4 */
--
2.35.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [PATCH 17/17] xfs: convert log ticket and iclog flags to unsigned.
2022-04-11 0:31 ` [PATCH 17/17] xfs: convert log ticket and iclog flags " Dave Chinner
@ 2022-04-12 7:27 ` Chandan Babu R
0 siblings, 0 replies; 40+ messages in thread
From: Chandan Babu R @ 2022-04-12 7:27 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-xfs
On 11 Apr 2022 at 06:01, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> 5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
> fields to be unsigned.
>
Looks good.
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_log_priv.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index 401cdc400980..438df48a84c4 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -51,8 +51,8 @@ enum xlog_iclog_state {
> /*
> * In core log flags
> */
> -#define XLOG_ICL_NEED_FLUSH (1 << 0) /* iclog needs REQ_PREFLUSH */
> -#define XLOG_ICL_NEED_FUA (1 << 1) /* iclog needs REQ_FUA */
> +#define XLOG_ICL_NEED_FLUSH (1u << 0) /* iclog needs REQ_PREFLUSH */
> +#define XLOG_ICL_NEED_FUA (1u << 1) /* iclog needs REQ_FUA */
>
> #define XLOG_ICL_STRINGS \
> { XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \
> @@ -62,7 +62,7 @@ enum xlog_iclog_state {
> /*
> * Log ticket flags
> */
> -#define XLOG_TIC_PERM_RESERV 0x1 /* permanent reservation */
> +#define XLOG_TIC_PERM_RESERV (1u << 0) /* permanent reservation */
>
> #define XLOG_TIC_FLAGS \
> { XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" }
> @@ -165,7 +165,7 @@ typedef struct xlog_ticket {
> char t_ocnt; /* original count : 1 */
> char t_cnt; /* current count : 1 */
> char t_clientid; /* who does this belong to; : 1 */
> - char t_flags; /* properties of reservation : 1 */
> + uint8_t t_flags; /* properties of reservation : 1 */
>
> /* reservation array fields */
> uint t_res_num; /* num in array : 4 */
--
chandan
^ permalink raw reply [flat|nested] 40+ messages in thread