xfsprogs: libxfs sync for v7.2
cover xfsprogs: libxfs sync for v7.2
Hi all,
This is libxfs sync for v7.1..v7.2.
The conflicts for this sync were in missing FS_XFLAG_CASEFOLD and FS_XFLAG_CASENONPRESERVING flags, the replacement of xfs_inode->i_ino with I_INO() macro, and removal of xfs_imap_to_bp() in favor of xfs_read_icluster().
See Interdiff below.
Andrey Albershteyn (1):
xfs: fix null pointer dereference in tracepoint
Christoph Hellwig (14):
xfs: add a XFS_INODE_TO_AGNO helper
xfs: add a XFS_INODE_TO_AGINO helper
xfs: add a XFS_INO_TO_FSB helper
xfs: add a xfs_rmap_inode_bmbt_owner
xfs: add a xfs_rmap_inode_owner helper
xfs: remove the i_ino field in struct xfs_inode
xfs: cleanup xfs_imap
xfs: remove im_len field in struct xfs_imap
xfs: massage xfs_imap_to_bp into xfs_read_icluster
xfs: store an agbno in struct xfs_imap
xfs: mark struct xfs_imap as __packed
xfs: pass back updated nb from xfs_growfs_compute_deltas
xfs: cleanup xfs_growfs_compute_deltas
xfs: check v5 superblock features early
Chuck Lever (1):
xfs: Report case sensitivity in fileattr_get
Darrick J. Wong (1):
xfs: fix pointer arithmetic error on 32-bit systems
Dawei Feng (1):
xfs: fix memory leak in xfs_dqinode_metadir_create()
Lin Jiapeng (1):
xfs: fix exchange-range reflink flag clearing issue with INO1_WRITTEN
Xiang Mei (1):
xfs: fix off-by-one in rtrefcount btree root level validation
Yingjie Gao (1):
xfs: fix exchmaps reservation limit check
db/attrset.c | 2 +- db/bmap_inflate.c | 4 +- db/dquot.c | 2 +- db/iunlink.c | 12 ++-- db/namei.c | 14 ++-- db/rdump.c | 2 +- include/linux.h | 5 ++ include/xfs_inode.h | 7 +- libxfs/defer_item.c | 2 +- libxfs/inode.c | 10 +-- libxfs/iunlink.c | 4 +- libxfs/libxfs_api_defs.h | 2 +- libxfs/listxattr.c | 4 +- libxfs/logitem.c | 10 ++- libxfs/util.c | 2 +- libxfs/xfs_ag.c | 42 ++++++----- libxfs/xfs_ag.h | 5 +- libxfs/xfs_attr.c | 2 +- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_bmap.c | 20 +++--- libxfs/xfs_bmap_btree.c | 8 +-- libxfs/xfs_bmap_btree.h | 2 +- libxfs/xfs_btree.c | 18 +++-- libxfs/xfs_btree_staging.c | 2 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_defer.c | 2 +- libxfs/xfs_dir2.c | 44 ++++++------ libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dir2_sf.c | 4 +- libxfs/xfs_dquot_buf.c | 14 +++- libxfs/xfs_exchmaps.c | 20 ++++-- libxfs/xfs_format.h | 6 ++ libxfs/xfs_ialloc.c | 90 ++++++++++-------------- libxfs/xfs_inode_buf.c | 24 +++---- libxfs/xfs_inode_buf.h | 13 ++-- libxfs/xfs_inode_fork.c | 6 +- libxfs/xfs_inode_util.c | 15 ++-- libxfs/xfs_metadir.c | 2 +- libxfs/xfs_parent.c | 8 +-- libxfs/xfs_parent.h | 2 +- libxfs/xfs_rmap.c | 6 +- libxfs/xfs_rmap.h | 4 ++ libxfs/xfs_rtbitmap.c | 4 +- libxfs/xfs_rtrefcount_btree.c | 8 +-- libxfs/xfs_rtrmap_btree.c | 4 +- libxfs/xfs_sb.c | 6 +- libxfs/xfs_symlink_remote.c | 6 +- mkfs/proto.c | 16 ++--- repair/bmap_repair.c | 12 ++-- repair/bulkload.c | 2 +- repair/phase6.c | 128 +++++++++++++++++----------------- repair/pptr.c | 100 +++++++++++++------------- repair/quotacheck.c | 8 +-- repair/rt.c | 6 +- repair/rtrefcount_repair.c | 2 +- repair/rtrmap_repair.c | 2 +- repair/xfs_repair.c | 2 +- 57 files changed, 391 insertions(+), 362 deletions(-)
Interdiff:
db/attrset.c +1 -1
@@ -701,7 +701,7 @@ attrlist_print( .whichfork = XFS_ATTR_FORK, .op_flags = XFS_DA_OP_OKNOENT, .dp = ip, - .owner = ip->i_ino, + .owner = I_INO(ip), .trans = tp, .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .name = name,
db/bmap_inflate.c +2 -2
@@ -176,7 +176,7 @@ alloc_bmbt_blocks( target =XFS_AGB_TO_FSB (mp, tgt_agno,0 ); } -libxfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, +libxfs_rmap_ino_bmbt_owner (&args.oinfo,I_INO (ip),XFS_DATA_FORK ); error = -libxfs_alloc_vextent_start_ag (&args, target);
@@ -421,7 +421,7 @@ estimate_size( report:dbprintf (_ ("ino 0x%llx nextents %llu btblocks %llu btheight %u dirty %u\n" ), - ip->i_ino, nextents, bmap_bload.nr_blocks, +I_INO (ip), nextents, bmap_bload.nr_blocks, bmap_bload.btree_height, dirty_blocks);return 0 ;
db/dquot.c +1 -1
@@ -104,7 +104,7 @@ dqtype_to_inode(if (error) goto out_dp; - ret = ip->i_ino; + ret =I_INO (ip);libxfs_irele (ip); out_dp:if (dp)
db/iunlink.c +7 -5
@@ -22,8 +22,8 @@ count_rtblocks(if (error) {dbprintf (_ ("could not read AG %u agino %u extents, err=%d\n" ), -XFS_INO_TO_AGNO (ip->i_mount, ip->i_ino), -XFS_INO_TO_AGINO (ip->i_mount, ip->i_ino), +XFS_INO_TO_AGNO (ip->i_mount,I_INO (ip)), +XFS_INO_TO_AGINO (ip->i_mount,I_INO (ip)), error);return 0 ; }
@@ -46,6 +46,7 @@ get_next_unlinked(xfs_ino_t ino;xfs_agino_t ret;int error; +struct xfs_perag *pag =libxfs_perag_get (mp, agno); ino =XFS_AGINO_TO_INO (mp, agno, agino); error = -libxfs_iget (mp,NULL , ino,0 , &ip);
@@ -65,7 +66,8 @@ get_next_unlinked(dbprintf ("\n" ); } - error = -libxfs_imap_to_bp (mp,NULL , &ip->i_imap, &ino_bp); + error = -libxfs_read_icluster (pag,NULL , ip->i_imap.im_agbno, &ino_bp); +libxfs_perag_put (pag);if (error) {libxfs_irele (ip); goto bad;
@@ -246,8 +248,8 @@ create_unlinked(dbprintf (_ ("commit inode: %s\n" ),strerror (error));dbprintf (_ ("Created unlinked inode %llu in agno %u\n" ), - (unsigned long long )ip->i_ino, -XFS_INO_TO_AGNO (mp, ip->i_ino)); + (unsigned long long )I_INO (ip), +XFS_INO_TO_AGNO (mp,I_INO (ip)));libxfs_irele (ip);return error; out_rele:
db/namei.c +7 -7
@@ -331,7 +331,7 @@ list_sfdir(/* . and .. entries */ off =xfs_dir2_db_off_to_dataptr (geo, geo->datablk, geo->data_entry_offset); - error =dir_emit (args->trans, args->dp, off,"." ,-1 , dp->i_ino, + error =dir_emit (args->trans, args->dp, off,"." ,-1 ,I_INO (dp),XFS_DIR3_FT_DIR , private);if (error)return error;
@@ -503,7 +503,7 @@ listdir( .trans = tp, .dp = dp, .geo = dp->i_mount->m_dir_geo, - .owner = dp->i_ino, + .owner = I_INO(dp), };int error;
@@ -748,7 +748,7 @@ list_leaf_pptrs(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip),0 , &leaf_bp);if (error)return error;
@@ -846,7 +846,7 @@ list_node_pptrs(libxfs_trans_brelse (NULL , leaf_bp); - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error)return error;
@@ -1062,7 +1062,7 @@ create_child(libxfs_trans_ijoin (tp, dp,0 );libxfs_trans_ijoin (tp, ip,0 ); - error = -libxfs_dir_createname (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_createname (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;
@@ -1076,7 +1076,7 @@ create_child(/* Replace the dotdot entry in the child directory. */ if (isdir) { error = -libxfs_dir_replace (tp, ip, &xfs_name_dotdot, - dp->i_ino, resblks); +I_INO (dp), resblks);if (error) goto out_trans; }
@@ -1287,7 +1287,7 @@ remove_child(if (error) goto out_trans; - error = -libxfs_dir_removename (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_removename (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;
db/rdump.c +1 -1
@@ -376,7 +376,7 @@ rdump_xattr( .trans = tp, .dp = ip, .geo = mp->m_attr_geo, - .owner = ip->i_ino, + .owner = I_INO(ip), .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .namelen = namelen, .name = name,
include/linux.h +5 -0
@@ -268,6 +268,11 @@ struct file_attr {#define RWF_DONTCACHE ((__kernel_rwf_t)0x00000080)#endif +#ifndef FS_XFLAG_CASEFOLD +#define FS_XFLAG_CASEFOLD 0x00040000/* case-insensitive lookups */ +#define FS_XFLAG_CASENONPRESERVING 0x00080000/* case not preserved */ +#endif +/* * Reminder: anything added to this file will be compiled into downstream * userspace projects!
include/xfs_inode.h +6 -1
@@ -66,6 +66,7 @@ struct inode {mode_t i_mode;kuid_t i_uid;kgid_t i_gid; +uint64_t i_ino;uint32_t i_nlink;xfs_dev_t i_rdev;/* This actually holds xfs_dev_t */ unsigned int i_count;
@@ -218,7 +219,6 @@ static inline bool inode_wrong_type(const struct inode *inode, umode_t mode) typedef struct xfs_inode { struct cache_node i_node; struct xfs_mount *i_mount; /* fs mount struct ptr */ - xfs_ino_t i_ino; /* inode number (agno/agino) */ struct xfs_imap i_imap; /* location for xfs_imap() */ struct xfs_ifork *i_cowfp; /* copy on write extents */ struct xfs_ifork i_df; /* data fork */
@@ -445,4 +445,9 @@ extern void libxfs_irele(struct xfs_inode *ip);#define xfs_inherit_nosymlinks (false)#define xfs_inherit_nodefrag (false) +static inline xfs_ino_t I_INO (const struct xfs_inode *ip) +{ +return VFS_IC (ip)->i_ino; +} +#endif /* __XFS_INODE_H__ */
libxfs/defer_item.c +1 -1
@@ -563,7 +563,7 @@ xfs_bmap_update_diff_items(struct xfs_bmap_intent *ba =bi_entry (a);struct xfs_bmap_intent *bb =bi_entry (b); -return ba->bi_owner->i_ino - bb->bi_owner->i_ino; +return I_INO (ba->bi_owner) -I_INO (bb->bi_owner); }/* Get an BUI. */
libxfs/inode.c +6 -4
@@ -151,7 +151,7 @@ libxfs_iget(return -ENOMEM ;VFS_I (ip)->i_count =1 ; - ip->i_ino = ino; +VFS_I (ip)->i_ino = ino; ip->i_mount = mp; ip->i_diflags2 = mp->m_ino_geo.new_diflags2; ip->i_af.if_format =XFS_DINODE_FMT_EXTENTS ;
@@ -159,8 +159,8 @@ libxfs_iget( ip->i_prev_unlinked =NULLAGINO ;spin_lock_init (&VFS_I (ip)->i_lock); - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, ip->i_ino)); - error =xfs_imap (pag, tp, ip->i_ino, &ip->i_imap,0 ); + pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp,I_INO (ip))); + error =xfs_imap (pag, tp,I_INO (ip), &ip->i_imap,0 );xfs_perag_put (pag);if (error)
@@ -182,7 +182,7 @@ libxfs_iget( }else {struct xfs_buf *bp; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &bp); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp);if (error) goto out_destroy;
@@ -195,11 +195,13 @@ libxfs_iget(if (error) goto out_destroy; } +xfs_perag_put (pag); *ipp = ip;return 0 ; out_destroy: +xfs_perag_put (pag);kmem_cache_free (xfs_inode_cache, ip); *ipp =NULL ;return error;
libxfs/iunlink.c +2 -2
@@ -44,7 +44,7 @@ xfs_iunlink_log_dinode(int offset;int error; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &ibp); + error =xfs_read_icluster (iup->pag, tp, ip->i_imap.im_agbno, &ibp);if (error)return error;/*
@@ -66,7 +66,7 @@ xfs_iunlink_log_dinode( }trace_xfs_iunlink_update_dinode (mp,pag_agno (iup->pag), -XFS_INO_TO_AGINO (mp, ip->i_ino), +XFS_INO_TO_AGINO (mp,I_INO (ip)),be32_to_cpu (dip->di_next_unlinked), iup->next_agino);
libxfs/libxfs_api_defs.h +1 -1
@@ -200,7 +200,7 @@#define xfs_iext_lookup_extent libxfs_iext_lookup_extent#define xfs_iext_next libxfs_iext_next#define xfs_ifork_zap_attr libxfs_ifork_zap_attr -#define xfs_imap_to_bp libxfs_imap_to_bp +#define xfs_read_icluster libxfs_read_icluster#define xfs_initialize_perag libxfs_initialize_perag#define xfs_initialize_perag_data libxfs_initialize_perag_data
libxfs/listxattr.c +2 -2
@@ -101,7 +101,7 @@ xattr_walk_leaf(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip),0 , &leaf_bp);if (error)return error;
@@ -231,7 +231,7 @@ xattr_walk_node(if (bitmap_test (seen_blocks, leafhdr.forw,1 )) goto out_bitmap; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error) goto out_bitmap;
libxfs/logitem.c +7 -3
@@ -16,6 +16,7 @@#include "xfs_inode.h" #include "xfs_trans.h" #include "xfs_rtbitmap.h" +#include "xfs_ag.h" struct kmem_cache *xfs_buf_item_cache;struct kmem_cache *xfs_ili_cache;/* inode log item cache */
@@ -140,7 +141,7 @@ static uint64_txfs_inode_item_sort ( struct xfs_log_item *lip) { -return INODE_ITEM (lip)->ili_inode->i_ino; +return I_INO (INODE_ITEM (lip)->ili_inode); }/*
@@ -248,6 +249,7 @@ xfs_inode_item_precommit( }if (!iip->ili_item.li_buf) { +struct xfs_perag *pag;struct xfs_buf *bp;int error;
@@ -261,7 +263,9 @@ xfs_inode_item_precommit(* here. */ spin_unlock (&iip->ili_lock); - error =xfs_imap_to_bp (ip->i_mount, tp, &ip->i_imap, &bp); + pag =xfs_perag_get (ip->i_mount,XFS_INODE_TO_AGNO (ip)); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp); +xfs_perag_put (pag);if (error)return error;
@@ -316,7 +320,7 @@ xfs_inode_item_init( iip = ip->i_itemp =kmem_cache_zalloc (xfs_ili_cache,0 );#ifdef LI_DEBUG fprintf (stderr,"inode_item_init for inode %llu, iip=%p\n" , - ip->i_ino, iip); +I_INO (ip), iip);#endif spin_lock_init (&iip->ili_lock);
libxfs/util.c +1 -1
@@ -343,7 +343,7 @@ xfs_inode_verifier_error(xfs_alert (NULL ,"Metadata %s detected at %p, inode 0x%llx %s" , error == -EFSBADCRC ?"CRC error" :"corruption" , failaddr ? failaddr : __return_address, - ip->i_ino, name); +I_INO (ip), name); }/*
libxfs/xfs_log_format.h +0 -13
@@ -52,19 +52,6 @@ typedef uint32_t xlog_tid_t;#define CYCLE_LSN (lsn) ((uint)((lsn)>>32))#define BLOCK_LSN (lsn) ((uint)(lsn)) -/* -* By comparing each component, we don't have to worry about extra endian issues -* in treating two 32 bit numbers as one 64 bit number -*/ -static inline xfs_lsn_t XFS_LSN_CMP (xfs_lsn_t lsn1,xfs_lsn_t lsn2) -{ -if (CYCLE_LSN (lsn1) !=CYCLE_LSN (lsn2)) -return CYCLE_LSN (lsn1) <CYCLE_LSN (lsn2) ?-999 :999 ; -if (BLOCK_LSN (lsn1) !=BLOCK_LSN (lsn2)) -return BLOCK_LSN (lsn1) <BLOCK_LSN (lsn2) ?-999 :999 ; -return 0 ; -} -/* this is used in a spot where we might otherwise double-endian-flip */ #define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0])
mkfs/proto.c +8 -8
@@ -289,7 +289,7 @@ writesymlink(xfs_extlen_t nb =XFS_B_TO_FSB (mp, len);int error; - error = -libxfs_symlink_write_target (tp, ip, ip->i_ino, buf, len, nb, + error = -libxfs_symlink_write_target (tp, ip,I_INO (ip), buf, len, nb, nb);if (error) { fprintf(stderr,
@@ -417,7 +417,7 @@ writeattr(struct xfs_da_args args = { .dp = ip, .geo = ip->i_mount->m_attr_geo, - .owner = ip->i_ino, + .owner =I_INO (ip), .whichfork =XFS_ATTR_FORK , .op_flags =XFS_DA_OP_OKNOENT , .value = valuebuf,
@@ -548,7 +548,7 @@ newdirent( rsv =XFS_DIRENTER_SPACE_RES (mp, name->len); - error = -libxfs_dir_createname (tp, pip, name, ip->i_ino, rsv); + error = -libxfs_dir_createname (tp, pip, name,I_INO (ip), rsv);if (error)fail (_ ("directory createname error" ), error);
@@ -927,7 +927,7 @@ parseproto(fail (_ ("Inode allocation failed" ), error);if (!pip) { pip = ip; - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp); isroot =1 ; }else {
@@ -1057,10 +1057,10 @@ create_sb_metadata_file(switch (type) {case XFS_RTGI_BITMAP : - mp->m_sb.sb_rbmino = ip->i_ino; + mp->m_sb.sb_rbmino =I_INO (ip);break ;case XFS_RTGI_SUMMARY : - mp->m_sb.sb_rsumino = ip->i_ino; + mp->m_sb.sb_rsumino =I_INO (ip);break ;default : error =EFSCORRUPTED ;
@@ -1634,7 +1634,7 @@ create_nondir_inode(* hardlink, so we need to store it. */ if (file_stat->st_nlink >1 ) -track_hardlink_inode (file_stat, ip->i_ino); +track_hardlink_inode (file_stat,I_INO (ip));libxfs_irele (ip); }
@@ -1880,7 +1880,7 @@ populate_from_dir(if (error)fail (_ ("Inode allocation failed" ), error); - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp);newdirectory (mp, tp, ip, ip);libxfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );
repair/bmap_repair.c +8 -4
@@ -134,7 +134,7 @@ xrep_bmap_walk_rmap(int error;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_fork_rmap (rb, cur, rec);
@@ -252,7 +252,7 @@ xrep_bmap_walk_rtrmap(int error =0 ;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_rtfork_rmap (rb->sc, cur, rec);
@@ -576,7 +576,7 @@ xrep_bmap_build_new_fork(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino, rb->whichfork); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip), rb->whichfork);bulkload_init_inode (&rb->new_fork_info, sc, rb->whichfork, &oinfo); bmap_cur =libxfs_bmbt_init_cursor (sc->mp,NULL , sc->ip,XFS_STAGING_FORK );
@@ -745,6 +745,7 @@ rebuild_bmap(xfs_daddr_t bp_bn;int bp_length;int error, err2; +struct xfs_perag *pag; bp_bn =xfs_buf_daddr (*ino_bpp); bp_length = (*ino_bpp)->b_length;
@@ -821,7 +822,10 @@ rebuild_bmap(* Rebuilding the inode fork rolled the transaction, so we need to * re-grab the inode cluster buffer and dinode pointer for the caller. */ - err2 = -libxfs_imap_to_bp (mp,NULL , &sc.ip->i_imap, ino_bpp); + pag =libxfs_perag_get (sc.ip->i_mount,XFS_INODE_TO_AGNO (sc.ip)); + err2 = -libxfs_read_icluster (pag,NULL , sc.ip->i_imap.im_agbno, + ino_bpp); +libxfs_perag_put (pag);if (err2) do_error( _("Unable to re-grab inode cluster buffer after failed repair of inode %llu, error %d.\n"),
repair/bulkload.c +1 -1
@@ -32,7 +32,7 @@ bulkload_init_inode(int whichfork, const struct xfs_owner_info *oinfo) { - bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, sc->ip->i_ino)); + bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, I_INO(sc->ip))); bkl->ifake.if_fork =kmem_cache_zalloc (xfs_ifork_cache,0 ); bkl->ifake.if_fork_size =xfs_inode_fork_size (sc->ip, whichfork); }
repair/phase6.c +64 -64
445 lines not on this page · raw message
repair/pptr.c +50 -50
384 lines not on this page · raw message
repair/quotacheck.c +4 -4
@@ -169,7 +169,7 @@ qc_count_rtblocks(if (error) {do_warn (_ ("could not read ino %" PRIu64" extents, err=%d\n" ), - ip->i_ino, error); +I_INO (ip), error); chkd_flags =0 ;return 0 ; }
@@ -375,7 +375,7 @@ qc_walk_dquot_extent(if (error) {do_warn (_ ("cannot read %s inode %" PRIu64", block %" PRIu64", disk block %" PRIu64", err=%d\n" ), -qflags_typestr (dquots->type), ip->i_ino, +qflags_typestr (dquots->type),I_INO (ip), map->br_startoff + bno, map->br_startblock + bno, error); chkd_flags =0 ;
@@ -454,7 +454,7 @@ quotacheck_verify(if (error) {do_warn (_ ("could not read %s inode %" PRIu64" extents, err=%d\n" ), -qflags_typestr (type), ip->i_ino, error); +qflags_typestr (type),I_INO (ip), error); chkd_flags =0 ; goto err; }
@@ -659,7 +659,7 @@ mark_quota_inode(if (error) goto out_corrupt; -set_quota_inode (type, ip->i_ino); +set_quota_inode (type,I_INO (ip));libxfs_irele (ip);return 0 ;
repair/rt.c +3 -3
@@ -268,7 +268,7 @@ check_rtfile_contents(if (xfs_has_rtgroups (mp)) {struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; -if (hdr->rt_owner !=cpu_to_be64 (ip->i_ino)) { +if (hdr->rt_owner !=cpu_to_be64 (I_INO (ip))) {do_warn (_ ("corrupt owner in %s at dblock 0x%llx\n" ), filename, (unsigned long long )bno);
@@ -461,12 +461,12 @@ mark_rtginode( goto out_corrupt;if (xfs_has_rtgroups (rtg_mount (rtg))) { -if (bitmap_test (rtg_inodes[type], ip->i_ino,1 )) { +if (bitmap_test (rtg_inodes[type],I_INO (ip),1 )) { error =EFSCORRUPTED ; goto out_corrupt; } - error =bitmap_set (rtg_inodes[type], ip->i_ino,1 ); + error =bitmap_set (rtg_inodes[type],I_INO (ip),1 );if (error) goto out_corrupt; }
repair/rtrefcount_repair.c +1 -1
@@ -173,7 +173,7 @@ xrep_rtrefc_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrefcountbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);
repair/rtrmap_repair.c +1 -1
@@ -211,7 +211,7 @@ xrep_rtrmap_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrmapbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);
repair/xfs_repair.c +1 -1
@@ -670,7 +670,7 @@ check_metadir_inode(/* If we changed the metadir inode, try reloading it. */ if (!mp->m_metadirip || - mp->m_metadirip->i_ino != mp->m_sb.sb_metadirino) { +I_INO (mp->m_metadirip) != mp->m_sb.sb_metadirino) {if (mp->m_metadirip)libxfs_irele (mp->m_metadirip);
Signature · 1 line
2.55.0
PATCH 1/21 xfs: Report case sensitivity in fileattr_get
From: Chuck Lever <[email protected]>
Source kernel commit: c9da43e4e5c32c2cb318e616ffa48c7148a70d49
Upper layers such as NFSD need to query whether a filesystem is case-sensitive. Add FS_XFLAG_CASEFOLD to xfs_ip2xflags() when the filesystem is formatted with the ASCIICI feature flag. This serves both FS_IOC_FSGETXATTR (via xfs_fill_fsxattr() in xfs_fileattr_get()) and XFS_IOC_BULKSTAT (which populates bs_xflags directly from xfs_ip2xflags()), so bulkstat consumers and per-inode queries see a consistent view of the filesystem's case-folding behavior.
FS_XFLAG_CASEFOLD is read-only: FS_XFLAG_RDONLY_MASK ensures FS_IOC_FSSETXATTR strips it, and xfs_flags2diflags() has no clause for CASEFOLD so the on-disk diflags are unaffected. The legacy FS_IOC_SETFLAGS path in xfs_fileattr_set() also allows FS_CASEFOLD_FL through its allowlist on ASCIICI filesystems so that a chattr read-modify-write cycle does not fail with EOPNOTSUPP.
XFS always preserves case. XFS is case-sensitive by default, but supports ASCII case-insensitive lookups when formatted with the ASCIICI feature flag.
--- include/linux.h | 5 +++++ libxfs/xfs_inode_util.c | 2 ++ 2 files changed, 7 insertions(+)
include/linux.h +5 -0
@@ -268,6 +268,11 @@ struct file_attr {#define RWF_DONTCACHE ((__kernel_rwf_t)0x00000080)#endif +#ifndef FS_XFLAG_CASEFOLD +#define FS_XFLAG_CASEFOLD 0x00040000/* case-insensitive lookups */ +#define FS_XFLAG_CASENONPRESERVING 0x00080000/* case not preserved */ +#endif +/* * Reminder: anything added to this file will be compiled into downstream * userspace projects!
libxfs/xfs_inode_util.c +2 -0
@@ -127,6 +127,8 @@ xfs_ip2xflags(if (xfs_inode_has_attr_fork (ip)) flags |=FS_XFLAG_HASATTR ; +if (xfs_has_asciici (ip->i_mount)) + flags |=FS_XFLAG_CASEFOLD ;return flags; }
Signature · 1 line
2.55.0
PATCH 2/21 xfs: fix exchmaps reservation limit check
In reply to Andrey AlbershteynFrom: Yingjie Gao <[email protected]>
Source kernel commit: 0a5213bbff62b51c7d4999ac8c7e11ea57d00d45
xfs_exchmaps_estimate_overhead() adds the bmbt and rmapbt overhead to a local resblks variable, but the final UINT_MAX check still tests req->resblks. That is the reservation value from before the overhead was added.
The computed value is stored back in req->resblks and later passed to xfs_trans_alloc(), whose block reservation argument is unsigned int. Check the computed reservation so the existing limit applies to the value that will be used.
--- libxfs/xfs_exchmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/xfs_exchmaps.c +1 -1
@@ -708,7 +708,7 @@ xfs_exchmaps_estimate_overhead(return -ENOSPC ;/* Can't actually reserve more than UINT_MAX blocks. */ -if (req->resblks >UINT_MAX ) +if (resblks >UINT_MAX )return -ENOSPC ; req->resblks = resblks;
Signature · 1 line
2.55.0
PATCH 3/21 xfs: add a XFS_INODE_TO_AGNO helper
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: a22166add624818a6c43b807d37f99483ba268a6
Add a shortcut for the common XFS_INO_TO_AGNO(mp, ip->i_ino) pattern.
--- libxfs/xfs_dir2.c | 4 ++-- libxfs/xfs_format.h | 2 ++ libxfs/xfs_ialloc.c | 2 +- libxfs/xfs_inode_util.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)
libxfs/xfs_dir2.c +2 -2
@@ -918,7 +918,7 @@ xfs_dir_add_child(if (VFS_I (ip)->i_nlink ==0 ) {struct xfs_perag *pag; - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, ip->i_ino)); + pag =xfs_perag_get (mp,XFS_INODE_TO_AGNO (ip)); error =xfs_iunlink_remove (tp, pag, ip);xfs_perag_put (pag);if (error)
@@ -1245,7 +1245,7 @@ xfs_dir_rename_children(ASSERT (VFS_I (du_wip->ip)->i_nlink ==0 ); - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, du_wip->ip->i_ino)); + pag =xfs_perag_get (mp,XFS_INODE_TO_AGNO (du_wip->ip)); error =xfs_iunlink_remove (tp, pag, du_wip->ip);xfs_perag_put (pag);if (error)
libxfs/xfs_format.h +2 -0
@@ -1276,6 +1276,8 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip) XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)#define XFS_INO_TO_AGNO (mp,i) \ ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp))) +#define XFS_INODE_TO_AGNO (ip) \ + XFS_INO_TO_AGNO((ip)->i_mount, (ip)->i_ino)#define XFS_INO_TO_AGINO (mp,i) \ ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))#define XFS_INO_TO_AGBNO (mp,i) \
libxfs/xfs_ialloc.c +1 -1
@@ -1865,7 +1865,7 @@ xfs_dialloc_pick_ag(if (S_ISDIR (mode))return (atomic_inc_return (&mp->m_agirotor) -1 ) % mp->m_maxagi; - start_agno =XFS_INO_TO_AGNO (mp, dp->i_ino); + start_agno =XFS_INODE_TO_AGNO (dp);if (start_agno >= mp->m_maxagi) start_agno =0 ;
libxfs/xfs_inode_util.c +1 -1
@@ -528,7 +528,7 @@ xfs_iunlink(ASSERT (VFS_I (ip)->i_mode !=0 );trace_xfs_iunlink (ip); - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, ip->i_ino)); + pag =xfs_perag_get (mp,XFS_INODE_TO_AGNO (ip));/* Get the agi buffer first. It ensures lock ordering on the list. */ error =xfs_read_agi (pag, tp,0 , &agibp);
Signature · 1 line
2.55.0
PATCH 4/21 xfs: add a XFS_INODE_TO_AGINO helper
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: f46edc9f1310d27710e2b39bf561ecef51f879d2
Add a shortcut for the common XFS_INO_TO_AGINO(mp, ip->i_ino) pattern.
--- libxfs/xfs_format.h | 2 ++ libxfs/xfs_inode_util.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-)
libxfs/xfs_format.h +2 -0
@@ -1280,6 +1280,8 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip) XFS_INO_TO_AGNO((ip)->i_mount, (ip)->i_ino)#define XFS_INO_TO_AGINO (mp,i) \ ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp))) +#define XFS_INODE_TO_AGINO (ip) \ + XFS_INO_TO_AGINO((ip)->i_mount, (ip)->i_ino)#define XFS_INO_TO_AGBNO (mp,i) \ (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
libxfs/xfs_inode_util.c +2 -3
@@ -461,10 +461,9 @@ xfs_iunlink_insert_inode(struct xfs_buf *agibp, struct xfs_inode *ip) { - struct xfs_mount *mp = tp->t_mountp; struct xfs_agi *agi = agibp->b_addr;xfs_agino_t next_agino; -xfs_agino_t agino =XFS_INO_TO_AGINO (mp, ip->i_ino); +xfs_agino_t agino =XFS_INODE_TO_AGINO (ip);short bucket_index = agino %XFS_AGI_UNLINKED_BUCKETS ;int error;
@@ -550,7 +549,7 @@ xfs_iunlink_remove_inode( {struct xfs_mount *mp = tp->t_mountp;struct xfs_agi *agi = agibp->b_addr; -xfs_agino_t agino =XFS_INO_TO_AGINO (mp, ip->i_ino); +xfs_agino_t agino =XFS_INODE_TO_AGINO (ip);xfs_agino_t head_agino;short bucket_index = agino %XFS_AGI_UNLINKED_BUCKETS ;int error;
Signature · 1 line
2.55.0
PATCH 5/21 xfs: add a XFS_INO_TO_FSB helper
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: f8b7c9a8b0a9e43b054981d134b426d9464264f6
Add a shortcut for the common XFS_INO_TO_FSB(mp, ip->i_ino) pattern.
--- libxfs/xfs_bmap.c | 8 +++----- libxfs/xfs_btree.c | 6 ++---- libxfs/xfs_format.h | 2 ++ 3 files changed, 7 insertions(+), 9 deletions(-)
libxfs/xfs_bmap.c +3 -5
@@ -675,8 +675,7 @@ xfs_bmap_extents_to_btree( args.minlen = args.maxlen = args.prod =1 ; args.wasdel = wasdel; *logflagsp =0 ; - error =xfs_alloc_vextent_start_ag (&args, -XFS_INO_TO_FSB (mp, ip->i_ino)); + error =xfs_alloc_vextent_start_ag (&args,XFS_INODE_TO_FSB (ip));if (error) goto out_root_realloc;
@@ -822,8 +821,7 @@ xfs_bmap_local_to_extents(*/ args.total = total; args.minlen = args.maxlen = args.prod =1 ; - error =xfs_alloc_vextent_start_ag (&args, -XFS_INO_TO_FSB (args.mp, ip->i_ino)); + error =xfs_alloc_vextent_start_ag (&args,XFS_INODE_TO_FSB (ip));if (error) goto done;
@@ -3584,7 +3582,7 @@ xfs_bmap_btalloc_best_length(xfs_extlen_t blen =0 ;int error; - ap->blkno =XFS_INO_TO_FSB (args->mp, ap->ip->i_ino); + ap->blkno =XFS_INODE_TO_FSB (ap->ip);if (!xfs_bmap_adjacent (ap)) ap->eof = false;
libxfs/xfs_btree.c +2 -4
@@ -3240,8 +3240,7 @@ xfs_btree_new_iroot(if (level >0 ) aptr = *xfs_btree_ptr_addr (cur,1 , block);else - aptr.l =cpu_to_be64 (XFS_INO_TO_FSB (cur->bc_mp, - cur->bc_ino.ip->i_ino)); + aptr.l =cpu_to_be64 (XFS_INODE_TO_FSB (cur->bc_ino.ip));/* Allocate the new block. If we can't do it, we're toast. Give up. */ error =xfs_btree_alloc_block (cur, &aptr, &nptr, stat);
@@ -5606,8 +5605,7 @@ xfs_btree_alloc_metafile_block(ASSERT (xfs_is_metadir_inode (ip));xfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, cur->bc_ino.whichfork); - error =xfs_alloc_vextent_start_ag (&args, -XFS_INO_TO_FSB (cur->bc_mp, ip->i_ino)); + error =xfs_alloc_vextent_start_ag (&args,XFS_INODE_TO_FSB (ip));if (error)return error;if (args.fsbno ==NULLFSBLOCK ) {
libxfs/xfs_format.h +2 -0
@@ -1289,6 +1289,8 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip) ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))#define XFS_INO_TO_FSB (mp,i) \ XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i)) +#define XFS_INODE_TO_FSB (ip) \ + XFS_INO_TO_FSB((ip)->i_mount, (ip)->i_ino)#define XFS_AGINO_TO_INO (mp,a,i) \ (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))#define XFS_AGINO_TO_AGBNO (mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
Signature · 1 line
2.55.0
PATCH 6/21 xfs: add a xfs_rmap_inode_bmbt_owner
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: ee237a900ceef00c8d1ca17a5cfadbd50fba67e9
Add a small wrapper for initializing the bmbt owner to i_ino.
--- libxfs/xfs_bmap.c | 4 ++-- libxfs/xfs_bmap_btree.c | 4 ++-- libxfs/xfs_btree.c | 4 ++-- libxfs/xfs_rmap.h | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-)
libxfs/xfs_bmap.c +2 -2
@@ -596,7 +596,7 @@ xfs_bmap_btree_to_extents(if ((error =xfs_btree_check_block (cur, cblock,0 , cbp)))return error; -xfs_rmap_ino_bmbt_owner (&oinfo, ip->i_ino, whichfork); +xfs_rmap_inode_bmbt_owner (&oinfo, ip, whichfork); error =xfs_free_extent_later (cur->bc_tp, cbno,1 , &oinfo,XFS_AG_RESV_NONE ,0 );if (error)
@@ -670,7 +670,7 @@ xfs_bmap_extents_to_btree(memset (&args,0 ,sizeof (args)); args.tp = tp; args.mp = mp; -xfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, whichfork); +xfs_rmap_inode_bmbt_owner (&args.oinfo, ip, whichfork); args.minlen = args.maxlen = args.prod =1 ; args.wasdel = wasdel;
libxfs/xfs_bmap_btree.c +2 -2
@@ -216,7 +216,7 @@ xfs_bmbt_alloc_block(memset (&args,0 ,sizeof (args)); args.tp = cur->bc_tp; args.mp = cur->bc_mp; -xfs_rmap_ino_bmbt_owner (&args.oinfo, cur->bc_ino.ip->i_ino, +xfs_rmap_inode_bmbt_owner (&args.oinfo, cur->bc_ino.ip, cur->bc_ino.whichfork); args.minlen = args.maxlen = args.prod =1 ; args.wasdel = cur->bc_flags &XFS_BTREE_BMBT_WASDEL ;
@@ -279,7 +279,7 @@ xfs_bmbt_free_block(struct xfs_owner_info oinfo;int error; -xfs_rmap_ino_bmbt_owner (&oinfo, ip->i_ino, cur->bc_ino.whichfork); +xfs_rmap_inode_bmbt_owner (&oinfo, ip, cur->bc_ino.whichfork); error =xfs_free_extent_later (cur->bc_tp, fsbno,1 , &oinfo,XFS_AG_RESV_NONE ,0 );if (error)
libxfs/xfs_btree.c +2 -2
@@ -5604,7 +5604,7 @@ xfs_btree_alloc_metafile_block(ASSERT (xfs_is_metadir_inode (ip)); -xfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, cur->bc_ino.whichfork); +xfs_rmap_inode_bmbt_owner (&args.oinfo, ip, cur->bc_ino.whichfork); error =xfs_alloc_vextent_start_ag (&args,XFS_INODE_TO_FSB (ip));if (error)return error;
@@ -5636,7 +5636,7 @@ xfs_btree_free_metafile_block(ASSERT (xfs_is_metadir_inode (ip)); -xfs_rmap_ino_bmbt_owner (&oinfo, ip->i_ino, cur->bc_ino.whichfork); +xfs_rmap_inode_bmbt_owner (&oinfo, ip, cur->bc_ino.whichfork); error =xfs_free_extent_later (tp, fsbno,1 , &oinfo,XFS_AG_RESV_METAFILE ,0 );if (error)
libxfs/xfs_rmap.h +2 -0
@@ -21,6 +21,8 @@ xfs_rmap_ino_bmbt_owner(if (whichfork ==XFS_ATTR_FORK ) oi->oi_flags |=XFS_OWNER_INFO_ATTR_FORK ; } +#define xfs_rmap_inode_bmbt_owner (oi, ip, whichfork) \ + xfs_rmap_ino_bmbt_owner(oi, (ip)->i_ino, whichfork)static inline void xfs_rmap_ino_owner(
Signature · 1 line
2.55.0
PATCH 7/21 xfs: add a xfs_rmap_inode_owner helper
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: f882fc7dd9f04f73d94379deb9e68d8db613c976
Add a small wrapper for initializing the rmap owner to i_ino.
--- libxfs/xfs_bmap.c | 2 +- libxfs/xfs_rmap.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
libxfs/xfs_bmap.c +1 -1
@@ -813,7 +813,7 @@ xfs_bmap_local_to_extents( args.mp = ip->i_mount; args.total = total; args.minlen = args.maxlen = args.prod =1 ; -xfs_rmap_ino_owner (&args.oinfo, ip->i_ino, whichfork,0 ); +xfs_rmap_inode_owner (&args.oinfo, ip, whichfork,0 );/* * Allocate a block. We know we need only one, since the
libxfs/xfs_rmap.h +2 -0
@@ -37,6 +37,8 @@ xfs_rmap_ino_owner(if (whichfork ==XFS_ATTR_FORK ) oi->oi_flags |=XFS_OWNER_INFO_ATTR_FORK ; } +#define xfs_rmap_inode_owner (oi, ip, whichfork, offset) \ + xfs_rmap_ino_owner(oi, (ip)->i_ino, whichfork, offset)static inline bool xfs_rmap_should_skip_owner_update(
Signature · 1 line
2.55.0
PATCH 8/21 xfs: remove the i_ino field in struct xfs_inode
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 1113a6d6d5d1336f4415fa1367aac0f853f0892d
Now that the VFS inode has a u64 i_ino field, there is no need to store a copy of the inode number in the xfs_inode structure.
Introduce an I_INO() wrapper as a shortcut to the inode number so that we don't have to propagate the VFS inode everywhere.
The only non-obvious part is the clearing of i_ino to 0 for RCU freeing the inode. None of this calls into VFS paths, which makes clearing the VFS inode field here just as safe as clearing the old field in the xfs_inode.
--- db/attrset.c | 2 +- db/bmap_inflate.c | 4 +- db/dquot.c | 2 +- db/iunlink.c | 8 +-- db/namei.c | 14 ++-- db/rdump.c | 2 +- include/xfs_inode.h | 7 +- libxfs/defer_item.c | 2 +- libxfs/inode.c | 6 +- libxfs/iunlink.c | 2 +- libxfs/listxattr.c | 4 +- libxfs/logitem.c | 4 +- libxfs/util.c | 2 +- libxfs/xfs_attr.c | 2 +- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_bmap.c | 6 +- libxfs/xfs_bmap_btree.c | 4 +- libxfs/xfs_btree.c | 8 +-- libxfs/xfs_btree_staging.c | 2 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_dir2.c | 40 +++++------ libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dir2_sf.c | 4 +- libxfs/xfs_exchmaps.c | 8 +-- libxfs/xfs_format.h | 6 +- libxfs/xfs_ialloc.c | 2 +- libxfs/xfs_inode_buf.c | 4 +- libxfs/xfs_inode_fork.c | 6 +- libxfs/xfs_inode_util.c | 6 +- libxfs/xfs_metadir.c | 2 +- libxfs/xfs_parent.c | 8 +-- libxfs/xfs_parent.h | 2 +- libxfs/xfs_rmap.c | 6 +- libxfs/xfs_rmap.h | 4 +- libxfs/xfs_rtbitmap.c | 4 +- libxfs/xfs_rtrefcount_btree.c | 4 +- libxfs/xfs_rtrmap_btree.c | 4 +- libxfs/xfs_symlink_remote.c | 6 +- mkfs/proto.c | 16 ++--- repair/bmap_repair.c | 6 +- repair/bulkload.c | 2 +- repair/phase6.c | 128 +++++++++++++++++----------------- repair/pptr.c | 100 +++++++++++++------------- repair/quotacheck.c | 8 +-- repair/rt.c | 6 +- repair/rtrefcount_repair.c | 2 +- repair/rtrmap_repair.c | 2 +- repair/xfs_repair.c | 2 +- 48 files changed, 240 insertions(+), 235 deletions(-)
db/attrset.c +1 -1
@@ -701,7 +701,7 @@ attrlist_print( .whichfork = XFS_ATTR_FORK, .op_flags = XFS_DA_OP_OKNOENT, .dp = ip, - .owner = ip->i_ino, + .owner = I_INO(ip), .trans = tp, .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .name = name,
db/bmap_inflate.c +2 -2
@@ -176,7 +176,7 @@ alloc_bmbt_blocks( target =XFS_AGB_TO_FSB (mp, tgt_agno,0 ); } -libxfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, +libxfs_rmap_ino_bmbt_owner (&args.oinfo,I_INO (ip),XFS_DATA_FORK ); error = -libxfs_alloc_vextent_start_ag (&args, target);
@@ -421,7 +421,7 @@ estimate_size( report:dbprintf (_ ("ino 0x%llx nextents %llu btblocks %llu btheight %u dirty %u\n" ), - ip->i_ino, nextents, bmap_bload.nr_blocks, +I_INO (ip), nextents, bmap_bload.nr_blocks, bmap_bload.btree_height, dirty_blocks);return 0 ;
db/dquot.c +1 -1
@@ -104,7 +104,7 @@ dqtype_to_inode(if (error) goto out_dp; - ret = ip->i_ino; + ret =I_INO (ip);libxfs_irele (ip); out_dp:if (dp)
db/iunlink.c +4 -4
@@ -22,8 +22,8 @@ count_rtblocks(if (error) {dbprintf (_ ("could not read AG %u agino %u extents, err=%d\n" ), -XFS_INO_TO_AGNO (ip->i_mount, ip->i_ino), -XFS_INO_TO_AGINO (ip->i_mount, ip->i_ino), +XFS_INO_TO_AGNO (ip->i_mount,I_INO (ip)), +XFS_INO_TO_AGINO (ip->i_mount,I_INO (ip)), error);return 0 ; }
@@ -246,8 +246,8 @@ create_unlinked(dbprintf (_ ("commit inode: %s\n" ),strerror (error));dbprintf (_ ("Created unlinked inode %llu in agno %u\n" ), - (unsigned long long )ip->i_ino, -XFS_INO_TO_AGNO (mp, ip->i_ino)); + (unsigned long long )I_INO (ip), +XFS_INO_TO_AGNO (mp,I_INO (ip)));libxfs_irele (ip);return error; out_rele:
db/namei.c +7 -7
@@ -331,7 +331,7 @@ list_sfdir(/* . and .. entries */ off =xfs_dir2_db_off_to_dataptr (geo, geo->datablk, geo->data_entry_offset); - error =dir_emit (args->trans, args->dp, off,"." ,-1 , dp->i_ino, + error =dir_emit (args->trans, args->dp, off,"." ,-1 ,I_INO (dp),XFS_DIR3_FT_DIR , private);if (error)return error;
@@ -503,7 +503,7 @@ listdir( .trans = tp, .dp = dp, .geo = dp->i_mount->m_dir_geo, - .owner = dp->i_ino, + .owner = I_INO(dp), };int error;
@@ -748,7 +748,7 @@ list_leaf_pptrs(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip),0 , &leaf_bp);if (error)return error;
@@ -846,7 +846,7 @@ list_node_pptrs(libxfs_trans_brelse (NULL , leaf_bp); - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error)return error;
@@ -1062,7 +1062,7 @@ create_child(libxfs_trans_ijoin (tp, dp,0 );libxfs_trans_ijoin (tp, ip,0 ); - error = -libxfs_dir_createname (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_createname (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;
@@ -1076,7 +1076,7 @@ create_child(/* Replace the dotdot entry in the child directory. */ if (isdir) { error = -libxfs_dir_replace (tp, ip, &xfs_name_dotdot, - dp->i_ino, resblks); +I_INO (dp), resblks);if (error) goto out_trans; }
@@ -1287,7 +1287,7 @@ remove_child(if (error) goto out_trans; - error = -libxfs_dir_removename (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_removename (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;
db/rdump.c +1 -1
@@ -376,7 +376,7 @@ rdump_xattr( .trans = tp, .dp = ip, .geo = mp->m_attr_geo, - .owner = ip->i_ino, + .owner = I_INO(ip), .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .namelen = namelen, .name = name,
include/xfs_inode.h +6 -1
@@ -66,6 +66,7 @@ struct inode {mode_t i_mode;kuid_t i_uid;kgid_t i_gid; +uint64_t i_ino;uint32_t i_nlink;xfs_dev_t i_rdev;/* This actually holds xfs_dev_t */ unsigned int i_count;
@@ -218,7 +219,6 @@ static inline bool inode_wrong_type(const struct inode *inode, umode_t mode) typedef struct xfs_inode { struct cache_node i_node; struct xfs_mount *i_mount; /* fs mount struct ptr */ - xfs_ino_t i_ino; /* inode number (agno/agino) */ struct xfs_imap i_imap; /* location for xfs_imap() */ struct xfs_ifork *i_cowfp; /* copy on write extents */ struct xfs_ifork i_df; /* data fork */
@@ -445,4 +445,9 @@ extern void libxfs_irele(struct xfs_inode *ip);#define xfs_inherit_nosymlinks (false)#define xfs_inherit_nodefrag (false) +static inline xfs_ino_t I_INO (const struct xfs_inode *ip) +{ +return VFS_IC (ip)->i_ino; +} +#endif /* __XFS_INODE_H__ */
libxfs/defer_item.c +1 -1
@@ -563,7 +563,7 @@ xfs_bmap_update_diff_items(struct xfs_bmap_intent *ba =bi_entry (a);struct xfs_bmap_intent *bb =bi_entry (b); -return ba->bi_owner->i_ino - bb->bi_owner->i_ino; +return I_INO (ba->bi_owner) -I_INO (bb->bi_owner); }/* Get an BUI. */
libxfs/inode.c +3 -3
@@ -151,7 +151,7 @@ libxfs_iget(return -ENOMEM ;VFS_I (ip)->i_count =1 ; - ip->i_ino = ino; +VFS_I (ip)->i_ino = ino; ip->i_mount = mp; ip->i_diflags2 = mp->m_ino_geo.new_diflags2; ip->i_af.if_format =XFS_DINODE_FMT_EXTENTS ;
@@ -159,8 +159,8 @@ libxfs_iget( ip->i_prev_unlinked =NULLAGINO ;spin_lock_init (&VFS_I (ip)->i_lock); - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, ip->i_ino)); - error =xfs_imap (pag, tp, ip->i_ino, &ip->i_imap,0 ); + pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp,I_INO (ip))); + error =xfs_imap (pag, tp,I_INO (ip), &ip->i_imap,0 );xfs_perag_put (pag);if (error)
libxfs/iunlink.c +1 -1
@@ -66,7 +66,7 @@ xfs_iunlink_log_dinode( }trace_xfs_iunlink_update_dinode (mp,pag_agno (iup->pag), -XFS_INO_TO_AGINO (mp, ip->i_ino), +XFS_INO_TO_AGINO (mp,I_INO (ip)),be32_to_cpu (dip->di_next_unlinked), iup->next_agino);
libxfs/listxattr.c +2 -2
@@ -101,7 +101,7 @@ xattr_walk_leaf(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip),0 , &leaf_bp);if (error)return error;
@@ -231,7 +231,7 @@ xattr_walk_node(if (bitmap_test (seen_blocks, leafhdr.forw,1 )) goto out_bitmap; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error) goto out_bitmap;
libxfs/logitem.c +2 -2
@@ -140,7 +140,7 @@ static uint64_txfs_inode_item_sort ( struct xfs_log_item *lip) { -return INODE_ITEM (lip)->ili_inode->i_ino; +return I_INO (INODE_ITEM (lip)->ili_inode); }/*
@@ -316,7 +316,7 @@ xfs_inode_item_init( iip = ip->i_itemp =kmem_cache_zalloc (xfs_ili_cache,0 );#ifdef LI_DEBUG fprintf (stderr,"inode_item_init for inode %llu, iip=%p\n" , - ip->i_ino, iip); +I_INO (ip), iip);#endif spin_lock_init (&iip->ili_lock);
libxfs/util.c +1 -1
@@ -343,7 +343,7 @@ xfs_inode_verifier_error(xfs_alert (NULL ,"Metadata %s detected at %p, inode 0x%llx %s" , error == -EFSBADCRC ?"CRC error" :"corruption" , failaddr ? failaddr : __return_address, - ip->i_ino, name); +I_INO (ip), name); }/*
libxfs/xfs_attr.c +1 -1
@@ -275,7 +275,7 @@ xfs_attr_get(return -EIO ;if (!args->owner) - args->owner = args->dp->i_ino; + args->owner =I_INO (args->dp); args->geo = args->dp->i_mount->m_attr_geo; args->whichfork =XFS_ATTR_FORK ;xfs_attr_sethash (args);
libxfs/xfs_attr_leaf.c +1 -1
@@ -1426,7 +1426,7 @@ xfs_attr3_leaf_init(struct xfs_da_args args = { .trans = tp, .dp = dp, - .owner = dp->i_ino, + .owner =I_INO (dp), .geo = dp->i_mount->m_attr_geo, };
libxfs/xfs_bmap.c +3 -3
@@ -968,7 +968,7 @@ xfs_bmap_add_attrfork_local( dargs.total = dargs.geo->fsbcount; dargs.whichfork =XFS_DATA_FORK ; dargs.trans = tp; - dargs.owner = ip->i_ino; + dargs.owner =I_INO (ip);return xfs_dir2_sf_to_block (&dargs); }
@@ -1102,7 +1102,7 @@ xfs_bmap_complain_bad_rec(xfs_warn (mp,"Bmap BTree record corruption in inode 0x%llx %s fork detected at %pS!" , - ip->i_ino, forkname, fa); +I_INO (ip), forkname, fa); xfs_warn(mp, "Offset 0x%llx, start block 0x%llx, block count 0x%llx state 0x%x", irec->br_startoff, irec->br_startblock, irec->br_blockcount,
@@ -1135,7 +1135,7 @@ xfs_iread_bmbt_block( num_recs =xfs_btree_get_numrecs (block);if (unlikely (ir->loaded + num_recs > ifp->if_nextents)) {xfs_warn (ip->i_mount,"corrupt dinode %llu, (btree extents)." , - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip));xfs_inode_verifier_error (ip, -EFSCORRUPTED , __func__, block,sizeof (*block), __this_address);xfs_bmap_mark_sick (ip, whichfork);
libxfs/xfs_bmap_btree.c +2 -2
@@ -35,10 +35,10 @@ xfs_bmbt_init_block( {if (bp)xfs_btree_init_buf (ip->i_mount, bp, &xfs_bmbt_ops, level, - numrecs, ip->i_ino); + numrecs,I_INO (ip));else xfs_btree_init_block (ip->i_mount, buf, &xfs_bmbt_ops, level, - numrecs, ip->i_ino); + numrecs,I_INO (ip)); }/*
libxfs/xfs_btree.c +4 -4
@@ -368,7 +368,7 @@ xfs_btree_check_ptr(case XFS_BTREE_TYPE_INODE :xfs_err (cur->bc_mp,"Inode %llu fork %d: Corrupt %sbt pointer at level %d index %d." , - cur->bc_ino.ip->i_ino, +I_INO (cur->bc_ino.ip), cur->bc_ino.whichfork, cur->bc_ops->name, level, index);break ;
@@ -1302,7 +1302,7 @@ xfs_btree_owner(case XFS_BTREE_TYPE_MEM :return cur->bc_mem.xfbtree->owner;case XFS_BTREE_TYPE_INODE : -return cur->bc_ino.ip->i_ino; +return I_INO (cur->bc_ino.ip);case XFS_BTREE_TYPE_AG :return cur->bc_group->xg_gno;default :
@@ -3126,7 +3126,7 @@ xfs_btree_promote_leaf_iroot(*/ broot = cur->bc_ops->broot_realloc (cur,1 );xfs_btree_init_block (cur->bc_mp, broot, cur->bc_ops, - cur->bc_nlevels -1 ,1 , cur->bc_ino.ip->i_ino); + cur->bc_nlevels -1 ,1 ,I_INO (cur->bc_ino.ip)); pp =xfs_btree_ptr_addr (cur,1 , broot); kp =xfs_btree_key_addr (cur,1 , broot);
@@ -3823,7 +3823,7 @@ xfs_btree_demote_leaf_child(*/ broot = cur->bc_ops->broot_realloc (cur, numrecs);xfs_btree_init_block (cur->bc_mp, broot, cur->bc_ops,0 , numrecs, - cur->bc_ino.ip->i_ino); +I_INO (cur->bc_ino.ip)); rp =xfs_btree_rec_addr (cur,1 , broot); crp =xfs_btree_rec_addr (cur,1 , cblock);
libxfs/xfs_btree_staging.c +1 -1
@@ -309,7 +309,7 @@ xfs_btree_bload_prep_block(/* Initialize it and send it out. */ xfs_btree_init_block (cur->bc_mp, ifp->if_broot, cur->bc_ops, - level, nr_this_block, cur->bc_ino.ip->i_ino); + level, nr_this_block,I_INO (cur->bc_ino.ip)); *bpp =NULL ; *blockp = ifp->if_broot;
libxfs/xfs_da_btree.c +1 -1
@@ -2776,7 +2776,7 @@ invalid_mapping: error = -EFSCORRUPTED ;if (xfs_error_level >=XFS_ERRLEVEL_LOW ) {xfs_alert (mp,"%s: bno %u inode %llu" , - __func__, bno, dp->i_ino); + __func__, bno,I_INO (dp));for (i =0 ; i < nirecs; i++) { xfs_alert(mp,
libxfs/xfs_dir2.c +20 -20
@@ -243,7 +243,7 @@ xfs_dir_init(int error;ASSERT (S_ISDIR (VFS_I (dp)->i_mode)); - error =xfs_dir_ino_validate (tp->t_mountp, pdp->i_ino); + error =xfs_dir_ino_validate (tp->t_mountp,I_INO (pdp));if (error)return error;
@@ -254,8 +254,8 @@ xfs_dir_init( args->geo = dp->i_mount->m_dir_geo; args->dp = dp; args->trans = tp; - args->owner = dp->i_ino; - error =xfs_dir2_sf_create (args, pdp->i_ino); + args->owner =I_INO (dp); + error =xfs_dir2_sf_create (args,I_INO (pdp));kfree (args);return error; }
@@ -355,7 +355,7 @@ xfs_dir_createname( args->whichfork =XFS_DATA_FORK ; args->trans = tp; args->op_flags =XFS_DA_OP_ADDNAME |XFS_DA_OP_OKNOENT ; - args->owner = dp->i_ino; + args->owner =I_INO (dp); rval =xfs_dir_createname_args (args);kfree (args);
@@ -446,7 +446,7 @@ xfs_dir_lookup( args->whichfork =XFS_DATA_FORK ; args->trans = tp; args->op_flags =XFS_DA_OP_OKNOENT ; - args->owner = dp->i_ino; + args->owner =I_INO (dp);if (ci_name) args->op_flags |=XFS_DA_OP_CILOOKUP ;
@@ -515,7 +515,7 @@ xfs_dir_removename( args->total = total; args->whichfork =XFS_DATA_FORK ; args->trans = tp; - args->owner = dp->i_ino; + args->owner =I_INO (dp); rval =xfs_dir_removename_args (args);kfree (args);return rval;
@@ -575,7 +575,7 @@ xfs_dir_replace( args->total = total; args->whichfork =XFS_DATA_FORK ; args->trans = tp; - args->owner = dp->i_ino; + args->owner =I_INO (dp); rval =xfs_dir_replace_args (args);kfree (args);return rval;
@@ -854,7 +854,7 @@ xfs_dir_create_child(xfs_assert_ilocked (ip,XFS_ILOCK_EXCL );xfs_assert_ilocked (dp,XFS_ILOCK_EXCL ); - error =xfs_dir_createname (tp, dp, name, ip->i_ino, resblks); + error =xfs_dir_createname (tp, dp, name,I_INO (ip), resblks);if (error) {ASSERT (error != -ENOSPC );return error;
@@ -925,7 +925,7 @@ xfs_dir_add_child(return error; } - error =xfs_dir_createname (tp, dp, name, ip->i_ino, resblks); + error =xfs_dir_createname (tp, dp, name,I_INO (ip), resblks);if (error)return error;
@@ -994,7 +994,7 @@ xfs_dir_remove_child(* get freed before the child directory is closed. If the fs * gets shrunk, this can lead to dirent inode validation errors. */ -if (dp->i_ino != tp->t_mountp->m_sb.sb_rootino) { +if (I_INO (dp) != tp->t_mountp->m_sb.sb_rootino) { error =xfs_dir_replace (tp, ip, &xfs_name_dotdot, tp->t_mountp->m_sb.sb_rootino,0 );if (error)
@@ -1015,7 +1015,7 @@ xfs_dir_remove_child(if (error)return error; - error =xfs_dir_removename (tp, dp, name, ip->i_ino, resblks); + error =xfs_dir_removename (tp, dp, name,I_INO (ip), resblks);if (error) {ASSERT (error != -ENOENT );return error;
@@ -1058,12 +1058,12 @@ xfs_dir_exchange_children(int error;/* Swap inode number for dirent in first parent */ - error =xfs_dir_replace (tp, dp1, name1, ip2->i_ino, spaceres); + error =xfs_dir_replace (tp, dp1, name1,I_INO (ip2), spaceres);if (error)return error;/* Swap inode number for dirent in second parent */ - error =xfs_dir_replace (tp, dp2, name2, ip1->i_ino, spaceres); + error =xfs_dir_replace (tp, dp2, name2,I_INO (ip1), spaceres);if (error)return error;
@@ -1077,7 +1077,7 @@ xfs_dir_exchange_children(if (S_ISDIR (VFS_I (ip2)->i_mode)) { error =xfs_dir_replace (tp, ip2, &xfs_name_dotdot, - dp1->i_ino, spaceres); +I_INO (dp1), spaceres);if (error)return error;
@@ -1101,7 +1101,7 @@ xfs_dir_exchange_children(if (S_ISDIR (VFS_I (ip1)->i_mode)) { error =xfs_dir_replace (tp, ip1, &xfs_name_dotdot, - dp2->i_ino, spaceres); +I_INO (dp2), spaceres);if (error)return error;
@@ -1264,7 +1264,7 @@ xfs_dir_rename_children(* to account for the ".." reference from the new entry. */ error =xfs_dir_createname (tp, target_dp, target_name, - src_ip->i_ino, spaceres); +I_INO (src_ip), spaceres);if (error)return error;
@@ -1285,7 +1285,7 @@ xfs_dir_rename_children(* name at the destination directory, remove it first. */ error =xfs_dir_replace (tp, target_dp, target_name, - src_ip->i_ino, spaceres); +I_INO (src_ip), spaceres);if (error)return error;
@@ -1319,7 +1319,7 @@ xfs_dir_rename_children(* directory. */ error =xfs_dir_replace (tp, src_ip, &xfs_name_dotdot, - target_dp->i_ino, spaceres); +I_INO (target_dp), spaceres);ASSERT (error != -EEXIST );if (error)return error;
@@ -1357,10 +1357,10 @@ xfs_dir_rename_children(* altogether. */ if (du_wip->ip) - error =xfs_dir_replace (tp, src_dp, src_name, du_wip->ip->i_ino, + error =xfs_dir_replace (tp, src_dp, src_name,I_INO (du_wip->ip), spaceres);else - error =xfs_dir_removename (tp, src_dp, src_name, src_ip->i_ino, + error =xfs_dir_removename (tp, src_dp, src_name,I_INO (src_ip), spaceres);if (error)return error;
libxfs/xfs_dir2_node.c +1 -1
@@ -1736,7 +1736,7 @@ xfs_dir2_node_add_datablk( fbno)) {xfs_alert (mp,"%s: dir ino %llu needed freesp block %lld for data block %lld, got %lld" , - __func__, (unsigned long long )dp->i_ino, + __func__, (unsigned long long )I_INO (dp), (long long )xfs_dir2_db_to_fdb (args->geo, *dbno), (long long )*dbno, (long long )fbno);if (fblk) {
libxfs/xfs_dir2_sf.c +2 -2
@@ -301,7 +301,7 @@ xfs_dir2_block_to_sf(* Skip . */ if (dep->namelen ==1 && dep->name[0 ] =='.' ) -ASSERT (be64_to_cpu (dep->inumber) == dp->i_ino); +ASSERT (be64_to_cpu (dep->inumber) ==I_INO (dp));/* * Skip .., but make sure the inode number is right. */
@@ -863,7 +863,7 @@ xfs_dir2_sf_lookup(* Special case for . */ if (args->namelen ==1 && args->name[0 ] =='.' ) { - args->inumber = dp->i_ino; + args->inumber =I_INO (dp); args->cmpresult =XFS_CMP_EXACT ; args->filetype =XFS_DIR3_FT_DIR ;return -EEXIST ;
libxfs/xfs_exchmaps.c +4 -4
@@ -426,7 +426,7 @@ xfs_exchmaps_attr_to_sf( .geo = tp->t_mountp->m_attr_geo, .whichfork = XFS_ATTR_FORK, .trans = tp, - .owner = xmi->xmi_ip2->i_ino, + .owner = I_INO(xmi->xmi_ip2), };struct xfs_buf *bp;int forkoff;
@@ -435,7 +435,7 @@ xfs_exchmaps_attr_to_sf(if (!xfs_attr_is_leaf (xmi->xmi_ip2))return 0 ; - error =xfs_attr3_leaf_read (tp, xmi->xmi_ip2, xmi->xmi_ip2->i_ino,0 , + error =xfs_attr3_leaf_read (tp, xmi->xmi_ip2,I_INO (xmi->xmi_ip2),0 , &bp);if (error)return error;
@@ -458,7 +458,7 @@ xfs_exchmaps_dir_to_sf( .geo = tp->t_mountp->m_dir_geo, .whichfork = XFS_DATA_FORK, .trans = tp, - .owner = xmi->xmi_ip2->i_ino, + .owner = I_INO(xmi->xmi_ip2), };struct xfs_dir2_sf_hdr sfh;struct xfs_buf *bp;
@@ -468,7 +468,7 @@ xfs_exchmaps_dir_to_sf(if (xfs_dir2_format (&args, &error) !=XFS_DIR2_FMT_BLOCK )return error; - error =xfs_dir3_block_read (tp, xmi->xmi_ip2, xmi->xmi_ip2->i_ino, &bp); + error =xfs_dir3_block_read (tp, xmi->xmi_ip2,I_INO (xmi->xmi_ip2), &bp);if (error)return error;
libxfs/xfs_format.h +3 -3
@@ -1277,11 +1277,11 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip)#define XFS_INO_TO_AGNO (mp,i) \ ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))#define XFS_INODE_TO_AGNO (ip) \ - XFS_INO_TO_AGNO((ip)->i_mount, (ip)->i_ino) + XFS_INO_TO_AGNO((ip)->i_mount, I_INO(ip))#define XFS_INO_TO_AGINO (mp,i) \ ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))#define XFS_INODE_TO_AGINO (ip) \ - XFS_INO_TO_AGINO((ip)->i_mount, (ip)->i_ino) + XFS_INO_TO_AGINO((ip)->i_mount, I_INO(ip))#define XFS_INO_TO_AGBNO (mp,i) \ (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \ XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
@@ -1290,7 +1290,7 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip)#define XFS_INO_TO_FSB (mp,i) \ XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))#define XFS_INODE_TO_FSB (ip) \ - XFS_INO_TO_FSB((ip)->i_mount, (ip)->i_ino) + XFS_INO_TO_FSB((ip)->i_mount, I_INO(ip))#define XFS_AGINO_TO_INO (mp,a,i) \ (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))#define XFS_AGINO_TO_AGBNO (mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
libxfs/xfs_ialloc.c +1 -1
@@ -1890,7 +1890,7 @@ xfs_dialloc(struct xfs_perag *pag;struct xfs_ino_geometry *igeo =M_IGEO (mp);xfs_ino_t ino =NULLFSINO ; -xfs_ino_t parent = args->pip ? args->pip->i_ino :0 ; +xfs_ino_t parent = args->pip ?I_INO (args->pip) :0 ;xfs_agnumber_t agno;xfs_agnumber_t start_agno;umode_t mode = args->mode &S_IFMT ;
libxfs/xfs_inode_buf.c +2 -2
@@ -182,7 +182,7 @@ xfs_inode_from_disk(ASSERT (ip->i_cowfp ==NULL ); - fa =xfs_dinode_verify (ip->i_mount, ip->i_ino, from); + fa =xfs_dinode_verify (ip->i_mount,I_INO (ip), from);if (fa) {xfs_inode_verifier_error (ip, -EFSCORRUPTED ,"dinode" , from,sizeof (*from), fa);
@@ -355,7 +355,7 @@ xfs_inode_to_disk( to->di_flags2 =cpu_to_be64 (ip->i_diflags2);/* also covers the di_used_blocks union arm: */ to->di_cowextsize =cpu_to_be32 (ip->i_cowextsize); - to->di_ino =cpu_to_be64 (ip->i_ino); + to->di_ino =cpu_to_be64 (I_INO (ip)); to->di_lsn =cpu_to_be64 (lsn);memset (to->di_pad2,0 ,sizeof (to->di_pad2));uuid_copy (&to->di_uuid, &ip->i_mount->m_sb.sb_meta_uuid);
libxfs/xfs_inode_fork.c +3 -3
@@ -85,7 +85,7 @@ xfs_iformat_local(if (unlikely (size >XFS_DFORK_SIZE (dip, ip->i_mount, whichfork))) {xfs_warn (ip->i_mount,"corrupt inode %llu (bad size %d for local fork, size = %zd)." , - (unsigned long long ) ip->i_ino, size, + (unsigned long long )I_INO (ip), size,XFS_DFORK_SIZE (dip, ip->i_mount, whichfork)); xfs_inode_verifier_error(ip, -EFSCORRUPTED, "xfs_iformat_local", dip, sizeof(*dip),
@@ -124,7 +124,7 @@ xfs_iformat_extents(*/ if (unlikely (size <0 || size >XFS_DFORK_SIZE (dip, mp, whichfork))) {xfs_warn (ip->i_mount,"corrupt inode %llu ((a)extents = %llu)." , - ip->i_ino, nex); +I_INO (ip), nex);xfs_inode_verifier_error (ip, -EFSCORRUPTED ,"xfs_iformat_extents(1)" , dip,sizeof (*dip), __this_address);
@@ -203,7 +203,7 @@ xfs_iformat_btree( ifp->if_nextents > ip->i_nblocks) || level == 0 || level > XFS_BM_MAXLEVELS(mp, whichfork)) {xfs_warn (mp,"corrupt inode %llu (btree)." , - (unsigned long long ) ip->i_ino); + (unsigned long long )I_INO (ip));xfs_inode_verifier_error (ip, -EFSCORRUPTED ,"xfs_iformat_btree" , dfp, size, __this_address);
libxfs/xfs_inode_util.c +3 -3
@@ -651,7 +651,7 @@ xfs_droplink(if (inode->i_nlink ==0 ) {xfs_info_ratelimited (tp->t_mountp,"Inode 0x%llx link count dropped below zero. Pinning link count." , - ip->i_ino); +I_INO (ip));set_nlink (inode,XFS_NLINK_PINNED ); }if (inode->i_nlink !=XFS_NLINK_PINNED )
@@ -680,7 +680,7 @@ xfs_bumplink(if (inode->i_nlink ==XFS_NLINK_PINNED -1 )xfs_info_ratelimited (tp->t_mountp,"Inode 0x%llx link count exceeded maximum. Pinning link count." , - ip->i_ino); +I_INO (ip));if (inode->i_nlink !=XFS_NLINK_PINNED )inc_nlink (inode);
@@ -704,7 +704,7 @@ xfs_inode_uninit(* makes the AGI lock -> unlinked list modification order the same as * used in O_TMPFILE creation. */ - error =xfs_difree (tp, pag, ip->i_ino, xic); + error =xfs_difree (tp, pag,I_INO (ip), xic);if (error)return error;
libxfs/xfs_metadir.c +1 -1
@@ -93,7 +93,7 @@ xfs_metadir_lookup( .hashval = xfs_dir2_hashname(mp, xname), .whichfork = XFS_DATA_FORK, .op_flags = XFS_DA_OP_OKNOENT, - .owner = dp->i_ino, + .owner = I_INO(dp), };int error;
libxfs/xfs_parent.c +4 -4
@@ -199,7 +199,7 @@ xfs_parent_addname(xfs_inode_to_parent_rec (&ppargs->rec, dp);xfs_parent_da_args_init (&ppargs->args, tp, &ppargs->rec, child, - child->i_ino, parent_name); +I_INO (child), parent_name);return xfs_attr_setname (&ppargs->args,0 ); }
@@ -221,7 +221,7 @@ xfs_parent_removename(xfs_inode_to_parent_rec (&ppargs->rec, dp);xfs_parent_da_args_init (&ppargs->args, tp, &ppargs->rec, child, - child->i_ino, parent_name); +I_INO (child), parent_name);return xfs_attr_removename (&ppargs->args); }
@@ -245,7 +245,7 @@ xfs_parent_replacename(xfs_inode_to_parent_rec (&ppargs->rec, old_dp);xfs_parent_da_args_init (&ppargs->args, tp, &ppargs->rec, child, - child->i_ino, old_name); +I_INO (child), old_name);xfs_inode_to_parent_rec (&ppargs->new_rec, new_dp);
@@ -309,7 +309,7 @@ xfs_parent_lookup( struct xfs_da_args *scratch) {memset (scratch,0 ,sizeof (struct xfs_da_args )); -xfs_parent_da_args_init (scratch, tp, pptr, ip, ip->i_ino, parent_name); +xfs_parent_da_args_init (scratch, tp, pptr, ip,I_INO (ip), parent_name);return xfs_attr_get_ilocked (scratch); }
libxfs/xfs_parent.h +1 -1
@@ -34,7 +34,7 @@ xfs_inode_to_parent_rec(struct xfs_parent_rec *rec, const struct xfs_inode *dp) { - xfs_parent_rec_init(rec, dp->i_ino, VFS_IC(dp)->i_generation); + xfs_parent_rec_init(rec, I_INO(dp), VFS_IC(dp)->i_generation); }extern struct kmem_cache *xfs_parent_args_cache;
libxfs/xfs_rmap.c +3 -3
@@ -2779,7 +2779,7 @@ xfs_rmap_map_extent(if (whichfork !=XFS_ATTR_FORK &&xfs_is_reflink_inode (ip)) type =XFS_RMAP_MAP_SHARED ; -__xfs_rmap_add (tp, type, ip->i_ino, isrt, whichfork,PREV ); +__xfs_rmap_add (tp, type,I_INO (ip), isrt, whichfork,PREV ); }/* Unmap an extent out of a file. */
@@ -2799,7 +2799,7 @@ xfs_rmap_unmap_extent(if (whichfork !=XFS_ATTR_FORK &&xfs_is_reflink_inode (ip)) type =XFS_RMAP_UNMAP_SHARED ; -__xfs_rmap_add (tp, type, ip->i_ino, isrt, whichfork,PREV ); +__xfs_rmap_add (tp, type,I_INO (ip), isrt, whichfork,PREV ); }/*
@@ -2825,7 +2825,7 @@ xfs_rmap_convert_extent(if (whichfork !=XFS_ATTR_FORK &&xfs_is_reflink_inode (ip)) type =XFS_RMAP_CONVERT_SHARED ; -__xfs_rmap_add (tp, type, ip->i_ino, isrt, whichfork,PREV ); +__xfs_rmap_add (tp, type,I_INO (ip), isrt, whichfork,PREV ); }/* Schedule the creation of an rmap for non-file data. */
libxfs/xfs_rmap.h +2 -2
@@ -22,7 +22,7 @@ xfs_rmap_ino_bmbt_owner( oi->oi_flags |=XFS_OWNER_INFO_ATTR_FORK ; }#define xfs_rmap_inode_bmbt_owner (oi, ip, whichfork) \ - xfs_rmap_ino_bmbt_owner(oi, (ip)->i_ino, whichfork) + xfs_rmap_ino_bmbt_owner(oi, I_INO(ip), whichfork)static inline void xfs_rmap_ino_owner(
@@ -38,7 +38,7 @@ xfs_rmap_ino_owner( oi->oi_flags |=XFS_OWNER_INFO_ATTR_FORK ; }#define xfs_rmap_inode_owner (oi, ip, whichfork, offset) \ - xfs_rmap_ino_owner(oi, (ip)->i_ino, whichfork, offset) + xfs_rmap_ino_owner(oi, I_INO(ip), whichfork, offset)static inline bool xfs_rmap_should_skip_owner_update(
libxfs/xfs_rtbitmap.c +2 -2
@@ -209,7 +209,7 @@ xfs_rtbuf_get(if (xfs_has_rtgroups (mp)) {struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; -if (hdr->rt_owner !=cpu_to_be64 (ip->i_ino)) { +if (hdr->rt_owner !=cpu_to_be64 (I_INO (ip))) {xfs_buf_mark_corrupt (bp);xfs_trans_brelse (args->tp, bp);xfs_rtginode_mark_sick (args->rtg, type);
@@ -1404,7 +1404,7 @@ xfs_rtfile_initialize_block( hdr->rt_magic =cpu_to_be32 (XFS_RTBITMAP_MAGIC ); else hdr->rt_magic = cpu_to_be32(XFS_RTSUMMARY_MAGIC); - hdr->rt_owner =cpu_to_be64 (ip->i_ino); + hdr->rt_owner =cpu_to_be64 (I_INO (ip)); hdr->rt_blkno =cpu_to_be64 (XFS_FSB_TO_DADDR (mp, fsbno)); hdr->rt_lsn =0 ;uuid_copy (&hdr->rt_uuid, &mp->m_sb.sb_meta_uuid);
libxfs/xfs_rtrefcount_btree.c +2 -2
@@ -600,7 +600,7 @@ xfs_rtrefcountbt_from_disk( rblocklen =xfs_rtrefcount_broot_space (mp, dblock);xfs_btree_init_block (mp, rblock, &xfs_rtrefcountbt_ops,0 ,0 , - ip->i_ino); +I_INO (ip)); rblock->bb_level = dblock->bb_level; rblock->bb_numrecs = dblock->bb_numrecs;
@@ -749,7 +749,7 @@ xfs_rtrefcountbt_create( xfs_rtrefcount_broot_space_calc(mp, 0, 0));if (broot)xfs_btree_init_block (mp, broot, &xfs_rtrefcountbt_ops,0 ,0 , - ip->i_ino); +I_INO (ip));xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE |XFS_ILOG_DBROOT );return 0 ; }
libxfs/xfs_rtrmap_btree.c +2 -2
@@ -838,7 +838,7 @@ xfs_rtrmapbt_from_disk(unsigned int numrecs;unsigned int maxrecs; -xfs_btree_init_block (mp, rblock, &xfs_rtrmapbt_ops,0 ,0 , ip->i_ino); +xfs_btree_init_block (mp, rblock, &xfs_rtrmapbt_ops,0 ,0 ,I_INO (ip)); rblock->bb_level = dblock->bb_level; rblock->bb_numrecs = dblock->bb_numrecs;
@@ -980,7 +980,7 @@ xfs_rtrmapbt_create( broot =xfs_broot_realloc (ifp,xfs_rtrmap_broot_space_calc (mp,0 ,0 ));if (broot)xfs_btree_init_block (mp, broot, &xfs_rtrmapbt_ops,0 ,0 , - ip->i_ino); +I_INO (ip));xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE |XFS_ILOG_DBROOT );return 0 ;
libxfs/xfs_symlink_remote.c +3 -3
@@ -193,7 +193,7 @@ xfs_symlink_local_to_remote( bp->b_ops = &xfs_symlink_buf_ops; buf = bp->b_addr; - buf +=xfs_symlink_hdr_set (mp, ip->i_ino,0 , ifp->if_bytes, bp); + buf +=xfs_symlink_hdr_set (mp,I_INO (ip),0 , ifp->if_bytes, bp);memcpy (buf, ifp->if_data, ifp->if_bytes);xfs_trans_log_buf (tp, bp,0 ,sizeof (struct xfs_dsymlink_hdr ) + ifp->if_bytes -1 );
@@ -274,13 +274,13 @@ xfs_symlink_remote_read( cur_chunk = bp->b_addr;if (xfs_has_crc (mp)) { -if (!xfs_symlink_hdr_ok (ip->i_ino, offset, +if (!xfs_symlink_hdr_ok (I_INO (ip), offset, byte_cnt, bp)) {xfs_inode_mark_sick (ip,XFS_SICK_INO_SYMLINK ); error = -EFSCORRUPTED ;xfs_alert (mp,"symlink header does not match required off/len/owner (0x%x/0x%x,0x%llx)" , - offset, byte_cnt, ip->i_ino); + offset, byte_cnt,I_INO (ip));xfs_buf_relse (bp); goto out;
mkfs/proto.c +8 -8
@@ -289,7 +289,7 @@ writesymlink(xfs_extlen_t nb =XFS_B_TO_FSB (mp, len);int error; - error = -libxfs_symlink_write_target (tp, ip, ip->i_ino, buf, len, nb, + error = -libxfs_symlink_write_target (tp, ip,I_INO (ip), buf, len, nb, nb);if (error) { fprintf(stderr,
@@ -417,7 +417,7 @@ writeattr(struct xfs_da_args args = { .dp = ip, .geo = ip->i_mount->m_attr_geo, - .owner = ip->i_ino, + .owner =I_INO (ip), .whichfork =XFS_ATTR_FORK , .op_flags =XFS_DA_OP_OKNOENT , .value = valuebuf,
@@ -548,7 +548,7 @@ newdirent( rsv =XFS_DIRENTER_SPACE_RES (mp, name->len); - error = -libxfs_dir_createname (tp, pip, name, ip->i_ino, rsv); + error = -libxfs_dir_createname (tp, pip, name,I_INO (ip), rsv);if (error)fail (_ ("directory createname error" ), error);
@@ -927,7 +927,7 @@ parseproto(fail (_ ("Inode allocation failed" ), error);if (!pip) { pip = ip; - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp); isroot =1 ; }else {
@@ -1057,10 +1057,10 @@ create_sb_metadata_file(switch (type) {case XFS_RTGI_BITMAP : - mp->m_sb.sb_rbmino = ip->i_ino; + mp->m_sb.sb_rbmino =I_INO (ip);break ;case XFS_RTGI_SUMMARY : - mp->m_sb.sb_rsumino = ip->i_ino; + mp->m_sb.sb_rsumino =I_INO (ip);break ;default : error =EFSCORRUPTED ;
@@ -1634,7 +1634,7 @@ create_nondir_inode(* hardlink, so we need to store it. */ if (file_stat->st_nlink >1 ) -track_hardlink_inode (file_stat, ip->i_ino); +track_hardlink_inode (file_stat,I_INO (ip));libxfs_irele (ip); }
@@ -1880,7 +1880,7 @@ populate_from_dir(if (error)fail (_ ("Inode allocation failed" ), error); - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp);newdirectory (mp, tp, ip, ip);libxfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );
repair/bmap_repair.c +3 -3
@@ -134,7 +134,7 @@ xrep_bmap_walk_rmap(int error;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_fork_rmap (rb, cur, rec);
@@ -252,7 +252,7 @@ xrep_bmap_walk_rtrmap(int error =0 ;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_rtfork_rmap (rb->sc, cur, rec);
@@ -576,7 +576,7 @@ xrep_bmap_build_new_fork(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino, rb->whichfork); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip), rb->whichfork);bulkload_init_inode (&rb->new_fork_info, sc, rb->whichfork, &oinfo); bmap_cur =libxfs_bmbt_init_cursor (sc->mp,NULL , sc->ip,XFS_STAGING_FORK );
repair/bulkload.c +1 -1
@@ -32,7 +32,7 @@ bulkload_init_inode(int whichfork, const struct xfs_owner_info *oinfo) { - bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, sc->ip->i_ino)); + bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, I_INO(sc->ip))); bkl->ifake.if_fork =kmem_cache_zalloc (xfs_ifork_cache,0 ); bkl->ifake.if_fork_size =xfs_inode_fork_size (sc->ip, whichfork); }
repair/phase6.c +64 -64
445 lines not on this page · raw message
repair/pptr.c +50 -50
384 lines not on this page · raw message
repair/quotacheck.c +4 -4
@@ -169,7 +169,7 @@ qc_count_rtblocks(if (error) {do_warn (_ ("could not read ino %" PRIu64" extents, err=%d\n" ), - ip->i_ino, error); +I_INO (ip), error); chkd_flags =0 ;return 0 ; }
@@ -375,7 +375,7 @@ qc_walk_dquot_extent(if (error) {do_warn (_ ("cannot read %s inode %" PRIu64", block %" PRIu64", disk block %" PRIu64", err=%d\n" ), -qflags_typestr (dquots->type), ip->i_ino, +qflags_typestr (dquots->type),I_INO (ip), map->br_startoff + bno, map->br_startblock + bno, error); chkd_flags =0 ;
@@ -454,7 +454,7 @@ quotacheck_verify(if (error) {do_warn (_ ("could not read %s inode %" PRIu64" extents, err=%d\n" ), -qflags_typestr (type), ip->i_ino, error); +qflags_typestr (type),I_INO (ip), error); chkd_flags =0 ; goto err; }
@@ -659,7 +659,7 @@ mark_quota_inode(if (error) goto out_corrupt; -set_quota_inode (type, ip->i_ino); +set_quota_inode (type,I_INO (ip));libxfs_irele (ip);return 0 ;
repair/rt.c +3 -3
@@ -268,7 +268,7 @@ check_rtfile_contents(if (xfs_has_rtgroups (mp)) {struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; -if (hdr->rt_owner !=cpu_to_be64 (ip->i_ino)) { +if (hdr->rt_owner !=cpu_to_be64 (I_INO (ip))) {do_warn (_ ("corrupt owner in %s at dblock 0x%llx\n" ), filename, (unsigned long long )bno);
@@ -461,12 +461,12 @@ mark_rtginode( goto out_corrupt;if (xfs_has_rtgroups (rtg_mount (rtg))) { -if (bitmap_test (rtg_inodes[type], ip->i_ino,1 )) { +if (bitmap_test (rtg_inodes[type],I_INO (ip),1 )) { error =EFSCORRUPTED ; goto out_corrupt; } - error =bitmap_set (rtg_inodes[type], ip->i_ino,1 ); + error =bitmap_set (rtg_inodes[type],I_INO (ip),1 );if (error) goto out_corrupt; }
repair/rtrefcount_repair.c +1 -1
@@ -173,7 +173,7 @@ xrep_rtrefc_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrefcountbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);
repair/rtrmap_repair.c +1 -1
@@ -211,7 +211,7 @@ xrep_rtrmap_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrmapbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);
repair/xfs_repair.c +1 -1
@@ -670,7 +670,7 @@ check_metadir_inode(/* If we changed the metadir inode, try reloading it. */ if (!mp->m_metadirip || - mp->m_metadirip->i_ino != mp->m_sb.sb_metadirino) { +I_INO (mp->m_metadirip) != mp->m_sb.sb_metadirino) {if (mp->m_metadirip)libxfs_irele (mp->m_metadirip);
Signature · 1 line
2.55.0
PATCH 9/21 xfs: cleanup xfs_imap
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 41397e7ca8a06507ae6f52f68cd27b0812e9a561
Reshuffle the code a bit so that the imap_lookup and filling out of the xfs_imap structure aren't duplicated.
--- libxfs/xfs_ialloc.c | 62 ++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 34 deletions(-)
libxfs/xfs_ialloc.c +28 -34
@@ -2506,43 +2506,37 @@ xfs_imap(* inodes in stale state on disk. Hence we have to do a btree lookup * in all cases where an untrusted inode number is passed. */ -if (flags &XFS_IGET_UNTRUSTED ) { - error =xfs_imap_lookup (pag, tp, agino, agbno, - &chunk_agbno, &offset_agbno, flags); -if (error) -return error; - goto out_map; - } +if (!(flags &XFS_IGET_UNTRUSTED )) { +/* +* If the inode cluster size is the same or smaller than the +* blocksize, get to the buffer by simple arithmetics. +*/ +if (M_IGEO (mp)->blocks_per_cluster ==1 ) { + cluster_agbno = agbno; + offset =XFS_INO_TO_OFFSET (mp, ino); +ASSERT (offset < mp->m_sb.sb_inopblock); + goto out; + } -/* -* If the inode cluster size is the same as the blocksize or -* smaller we get to the buffer by simple arithmetics. -*/ -if (M_IGEO (mp)->blocks_per_cluster ==1 ) { - offset =XFS_INO_TO_OFFSET (mp, ino); -ASSERT (offset < mp->m_sb.sb_inopblock); +/* +* If the inode chunks are aligned, use simple maths to find the +* location. +*/ +if (M_IGEO (mp)->inoalign_mask) { + offset_agbno = agbno &M_IGEO (mp)->inoalign_mask; + chunk_agbno = agbno - offset_agbno; + goto out_map; + } - imap->im_blkno =xfs_agbno_to_daddr (pag, agbno); - imap->im_len =XFS_FSB_TO_BB (mp,1 ); - imap->im_boffset = (unsigned short )(offset << - mp->m_sb.sb_inodelog); -return 0 ; +/* +* Otherwise we have to do a btree lookup to find the location. +*/ } -/* -* If the inode chunks are aligned then use simple maths to -* find the location. Otherwise we have to do a btree -* lookup to find the location. -*/ -if (M_IGEO (mp)->inoalign_mask) { - offset_agbno = agbno &M_IGEO (mp)->inoalign_mask; - chunk_agbno = agbno - offset_agbno; - }else { - error =xfs_imap_lookup (pag, tp, agino, agbno, - &chunk_agbno, &offset_agbno, flags); -if (error) -return error; - } + error =xfs_imap_lookup (pag, tp, agino, agbno, &chunk_agbno, + &offset_agbno, flags); +if (error) +return error; out_map:ASSERT (agbno >= chunk_agbno);
@@ -2551,7 +2545,7 @@ out_map: M_IGEO(mp)->blocks_per_cluster); offset = ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock) +XFS_INO_TO_OFFSET (mp, ino); - +out: imap->im_blkno =xfs_agbno_to_daddr (pag, cluster_agbno); imap->im_len =XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster); imap->im_boffset = (unsigned short )(offset << mp->m_sb.sb_inodelog);
Signature · 1 line
2.55.0
PATCH 10/21 xfs: remove im_len field in struct xfs_imap
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 33451947c4f0f91df74af2db4384143446a1157a
im_len is always set to the same value for a given file system, which makes it redundant.
--- libxfs/xfs_ialloc.c | 10 +++++----- libxfs/xfs_inode_buf.c | 3 ++- libxfs/xfs_inode_buf.h | 1 - 3 files changed, 7 insertions(+), 7 deletions(-)
libxfs/xfs_ialloc.c +5 -5
@@ -2547,7 +2547,6 @@ out_map:XFS_INO_TO_OFFSET (mp, ino); out: imap->im_blkno =xfs_agbno_to_daddr (pag, cluster_agbno); - imap->im_len =XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster); imap->im_boffset = (unsigned short )(offset << mp->m_sb.sb_inodelog);/*
@@ -2556,12 +2555,13 @@ out:* read_buf and panicing when we get an error from the * driver. */ -if ((imap->im_blkno + imap->im_len) > +if (imap->im_blkno + +XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster) >XFS_FSB_TO_BB (mp, mp->m_sb.sb_dblocks)) {xfs_alert (mp, -"%s: (im_blkno (0x%llx) + im_len (0x%llx)) > sb_dblocks (0x%llx)" , - __func__, (unsigned long long ) imap->im_blkno, - (unsigned long long ) imap->im_len, +"%s: (im_blkno (0x%llx) + len (0x%x)) > sb_dblocks (0x%llx)" , + __func__, imap->im_blkno, +XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster),XFS_FSB_TO_BB (mp, mp->m_sb.sb_dblocks));return -EINVAL ; }
libxfs/xfs_inode_buf.c +2 -1
@@ -134,7 +134,8 @@ xfs_imap_to_bp(int error; error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, imap->im_blkno, - imap->im_len,0 , bpp, &xfs_inode_buf_ops); +XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster), +0 , bpp, &xfs_inode_buf_ops);if (xfs_metadata_is_sick (error))xfs_agno_mark_sick (mp,xfs_daddr_to_agno (mp, imap->im_blkno),XFS_SICK_AG_INODES );
libxfs/xfs_inode_buf.h +0 -1
@@ -15,7 +15,6 @@ struct xfs_dinode;*/ struct xfs_imap {xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -unsigned short im_len;/* length in BBs of inode chunk */ unsigned short im_boffset;/* inode offset in block in bytes */ };
Signature · 1 line
2.55.0
PATCH 11/21 xfs: massage xfs_imap_to_bp into xfs_read_icluster
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: caffb4252cf15c5c3bbe7ff1f48f24f4015edb9c
xfs_imap_to_bp only uses the im_blkno field from struct xfs_imap, so pass that directly. Rename the function to xfs_read_icluster, which describes the functionality much better and matches other helpers like xfs_read_agf and xfs_read_agi.
--- libxfs/xfs_ialloc.c | 2 +- libxfs/xfs_inode_buf.c | 12 +++++------- libxfs/xfs_inode_buf.h | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-)
libxfs/xfs_ialloc.c +1 -1
@@ -1070,7 +1070,7 @@ xfs_dialloc_check_ino(if (error)return -EAGAIN ; - error =xfs_imap_to_bp (pag_mount (pag), tp, &imap, &bp); + error =xfs_read_icluster (pag_mount (pag), tp, imap.im_blkno, &bp);if (error)return -EAGAIN ;
libxfs/xfs_inode_buf.c +5 -7
@@ -120,24 +120,22 @@ const struct xfs_buf_ops xfs_inode_buf_ra_ops = {/* -* This routine is called to map an inode to the buffer containing the on-disk -* version of the inode. It returns a pointer to the buffer containing the -* on-disk inode in the bpp parameter. +* Read the inode cluster at @bno and return it in @bpp. */ int -xfs_imap_to_bp ( +xfs_read_icluster (struct xfs_mount *mp,struct xfs_trans *tp, -struct xfs_imap *imap, +xfs_daddr_t bno,struct xfs_buf **bpp) {int error; - error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, imap->im_blkno, + error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, bno,XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster),0 , bpp, &xfs_inode_buf_ops);if (xfs_metadata_is_sick (error)) -xfs_agno_mark_sick (mp,xfs_daddr_to_agno (mp, imap->im_blkno), +xfs_agno_mark_sick (mp,xfs_daddr_to_agno (mp, bno),XFS_SICK_AG_INODES );return error; }
libxfs/xfs_inode_buf.h +3 -3
@@ -11,15 +11,15 @@ struct xfs_dinode;/* * Inode location information. Stored in the inode and passed to -* xfs_imap_to_bp() to get a buffer and dinode for a given inode. +* xfs_read_icluster() to get a buffer and dinode for a given inode. */ struct xfs_imap {xfs_daddr_t im_blkno;/* starting BB of inode chunk */ unsigned short im_boffset;/* inode offset in block in bytes */ }; -int xfs_imap_to_bp (struct xfs_mount *mp,struct xfs_trans *tp, -struct xfs_imap *imap,struct xfs_buf **bpp); +int xfs_read_icluster (struct xfs_mount *mp,struct xfs_trans *tp, +xfs_daddr_t bno,struct xfs_buf **bpp);void xfs_dinode_calc_crc (struct xfs_mount *mp,struct xfs_dinode *dip);void xfs_inode_to_disk (struct xfs_inode *ip,struct xfs_dinode *to,xfs_lsn_t lsn);
Signature · 1 line
2.55.0
PATCH 12/21 xfs: store an agbno in struct xfs_imap
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 9b64ca202f364a6bf8e19bdd20953bc2d776c67f
The xfs_imap structure is embedded into the xfs_inode, which means the size of it directly affects the inode size. Replacing the xfs_daddr_t with an xfs_agbno_t and taking the AG information from other easily available sources allows us to shrink the structure including the typical padding from 16 bytes to 8 bytes.
As a side-effect the debugging check in xfs_imap() naturally now converges to a stricter variant that checks that the cluster is located inside a single AG, and not just inside the entire device.
--- db/iunlink.c | 4 +++- libxfs/inode.c | 4 +++- libxfs/iunlink.c | 2 +- libxfs/libxfs_api_defs.h | 2 +- libxfs/logitem.c | 6 +++++- libxfs/xfs_ialloc.c | 24 +++++++----------------- libxfs/xfs_inode_buf.c | 11 ++++++----- libxfs/xfs_inode_buf.h | 8 ++++---- repair/bmap_repair.c | 6 +++++- 9 files changed, 35 insertions(+), 32 deletions(-)
db/iunlink.c +3 -1
@@ -46,6 +46,7 @@ get_next_unlinked(xfs_ino_t ino;xfs_agino_t ret;int error; +struct xfs_perag *pag =libxfs_perag_get (mp, agno); ino =XFS_AGINO_TO_INO (mp, agno, agino); error = -libxfs_iget (mp,NULL , ino,0 , &ip);
@@ -65,7 +66,8 @@ get_next_unlinked(dbprintf ("\n" ); } - error = -libxfs_imap_to_bp (mp,NULL , &ip->i_imap, &ino_bp); + error = -libxfs_read_icluster (pag,NULL , ip->i_imap.im_agbno, &ino_bp); +libxfs_perag_put (pag);if (error) {libxfs_irele (ip); goto bad;
libxfs/inode.c +3 -1
@@ -182,7 +182,7 @@ libxfs_iget( }else {struct xfs_buf *bp; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &bp); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp);if (error) goto out_destroy;
@@ -195,11 +195,13 @@ libxfs_iget(if (error) goto out_destroy; } +xfs_perag_put (pag); *ipp = ip;return 0 ; out_destroy: +xfs_perag_put (pag);kmem_cache_free (xfs_inode_cache, ip); *ipp =NULL ;return error;
libxfs/iunlink.c +1 -1
@@ -44,7 +44,7 @@ xfs_iunlink_log_dinode(int offset;int error; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &ibp); + error =xfs_read_icluster (iup->pag, tp, ip->i_imap.im_agbno, &ibp);if (error)return error;/*
libxfs/libxfs_api_defs.h +1 -1
@@ -200,7 +200,7 @@#define xfs_iext_lookup_extent libxfs_iext_lookup_extent#define xfs_iext_next libxfs_iext_next#define xfs_ifork_zap_attr libxfs_ifork_zap_attr -#define xfs_imap_to_bp libxfs_imap_to_bp +#define xfs_read_icluster libxfs_read_icluster#define xfs_initialize_perag libxfs_initialize_perag#define xfs_initialize_perag_data libxfs_initialize_perag_data
libxfs/logitem.c +5 -1
@@ -16,6 +16,7 @@#include "xfs_inode.h" #include "xfs_trans.h" #include "xfs_rtbitmap.h" +#include "xfs_ag.h" struct kmem_cache *xfs_buf_item_cache;struct kmem_cache *xfs_ili_cache;/* inode log item cache */
@@ -248,6 +249,7 @@ xfs_inode_item_precommit( }if (!iip->ili_item.li_buf) { +struct xfs_perag *pag;struct xfs_buf *bp;int error;
@@ -261,7 +263,9 @@ xfs_inode_item_precommit(* here. */ spin_unlock (&iip->ili_lock); - error =xfs_imap_to_bp (ip->i_mount, tp, &ip->i_imap, &bp); + pag =xfs_perag_get (ip->i_mount,XFS_INODE_TO_AGNO (ip)); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp); +xfs_perag_put (pag);if (error)return error;
libxfs/xfs_ialloc.c +7 -17
@@ -1070,7 +1070,7 @@ xfs_dialloc_check_ino(if (error)return -EAGAIN ; - error =xfs_read_icluster (pag_mount (pag), tp, imap.im_blkno, &bp); + error =xfs_read_icluster (pag, tp, imap.im_agbno, &bp);if (error)return -EAGAIN ;
@@ -2546,23 +2546,13 @@ out_map: offset = ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock) +XFS_INO_TO_OFFSET (mp, ino); out: - imap->im_blkno =xfs_agbno_to_daddr (pag, cluster_agbno); + imap->im_agbno = cluster_agbno; imap->im_boffset = (unsigned short )(offset << mp->m_sb.sb_inodelog); - -/* -* If the inode number maps to a block outside the bounds -* of the file system then return NULL rather than calling -* read_buf and panicing when we get an error from the -* driver. -*/ -if (imap->im_blkno + -XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster) > -XFS_FSB_TO_BB (mp, mp->m_sb.sb_dblocks)) { -xfs_alert (mp, -"%s: (im_blkno (0x%llx) + len (0x%x)) > sb_dblocks (0x%llx)" , - __func__, imap->im_blkno, -XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster), -XFS_FSB_TO_BB (mp, mp->m_sb.sb_dblocks)); +if (imap->im_agbno +M_IGEO (mp)->blocks_per_cluster > +pag_group (pag)->xg_block_count) { +xfs_alert (mp,"inode cluster out of range: %u/%u > %u" , + imap->im_agbno,M_IGEO (mp)->blocks_per_cluster, +pag_group (pag)->xg_block_count);return -EINVAL ; }return 0 ;
libxfs/xfs_inode_buf.c +6 -5
@@ -124,19 +124,20 @@ const struct xfs_buf_ops xfs_inode_buf_ra_ops = {*/ int xfs_read_icluster ( -struct xfs_mount *mp, +struct xfs_perag *pag,struct xfs_trans *tp, -xfs_daddr_t bno, +xfs_agblock_t agbno,struct xfs_buf **bpp) { +struct xfs_mount *mp =pag_mount (pag);int error; - error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, bno, + error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, +xfs_agbno_to_daddr (pag, agbno),XFS_FSB_TO_BB (mp,M_IGEO (mp)->blocks_per_cluster),0 , bpp, &xfs_inode_buf_ops);if (xfs_metadata_is_sick (error)) -xfs_agno_mark_sick (mp,xfs_daddr_to_agno (mp, bno), -XFS_SICK_AG_INODES ); +xfs_agno_mark_sick (mp,pag_agno (pag),XFS_SICK_AG_INODES );return error; }
libxfs/xfs_inode_buf.h +4 -4
@@ -14,12 +14,12 @@ struct xfs_dinode;* xfs_read_icluster() to get a buffer and dinode for a given inode. */ struct xfs_imap { -xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -unsigned short im_boffset;/* inode offset in block in bytes */ +xfs_agblock_t im_agbno;/* starting agbno of inode cluster */ +unsigned short im_boffset;/* offset in inode cluster in bytes */ }; -int xfs_read_icluster (struct xfs_mount *mp,struct xfs_trans *tp, -xfs_daddr_t bno,struct xfs_buf **bpp); +int xfs_read_icluster (struct xfs_perag *pag,struct xfs_trans *tp, +xfs_agblock_t agbno,struct xfs_buf **bpp);void xfs_dinode_calc_crc (struct xfs_mount *mp,struct xfs_dinode *dip);void xfs_inode_to_disk (struct xfs_inode *ip,struct xfs_dinode *to,xfs_lsn_t lsn);
repair/bmap_repair.c +5 -1
@@ -745,6 +745,7 @@ rebuild_bmap(xfs_daddr_t bp_bn;int bp_length;int error, err2; +struct xfs_perag *pag; bp_bn =xfs_buf_daddr (*ino_bpp); bp_length = (*ino_bpp)->b_length;
@@ -821,7 +822,10 @@ rebuild_bmap(* Rebuilding the inode fork rolled the transaction, so we need to * re-grab the inode cluster buffer and dinode pointer for the caller. */ - err2 = -libxfs_imap_to_bp (mp,NULL , &sc.ip->i_imap, ino_bpp); + pag =libxfs_perag_get (sc.ip->i_mount,XFS_INODE_TO_AGNO (sc.ip)); + err2 = -libxfs_read_icluster (pag,NULL , sc.ip->i_imap.im_agbno, + ino_bpp); +libxfs_perag_put (pag);if (err2) do_error( _("Unable to re-grab inode cluster buffer after failed repair of inode %llu, error %d.\n"),
Signature · 1 line
2.55.0
PATCH 13/21 xfs: mark struct xfs_imap as __packed
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 4f16139d8e296ec5403c3ebbe874dcd5c57648ca
This returns 2 bytes of padding at the to struct xfs_inode into which this structure is embedded.
--- libxfs/xfs_inode_buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/xfs_inode_buf.h +1 -1
@@ -16,7 +16,7 @@ struct xfs_dinode;struct xfs_imap {xfs_agblock_t im_agbno;/* starting agbno of inode cluster */ unsigned short im_boffset;/* offset in inode cluster in bytes */ -}; +} __packed;int xfs_read_icluster (struct xfs_perag *pag,struct xfs_trans *tp,xfs_agblock_t agbno,struct xfs_buf **bpp);
Signature · 1 line
2.55.0
PATCH 14/21 xfs: fix pointer arithmetic error on 32-bit systems
In reply to Andrey AlbershteynFrom: "Darrick J. Wong" <[email protected]>
Source kernel commit: 84eec3f7fc73144d1a230c9e8ad92721e37dcaab
The translation of the old XFS_BMBT_KEY_ADDR macro into a static function is not correct on 32-bit systems because the sizeof() argument went from being a xfs_bmbt_key_t (i.e. a struct) to a (struct xfs_bmbt_key *) (i.e. a pointer to the same struct). On 64-bit systems this turns out ok because they are the same size, but on 32-bit systems this is catastrophic because they are not the same size. So far there have been no complaints, most likely because the xfs developers urge against running it on 32-bit systems. But this needs fixing asap.
--- libxfs/xfs_bmap_btree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/xfs_bmap_btree.h +1 -1
@@ -89,7 +89,7 @@ xfs_bmbt_key_addr( {return (struct xfs_bmbt_key *) ((char *)block +xfs_bmbt_block_len (mp) + - (index -1 ) *sizeof (struct xfs_bmbt_key *)); + (index -1 ) *sizeof (struct xfs_bmbt_key )); } static inline xfs_bmbt_ptr_t *
Signature · 1 line
2.55.0
PATCH 15/21 xfs: pass back updated nb from xfs_growfs_compute_deltas
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: 4cb6e89a3d901d4da515977e55f9a9a779238660
xfs_growfs_compute_deltas can update nb for corner cases like a number of blocks that would create a less the minimal sized AG, or running past the max AG limit. Pass back the calculated value to the caller, as it relies on to calculate the new number of perag structures.
Note that the grown file system size is not affected by this miscalculation as it uses the passed back delta value.
--- libxfs/xfs_ag.c | 10 +++++----- libxfs/xfs_ag.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
libxfs/xfs_ag.c +5 -5
@@ -864,7 +864,7 @@ resv_err:void xfs_growfs_compute_deltas (struct xfs_mount *mp, -xfs_rfsblock_t nb, +xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp) {
@@ -872,19 +872,19 @@ xfs_growfs_compute_deltas(int64_t delta;xfs_agnumber_t nagcount; - nb_div = nb; + nb_div = *nb; nb_mod =do_div (nb_div, mp->m_sb.sb_agblocks);if (nb_mod && nb_mod >=XFS_MIN_AG_BLOCKS ) nb_div++;else if (nb_mod) - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks;if (nb_div >XFS_MAX_AGNUMBER +1 ) { nb_div =XFS_MAX_AGNUMBER +1 ; - nb = nb_div * mp->m_sb.sb_agblocks; + *nb = nb_div * mp->m_sb.sb_agblocks; } nagcount = nb_div; - delta = nb - mp->m_sb.sb_dblocks; + delta = *nb - mp->m_sb.sb_dblocks; *deltap = delta; *nagcountp = nagcount; }
libxfs/xfs_ag.h +1 -1
@@ -330,7 +330,7 @@ int xfs_ag_init_headers(struct xfs_mount *mp, struct aghdr_init_data *id);int xfs_ag_shrink_space (struct xfs_perag *pag,struct xfs_trans **tpp,xfs_extlen_t delta);void -xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t nb, +xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t *nb,int64_t *deltap,xfs_agnumber_t *nagcountp);int xfs_ag_extend_space (struct xfs_perag *pag,struct xfs_trans *tp,xfs_extlen_t len);
Signature · 1 line
2.55.0
PATCH 16/21 xfs: cleanup xfs_growfs_compute_deltas
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: dfac6ba84819bd12535943c4090766bbc6c5ea7e
xfs_growfs_compute_deltas has an odd calling conventions, and looks very convoluted due to the use of do_div and strangely named and typed variables.
Rename it, make it return the agcount and let the caller calculate the delta. The internally use the better div_u64_rem helper and descriptive variable names and types. Also add a comment describing what the function is used for.
--- libxfs/xfs_ag.c | 42 ++++++++++++++++++++---------------------- libxfs/xfs_ag.h | 5 ++--- 2 files changed, 22 insertions(+), 25 deletions(-)
libxfs/xfs_ag.c +20 -22
@@ -861,32 +861,30 @@ resv_err:return err2; } -void -xfs_growfs_compute_deltas ( +/* +* Return the agcount for the new file system size passed in *nb and adjust *nb +* when it has to be reduced because of maximum AG count or because it would +* create a below minimum size AG. +*/ +xfs_agnumber_t +xfs_growfs_compute_agcount (struct xfs_mount *mp, -xfs_rfsblock_t *nb, -int64_t *deltap, -xfs_agnumber_t *nagcountp) +xfs_rfsblock_t *nb) { -xfs_rfsblock_t nb_div, nb_mod; -int64_t delta; -xfs_agnumber_t nagcount; +uint64_t agcount;/* 64-bits wide to catch overflows */ +xfs_extlen_t remainder; - nb_div = *nb; - nb_mod =do_div (nb_div, mp->m_sb.sb_agblocks); -if (nb_mod && nb_mod >=XFS_MIN_AG_BLOCKS ) - nb_div++; -else if (nb_mod) - *nb = nb_div * mp->m_sb.sb_agblocks; - -if (nb_div >XFS_MAX_AGNUMBER +1 ) { - nb_div =XFS_MAX_AGNUMBER +1 ; - *nb = nb_div * mp->m_sb.sb_agblocks; + agcount =div_u64_rem (*nb, mp->m_sb.sb_agblocks, &remainder); +if (agcount >=XFS_MAX_AGNUMBER +1 ) { + agcount =XFS_MAX_AGNUMBER +1 ; + remainder =0 ; + } + *nb = (xfs_rfsblock_t )agcount * mp->m_sb.sb_agblocks; +if (remainder >=XFS_MIN_AG_BLOCKS ) { + *nb += remainder; + agcount++; } - nagcount = nb_div; - delta = *nb - mp->m_sb.sb_dblocks; - *deltap = delta; - *nagcountp = nagcount; +return agcount; }/*
libxfs/xfs_ag.h +2 -3
@@ -329,12 +329,11 @@ struct aghdr_init_data {int xfs_ag_init_headers (struct xfs_mount *mp,struct aghdr_init_data *id);int xfs_ag_shrink_space (struct xfs_perag *pag,struct xfs_trans **tpp,xfs_extlen_t delta); -void -xfs_growfs_compute_deltas (struct xfs_mount *mp,xfs_rfsblock_t *nb, -int64_t *deltap,xfs_agnumber_t *nagcountp);int xfs_ag_extend_space (struct xfs_perag *pag,struct xfs_trans *tp,xfs_extlen_t len);int xfs_ag_get_geometry (struct xfs_perag *pag,struct xfs_ag_geometry *ageo); +xfs_agnumber_t xfs_growfs_compute_agcount (struct xfs_mount *mp, +xfs_rfsblock_t *nb);static inline xfs_fsblock_t xfs_agbno_to_fsb(
Signature · 1 line
2.55.0
PATCH 17/21 xfs: fix memory leak in xfs_dqinode_metadir_create()
In reply to Andrey AlbershteynFrom: Dawei Feng <[email protected]>
Source kernel commit: 45de375b25060edf46e20abb36521ba530336ceb
If xfs_metadir_create() fails in xfs_dqinode_metadir_create(), the current code returns directly, leaking the allocated update and transaction state. If the subsequent commit fails, the caller-owned inode reference is left behind.
Fix this memory leak by routing the create failure path through xfs_metadir_cancel(). For both create and commit failures, finish and release any inode returned to the caller, mirroring the unwind pattern in xfs_metadir_mkdir().
The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1.1.
An x86_64 allyesconfig build showed no new warnings. Runtime validation used kprobe fault injection during mount -o uquota on a metadir XFS image. Injecting xfs_metadir_create() reproduced the old active-update path that left mount stuck later in mount setup; after this change, the same injection reported cancel_hits=1 and irele_hits=1. Injecting xfs_metadir_commit() exercised the old inode-reference leak path; after this change, it reported irele_hits=1.
--- libxfs/xfs_dquot_buf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
libxfs/xfs_dquot_buf.c +12 -2
@@ -434,17 +434,27 @@ xfs_dqinode_metadir_create( error =xfs_metadir_create (&upd,S_IFREG );if (error) -return error; + goto out_cancel;xfs_trans_log_inode (upd.tp, upd.ip,XFS_ILOG_CORE ); error =xfs_metadir_commit (&upd);if (error) -return error; + goto out_irele;xfs_finish_inode_setup (upd.ip); *ipp = upd.ip;return 0 ; + +out_cancel: +xfs_metadir_cancel (&upd, error); +out_irele: +/* Have to finish setting up the inode to ensure it's deleted. */ +if (upd.ip) { +xfs_finish_inode_setup (upd.ip); +xfs_irele (upd.ip); + } +return error; }#ifndef __KERNEL__
Signature · 1 line
2.55.0
PATCH 18/21 xfs: fix null pointer dereference in tracepoint
In reply to Andrey AlbershteynSource kernel commit: 9202ee546b0cd71004eed7598546efe4660097da
If dfp is not NULL we exit early here, when dfp is NULL it's allocated in xfs_defer_alloc() but not assigned. The tracepoint tries to dereference members of dfp struct.
--- libxfs/xfs_defer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/xfs_defer.c +1 -1
@@ -871,7 +871,7 @@ xfs_defer_add_barrier(if (dfp)return ; -xfs_defer_alloc (&tp->t_dfops, &xfs_barrier_defer_type); + dfp =xfs_defer_alloc (&tp->t_dfops, &xfs_barrier_defer_type);trace_xfs_defer_add_item (tp->t_mountp, dfp,NULL ); }
Signature · 1 line
2.55.0
PATCH 19/21 xfs: fix off-by-one in rtrefcount btree root level validation
In reply to Andrey AlbershteynFrom: Xiang Mei <[email protected]>
Source kernel commit: cc3144da377de5fb422d44a2311f978623f7c900
xfs_rtrefcountbt_compute_maxlevels() sets
mp->m_rtrefc_maxlevels = min(d_maxlevels, r_maxlevels) + 1;
where the trailing "+ 1" already accounts for the inode-root level, so the deepest valid on-disk root level is m_rtrefc_maxlevels - 1 and a cursor must satisfy bc_nlevels <= bc_maxlevels (= m_rtrefc_maxlevels).
The two on-disk validation paths, xfs_rtrefcountbt_verify() and xfs_iformat_rtrefcount(), check the root level with ">" instead of ">=", so a crafted rtreflink (metadir + realtime + reflink) image whose /rtgroups/N.refcount inode has bb_level == m_rtrefc_maxlevels is accepted on mount. xfs_rtrefcountbt_init_cursor() then sets bc_nlevels = bb_level + 1, exceeding bc_maxlevels by one. Since the xfs_rtrefcountbt_cur slab object is sized for exactly bc_maxlevels entries, the first btree op on such a cursor indexes bc_levels[m_rtrefc_maxlevels] past the end of the object. This is reached by the first rtrefcount cursor built after mount, via log/CoW recovery (xfs_reflink_recover_cow() during xfs_mountfs()) or an FS_IOC_GETFSMAP over the realtime device.
Reject a root level equal to m_rtrefc_maxlevels, matching the ">=" form already used by the sibling data-device refcount/rmap verifiers and the in-memory rtrmap verifier.
BUG: KASAN: slab-out-of-bounds in xfs_btree_lookup (fs/xfs/libxfs/xfs_btree.c:2101) Write of size 2 at addr ffff888018391658 by task exploit/144
xfs_btree_lookup (fs/xfs/libxfs/xfs_btree.c:2101) xfs_btree_query_range (fs/xfs/libxfs/xfs_btree.c:5308) xfs_refcount_recover_cow_leftovers (fs/xfs/libxfs/xfs_refcount.c:2113) xfs_reflink_recover_cow (fs/xfs/xfs_reflink.c:1085) xlog_recover_finish (fs/xfs/xfs_log_recover.c:3551) xfs_mountfs (fs/xfs/xfs_mount.c:1158)xfs_fs_fill_super (fs/xfs/xfs_super.c:1940) get_tree_bdev_flags (fs/super.c:1634)vfs_get_tree (fs/super.c:1694)path_mount (fs/namespace.c:4161)__x64_sys_mount (fs/namespace.c:4367) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
The buggy address belongs to the cache xfs_rtrefcountbt_cur of size 216 The buggy address is located 8 bytes to the right of allocated 216-byte region [ffff888018391578, ffff888018391650) Kernel panic - not syncing: Fatal exception
--- libxfs/xfs_rtrefcount_btree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libxfs/xfs_rtrefcount_btree.c +2 -2
@@ -199,7 +199,7 @@ xfs_rtrefcountbt_verify(if (fa)return fa; level =be16_to_cpu (block->bb_level); -if (level > mp->m_rtrefc_maxlevels) +if (level >= mp->m_rtrefc_maxlevels)return __this_address;return xfs_btree_fsblock_verify (bp, mp->m_rtrefc_mxr[level !=0 ]);
@@ -649,7 +649,7 @@ xfs_iformat_rtrefcount( numrecs =be16_to_cpu (dfp->bb_numrecs); level =be16_to_cpu (dfp->bb_level); -if (level > mp->m_rtrefc_maxlevels || +if (level >= mp->m_rtrefc_maxlevels ||xfs_rtrefcount_droot_space_calc (level, numrecs) > dsize) {xfs_inode_mark_sick (ip,XFS_SICK_INO_CORE );return -EFSCORRUPTED ;
Signature · 1 line
2.55.0
PATCH 20/21 xfs: fix exchange-range reflink flag clearing issue with INO1_WRITTEN
In reply to Andrey AlbershteynFrom: Lin Jiapeng <[email protected]>
Source kernel commit: b2d5a81dae385333f9734910277fbf94c78bd17f
When exchanging two full-file ranges, xmi_can_exchange_reflink_flags() can move the reflink inode flag from the file that currently has it to the other file, as long as exactly one side is marked. This assumes that the file contents, and therefore all shared extents, are exchanged.
That assumption is not true when XFS_EXCHMAPS_INO1_WRITTEN is set. xfs_exchmaps_can_skip_mapping() can skip hole and unwritten mappings from file1, so an exchange can complete without moving every mapping that the earlier flag-swap decision accounted for. In that case the post-operation cleanup can clear the reflink flag from an inode that still owns shared written extents. Later writes then take the non-reflink write path and may update blocks that should still have been protected by CoW, which shows up as data corruption between reflink-related files.
Fix this by disabling the reflink flag exchange whenever XFS_EXCHMAPS_INO1_WRITTEN is requested. The contents exchange can still proceed; the conservative outcome is that both inodes keep the reflink flag. The regular reflink flag cleanup path can drop the extra flag later once the inode no longer has shared extents.
--- libxfs/xfs_exchmaps.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
libxfs/xfs_exchmaps.c +10 -0
@@ -956,6 +956,16 @@ xmi_can_exchange_reflink_flags( {struct xfs_mount *mp = req->ip1->i_mount; +/* +* The INO1_WRITTEN optimization can skip exchanging hole and +* unwritten mappings, which means we cannot guarantee that all +* shared extents actually moved to the other file. Clearing the +* reflink flag of an inode that still holds shared extents breaks +* the CoW write path, so refuse to exchange the flags in that case. +*/ +if (req->flags &XFS_EXCHMAPS_INO1_WRITTEN ) +return false; +if (hweight32 (reflink_state) !=1 )return false;if (req->startoff1 !=0 || req->startoff2 !=0 )
Signature · 1 line
2.55.0
PATCH 21/21 xfs: check v5 superblock features early
In reply to Andrey AlbershteynFrom: Christoph Hellwig <[email protected]>
Source kernel commit: eb6b2cc1fc8ad566d746d128a559989ff0bba5cc
When working on a new features that reuses the existing pad in the superblock, I noticed that mounting such a file system on an old kernel logs a rather confusing warning:
XFS (vdc): Metadir superblock padding fields must be zero.
This is because we only validate the various feature fields in v5 superblocks after the common superblock validation helper is called.
Fix this by calling the feature validation first.
--- libxfs/xfs_sb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libxfs/xfs_sb.c +3 -3
@@ -1116,10 +1116,10 @@ xfs_sb_read_verify(* because _verify_common checks the on-disk values. */ __xfs_sb_from_disk (&sb, dsb, false); - error =xfs_validate_sb_common (mp, bp, &sb); -if (error) - goto out_error; error =xfs_validate_sb_read (mp, &sb); +if (error) + goto out_error; + error =xfs_validate_sb_common (mp, bp, &sb); out_error:if (error == -EFSCORRUPTED || error == -EFSBADCRC )
Signature · 1 line
2.55.0
Quoted 9 lines · Andrey Albershteyn
Hi all,
This is libxfs sync for v7.1..v7.2.
The conflicts for this sync were in missing
FS_XFLAG_CASEFOLDandFS_XFLAG_CASENONPRESERVINGflags, the replacement ofxfs_inode->i_inowithI_INO()macro, and removal ofxfs_imap_to_bp()in favor ofxfs_read_icluster().See Interdiff below.
<nod>
Quoted 150 lines
Andrey Albershteyn (1):
xfs: fix null pointer dereference in tracepointChristoph Hellwig (14):
xfs: add aXFS_INODE_TO_AGNOhelper
xfs: add aXFS_INODE_TO_AGINOhelper
xfs: add aXFS_INO_TO_FSBhelper
xfs: add axfs_rmap_inode_bmbt_owner
xfs: add axfs_rmap_inode_ownerhelper
xfs: remove thei_inofield in structxfs_inode
xfs: cleanupxfs_imap
xfs: removeim_lenfield in structxfs_imap
xfs: massagexfs_imap_to_bpintoxfs_read_icluster
xfs: store an agbno in structxfs_imap
xfs: mark structxfs_imapas__packed
xfs: pass back updated nb fromxfs_growfs_compute_deltas
xfs: cleanupxfs_growfs_compute_deltas
xfs: check v5 superblock features earlyChuck Lever (1):
xfs: Report case sensitivity infileattr_getDarrick J. Wong (1):
xfs: fix pointer arithmetic error on 32-bit systemsDawei Feng (1):
xfs: fix memory leak inxfs_dqinode_metadir_create()Lin Jiapeng (1):
xfs: fix exchange-range reflink flag clearing issue withINO1_WRITTENXiang Mei (1):
xfs: fix off-by-one in rtrefcount btree root level validationYingjie Gao (1):
xfs: fix exchmaps reservation limit checkdb/attrset.c | 2 +- db/bmap_inflate.c | 4 +- db/dquot.c | 2 +- db/iunlink.c | 12 ++-- db/namei.c | 14 ++-- db/rdump.c | 2 +- include/linux.h | 5 ++ include/xfs_inode.h | 7 +- libxfs/defer_item.c | 2 +- libxfs/inode.c | 10 +-- libxfs/iunlink.c | 4 +- libxfs/libxfs_api_defs.h | 2 +- libxfs/listxattr.c | 4 +- libxfs/logitem.c | 10 ++- libxfs/util.c | 2 +- libxfs/xfs_ag.c | 42 ++++++----- libxfs/xfs_ag.h | 5 +- libxfs/xfs_attr.c | 2 +- libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_bmap.c | 20 +++--- libxfs/xfs_bmap_btree.c | 8 +-- libxfs/xfs_bmap_btree.h | 2 +- libxfs/xfs_btree.c | 18 +++-- libxfs/xfs_btree_staging.c | 2 +- libxfs/xfs_da_btree.c | 2 +- libxfs/xfs_defer.c | 2 +- libxfs/xfs_dir2.c | 44 ++++++------ libxfs/xfs_dir2_node.c | 2 +- libxfs/xfs_dir2_sf.c | 4 +- libxfs/xfs_dquot_buf.c | 14 +++- libxfs/xfs_exchmaps.c | 20 ++++-- libxfs/xfs_format.h | 6 ++ libxfs/xfs_ialloc.c | 90 ++++++++++-------------- libxfs/xfs_inode_buf.c | 24 +++---- libxfs/xfs_inode_buf.h | 13 ++-- libxfs/xfs_inode_fork.c | 6 +- libxfs/xfs_inode_util.c | 15 ++-- libxfs/xfs_metadir.c | 2 +- libxfs/xfs_parent.c | 8 +-- libxfs/xfs_parent.h | 2 +- libxfs/xfs_rmap.c | 6 +- libxfs/xfs_rmap.h | 4 ++ libxfs/xfs_rtbitmap.c | 4 +- libxfs/xfs_rtrefcount_btree.c | 8 +-- libxfs/xfs_rtrmap_btree.c | 4 +- libxfs/xfs_sb.c | 6 +- libxfs/xfs_symlink_remote.c | 6 +- mkfs/proto.c | 16 ++--- repair/bmap_repair.c | 12 ++-- repair/bulkload.c | 2 +- repair/phase6.c | 128 +++++++++++++++++----------------- repair/pptr.c | 100 +++++++++++++------------- repair/quotacheck.c | 8 +-- repair/rt.c | 6 +- repair/rtrefcount_repair.c | 2 +- repair/rtrmap_repair.c | 2 +- repair/xfs_repair.c | 2 +- 57 files changed, 391 insertions(+), 362 deletions(-)Interdiff:
db/attrset.c +1
-1@@ -701,7 +701,7 @@ attrlist_print( .whichfork = XFS_ATTR_FORK, .op_flags = XFS_DA_OP_OKNOENT, .dp = ip, - .owner = ip->i_ino, + .owner = I_INO(ip), .trans = tp, .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .name = name,db/bmap_inflate.c +2
-2@@ -176,7 +176,7 @@ alloc_bmbt_blocks( target =XFS_AGB_TO_FSB (mp, tgt_agno,0 ); } -libxfs_rmap_ino_bmbt_owner (&args.oinfo, ip->i_ino, +libxfs_rmap_ino_bmbt_owner (&args.oinfo,I_INO (ip),XFS_DATA_FORK ); error = -libxfs_alloc_vextent_start_ag (&args, target);@@ -421,7 +421,7 @@ estimate_size( report:dbprintf (_ ("ino 0x%llx nextents %llu btblocks %llu btheight %u dirty %u\n" ), - ip->i_ino, nextents, bmap_bload.nr_blocks, +I_INO (ip), nextents, bmap_bload.nr_blocks, bmap_bload.btree_height, dirty_blocks);return 0 ;db/dquot.c +1
-1@@ -104,7 +104,7 @@ dqtype_to_inode(if (error) goto out_dp; - ret = ip->i_ino; + ret =I_INO (ip);libxfs_irele (ip); out_dp:if (dp)db/iunlink.c +0
-0
db/iunlink.c count_rtblocks( · line 26
Quoted 7 lines
db/iunlink.c +2
-2@@ -22,8 +22,8 @@ count_rtblocks(if (error) { dbprintf( _("could not read AG %u agino %u extents, err=%d\n"), - XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino), - XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino), + XFS_INO_TO_AGNO(ip->i_mount, I_INO(ip)), + XFS_INO_TO_AGINO(ip->i_mount, I_INO(ip)),
XFS_INODE_TO_{AGNO,AGINO} ?
db/iunlink.c get_next_unlinked( · line 49
Quoted 8 lines
db/iunlink.c +1
-0error);return 0 ; }@@ -46,6 +46,7 @@ get_next_unlinked(xfs_ino_t ino;xfs_agino_t ret;int error; +struct xfs_perag *pag =libxfs_perag_get (mp, agno);
Grabbing it here leaks the pag reference if iget fails; I put it right before the libxfs_read_icluster call.
Quoted 13 lines
db/iunlink.c +2
-1ino =XFS_AGINO_TO_INO (mp, agno, agino); error = -libxfs_iget (mp,NULL , ino,0 , &ip);@@ -65,7 +66,8 @@ get_next_unlinked(dbprintf ("\n" ); } - error = -libxfs_imap_to_bp (mp,NULL , &ip->i_imap, &ino_bp); + error = -libxfs_read_icluster (pag,NULL , ip->i_imap.im_agbno, &ino_bp); +libxfs_perag_put (pag);if (error) {libxfs_irele (ip); goto bad;
db/iunlink.c create_unlinked( · line 252
Quoted 7 lines
db/iunlink.c +2
-2@@ -246,8 +248,8 @@ create_unlinked(dbprintf (_ ("commit inode: %s\n" ),strerror (error));dbprintf (_ ("Created unlinked inode %llu in agno %u\n" ), - (unsigned long long )ip->i_ino, -XFS_INO_TO_AGNO (mp, ip->i_ino)); + (unsigned long long )I_INO (ip), +XFS_INO_TO_AGNO (mp,I_INO (ip)));
Here too.
Quoted 104 lines
db/iunlink.c +0
-0libxfs_irele (ip);return error; out_rele:db/namei.c +7
-7@@ -331,7 +331,7 @@ list_sfdir(/* . and .. entries */ off =xfs_dir2_db_off_to_dataptr (geo, geo->datablk, geo->data_entry_offset); - error =dir_emit (args->trans, args->dp, off,"." ,-1 , dp->i_ino, + error =dir_emit (args->trans, args->dp, off,"." ,-1 ,I_INO (dp),XFS_DIR3_FT_DIR , private);if (error)return error;@@ -503,7 +503,7 @@ listdir( .trans = tp, .dp = dp, .geo = dp->i_mount->m_dir_geo, - .owner = dp->i_ino, + .owner = I_INO(dp), };int error;@@ -748,7 +748,7 @@ list_leaf_pptrs(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip),0 , &leaf_bp);if (error)return error;@@ -846,7 +846,7 @@ list_node_pptrs(libxfs_trans_brelse (NULL , leaf_bp); - error = -libxfs_attr3_leaf_read (NULL , ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (NULL , ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error)return error;@@ -1062,7 +1062,7 @@ create_child(libxfs_trans_ijoin (tp, dp,0 );libxfs_trans_ijoin (tp, ip,0 ); - error = -libxfs_dir_createname (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_createname (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;@@ -1076,7 +1076,7 @@ create_child(/* Replace the dotdot entry in the child directory. */ if (isdir) { error = -libxfs_dir_replace (tp, ip, &xfs_name_dotdot, - dp->i_ino, resblks); +I_INO (dp), resblks);if (error) goto out_trans; }@@ -1287,7 +1287,7 @@ remove_child(if (error) goto out_trans; - error = -libxfs_dir_removename (tp, dp, &xname, ip->i_ino, resblks); + error = -libxfs_dir_removename (tp, dp, &xname,I_INO (ip), resblks);if (error) goto out_trans;db/rdump.c +1
-1@@ -376,7 +376,7 @@ rdump_xattr( .trans = tp, .dp = ip, .geo = mp->m_attr_geo, - .owner = ip->i_ino, + .owner = I_INO(ip), .attr_filter = attr_flags & XFS_ATTR_NSP_ONDISK_MASK, .namelen = namelen, .name = name,include/linux.h +5
-0@@ -268,6 +268,11 @@ struct file_attr {#define RWF_DONTCACHE ((__kernel_rwf_t)0x00000080)#endif +#ifndef FS_XFLAG_CASEFOLD +#define FS_XFLAG_CASEFOLD 0x00040000/* case-insensitive lookups */ +#define FS_XFLAG_CASENONPRESERVING 0x00080000/* case not preserved */ +#endif +/* * Reminder: anything added to this file will be compiled into downstream * userspace projects! include/xfs_inode.h +0
-0
include/xfs_inode.h struct inode { · line 69
Quoted 4 lines
include/xfs_inode.h +1
-0@@ -66,6 +66,7 @@ struct inode {mode_t i_mode;kuid_t i_uid;kgid_t i_gid; +uint64_t i_ino;
I would put this after i_version for compactness, but that's mostly just me being nitpicky :)
Quoted 26 lines
include/xfs_inode.h +5
-1uint32_t i_nlink;xfs_dev_t i_rdev;/* This actually holds xfs_dev_t */ unsigned int i_count;@@ -218,7 +219,6 @@ static inline bool inode_wrong_type(const struct inode *inode, umode_t mode) typedef struct xfs_inode { struct cache_node i_node; struct xfs_mount *i_mount; /* fs mount struct ptr */ - xfs_ino_t i_ino; /* inode number (agno/agino) */ struct xfs_imap i_imap; /* location for xfs_imap() */ struct xfs_ifork *i_cowfp; /* copy on write extents */ struct xfs_ifork i_df; /* data fork */@@ -445,4 +445,9 @@ extern void libxfs_irele(struct xfs_inode *ip);#define xfs_inherit_nosymlinks (false)#define xfs_inherit_nodefrag (false) +static inline xfs_ino_t I_INO (const struct xfs_inode *ip) +{ +return VFS_IC (ip)->i_ino; +} +#endif /* __XFS_INODE_H__ */ libxfs/defer_item.c +0
-0
libxfs/defer_item.c xfs_bmap_update_diff_items( · line 566
Quoted 5 lines
libxfs/defer_item.c +1
-1@@ -563,7 +563,7 @@ xfs_bmap_update_diff_items(struct xfs_bmap_intent *ba =bi_entry (a);struct xfs_bmap_intent *bb =bi_entry (b); -return ba->bi_owner->i_ino - bb->bi_owner->i_ino; +return I_INO (ba->bi_owner) -I_INO (bb->bi_owner);
I did some cmp_init conversion for this file:
https://lore.kernel.org/linux-xfs/178302226322.845537.14974268104031687429.stgit@frogsfrogsfrogs/
Quoted 17 lines
libxfs/defer_item.c +0
-0}/* Get an BUI. */ libxfs/inode.c +1
-1@@ -151,7 +151,7 @@ libxfs_iget(return -ENOMEM ;VFS_I (ip)->i_count =1 ; - ip->i_ino = ino; +VFS_I (ip)->i_ino = ino; ip->i_mount = mp; ip->i_diflags2 = mp->m_ino_geo.new_diflags2; ip->i_af.if_format =XFS_DINODE_FMT_EXTENTS ;
libxfs/inode.c libxfs_iget( · line 162
Quoted 6 lines
libxfs/inode.c +1
-2@@ -159,8 +159,8 @@ libxfs_iget( ip->i_prev_unlinked =NULLAGINO ;spin_lock_init (&VFS_I (ip)->i_lock); - pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp, ip->i_ino)); - error =xfs_imap (pag, tp, ip->i_ino, &ip->i_imap,0 ); + pag =xfs_perag_get (mp,XFS_INO_TO_AGNO (mp,I_INO (ip)));
XFS_INODE_TO_AGNO
Quoted 41 lines
libxfs/inode.c +4
-1+ error =xfs_imap (pag, tp,I_INO (ip), &ip->i_imap,0 );xfs_perag_put (pag);if (error)@@ -182,7 +182,7 @@ libxfs_iget( }else {struct xfs_buf *bp; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &bp); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp);if (error) goto out_destroy;@@ -195,11 +195,13 @@ libxfs_iget(if (error) goto out_destroy; } +xfs_perag_put (pag); *ipp = ip;return 0 ; out_destroy: +xfs_perag_put (pag);kmem_cache_free (xfs_inode_cache, ip); *ipp =NULL ;return error;libxfs/iunlink.c +1
-1@@ -44,7 +44,7 @@ xfs_iunlink_log_dinode(int offset;int error; - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &ibp); + error =xfs_read_icluster (iup->pag, tp, ip->i_imap.im_agbno, &ibp);if (error)return error;/*
libxfs/iunlink.c xfs_iunlink_log_dinode( · line 69
Quoted 5 lines
libxfs/iunlink.c +1
-1@@ -66,7 +66,7 @@ xfs_iunlink_log_dinode( } trace_xfs_iunlink_update_dinode(mp, pag_agno(iup->pag), - XFS_INO_TO_AGINO(mp, ip->i_ino), + XFS_INO_TO_AGINO(mp, I_INO(ip)),
XFS_INODE_TO_AGINO
Quoted 1,059 lines
libxfs/iunlink.c +0
-0be32_to_cpu (dip->di_next_unlinked), iup->next_agino);libxfs/libxfs_api_defs.h +1
-1@@ -200,7 +200,7 @@#define xfs_iext_lookup_extent libxfs_iext_lookup_extent#define xfs_iext_next libxfs_iext_next#define xfs_ifork_zap_attr libxfs_ifork_zap_attr -#define xfs_imap_to_bp libxfs_imap_to_bp +#define xfs_read_icluster libxfs_read_icluster#define xfs_initialize_perag libxfs_initialize_perag#define xfs_initialize_perag_data libxfs_initialize_perag_datalibxfs/listxattr.c +2
-2@@ -101,7 +101,7 @@ xattr_walk_leaf(struct xfs_buf *leaf_bp;int error; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino,0 , &leaf_bp); + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip),0 , &leaf_bp);if (error)return error;@@ -231,7 +231,7 @@ xattr_walk_node(if (bitmap_test (seen_blocks, leafhdr.forw,1 )) goto out_bitmap; - error = -libxfs_attr3_leaf_read (tp, ip, ip->i_ino, + error = -libxfs_attr3_leaf_read (tp, ip,I_INO (ip), leafhdr.forw, &leaf_bp);if (error) goto out_bitmap;libxfs/logitem.c +7
-3@@ -16,6 +16,7 @@#include "xfs_inode.h" #include "xfs_trans.h" #include "xfs_rtbitmap.h" +#include "xfs_ag.h" struct kmem_cache *xfs_buf_item_cache;struct kmem_cache *xfs_ili_cache;/* inode log item cache */ @@ -140,7 +141,7 @@ static uint64_txfs_inode_item_sort ( struct xfs_log_item *lip) { -return INODE_ITEM (lip)->ili_inode->i_ino; +return I_INO (INODE_ITEM (lip)->ili_inode); }/* @@ -248,6 +249,7 @@ xfs_inode_item_precommit( }if (!iip->ili_item.li_buf) { +struct xfs_perag *pag;struct xfs_buf *bp;int error;@@ -261,7 +263,9 @@ xfs_inode_item_precommit(* here. */ spin_unlock (&iip->ili_lock); - error =xfs_imap_to_bp (ip->i_mount, tp, &ip->i_imap, &bp); + pag =xfs_perag_get (ip->i_mount,XFS_INODE_TO_AGNO (ip)); + error =xfs_read_icluster (pag, tp, ip->i_imap.im_agbno, &bp); +xfs_perag_put (pag);if (error)return error;@@ -316,7 +320,7 @@ xfs_inode_item_init( iip = ip->i_itemp =kmem_cache_zalloc (xfs_ili_cache,0 );#ifdef LI_DEBUG fprintf (stderr,"inode_item_init for inode %llu, iip=%p\n" , - ip->i_ino, iip); +I_INO (ip), iip);#endif spin_lock_init (&iip->ili_lock);libxfs/util.c +1
-1@@ -343,7 +343,7 @@ xfs_inode_verifier_error(xfs_alert (NULL ,"Metadata %s detected at %p, inode 0x%llx %s" , error == -EFSBADCRC ?"CRC error" :"corruption" , failaddr ? failaddr : __return_address, - ip->i_ino, name); +I_INO (ip), name); }/* libxfs/xfs_log_format.h +0
-13@@ -52,19 +52,6 @@ typedef uint32_t xlog_tid_t;#define CYCLE_LSN (lsn) ((uint)((lsn)>>32))#define BLOCK_LSN (lsn) ((uint)(lsn)) -/* -* By comparing each component, we don't have to worry about extra endian issues -* in treating two 32 bit numbers as one 64 bit number -*/ -static inline xfs_lsn_t XFS_LSN_CMP (xfs_lsn_t lsn1,xfs_lsn_t lsn2) -{ -if (CYCLE_LSN (lsn1) !=CYCLE_LSN (lsn2)) -return CYCLE_LSN (lsn1) <CYCLE_LSN (lsn2) ?-999 :999 ; -if (BLOCK_LSN (lsn1) !=BLOCK_LSN (lsn2)) -return BLOCK_LSN (lsn1) <BLOCK_LSN (lsn2) ?-999 :999 ; -return 0 ; -} -/* this is used in a spot where we might otherwise double-endian-flip */ #define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0])mkfs/proto.c +8
-8@@ -289,7 +289,7 @@ writesymlink(xfs_extlen_t nb =XFS_B_TO_FSB (mp, len);int error; - error = -libxfs_symlink_write_target (tp, ip, ip->i_ino, buf, len, nb, + error = -libxfs_symlink_write_target (tp, ip,I_INO (ip), buf, len, nb, nb);if (error) { fprintf(stderr,@@ -417,7 +417,7 @@ writeattr(struct xfs_da_args args = { .dp = ip, .geo = ip->i_mount->m_attr_geo, - .owner = ip->i_ino, + .owner =I_INO (ip), .whichfork =XFS_ATTR_FORK , .op_flags =XFS_DA_OP_OKNOENT , .value = valuebuf,@@ -548,7 +548,7 @@ newdirent( rsv =XFS_DIRENTER_SPACE_RES (mp, name->len); - error = -libxfs_dir_createname (tp, pip, name, ip->i_ino, rsv); + error = -libxfs_dir_createname (tp, pip, name,I_INO (ip), rsv);if (error)fail (_ ("directory createname error" ), error);@@ -927,7 +927,7 @@ parseproto(fail (_ ("Inode allocation failed" ), error);if (!pip) { pip = ip; - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp); isroot =1 ; }else {@@ -1057,10 +1057,10 @@ create_sb_metadata_file(switch (type) {case XFS_RTGI_BITMAP : - mp->m_sb.sb_rbmino = ip->i_ino; + mp->m_sb.sb_rbmino =I_INO (ip);break ;case XFS_RTGI_SUMMARY : - mp->m_sb.sb_rsumino = ip->i_ino; + mp->m_sb.sb_rsumino =I_INO (ip);break ;default : error =EFSCORRUPTED ;@@ -1634,7 +1634,7 @@ create_nondir_inode(* hardlink, so we need to store it. */ if (file_stat->st_nlink >1 ) -track_hardlink_inode (file_stat, ip->i_ino); +track_hardlink_inode (file_stat,I_INO (ip));libxfs_irele (ip); }@@ -1880,7 +1880,7 @@ populate_from_dir(if (error)fail (_ ("Inode allocation failed" ), error); - mp->m_sb.sb_rootino = ip->i_ino; + mp->m_sb.sb_rootino =I_INO (ip);libxfs_log_sb (tp);newdirectory (mp, tp, ip, ip);libxfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );repair/bmap_repair.c +8
-4@@ -134,7 +134,7 @@ xrep_bmap_walk_rmap(int error;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_fork_rmap (rb, cur, rec);@@ -252,7 +252,7 @@ xrep_bmap_walk_rtrmap(int error =0 ;/* Skip extents which are not owned by this inode and fork. */ -if (rec->rm_owner != rb->sc->ip->i_ino) +if (rec->rm_owner !=I_INO (rb->sc->ip))return 0 ; error =xrep_bmap_check_rtfork_rmap (rb->sc, cur, rec);@@ -576,7 +576,7 @@ xrep_bmap_build_new_fork(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino, rb->whichfork); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip), rb->whichfork);bulkload_init_inode (&rb->new_fork_info, sc, rb->whichfork, &oinfo); bmap_cur =libxfs_bmbt_init_cursor (sc->mp,NULL , sc->ip,XFS_STAGING_FORK );@@ -745,6 +745,7 @@ rebuild_bmap(xfs_daddr_t bp_bn;int bp_length;int error, err2; +struct xfs_perag *pag; bp_bn =xfs_buf_daddr (*ino_bpp); bp_length = (*ino_bpp)->b_length;@@ -821,7 +822,10 @@ rebuild_bmap(* Rebuilding the inode fork rolled the transaction, so we need to * re-grab the inode cluster buffer and dinode pointer for the caller. */ - err2 = -libxfs_imap_to_bp (mp,NULL , &sc.ip->i_imap, ino_bpp); + pag =libxfs_perag_get (sc.ip->i_mount,XFS_INODE_TO_AGNO (sc.ip)); + err2 = -libxfs_read_icluster (pag,NULL , sc.ip->i_imap.im_agbno, + ino_bpp); +libxfs_perag_put (pag);if (err2) do_error( _("Unable to re-grab inode cluster buffer after failed repair of inode %llu, error %d.\n"),repair/bulkload.c +1
-1@@ -32,7 +32,7 @@ bulkload_init_inode(int whichfork, const struct xfs_owner_info *oinfo) { - bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, sc->ip->i_ino)); + bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, I_INO(sc->ip))); bkl->ifake.if_fork =kmem_cache_zalloc (xfs_ifork_cache,0 ); bkl->ifake.if_fork_size =xfs_inode_fork_size (sc->ip, whichfork); }repair/phase6.c +64
-64@@ -277,7 +277,7 @@ dir_hash_check(if (seeval ==DIR_HASH_CK_OK )return 0 ;do_warn (_ ("bad hash table for directory inode %" PRIu64" (%s): " ), - ip->i_ino, seevalstr[seeval]); +I_INO (ip), seevalstr[seeval]);if (!no_modify)do_warn (_ ("rebuilding\n" ));else @@ -654,8 +654,8 @@ _("Couldn't create rtgroup %u %s inode, error %d\n"), ip = rtg->rtg_inodes[type];/* Mark the inode in use. */ -mark_ino_inuse (mp, ip->i_ino,S_IFREG , mp->m_rtdirip->i_ino); -mark_ino_metadata (mp, ip->i_ino); +mark_ino_inuse (mp,I_INO (ip),S_IFREG ,I_INO (mp->m_rtdirip)); +mark_ino_metadata (mp,I_INO (ip));return true; }@@ -786,7 +786,7 @@ mk_metadir(libxfs_trans_ijoin (tp, mp->m_metadirip,0 );libxfs_metafile_set_iflag (tp, mp->m_metadirip,XFS_METAFILE_DIR ); -mark_ino_metadata (mp, mp->m_metadirip->i_ino); +mark_ino_metadata (mp,I_INO (mp->m_metadirip)); error = -libxfs_trans_commit (tp);if (error)@@ -905,7 +905,7 @@ mk_orphanage(do_error (_ ("can't make %s, createname error %d\n" ),ORPHANAGE , error); -add_parent_ptr (du.ip->i_ino, (unsigned char *)ORPHANAGE , du.dp, false); +add_parent_ptr (I_INO (du.ip), (unsigned char *)ORPHANAGE , du.dp, false);/* * We bumped up the link count in the root directory to account @@ -974,7 +974,7 @@ trunc_metadata_inode(if (err)do_error (_ ("truncation of metadata inode 0x%llx failed, err=%d\n" ), - (unsigned long long )ip->i_ino, err); + (unsigned long long )I_INO (ip), err); }/* @@ -1008,7 +1008,7 @@ add_orphan_pptr( sizeof(struct xfs_attr_sf_hdr), true);if (error)do_error (_ ("can't add attr fork to inode 0x%llx\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); } error = -libxfs_parent_addname (tp, ppargs, orphanage_ip, xname, ip);@@ -1202,7 +1202,7 @@ mv_orphanage( }if (xfs_has_parent (mp)) -add_parent_ptr (ino_p->i_ino, xname.name, orphanage_ip, false); +add_parent_ptr (I_INO (ino_p), xname.name, orphanage_ip, false);libxfs_irele (ino_p);libxfs_irele (orphanage_ip);@@ -1303,10 +1303,10 @@ longform_dir2_rebuild(* orphanage later (the inode number here needs to be valid * for the libxfs_dir_init() call). */ - pip.i_ino =get_inode_parent (irec, ino_offset); -if (pip.i_ino ==NULLFSINO || -libxfs_dir_ino_validate (mp, pip.i_ino)) - pip.i_ino = mp->m_sb.sb_rootino; +VFS_I (&pip)->i_ino =get_inode_parent (irec, ino_offset); +if (I_INO (&pip) ==NULLFSINO || +libxfs_dir_ino_validate (mp,I_INO (&pip))) +VFS_I (&pip)->i_ino = mp->m_sb.sb_rootino; nres =libxfs_remove_space_res (mp,0 ); error = -libxfs_trans_alloc (mp, &M_RES (mp)->tr_remove, nres,0 ,0 , &tp);@@ -1317,7 +1317,7 @@ longform_dir2_rebuild( error =dir_binval (tp, ip,XFS_DATA_FORK );if (error)do_error (_ ("error %d invalidating directory %llu blocks\n" ), - error, (unsigned long long )ip->i_ino); + error, (unsigned long long )I_INO (ip));if ((error = -libxfs_bmap_last_offset (ip, &lastblock,XFS_DATA_FORK ))) do_error(_("xfs_bmap_last_offset failed -- error - %d\n"),@@ -1435,7 +1435,7 @@ dir2_kill_block( args.trans = tp; args.whichfork =XFS_DATA_FORK ; args.geo = mp->m_dir_geo; - args.owner = ip->i_ino; + args.owner =I_INO (ip);if (da_bno >= mp->m_dir_geo->leafblk && da_bno < mp->m_dir_geo->freeblk) error = -libxfs_da_shrink_inode (&args, da_bno, bp);else @@ -1443,7 +1443,7 @@ dir2_kill_block( xfs_dir2_da_to_db(mp->m_dir_geo, da_bno), bp);if (error)do_error (_ ("shrink_inode failed inode %" PRIu64" block %u\n" ), - ip->i_ino, da_bno); +I_INO (ip), da_bno); error = -libxfs_trans_commit (tp);if (error) do_error(@@ -1479,14 +1479,14 @@ check_longform_ftype(do_warn (_ ("would fix ftype mismatch (%d/%d) in directory/child inode %" PRIu64"/%" PRIu64"\n" ), dir_ftype, ino_ftype, - ip->i_ino, inum); +I_INO (ip), inum);return ; }do_warn (_ ("fixing ftype mismatch (%d/%d) in directory/child inode %" PRIu64"/%" PRIu64"\n" ), dir_ftype, ino_ftype, - ip->i_ino, inum); +I_INO (ip), inum);libxfs_dir2_data_put_ftype (mp, dep, ino_ftype);libxfs_dir2_data_log_entry (da, bp, dep);dir_hash_update_ftype (hashtab, addr, ino_ftype);@@ -1540,7 +1540,7 @@ longform_dir2_entry_check_data(struct xfs_da_args da = { .dp = ip, .geo = mp->m_dir_geo, - .owner = ip->i_ino, + .owner =I_INO (ip), };@@ -1633,11 +1633,11 @@ longform_dir2_entry_check_data(if (junkit) {do_warn (_ ("empty data block %u in directory inode %" PRIu64": " ), - da_bno, ip->i_ino); + da_bno,I_INO (ip)); }else {do_warn (_ ("corrupt block %u in directory inode %" PRIu64": " ), - da_bno, ip->i_ino); + da_bno,I_INO (ip)); }if (!no_modify) {do_warn (_ ("junking block\n" ));@@ -1663,7 +1663,7 @@ longform_dir2_entry_check_data(if (be32_to_cpu (d->magic) != wantmagic) {do_warn (_ ("bad directory block magic # %#x for directory inode %" PRIu64" block %d: " ), -be32_to_cpu (d->magic), ip->i_ino, da_bno); +be32_to_cpu (d->magic),I_INO (ip), da_bno);if (!no_modify) {do_warn (_ ("fixing magic # to %#x\n" ), wantmagic); d->magic =cpu_to_be32 (wantmagic);@@ -1691,7 +1691,7 @@ longform_dir2_entry_check_data(if (lastfree) {do_warn (_ ("directory inode %" PRIu64" block %u has consecutive free entries: " ), - ip->i_ino, da_bno); +I_INO (ip), da_bno);if (!no_modify) {do_warn (_ ("joining together\n" ));@@ -1737,7 +1737,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" in directory inode %" PRIu64" points to non-existent inode %" PRIu64", " ), - fname, ip->i_ino, inum,NULLFSINO )) { + fname,I_INO (ip), inum,NULLFSINO )) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1754,7 +1754,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" in directory inode %" PRIu64" points to free inode %" PRIu64", " ), - fname, ip->i_ino, inum,NULLFSINO )) { + fname,I_INO (ip), inum,NULLFSINO )) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1770,7 +1770,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" in regular dir %" PRIu64" points to a metadata inode %" PRIu64", " ), - fname, ip->i_ino, inum,NULLFSINO )) { + fname,I_INO (ip), inum,NULLFSINO )) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1786,7 +1786,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" in metadata dir %" PRIu64" points to a regular inode %" PRIu64", " ), - fname, ip->i_ino, inum,NULLFSINO )) { + fname,I_INO (ip), inum,NULLFSINO )) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1804,7 +1804,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("%s (ino %" PRIu64") in root (%" PRIu64") is not a directory, " ), -ORPHANAGE , inum, ip->i_ino,NULLFSINO )) { +ORPHANAGE , inum,I_INO (ip),NULLFSINO )) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1827,7 +1827,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" (ino %" PRIu64") in dir %" PRIu64" already points to ino %" PRIu64", " ), - fname, inum, ip->i_ino, dup_inum)) { + fname, inum,I_INO (ip), dup_inum)) { dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep); }@@ -1858,7 +1858,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" (ino %" PRIu64") in dir %" PRIu64" is not in the the first block, " ), fname, - inum, ip->i_ino,NULLFSINO )) { + inum,I_INO (ip),NULLFSINO )) {dir_hash_junkit (hashtab, addr); dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep);@@ -1881,7 +1881,7 @@ longform_dir2_entry_check_data(* '..' is already accounted for or will be taken care * of when directory is moved to orphanage. */ -if (ip->i_ino == inum) { +if (I_INO (ip) == inum) {ASSERT (no_modify || (dep->name[0 ] =='.' && dep->namelen ==1 ));add_inode_ref (current_irec, current_ino_offset);@@ -1891,7 +1891,7 @@ longform_dir2_entry_check_data( nbad++;if (entry_junked (_ ("entry \"%s\" in dir %" PRIu64" is not the first entry, " ), - fname, inum, ip->i_ino,NULLFSINO )) { + fname, inum,I_INO (ip),NULLFSINO )) {dir_hash_junkit (hashtab, addr); dep->name[0 ] ='/' ;libxfs_dir2_data_log_entry (&da, bp, dep);@@ -1944,8 +1944,8 @@ longform_dir2_entry_check_data( junkit =1 ;do_warn (_ ("entry \"%s\" in dir %" PRIu64" points to an already connected directory inode %" PRIu64"\n" ), - fname, ip->i_ino, inum); - }else if (parent == ip->i_ino) { + fname,I_INO (ip), inum); + }else if (parent ==I_INO (ip)) {add_inode_reached (irec, ino_offset);add_inode_ref (current_irec, current_ino_offset); }else if (parent ==NULLFSINO ) {@@ -1953,8 +1953,8 @@ _("entry \"%s\" in dir %" PRIu64" points to an already connected directory inodeso, set it as the parent and mark for rebuild */ do_warn (_ ("entry \"%s\" in dir ino %" PRIu64" doesn't have a .. entry, will set it in ino %" PRIu64".\n" ), - fname, ip->i_ino, inum); -set_inode_parent (irec, ino_offset, ip->i_ino); + fname,I_INO (ip), inum); +set_inode_parent (irec, ino_offset,I_INO (ip));add_inode_reached (irec, ino_offset);add_inode_ref (current_irec, current_ino_offset); add_dotdot_update(XFS_INO_TO_AGNO(mp, inum), irec,@@ -1963,7 +1963,7 @@ _("entry \"%s\" in dir %" PRIu64" points to an already connected directory inode junkit =1 ;do_warn (_ ("entry \"%s\" in dir inode %" PRIu64" inconsistent with .. value (%" PRIu64") in ino %" PRIu64"\n" ), - fname, ip->i_ino, parent, inum); + fname,I_INO (ip), parent, inum); }if (junkit) {if (inum == orphanage_ino)@@ -2086,12 +2086,12 @@ longform_dir2_check_leaf(if (error ==EFSBADCRC || error ==EFSCORRUPTED || fixit) {do_warn (_ ("leaf block %u for directory inode %" PRIu64" bad CRC\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));return 1 ; }else if (error) {do_error (_ ("can't read block %u for directory inode %" PRIu64", error %d\n" ), - da_bno, ip->i_ino, error); + da_bno,I_INO (ip), error);/* NOTREACHED */ }@@ -2108,13 +2108,13 @@ longform_dir2_check_leaf( (char *)&ents[leafhdr.count] > (char *)bestsp) {do_warn (_ ("leaf block %u for directory inode %" PRIu64" bad header\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }if (leafhdr.magic ==XFS_DIR3_LEAF1_MAGIC ) { - error =check_da3_header (mp, bp, ip->i_ino); + error =check_da3_header (mp, bp,I_INO (ip));if (error) {libxfs_buf_relse (bp);return error;@@ -2134,7 +2134,7 @@ longform_dir2_check_leaf(if (badtail) {do_warn (_ ("leaf block %u for directory inode %" PRIu64" bad tail\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }@@ -2195,7 +2195,7 @@ longform_dir2_check_node(if (error) {do_warn (_ ("can't read leaf block %u for directory inode %" PRIu64", error %d\n" ), - da_bno, ip->i_ino, error); + da_bno,I_INO (ip), error);return 1 ; } leaf = bp->b_addr;@@ -2207,7 +2207,7 @@ longform_dir2_check_node( leafhdr.magic == XFS_DA3_NODE_MAGIC)) {do_warn (_ ("unknown magic number %#x for block %u in directory inode %" PRIu64"\n" ), - leafhdr.magic, da_bno, ip->i_ino); + leafhdr.magic, da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }@@ -2215,7 +2215,7 @@ longform_dir2_check_node(/* check v5 metadata */ if (leafhdr.magic ==XFS_DIR3_LEAFN_MAGIC || leafhdr.magic ==XFS_DA3_NODE_MAGIC ) { - error =check_da3_header (mp, bp, ip->i_ino); + error =check_da3_header (mp, bp,I_INO (ip));if (error) {libxfs_buf_relse (bp);return error;@@ -2238,7 +2238,7 @@ longform_dir2_check_node( leafhdr.count < leafhdr.stale) {do_warn (_ ("leaf block %u for directory inode %" PRIu64" bad header\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }@@ -2270,7 +2270,7 @@ longform_dir2_check_node(if (error) {do_warn (_ ("can't read freespace block %u for directory inode %" PRIu64", error %d\n" ), - da_bno, ip->i_ino, error); + da_bno,I_INO (ip), error);return 1 ; } free = bp->b_addr;@@ -2285,13 +2285,13 @@ longform_dir2_check_node( freehdr.nvalid < freehdr.nused) {do_warn (_ ("free block %u for directory inode %" PRIu64" bad header\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }if (freehdr.magic ==XFS_DIR3_FREE_MAGIC ) { - error =check_dir3_header (mp, bp, ip->i_ino); + error =check_dir3_header (mp, bp,I_INO (ip));if (error) {libxfs_buf_relse (bp);return error;@@ -2303,7 +2303,7 @@ longform_dir2_check_node( be16_to_cpu(bests[i])) {do_warn (_ ("free block %u entry %i for directory ino %" PRIu64" bad\n" ), - da_bno, i, ip->i_ino); + da_bno, i,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }@@ -2313,7 +2313,7 @@ longform_dir2_check_node(if (used != freehdr.nused) {do_warn (_ ("free block %u for directory inode %" PRIu64" bad nused\n" ), - da_bno, ip->i_ino); + da_bno,I_INO (ip));libxfs_buf_relse (bp);return 1 ; }@@ -2324,7 +2324,7 @@ longform_dir2_check_node( (freetab->ents[i].v != NULLDATAOFF)) {do_warn (_ ("missing freetab entry %u for directory inode %" PRIu64"\n" ), - i, ip->i_ino); + i,I_INO (ip));return 1 ; } }@@ -2376,7 +2376,7 @@ longform_dir2_entry_check(/* is this a block, leaf, or node directory? */ args.dp = ip; args.geo = mp->m_dir_geo; - args.owner = ip->i_ino; + args.owner =I_INO (ip); fmt =libxfs_dir2_format (&args, &error);/* check directory "data" blocks (ie. name/inode pairs) */ @@ -2734,7 +2734,7 @@ shortform_dir2_entry_check( inode_is_meta(irec, ino_offset)) {do_warn (_ ("entry \"%s\" in regular dir %" PRIu64" points to a metadata inode %" PRIu64", " ), - fname, ip->i_ino, lino); + fname,I_INO (ip), lino); next_sfep =shortform_dir2_junk (mp, sfp, sfep, lino, &max_size, &i, &bytes_deleted, ino_dirty);@@ -2749,7 +2749,7 @@ shortform_dir2_entry_check( !inode_is_meta(irec, ino_offset)) {do_warn (_ ("entry \"%s\" in metadata dir %" PRIu64" points to a regular inode %" PRIu64", " ), - fname, ip->i_ino, lino); + fname,I_INO (ip), lino); next_sfep =shortform_dir2_junk (mp, sfp, sfep, lino, &max_size, &i, &bytes_deleted, ino_dirty);@@ -3000,7 +3000,7 @@ fix_dotdot(libxfs_trans_ijoin (tp, ip,0 ); - error = -libxfs_dir_createname (tp, ip, &xfs_name_dotdot, ip->i_ino, + error = -libxfs_dir_createname (tp, ip, &xfs_name_dotdot,I_INO (ip), nres);if (error) do_error(@@ -3133,7 +3133,7 @@ process_dir_inode(do_error (_ ("error %d fixing shortform directory %llu\n" ), error, - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); }else {libxfs_trans_cancel (tp); }@@ -3189,7 +3189,7 @@ _("error %d fixing shortform directory %llu\n"),libxfs_trans_ijoin (tp, ip,0 ); error = -libxfs_dir_createname (tp, ip, &xfs_name_dot, - ip->i_ino, nres); +I_INO (ip), nres);if (error) do_error( _("can't make \".\" entry in dir ino %" PRIu64 ", createname error %d\n"),@@ -3436,9 +3436,9 @@ reset_rt_metadir_inodes( }if (mp->m_rtdirip) { -mark_ino_inuse (mp, mp->m_rtdirip->i_ino,S_IFDIR , - mp->m_metadirip->i_ino); -mark_ino_metadata (mp, mp->m_rtdirip->i_ino); +mark_ino_inuse (mp,I_INO (mp->m_rtdirip),S_IFDIR , +I_INO (mp->m_metadirip)); +mark_ino_metadata (mp,I_INO (mp->m_rtdirip)); } }@@ -3557,8 +3557,8 @@ _("Couldn't reset link count on %s quota inode, error %d\n"), }/* Mark the inode in use. */ -mark_ino_inuse (mp, ip->i_ino,S_IFREG , dp->i_ino); -mark_ino_metadata (mp, ip->i_ino); +mark_ino_inuse (mp,I_INO (ip),S_IFREG ,I_INO (dp)); +mark_ino_metadata (mp,I_INO (ip));libxfs_irele (ip);return true; bad:@@ -3584,8 +3584,8 @@ reset_quota_metadir_inodes(do_error (_ ("failed to create quota metadir (%d)\n" ), error); -mark_ino_inuse (mp, dp->i_ino,S_IFDIR , mp->m_metadirip->i_ino); -mark_ino_metadata (mp, dp->i_ino); +mark_ino_inuse (mp,I_INO (dp),S_IFDIR ,I_INO (mp->m_metadirip)); +mark_ino_metadata (mp,I_INO (dp));ensure_quota_file (dp,XFS_DQTYPE_USER );ensure_quota_file (dp,XFS_DQTYPE_GROUP );repair/pptr.c +34
-34@@ -372,7 +372,7 @@ add_parent_ptr( };struct ag_pptr ag_pptr = { .child_agino =XFS_INO_TO_AGINO (mp, ino), - .parent_ino = dp->i_ino, + .parent_ino =I_INO (dp), .parent_gen =VFS_I (dp)->i_generation, .namelen = dname.len, };@@ -407,7 +407,7 @@ add_parent_ptr( dbg_printf( _("%s: dp %llu gen 0x%x fname '%s' namehash 0x%x ino %llu namecookie 0x%llx\n"), __func__, - (unsigned long long)dp->i_ino, + (unsigned long long)I_INO(dp), VFS_I(dp)->i_generation, fname, ag_pptr.namehash,@@ -438,7 +438,7 @@ remove_garbage_xattrs( .attr_filter = ga->attr_filter, .namelen = ga->attrnamelen, .valuelen = ga->attrvaluelen, - .owner = ip->i_ino, + .owner = I_INO(ip), .geo = ip->i_mount->m_attr_geo, .whichfork = XFS_ATTR_FORK, .op_flags = XFS_DA_OP_OKNOENT | XFS_DA_OP_LOGGED,@@ -452,7 +452,7 @@ remove_garbage_xattrs(do_error (_ ("allocating %zu bytes to remove ino %llu garbage xattr failed: %s\n" ), desired, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (errno)); bufsize = desired; }@@ -480,7 +480,7 @@ remove_garbage_xattrs(if (error)do_error (_ ("removing ino %llu garbage xattr failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); }@@ -515,7 +515,7 @@ record_garbage_xattr(if (!fscan->have_garbage)do_warn (_ ("would delete garbage parent pointer extended attributes in ino %llu\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); fscan->have_garbage = true;return ; }@@ -526,7 +526,7 @@ record_garbage_xattr(do_warn (_ ("deleting garbage parent pointer extended attributes in ino %llu\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); error = -init_slab (&fscan->garbage_xattr_recs,sizeof (struct garbage_xattr ));@@ -547,20 +547,20 @@ stuffit: &garbage_xattr.attrname_cookie, name, namelen);if (error)do_error (_ ("storing ino %llu garbage xattr failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); error = -xfblob_store (fscan->garbage_xattr_names, &garbage_xattr.attrvalue_cookie, value, valuelen);if (error)do_error (_ ("storing ino %llu garbage xattr failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); error = -slab_add (fscan->garbage_xattr_recs, &garbage_xattr);if (error)do_error (_ ("storing ino %llu garbage xattr rec failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); }@@ -627,7 +627,7 @@ examine_xattr(if (error)do_error (_ ("storing ino %llu parent pointer '%.*s' failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), namelen, (const char *)name,strerror (error));@@ -635,7 +635,7 @@ examine_xattr( error = -slab_add (fscan->file_pptr_recs, &file_pptr);if (error)do_error (_ ("storing ino %llu parent pointer rec failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); dbg_printf(@@ -647,7 +647,7 @@ examine_xattr( (const char *)name, namelen, file_pptr.namehash, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long )file_pptr.name_cookie, file_pptr.name_in_nameblobs);@@ -690,7 +690,7 @@ add_file_pptr(xfs_parent_rec_init (&pptr_rec, ag_pptr->parent_ino, ag_pptr->parent_gen); -return -libxfs_parent_set (ip, ip->i_ino, &xname, &pptr_rec, &scratch); +return -libxfs_parent_set (ip,I_INO (ip), &xname, &pptr_rec, &scratch); }/* Remove an on disk parent pointer from a file. */ @@ -709,7 +709,7 @@ remove_file_pptr(xfs_parent_rec_init (&pptr_rec, file_pptr->parent_ino, file_pptr->parent_gen); -return -libxfs_parent_unset (ip, ip->i_ino, &xname, &pptr_rec, &scratch); +return -libxfs_parent_unset (ip,I_INO (ip), &xname, &pptr_rec, &scratch); }/* Remove all pptrs from @ip. */ @@ -724,17 +724,17 @@ clear_all_pptrs(if (no_modify) {do_warn (_ ("would delete unlinked ino %llu parent pointers\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip));return ; }do_warn (_ ("deleting unlinked ino %llu parent pointers\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); error = -init_slab_cursor (fscan->file_pptr_recs,NULL , &cur);if (error)do_error (_ ("init ino %llu pptr cursor failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error));while ((file_pptr =pop_slab_cursor (cur)) !=NULL ) {@@ -744,7 +744,7 @@ clear_all_pptrs(if (error) do_error( _("loading incorrect name for ino %llu parent pointer (ino %llu gen 0x%x namecookie 0x%llx) failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, (unsigned long long)file_pptr->name_cookie,@@ -754,7 +754,7 @@ clear_all_pptrs(if (error)do_error (_ ("wiping ino %llu pptr (ino %llu gen 0x%x) failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long )file_pptr->parent_ino, file_pptr->parent_gen,strerror (error));@@ -778,7 +778,7 @@ add_missing_parent_ptr(if (error) do_error( _("loading missing name for ino %llu parent pointer (ino %llu gen 0x%x namecookie 0x%llx) failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, (unsigned long long)ag_pptr->name_cookie,@@ -787,7 +787,7 @@ add_missing_parent_ptr(if (no_modify) { do_warn( _("would add missing ino %llu parent pointer (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen,@@ -796,7 +796,7 @@ add_missing_parent_ptr( }else { do_warn( _("adding missing ino %llu parent pointer (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen,@@ -807,7 +807,7 @@ add_missing_parent_ptr(if (error) do_error( _("adding ino %llu pptr (ino %llu gen 0x%x name '%.*s') failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen,@@ -829,7 +829,7 @@ remove_incorrect_parent_ptr(if (error) do_error( _("loading incorrect name for ino %llu parent pointer (ino %llu gen 0x%x namecookie 0x%llx) failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, (unsigned long long)file_pptr->name_cookie,@@ -838,7 +838,7 @@ remove_incorrect_parent_ptr(if (no_modify) { do_warn( _("would remove bad ino %llu parent pointer (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -848,7 +848,7 @@ remove_incorrect_parent_ptr( do_warn( _("removing bad ino %llu parent pointer (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -858,7 +858,7 @@ remove_incorrect_parent_ptr(if (error) do_error( _("removing ino %llu pptr (ino %llu gen 0x%x name '%.*s') failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -886,7 +886,7 @@ compare_parent_ptrs(if (error) do_error( _("loading master-list name for ino %llu parent pointer (ino %llu gen 0x%x namecookie 0x%llx namelen %u) failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, (unsigned long long)ag_pptr->name_cookie,@@ -897,7 +897,7 @@ compare_parent_ptrs(if (error) do_error( _("loading file-list name for ino %llu parent pointer (ino %llu gen 0x%x namecookie 0x%llx namelen %u) failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, (unsigned long long)file_pptr->name_cookie,@@ -919,7 +919,7 @@ reset:if (no_modify) { do_warn( _("would update ino %llu parent pointer (ino %llu gen 0x%x name '%.*s') -> (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -933,7 +933,7 @@ reset: do_warn( _("updating ino %llu parent pointer (ino %llu gen 0x%x name '%.*s') -> (ino %llu gen 0x%x name '%.*s')\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -948,7 +948,7 @@ reset:if (error) do_error( _("erasing ino %llu pptr (ino %llu gen 0x%x name '%.*s') failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen,@@ -964,7 +964,7 @@ _("erasing ino %llu pptr (ino %llu gen 0x%x name '%.*s') failed: %s\n"),if (error && error !=EEXIST ) do_error( _("updating ino %llu pptr (ino %llu gen 0x%x name '%.*s') failed: %s\n"), - (unsigned long long)ip->i_ino, + (unsigned long long)I_INO(ip), (unsigned long long)ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen,
repair/pptr.c crosscheck_file_parent_ptrs( · line 1054
Quoted 7 lines
repair/pptr.c +2
-2@@ -1050,8 +1050,8 @@ crosscheck_file_parent_ptrs(struct ag_pptr *ag_pptr, *prev_ag_pptr =NULL ;struct file_pptr *file_pptr;struct xfs_mount *mp = ip->i_mount; -xfs_agnumber_t agno =XFS_INO_TO_AGNO (mp, ip->i_ino); -xfs_agino_t agino =XFS_INO_TO_AGINO (mp, ip->i_ino); +xfs_agnumber_t agno =XFS_INO_TO_AGNO (mp,I_INO (ip)); +xfs_agino_t agino =XFS_INO_TO_AGINO (mp,I_INO (ip));
XFS_INODE_TO_{AGNO,AGINO}
Quoted 219 lines
repair/pptr.c +14
-14int error; ag_pptr =peek_slab_cursor (fscan->ag_pptr_recs_cur);@@ -1081,7 +1081,7 @@ crosscheck_file_parent_ptrs(_ ("found dirent referring to ino %llu even though inobt scan moved on to ino %llu?!\n" ), (unsigned long long )XFS_AGINO_TO_INO (mp, agno, ag_pptr->child_agino), - (unsigned long long)ip->i_ino); + (unsigned long long)I_INO(ip));/* does not return */ }@@ -1096,7 +1096,7 @@ crosscheck_file_parent_ptrs( &fscan->file_pptr_recs_cur);if (error)do_error (_ ("init ino %llu parent pointer cursor failed: %s\n" ), - (unsigned long long )ip->i_ino,strerror (error)); + (unsigned long long )I_INO (ip),strerror (error)); do { int cmp_result;@@ -1114,7 +1114,7 @@ crosscheck_file_parent_ptrs( (unsigned long long )ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long)ag_pptr->name_cookie); prev_ag_pptr = ag_pptr;advance_slab_cursor (fscan->ag_pptr_recs_cur);@@ -1131,7 +1131,7 @@ crosscheck_file_parent_ptrs( (unsigned long long )ag_pptr->parent_ino, ag_pptr->parent_gen, ag_pptr->namelen, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long)ag_pptr->name_cookie);if (file_pptr) {@@ -1141,13 +1141,13 @@ crosscheck_file_parent_ptrs( (unsigned long long )file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long)file_pptr->name_cookie); }else {dbg_printf (_ ("%s: ran out of parent pointers for ino %llu (file)\n" ), __func__, - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip)); } cmp_result =cmp_file_to_ag_pptr (file_pptr, ag_pptr);@@ -1188,7 +1188,7 @@ crosscheck_file_parent_ptrs( (unsigned long long )file_pptr->parent_ino, file_pptr->parent_gen, file_pptr->namelen, - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip), (unsigned long long)file_pptr->name_cookie);/* @@ -1223,11 +1223,11 @@ check_file_parent_ptrs(libxfs_trans_cancel (tp);if (error && !no_modify)do_error (_ ("ino %llu parent pointer scan failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error));if (error) {do_warn (_ ("ino %llu parent pointer scan failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); goto out_free; }@@ -1361,20 +1361,20 @@ erase_pptrs( &garbage_xattr.attrname_cookie, name, namelen);if (error)do_error (_ ("storing ino %llu garbage pptr failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); error = -xfblob_store (fscan->garbage_xattr_names, &garbage_xattr.attrvalue_cookie, value, valuelen);if (error)do_error (_ ("storing ino %llu garbage pptr failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error)); error = -slab_add (fscan->garbage_xattr_recs, &garbage_xattr);if (error)do_error (_ ("storing ino %llu garbage pptr rec failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error));return 0 ;@@ -1399,7 +1399,7 @@ try_erase_parent_ptrs(if (no_modify) {do_warn (_ ("would delete garbage parent pointers in metadata ino %llu\n" ), - (unsigned long long )ip->i_ino); + (unsigned long long )I_INO (ip));return ; }@@ -1423,7 +1423,7 @@ try_erase_parent_ptrs(libxfs_trans_cancel (tp);if (error)do_warn (_ ("ino %llu garbage pptr collection failed: %s\n" ), - (unsigned long long )ip->i_ino, + (unsigned long long )I_INO (ip),strerror (error));remove_garbage_xattrs (ip, &fscan);repair/quotacheck.c +4
-4@@ -169,7 +169,7 @@ qc_count_rtblocks(if (error) {do_warn (_ ("could not read ino %" PRIu64" extents, err=%d\n" ), - ip->i_ino, error); +I_INO (ip), error); chkd_flags =0 ;return 0 ; }@@ -375,7 +375,7 @@ qc_walk_dquot_extent(if (error) {do_warn (_ ("cannot read %s inode %" PRIu64", block %" PRIu64", disk block %" PRIu64", err=%d\n" ), -qflags_typestr (dquots->type), ip->i_ino, +qflags_typestr (dquots->type),I_INO (ip), map->br_startoff + bno, map->br_startblock + bno, error); chkd_flags =0 ;@@ -454,7 +454,7 @@ quotacheck_verify(if (error) {do_warn (_ ("could not read %s inode %" PRIu64" extents, err=%d\n" ), -qflags_typestr (type), ip->i_ino, error); +qflags_typestr (type),I_INO (ip), error); chkd_flags =0 ; goto err; }@@ -659,7 +659,7 @@ mark_quota_inode(if (error) goto out_corrupt; -set_quota_inode (type, ip->i_ino); +set_quota_inode (type,I_INO (ip));libxfs_irele (ip);return 0 ;repair/rt.c +3
-3@@ -268,7 +268,7 @@ check_rtfile_contents(if (xfs_has_rtgroups (mp)) {struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; -if (hdr->rt_owner !=cpu_to_be64 (ip->i_ino)) { +if (hdr->rt_owner !=cpu_to_be64 (I_INO (ip))) {do_warn (_ ("corrupt owner in %s at dblock 0x%llx\n" ), filename, (unsigned long long )bno);@@ -461,12 +461,12 @@ mark_rtginode( goto out_corrupt;if (xfs_has_rtgroups (rtg_mount (rtg))) { -if (bitmap_test (rtg_inodes[type], ip->i_ino,1 )) { +if (bitmap_test (rtg_inodes[type],I_INO (ip),1 )) { error =EFSCORRUPTED ; goto out_corrupt; } - error =bitmap_set (rtg_inodes[type], ip->i_ino,1 ); + error =bitmap_set (rtg_inodes[type],I_INO (ip),1 );if (error) goto out_corrupt; }repair/rtrefcount_repair.c +1
-1@@ -173,7 +173,7 @@ xrep_rtrefc_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrefcountbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);repair/rtrmap_repair.c +1
-1@@ -211,7 +211,7 @@ xrep_rtrmap_build_new_tree(* Prepare to construct the new fork by initializing the new btree * structure and creating a fake ifork in the ifakeroot structure. */ -libxfs_rmap_ino_bmbt_owner (&oinfo, sc->ip->i_ino,XFS_DATA_FORK ); +libxfs_rmap_ino_bmbt_owner (&oinfo,I_INO (sc->ip),XFS_DATA_FORK );bulkload_init_inode (&rr->new_fork_info, sc,XFS_DATA_FORK , &oinfo); cur =libxfs_rtrmapbt_init_cursor (NULL , rr->rtg);libxfs_btree_stage_ifakeroot (cur, ifake);repair/xfs_repair.c +0
-0
repair/xfs_repair.c check_metadir_inode( · line 676
Quoted 8 lines
repair/xfs_repair.c +1
-1@@ -670,7 +670,7 @@ check_metadir_inode(/* If we changed the metadir inode, try reloading it. */ if (!mp->m_metadirip || - mp->m_metadirip->i_ino != mp->m_sb.sb_metadirino) { +I_INO (mp->m_metadirip) != mp->m_sb.sb_metadirino) {if (mp->m_metadirip)libxfs_irele (mp->m_metadirip);
Otherwise looks fine to me.
--D
Quoted 5 lines · Darrick J. Wong
Quoted 4 lines · Andrey Albershteyn
Hi all,
This is libxfs sync for v7.1..v7.2.
Quoted 7 lines
libxfs/defer_item.c xfs_bmap_update_diff_items( · line 566
Quoted 4 lines
...
libxfs/defer_item.c +1
-1-return ba->bi_owner->i_ino - bb->bi_owner->i_ino; +return I_INO (ba->bi_owner) -I_INO (bb->bi_owner);I did some
cmp_initconversion for this file:
https://lore.kernel.org/linux-xfs/178302226322.845537.14974268104031687429.stgit@frogsfrogsfrogs/
Oh I forgot that you already did the sync, I will rebase those "Fixes" on top of your version then and resend it.
Signature · 1 line
- Andrey
Looks good modulo the cleanups Darrick suggested in the converted non-libxfs code.