xfs: unsigned flags conversion for c11
PATCH 10/17 xfs: convert da btree operations flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_da_btree.h | 16 ++++++++-------- fs/xfs/xfs_trace.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-)
fs/xfs/libxfs/xfs_da_btree.h +8 -8
@@ -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,
fs/xfs/xfs_trace.h +4 -4
@@ -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)
Signature · 1 line
2.35.1
PATCH 4/17 xfs: convert bmap extent type flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_bmap.c | 14 +++++++------- fs/xfs/libxfs/xfs_bmap.h | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-)
fs/xfs/libxfs/xfs_bmap.c +7 -7
@@ -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;
fs/xfs/libxfs/xfs_bmap.h +11 -11
@@ -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 :
Signature · 1 line
2.35.1
PATCH 6/17 xfs: convert AGF log flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- 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(-)
fs/xfs/libxfs/xfs_alloc.c +5 -5
@@ -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;
fs/xfs/libxfs/xfs_alloc.h +1 -1
@@ -121,7 +121,7 @@ voidxfs_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.
fs/xfs/libxfs/xfs_format.h +19 -19
@@ -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" }, \
Signature · 1 line
2.35.1
PATCH 7/17 xfs: convert AGI log flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- 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(-)
fs/xfs/libxfs/xfs_format.h +15 -15
@@ -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 */
fs/xfs/libxfs/xfs_ialloc.c +3 -3
@@ -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 */
fs/xfs/libxfs/xfs_ialloc.h +1 -1
@@ -60,7 +60,7 @@ voidxfs_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)
Signature · 1 line
2.35.1
cover xfs: unsigned flags conversion for c11
Hi folks,
With the addition of C11 compiler specs to 5.18-rc1, some compilers are generating warnings about our use of signed flag values being placed into unsigned fields.
The initial warning is caused by the trace event infrastructure using __print_flags(). The array structure used internally that we use macros to initialise defines the flags field as an unsigned long. This causes signed int flags that set the high bit to be sign extended and not be correct. gcc-5 then fails to detect this value as a constant and it throws errors.
The fix for this is to just define the flag values as unsigned ints. While we only need to convert the buffer flags to avoid the build error for merge into 5.18-rcX, this series converts all the flags fields that are used to initialise trace event __print_flags() arrays. Most of these flags are stored in unsigned int variables, we really should be declaring them as unsigned values anyway.
Hence this patch set cleans up all these flag values to use unsigned values, use unsigned storage variables, and convert all the places that pass them around to use unsigned varaibles. I've converted all the value definitions to use consistent (1u << x) definitions so it is clear they are intended to be one bit per value flags.
There are other flags values and fields in XFS that I have not converted - these can be cleaned up over time as they currently do not have non-obvious build-breaking potential.
This is based on 5.18-rc2.
Cheers,
Dave.
PATCH 1/17 xfs: convert buffer flags to unsigned.
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 <[email protected]>.
--- fs/xfs/xfs_buf.c | 6 +++--- fs/xfs/xfs_buf.h | 42 +++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 24 deletions(-)
fs/xfs/xfs_buf.c +3 -3
@@ -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 @@ intxfs_buf_get_uncached ( struct xfs_buftarg *target, size_t numblks, - int flags, + xfs_buf_flags_t flags, struct xfs_buf **bpp) { int error;
fs/xfs/xfs_buf.h +21 -21
67 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH 2/17 xfs: convert attr type flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_da_format.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/xfs/libxfs/xfs_da_format.h +4 -4
@@ -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)/*
Signature · 1 line
2.35.1
PATCH 16/17 xfs: convert shutdown reasons to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- 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(-)
fs/xfs/xfs_fsops.c +1 -1
@@ -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) {
fs/xfs/xfs_log.c +1 -1
@@ -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 );
fs/xfs/xfs_log.h +1 -1
@@ -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);
fs/xfs/xfs_mount.h +5 -6
@@ -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" }, \
Signature · 1 line
2.35.1
PATCH 8/17 xfs: convert btree buffer log flags to unsigned.
In reply to Dave Chinner5.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.
--- fs/xfs/libxfs/xfs_btree.c | 10 +++++----- fs/xfs/libxfs/xfs_btree.h | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-)
fs/xfs/libxfs/xfs_btree.c +5 -5
@@ -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 @@ voidxfs_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 */
fs/xfs/libxfs/xfs_btree.h +13 -13
@@ -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 );/*
Signature · 1 line
2.35.1
PATCH 12/17 xfs: convert log item tracepoint flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/xfs_trans.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_trans.h +4 -4
@@ -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;
Signature · 1 line
2.35.1
PATCH 3/17 xfs: convert scrub type flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
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.
--- fs/xfs/libxfs/xfs_fs.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/xfs/libxfs/xfs_fs.h +8 -8
@@ -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 | \
Signature · 1 line
2.35.1
PATCH 5/17 xfs: convert bmapi flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_bmap.c | 22 +++++++++++----------- fs/xfs/libxfs/xfs_bmap.h | 36 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 29 deletions(-)
fs/xfs/libxfs/xfs_bmap.c +11 -11
@@ -485,7 +485,7 @@ STATIC voidxfs_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) {
fs/xfs/libxfs/xfs_bmap.h +18 -18
@@ -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;
Signature · 1 line
2.35.1
PATCH 14/17 xfs: convert ptag flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- 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(-)
fs/xfs/xfs_error.h +10 -10
@@ -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" }, \
fs/xfs/xfs_message.c +1 -1
@@ -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;
fs/xfs/xfs_message.h +2 -1
@@ -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)
Signature · 1 line
2.35.1
PATCH 17/17 xfs: convert log ticket and iclog flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/xfs_log_priv.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_log_priv.h +4 -4
@@ -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 */
Signature · 1 line
2.35.1
PATCH 9/17 xfs: convert buffer log item flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/xfs_buf_item.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
fs/xfs/xfs_buf_item.h +11 -13
@@ -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
Signature · 1 line
2.35.1
PATCH 15/17 xfs: convert quota options flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_quota_defs.h | 45 +++++++++++++++++++++++----------- fs/xfs/xfs_trace.h | 16 ------------ 2 files changed, 31 insertions(+), 30 deletions(-)
fs/xfs/libxfs/xfs_quota_defs.h +31 -14
@@ -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,
fs/xfs/xfs_trace.h +0 -16
@@ -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),
Signature · 1 line
2.35.1
PATCH 13/17 xfs: convert inode lock flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- 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(-)
fs/xfs/xfs_file.c +6 -6
@@ -310,7 +310,7 @@ STATIC ssize_txfs_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);
fs/xfs/xfs_inode.c +12 -9
@@ -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; } }
fs/xfs/xfs_inode.h +8 -8
@@ -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
Signature · 1 line
2.35.1
PATCH 11/17 xfs: convert dquot flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
--- fs/xfs/libxfs/xfs_format.h | 8 ++++---- fs/xfs/libxfs/xfs_quota_defs.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
fs/xfs/libxfs/xfs_format.h +4 -4
@@ -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 | \
fs/xfs/libxfs/xfs_quota_defs.h +2 -2
@@ -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" }, \
Signature · 1 line
2.35.1
Re: [PATCH 01/17] xfs: convert buffer flags to unsigned.
In reply to Dave ChinnerQuoted 19 lines · Dave Chinner
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
#defineXBF_UNMAPPED(1 << 31)/* do not map the buffer */
Quoted 8 lines
as
__print_flagsassignsXFS_BUF_FLAGSto a structure that uses an unsigned long for the flag. Since this results in the value ofXBF_UNMAPPEDcausing 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 <[email protected]>.
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,
Quoted 111 lines
Reported-by Geert Uytterhoeven <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_buf.c | 6 +++--- fs/xfs/xfs_buf.h | 42 +++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 24 deletions(-)fs/xfs/xfs_buf.c +3
-3@@ -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 @@ intxfs_buf_get_uncached ( struct xfs_buftarg *target, size_t numblks, - int flags, + xfs_buf_flags_t flags, struct xfs_buf **bpp) { int error;fs/xfs/xfs_buf.h +21
-21@@ -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);
Signature · 1 line
chandan
Re: [PATCH 02/17] xfs: convert attr type flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good to me.
Quoted 24 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_da_format.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)fs/xfs/libxfs/xfs_da_format.h +4
-4@@ -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)/*
Signature · 1 line
chandan
Re: [PATCH 03/17] xfs: convert scrub type flags to unsigned.
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
This touches
xfs_fs.hso affects the user API, but the user API fields are also unsigned so the flags should really be unsigned, too.
Looks good to me.
Quoted 52 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_fs.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)fs/xfs/libxfs/xfs_fs.h +8
-8@@ -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 | \
Signature · 1 line
chandan
Re: [PATCH 04/17] xfs: convert bmap extent type flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good to me.
Quoted 113 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_bmap.c | 14 +++++++------- fs/xfs/libxfs/xfs_bmap.h | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-)fs/xfs/libxfs/xfs_bmap.c +7
-7@@ -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;fs/xfs/libxfs/xfs_bmap.h +11
-11@@ -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 :
Signature · 1 line
chandan
Re: [PATCH 05/17] xfs: convert bmapi flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
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.
Quoted 213 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_bmap.c | 22 +++++++++++----------- fs/xfs/libxfs/xfs_bmap.h | 36 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 29 deletions(-)fs/xfs/libxfs/xfs_bmap.c +11
-11@@ -485,7 +485,7 @@ STATIC voidxfs_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) {fs/xfs/libxfs/xfs_bmap.h +18
-18@@ -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;
Signature · 1 line
chandan
Re: [PATCH 06/17] xfs: convert AGF log flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks correct.
Quoted 105 lines
Signed-off-by Dave Chinner <[email protected]>--- 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(-)fs/xfs/libxfs/xfs_alloc.c +5
-5@@ -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;fs/xfs/libxfs/xfs_alloc.h +1
-1@@ -121,7 +121,7 @@ voidxfs_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. fs/xfs/libxfs/xfs_format.h +19
-19@@ -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" }, \
Signature · 1 line
chandan
Re: [PATCH 05/17] xfs: convert bmapi flags to unsigned.
In reply to Chandan Babu RQuoted 7 lines · Chandan Babu R
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Quoted 5 lines
The fourth argument of
xfs_itruncate_extents_flags()and the return type ofxfs_bmapi_aflag()must be unsigned int.Also, the data type of
bmapi_flagsvariable inxfs_iomap_write_direct()andxfs_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.
Quoted 6 lines
The remaining changes look good to me.
Reviewed-by Chandan Babu R <[email protected]>Quoted 1 line
Signed-off-by Dave Chinner <[email protected]>
Signature · 1 line
chandan
Re: [PATCH 07/17] xfs: convert AGI log flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks correct.
Quoted 79 lines
Signed-off-by Dave Chinner <[email protected]>--- 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(-)fs/xfs/libxfs/xfs_format.h +15
-15@@ -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 */ fs/xfs/libxfs/xfs_ialloc.c +3
-3@@ -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 */ fs/xfs/libxfs/xfs_ialloc.h +1
-1@@ -60,7 +60,7 @@ voidxfs_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)
Signature · 1 line
chandan
Re: [PATCH 08/17] xfs: convert btree buffer log flags to unsigned.
In reply to Dave ChinnerQuoted 8 lines · Dave Chinner
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 auint32_tall cases now. I have no idea why we made that parameter aint64_tin the first place, but while we are fixing this up change it to auint32_tfield, too.
Looks good.
Quoted 105 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_btree.c | 10 +++++----- fs/xfs/libxfs/xfs_btree.h | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-)fs/xfs/libxfs/xfs_btree.c +5
-5@@ -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 @@ voidxfs_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 */ fs/xfs/libxfs/xfs_btree.h +13
-13@@ -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 );/*
Signature · 1 line
chandan
Re: [PATCH 16/17] xfs: convert shutdown reasons to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 73 lines
Signed-off-by Dave Chinner <[email protected]>--- 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(-)fs/xfs/xfs_fsops.c +1
-1@@ -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) {fs/xfs/xfs_log.c +1
-1@@ -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 );fs/xfs/xfs_log.h +1
-1@@ -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);fs/xfs/xfs_mount.h +5
-6@@ -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" }, \
Signature · 1 line
chandan
Re: [PATCH 10/17] xfs: convert da btree operations flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 86 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_da_btree.h | 16 ++++++++-------- fs/xfs/xfs_trace.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-)fs/xfs/libxfs/xfs_da_btree.h +8
-8@@ -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,fs/xfs/xfs_trace.h +4
-4@@ -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)
Signature · 1 line
chandan
Re: [PATCH 11/17] xfs: convert dquot flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 40 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_format.h | 8 ++++---- fs/xfs/libxfs/xfs_quota_defs.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)fs/xfs/libxfs/xfs_format.h +4
-4@@ -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 | \fs/xfs/libxfs/xfs_quota_defs.h +2
-2@@ -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" }, \
Signature · 1 line
chandan
Re: [PATCH 12/17] xfs: convert log item tracepoint flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 24 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_trans.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)fs/xfs/xfs_trans.h +4
-4@@ -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;
Signature · 1 line
chandan
Re: [PATCH 14/17] xfs: convert ptag flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 65 lines
Signed-off-by Dave Chinner <[email protected]>--- 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(-)fs/xfs/xfs_error.h +10
-10@@ -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" }, \fs/xfs/xfs_message.c +1
-1@@ -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;fs/xfs/xfs_message.h +2
-1@@ -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)
Signature · 1 line
chandan
Re: [PATCH 15/17] xfs: convert quota options flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 105 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/libxfs/xfs_quota_defs.h | 45 +++++++++++++++++++++++----------- fs/xfs/xfs_trace.h | 16 ------------ 2 files changed, 31 insertions(+), 30 deletions(-)fs/xfs/libxfs/xfs_quota_defs.h +31
-14@@ -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,fs/xfs/xfs_trace.h +0
-16@@ -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),
Signature · 1 line
chandan
Re: [PATCH 09/17] xfs: convert buffer log item flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 48 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_buf_item.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)fs/xfs/xfs_buf_item.h +11
-13@@ -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
Signature · 1 line
chandan
Re: [PATCH 13/17] xfs: convert inode lock flags to unsigned.
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 5 lines
fs/xfs/xfs_inode.h +0
-1@@ -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
fs/xfs/xfs_inode.h static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) · line 361
Quoted 10 lines
fs/xfs/xfs_inode.h +2
-1+#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?
Signature · 1 line
chandan
Re: [PATCH 13/17] xfs: convert inode lock flags to unsigned.
Quoted 24 lines · Chandan Babu R
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Signed-off-by Dave Chinner <[email protected]>---
[...]
Quoted 13 lines
fs/xfs/xfs_inode.h +2
-2@@ -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
Quoted 4 lines
fs/xfs/xfs_inode.h static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) · line 361
Quoted 2 lines
fs/xfs/xfs_inode.h +0
-0#define XFS_ILOCK_SHIFT 24#define XFS_ILOCK_PARENT_VAL 5Why isn't the value of
XFS_ILOCK_DEP_MASKmarked as unsigned?
Because I'm blind as a bat at the best of times... :)
Good catch - I'll fix it up.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 17/17] xfs: convert log ticket and iclog flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 38 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_log_priv.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)fs/xfs/xfs_log_priv.h +4
-4@@ -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 */
Signature · 1 line
chandan
PATCH v2 13/17 xfs: convert inode lock flags to unsigned.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
---
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(-)
fs/xfs/xfs_file.c +6 -6
@@ -310,7 +310,7 @@ STATIC ssize_txfs_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);
fs/xfs/xfs_inode.c +12 -9
@@ -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; } }
fs/xfs/xfs_inode.h +12 -12
@@ -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)
Re: [PATCH 13/17 v2] xfs: convert inode lock flags to unsigned.
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Signed-off-by Dave Chinner <[email protected]>---
V2:
- convert the missed ILOCK bit values and masks to unsigned.
Looks ok now
Quoted 185 lines
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(-)fs/xfs/xfs_file.c +6
-6@@ -310,7 +310,7 @@ STATIC ssize_txfs_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);fs/xfs/xfs_inode.c +0
-0@@ -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.
*/fs/xfs/xfs_inode.c +12
-9-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; } }fs/xfs/xfs_inode.h +6
-6@@ -278,12 +278,12 @@ static inline bool xfs_inode_has_bigtime(structxfs_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\fs/xfs/xfs_inode.h +6
-6| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \@@ -350,19 +350,19 @@ static inline bool xfs_inode_has_bigtime(structxfs_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)
#defineXFS_ILOCK_RTBITMAP(XFS_ILOCK_RTBITMAP_V
AL <<XFS_ILOCK_SHIFT)
#defineXFS_ILOCK_RTSUM(XFS_ILOCK_RTSUM_VAL
<<XFS_ILOCK_SHIFT)
Re: [PATCH 13/17 v2] xfs: convert inode lock flags to unsigned.
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned fields to be unsigned.
Looks good.
Quoted 179 lines
Signed-off-by Dave Chinner <[email protected]>---
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(-)fs/xfs/xfs_file.c +6
-6@@ -310,7 +310,7 @@ STATIC ssize_txfs_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);fs/xfs/xfs_inode.c +12
-9@@ -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; } }fs/xfs/xfs_inode.h +12
-12@@ -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)
Signature · 1 line
chandan