kill macro noise in xfs_dir2*.h
PATCH 1/1 kill macro noise in xfs_dir2*.h
Remove all the macros that just give inline functions uppercase names.
fs/xfs/xfs_dir2.c +6 -6
@@ -55,9 +55,9 @@ xfs_dir_mount( XFS_MAX_BLOCKSIZE); mp->m_dirblksize =1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog); mp->m_dirblkfsbs =1 << mp->m_sb.sb_dirblklog; - mp->m_dirdatablk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_DATA_FIRSTDB (mp)); - mp->m_dirleafblk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_LEAF_FIRSTDB (mp)); - mp->m_dirfreeblk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_FREE_FIRSTDB (mp)); + mp->m_dirdatablk =xfs_dir2_db_to_da (mp,XFS_DIR2_DATA_FIRSTDB (mp)); + mp->m_dirleafblk =xfs_dir2_db_to_da (mp,XFS_DIR2_LEAF_FIRSTDB (mp)); + mp->m_dirfreeblk =xfs_dir2_db_to_da (mp,XFS_DIR2_FREE_FIRSTDB (mp)); mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - (uint )sizeof (xfs_da_node_hdr_t)) / (uint )sizeof (xfs_da_node_entry_t);
@@ -554,7 +554,7 @@ xfs_dir2_grow_inode(*/ if (mapp != &map)kmem_free (mapp,sizeof (*mapp) * count); - *dbp =XFS_DIR2_DA_TO_DB (mp, (xfs_dablk_t )bno); + *dbp =xfs_dir2_da_to_db (mp, (xfs_dablk_t )bno);/* * Update file's size if this is the data space and it grew. */
@@ -706,7 +706,7 @@ xfs_dir2_shrink_inode( dp = args->dp; mp = dp->i_mount; tp = args->trans; - da =XFS_DIR2_DB_TO_DA (mp, db); + da =xfs_dir2_db_to_da (mp, db);/* * Unmap the fsblock(s). */
@@ -742,7 +742,7 @@ xfs_dir2_shrink_inode(/* * If the block isn't the last one in the directory, we're done. */ -if (dp->i_d.di_size >XFS_DIR2_DB_OFF_TO_BYTE (mp, db +1 ,0 )) +if (dp->i_d.di_size >xfs_dir2_db_off_to_byte (mp, db +1 ,0 ))return 0 ; bno = da;if ((error =xfs_bmap_last_before (tp, dp, &bno,XFS_DATA_FORK ))) {
fs/xfs/xfs_dir2_block.c +49 -49
315 lines not on this page · raw message
fs/xfs/xfs_dir2_block.h +0 -2
@@ -60,7 +60,6 @@ typedef struct xfs_dir2_block {/* * Pointer to the leaf header embedded in a data block (1-block format) */ -#define XFS_DIR2_BLOCK_TAIL_P (mp,block) xfs_dir2_block_tail_p(mp,block)static inline xfs_dir2_block_tail_t *xfs_dir2_block_tail_p (struct xfs_mount *mp,xfs_dir2_block_t *block) {
@@ -71,7 +70,6 @@ xfs_dir2_block_tail_p(struct xfs_mount */* * Pointer to the leaf entries embedded in a data block (1-block format) */ -#define XFS_DIR2_BLOCK_LEAF_P (btp) xfs_dir2_block_leaf_p(btp)static inline struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p (xfs_dir2_block_tail_t *btp) {
fs/xfs/xfs_dir2_data.c +27 -27
183 lines not on this page · raw message
fs/xfs/xfs_dir2_data.h +4 -8
@@ -44,7 +44,7 @@ struct xfs_trans;#define XFS_DIR2_DATA_SPACE 0#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_DATA_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATA_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET)/* * Offsets of . and .. in data space (always block 0)
@@ -52,9 +52,9 @@ struct xfs_trans;#define XFS_DIR2_DATA_DOT_OFFSET \ ((xfs_dir2_data_aoff_t)sizeof(xfs_dir2_data_hdr_t))#define XFS_DIR2_DATA_DOTDOT_OFFSET \ - (XFS_DIR2_DATA_DOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(1)) + (XFS_DIR2_DATA_DOT_OFFSET + xfs_dir2_data_entsize(1))#define XFS_DIR2_DATA_FIRST_OFFSET \ - (XFS_DIR2_DATA_DOTDOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(2)) + (XFS_DIR2_DATA_DOTDOT_OFFSET + xfs_dir2_data_entsize(2))/* * Structures.
@@ -123,7 +123,6 @@ typedef struct xfs_dir2_data {/* * Size of a data entry. */ -#define XFS_DIR2_DATA_ENTSIZE (n) xfs_dir2_data_entsize(n)static inline int xfs_dir2_data_entsize (int n) { return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
@@ -133,19 +132,16 @@ static inline int xfs_dir2_data_entsize(/* * Pointer to an entry's tag word. */ -#define XFS_DIR2_DATA_ENTRY_TAG_P (dep) xfs_dir2_data_entry_tag_p(dep)static inline __be16 *xfs_dir2_data_entry_tag_p (xfs_dir2_data_entry_t *dep) {return (__be16 *)((char *)dep + -XFS_DIR2_DATA_ENTSIZE (dep->namelen) -sizeof (__be16)); +xfs_dir2_data_entsize (dep->namelen) -sizeof (__be16)); }/* * Pointer to a freespace's tag word. */ -#define XFS_DIR2_DATA_UNUSED_TAG_P (dup) \ - xfs_dir2_data_unused_tag_p(dup)static inline __be16 *xfs_dir2_data_unused_tag_p (xfs_dir2_data_unused_t *dup) {
fs/xfs/xfs_dir2_leaf.c +53 -53
347 lines not on this page · raw message
fs/xfs/xfs_dir2_leaf.h +6 -23
@@ -32,7 +32,7 @@ struct xfs_trans;#define XFS_DIR2_LEAF_SPACE 1#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_LEAF_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET)/* * Offset in data space of a data entry.
@@ -82,7 +82,6 @@ typedef struct xfs_dir2_leaf {* DB blocks here are logical directory block numbers, not filesystem blocks. */ -#define XFS_DIR2_MAX_LEAF_ENTS (mp) xfs_dir2_max_leaf_ents(mp)static inline int xfs_dir2_max_leaf_ents (struct xfs_mount *mp) { return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) /
@@ -92,7 +91,6 @@ static inline int xfs_dir2_max_leaf_ents/* * Get address of the bestcount field in the single-leaf block. */ -#define XFS_DIR2_LEAF_TAIL_P (mp,lp) xfs_dir2_leaf_tail_p(mp, lp)static inline xfs_dir2_leaf_tail_t *xfs_dir2_leaf_tail_p (struct xfs_mount *mp,xfs_dir2_leaf_t *lp) {
@@ -104,7 +102,6 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *m/* * Get address of the bests array in the single-leaf block. */ -#define XFS_DIR2_LEAF_BESTS_P (ltp) xfs_dir2_leaf_bests_p(ltp)static inline __be16 *xfs_dir2_leaf_bests_p (xfs_dir2_leaf_tail_t *ltp) {
@@ -114,7 +111,6 @@ xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail/* * Convert dataptr to byte in file space */ -#define XFS_DIR2_DATAPTR_TO_BYTE (mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)static inline xfs_dir2_off_t xfs_dir2_dataptr_to_byte (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) {
@@ -124,7 +120,6 @@ xfs_dir2_dataptr_to_byte(struct xfs_moun/* * Convert byte in file space to dataptr. It had better be aligned. */ -#define XFS_DIR2_BYTE_TO_DATAPTR (mp,by) xfs_dir2_byte_to_dataptr(mp,by)static inline xfs_dir2_dataptr_t xfs_dir2_byte_to_dataptr (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -134,7 +129,6 @@ xfs_dir2_byte_to_dataptr(struct xfs_moun/* * Convert byte in space to (DB) block */ -#define XFS_DIR2_BYTE_TO_DB (mp,by) xfs_dir2_byte_to_db(mp, by)static inline xfs_dir2_db_t xfs_dir2_byte_to_db (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -145,17 +139,15 @@ xfs_dir2_byte_to_db(struct xfs_mount *mp/* * Convert dataptr to a block number */ -#define XFS_DIR2_DATAPTR_TO_DB (mp,dp) xfs_dir2_dataptr_to_db(mp, dp)static inline xfs_dir2_db_t xfs_dir2_dataptr_to_db (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) { -return XFS_DIR2_BYTE_TO_DB (mp,XFS_DIR2_DATAPTR_TO_BYTE (mp, dp)); +return xfs_dir2_byte_to_db (mp,xfs_dir2_dataptr_to_byte (mp, dp)); }/* * Convert byte in space to offset in a block */ -#define XFS_DIR2_BYTE_TO_OFF (mp,by) xfs_dir2_byte_to_off(mp, by)static inline xfs_dir2_data_aoff_t xfs_dir2_byte_to_off (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -166,18 +158,15 @@ xfs_dir2_byte_to_off(struct xfs_mount *m/* * Convert dataptr to a byte offset in a block */ -#define XFS_DIR2_DATAPTR_TO_OFF (mp,dp) xfs_dir2_dataptr_to_off(mp, dp)static inline xfs_dir2_data_aoff_t xfs_dir2_dataptr_to_off (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) { -return XFS_DIR2_BYTE_TO_OFF (mp,XFS_DIR2_DATAPTR_TO_BYTE (mp, dp)); +return xfs_dir2_byte_to_off (mp,xfs_dir2_dataptr_to_byte (mp, dp)); }/* * Convert block and offset to byte in space */ -#define XFS_DIR2_DB_OFF_TO_BYTE (mp,db,o) \ - xfs_dir2_db_off_to_byte(mp, db, o)static inline xfs_dir2_off_t xfs_dir2_db_off_to_byte (struct xfs_mount *mp,xfs_dir2_db_t db,xfs_dir2_data_aoff_t o)
@@ -189,7 +178,6 @@ xfs_dir2_db_off_to_byte(struct xfs_mount/* * Convert block (DB) to block (dablk) */ -#define XFS_DIR2_DB_TO_DA (mp,db) xfs_dir2_db_to_da(mp, db)static inline xfs_dablk_t xfs_dir2_db_to_da (struct xfs_mount *mp,xfs_dir2_db_t db) {
@@ -199,29 +187,25 @@ xfs_dir2_db_to_da(struct xfs_mount *mp,/* * Convert byte in space to (DA) block */ -#define XFS_DIR2_BYTE_TO_DA (mp,by) xfs_dir2_byte_to_da(mp, by)static inline xfs_dablk_t xfs_dir2_byte_to_da (struct xfs_mount *mp,xfs_dir2_off_t by) { -return XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_BYTE_TO_DB (mp, by)); +return xfs_dir2_db_to_da (mp,xfs_dir2_byte_to_db (mp, by)); }/* * Convert block and offset to dataptr */ -#define XFS_DIR2_DB_OFF_TO_DATAPTR (mp,db,o) \ - xfs_dir2_db_off_to_dataptr(mp, db, o)static inline xfs_dir2_dataptr_t xfs_dir2_db_off_to_dataptr (struct xfs_mount *mp,xfs_dir2_db_t db,xfs_dir2_data_aoff_t o) { -return XFS_DIR2_BYTE_TO_DATAPTR (mp,XFS_DIR2_DB_OFF_TO_BYTE (mp, db, o)); +return xfs_dir2_byte_to_dataptr (mp,xfs_dir2_db_off_to_byte (mp, db, o)); }/* * Convert block (dablk) to block (DB) */ -#define XFS_DIR2_DA_TO_DB (mp,da) xfs_dir2_da_to_db(mp, da)static inline xfs_dir2_db_t xfs_dir2_da_to_db (struct xfs_mount *mp,xfs_dablk_t da) {
@@ -231,11 +215,10 @@ xfs_dir2_da_to_db(struct xfs_mount *mp,/* * Convert block (dablk) to byte offset in space */ -#define XFS_DIR2_DA_TO_BYTE (mp,da) xfs_dir2_da_to_byte(mp, da)static inline xfs_dir2_off_t xfs_dir2_da_to_byte (struct xfs_mount *mp,xfs_dablk_t da) { -return XFS_DIR2_DB_OFF_TO_BYTE (mp,XFS_DIR2_DA_TO_DB (mp, da),0 ); +return xfs_dir2_db_off_to_byte (mp,xfs_dir2_da_to_db (mp, da),0 ); }/*
fs/xfs/xfs_dir2_node.c +33 -33
248 lines not on this page · raw message
fs/xfs/xfs_dir2_node.h +1 -3
@@ -36,7 +36,7 @@ struct xfs_trans;#define XFS_DIR2_FREE_SPACE 2#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_FREE_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_FREE_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET)#define XFS_DIR2_FREE_MAGIC 0x58443246/* XD2F */
@@ -60,7 +60,6 @@ typedef struct xfs_dir2_free {/* * Convert data space db to the corresponding free db. */ -#define XFS_DIR2_DB_TO_FDB (mp,db) xfs_dir2_db_to_fdb(mp, db)static inline xfs_dir2_db_t xfs_dir2_db_to_fdb (struct xfs_mount *mp,xfs_dir2_db_t db) {
@@ -70,7 +69,6 @@ xfs_dir2_db_to_fdb(struct xfs_mount *mp,/* * Convert data space db to the corresponding index in a free db. */ -#define XFS_DIR2_DB_TO_FDINDEX (mp,db) xfs_dir2_db_to_fdindex(mp, db)static inline int xfs_dir2_db_to_fdindex (struct xfs_mount *mp,xfs_dir2_db_t db) {
fs/xfs/xfs_dir2_sf.c +102 -102
487 lines not on this page · raw message
fs/xfs/xfs_dir2_sf.h +2 -18
@@ -90,7 +90,6 @@ typedef struct xfs_dir2_sf {xfs_dir2_sf_entry_t list[1 ];/* shortform entries */ } xfs_dir2_sf_t; -#define XFS_DIR2_SF_HDR_SIZE (i8count) xfs_dir2_sf_hdr_size(i8count)static inline int xfs_dir2_sf_hdr_size (int i8count) { return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \
@@ -98,14 +97,11 @@ static inline int xfs_dir2_sf_hdr_size(i ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_INUMBERP (sfep) xfs_dir2_sf_inumberp(sfep)static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp (xfs_dir2_sf_entry_t *sfep) {return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]; } -#define XFS_DIR2_SF_GET_INUMBER (sfp, from) \ - xfs_dir2_sf_get_inumber(sfp, from)static inline xfs_intino_t xfs_dir2_sf_get_inumber (xfs_dir2_sf_t *sfp,xfs_dir2_inou_t *from) {
@@ -114,8 +110,6 @@ xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *s (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)); } -#define XFS_DIR2_SF_PUT_INUMBER (sfp,from,to) \ - xfs_dir2_sf_put_inumber(sfp,from,to)static inline void xfs_dir2_sf_put_inumber (xfs_dir2_sf_t *sfp,xfs_ino_t *from,xfs_dir2_inou_t *to) {
@@ -125,24 +119,18 @@ static inline void xfs_dir2_sf_put_inumbXFS_PUT_DIR_INO8 (*(from), (to)->i8); } -#define XFS_DIR2_SF_GET_OFFSET (sfep) \ - xfs_dir2_sf_get_offset(sfep)static inline xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset (xfs_dir2_sf_entry_t *sfep) {return INT_GET_UNALIGNED_16_BE (&(sfep)->offset.i); } -#define XFS_DIR2_SF_PUT_OFFSET (sfep,off) \ - xfs_dir2_sf_put_offset(sfep,off)static inline void xfs_dir2_sf_put_offset (xfs_dir2_sf_entry_t *sfep,xfs_dir2_data_aoff_t off) {INT_SET_UNALIGNED_16_BE (&(sfep)->offset.i, off); } -#define XFS_DIR2_SF_ENTSIZE_BYNAME (sfp,len) \ - xfs_dir2_sf_entsize_byname(sfp,len)static inline int xfs_dir2_sf_entsize_byname (xfs_dir2_sf_t *sfp,int len) { return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \
@@ -150,8 +138,6 @@ static inline int xfs_dir2_sf_entsize_by ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_ENTSIZE_BYENTRY (sfp,sfep) \ - xfs_dir2_sf_entsize_byentry(sfp,sfep)static inline int xfs_dir2_sf_entsize_byentry (xfs_dir2_sf_t *sfp,xfs_dir2_sf_entry_t *sfep) {
@@ -160,19 +146,17 @@ xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_ ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_FIRSTENTRY (sfp) xfs_dir2_sf_firstentry(sfp)static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry (xfs_dir2_sf_t *sfp) {return ((xfs_dir2_sf_entry_t *) \ - ((char *)(sfp) +XFS_DIR2_SF_HDR_SIZE (sfp->hdr.i8count))); + ((char *)(sfp) +xfs_dir2_sf_hdr_size (sfp->hdr.i8count))); } -#define XFS_DIR2_SF_NEXTENTRY (sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep)static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_nextentry (xfs_dir2_sf_t *sfp,xfs_dir2_sf_entry_t *sfep) {return ((xfs_dir2_sf_entry_t *) \ - ((char *)(sfep) +XFS_DIR2_SF_ENTSIZE_BYENTRY (sfp,sfep))); + ((char *)(sfep) +xfs_dir2_sf_entsize_byentry (sfp,sfep))); }/*
Quoted 3 lines · Christoph Hellwig
Remove all the macros that just give inline functions uppercase names.
Signed-off-by Christoph Hellwig <[email protected]>
Added to my QA tree.
Thanks, Christoph.
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group
Quoted 3 lines · Christoph Hellwig
Remove all the macros that just give inline functions uppercase names.
Signed-off-by Christoph Hellwig <[email protected]>
BTW, you'll need this patch to make debug kernels build....
Cheers,
Dave.
Signature · 74 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
---
fs/xfs/xfsidbg.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Index: 2.6.x-xfs-new/fs/xfs/xfsidbg.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfsidbg.c 2007-03-30 09:30:01.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/xfsidbg.c 2007-04-19 10:02:29.565671598 +1000
@@ -5490,7 +5490,7 @@ xfs_dir2data(void *addr, int size)
/* XFS_DIR2_BLOCK_TAIL_P */
tail = (xfs_dir2_block_tail_t *)
((char *)bb + size - sizeof(xfs_dir2_block_tail_t));
- l = XFS_DIR2_BLOCK_LEAF_P(tail);
+ l = xfs_dir2_block_leaf_p(tail);
t = (char *)l;
}
for (p = (char *)(h + 1); p < t; ) {
@@ -5500,7 +5500,7 @@ xfs_dir2data(void *addr, int size)
(unsigned long) (p - (char *)addr),
INT_GET(u->freetag, ARCH_CONVERT),
INT_GET(u->length, ARCH_CONVERT),
- INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(u), ARCH_CONVERT));
+ INT_GET(*xfs_dir2_data_unused_tag_p(u), ARCH_CONVERT));
p += INT_GET(u->length, ARCH_CONVERT);
continue;
}
@@ -5511,8 +5511,8 @@ xfs_dir2data(void *addr, int size)
e->namelen);
for (k = 0; k < e->namelen; k++)
kdb_printf("%c", e->name[k]);
- kdb_printf("\" tag 0x%x\n", INT_GET(*XFS_DIR2_DATA_ENTRY_TAG_P(e), ARCH_CONVERT));
- p += XFS_DIR2_DATA_ENTSIZE(e->namelen);
+ kdb_printf("\" tag 0x%x\n", INT_GET(*xfs_dir2_data_entry_tag_p(e), ARCH_CONVERT));
+ p += xfs_dir2_data_entsize(e->namelen);
}
if (INT_GET(h->magic, ARCH_CONVERT) == XFS_DIR2_DATA_MAGIC)
return;
@@ -5557,7 +5557,7 @@ xfs_dir2leaf(xfs_dir2_leaf_t *leaf, int
return;
/* XFS_DIR2_LEAF_TAIL_P */
t = (xfs_dir2_leaf_tail_t *)((char *)leaf + size - sizeof(*t));
- b = XFS_DIR2_LEAF_BESTS_P(t);
+ b = xfs_dir2_leaf_bests_p(t);
for (j = 0; j < INT_GET(t->bestcount, ARCH_CONVERT); j++, b++) {
kdb_printf("0x%lx best %d 0x%x\n",
(unsigned long) ((char *)b - (char *)leaf), j,
@@ -5578,19 +5578,19 @@ xfsidbg_xdir2sf(xfs_dir2_sf_t *s)
int i, j;
sfh = &s->hdr;
- ino = XFS_DIR2_SF_GET_INUMBER(s, &sfh->parent);
+ ino = xfs_dir2_sf_get_inumber(s, &sfh->parent);
kdb_printf("hdr count %d i8count %d parent %llu\n",
sfh->count, sfh->i8count, (unsigned long long) ino);
- for (i = 0, sfe = XFS_DIR2_SF_FIRSTENTRY(s); i < sfh->count; i++) {
- ino = XFS_DIR2_SF_GET_INUMBER(s, XFS_DIR2_SF_INUMBERP(sfe));
+ for (i = 0, sfe = xfs_dir2_sf_firstentry(s); i < sfh->count; i++) {
+ ino = xfs_dir2_sf_get_inumber(s, xfs_dir2_sf_inumberp(sfe));
kdb_printf("entry %d inumber %llu offset 0x%x namelen %d name \"",
i, (unsigned long long) ino,
- XFS_DIR2_SF_GET_OFFSET(sfe),
+ xfs_dir2_sf_get_offset(sfe),
sfe->namelen);
for (j = 0; j < sfe->namelen; j++)
kdb_printf("%c", sfe->name[j]);
kdb_printf("\"\n");
- sfe = XFS_DIR2_SF_NEXTENTRY(s, sfe);
+ sfe = xfs_dir2_sf_nextentry(s, sfe);
}
}Quoted 6 lines · David Chinner
Quoted 3 lines · Christoph Hellwig
Remove all the macros that just give inline functions uppercase names.
Signed-off-by Christoph Hellwig <[email protected]>BTW, you'll need this patch to make debug kernels build....
Well, there's not xfsidb in mainline and that's the tree I tend to work with for all my patches. I suspect you'll have to fixup xfsidb for whatever patches come from normal mainline-using developers :)
Quoted 3 lines · Christoph Hellwig
Remove all the macros that just give inline functions uppercase names.
Signed-off-by Christoph Hellwig <[email protected]>
This patch still hasn't made it to mainline, so here's a version rediffed for latest mainline because it's required for the next patch I'll post:
fs/xfs/xfs_dir2.c +6 -6
@@ -55,9 +55,9 @@ xfs_dir_mount( XFS_MAX_BLOCKSIZE); mp->m_dirblksize =1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog); mp->m_dirblkfsbs =1 << mp->m_sb.sb_dirblklog; - mp->m_dirdatablk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_DATA_FIRSTDB (mp)); - mp->m_dirleafblk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_LEAF_FIRSTDB (mp)); - mp->m_dirfreeblk =XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_FREE_FIRSTDB (mp)); + mp->m_dirdatablk =xfs_dir2_db_to_da (mp,XFS_DIR2_DATA_FIRSTDB (mp)); + mp->m_dirleafblk =xfs_dir2_db_to_da (mp,XFS_DIR2_LEAF_FIRSTDB (mp)); + mp->m_dirfreeblk =xfs_dir2_db_to_da (mp,XFS_DIR2_FREE_FIRSTDB (mp)); mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - (uint )sizeof (xfs_da_node_hdr_t)) / (uint )sizeof (xfs_da_node_entry_t);
@@ -554,7 +554,7 @@ xfs_dir2_grow_inode(*/ if (mapp != &map)kmem_free (mapp,sizeof (*mapp) * count); - *dbp =XFS_DIR2_DA_TO_DB (mp, (xfs_dablk_t )bno); + *dbp =xfs_dir2_da_to_db (mp, (xfs_dablk_t )bno);/* * Update file's size if this is the data space and it grew. */
@@ -706,7 +706,7 @@ xfs_dir2_shrink_inode( dp = args->dp; mp = dp->i_mount; tp = args->trans; - da =XFS_DIR2_DB_TO_DA (mp, db); + da =xfs_dir2_db_to_da (mp, db);/* * Unmap the fsblock(s). */
@@ -742,7 +742,7 @@ xfs_dir2_shrink_inode(/* * If the block isn't the last one in the directory, we're done. */ -if (dp->i_d.di_size >XFS_DIR2_DB_OFF_TO_BYTE (mp, db +1 ,0 )) +if (dp->i_d.di_size >xfs_dir2_db_off_to_byte (mp, db +1 ,0 ))return 0 ; bno = da;if ((error =xfs_bmap_last_before (tp, dp, &bno,XFS_DATA_FORK ))) {
fs/xfs/xfs_dir2_block.c +49 -49
315 lines not on this page · raw message
fs/xfs/xfs_dir2_block.h +0 -2
@@ -60,7 +60,6 @@ typedef struct xfs_dir2_block {/* * Pointer to the leaf header embedded in a data block (1-block format) */ -#define XFS_DIR2_BLOCK_TAIL_P (mp,block) xfs_dir2_block_tail_p(mp,block)static inline xfs_dir2_block_tail_t *xfs_dir2_block_tail_p (struct xfs_mount *mp,xfs_dir2_block_t *block) {
@@ -71,7 +70,6 @@ xfs_dir2_block_tail_p(struct xfs_mount */* * Pointer to the leaf entries embedded in a data block (1-block format) */ -#define XFS_DIR2_BLOCK_LEAF_P (btp) xfs_dir2_block_leaf_p(btp)static inline struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p (xfs_dir2_block_tail_t *btp) {
fs/xfs/xfs_dir2_data.c +27 -27
183 lines not on this page · raw message
fs/xfs/xfs_dir2_data.h +4 -8
@@ -44,7 +44,7 @@ struct xfs_trans;#define XFS_DIR2_DATA_SPACE 0#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_DATA_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATA_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET)/* * Offsets of . and .. in data space (always block 0)
@@ -52,9 +52,9 @@ struct xfs_trans;#define XFS_DIR2_DATA_DOT_OFFSET \ ((xfs_dir2_data_aoff_t)sizeof(xfs_dir2_data_hdr_t))#define XFS_DIR2_DATA_DOTDOT_OFFSET \ - (XFS_DIR2_DATA_DOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(1)) + (XFS_DIR2_DATA_DOT_OFFSET + xfs_dir2_data_entsize(1))#define XFS_DIR2_DATA_FIRST_OFFSET \ - (XFS_DIR2_DATA_DOTDOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(2)) + (XFS_DIR2_DATA_DOTDOT_OFFSET + xfs_dir2_data_entsize(2))/* * Structures.
@@ -123,7 +123,6 @@ typedef struct xfs_dir2_data {/* * Size of a data entry. */ -#define XFS_DIR2_DATA_ENTSIZE (n) xfs_dir2_data_entsize(n)static inline int xfs_dir2_data_entsize (int n) { return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
@@ -133,19 +132,16 @@ static inline int xfs_dir2_data_entsize(/* * Pointer to an entry's tag word. */ -#define XFS_DIR2_DATA_ENTRY_TAG_P (dep) xfs_dir2_data_entry_tag_p(dep)static inline __be16 *xfs_dir2_data_entry_tag_p (xfs_dir2_data_entry_t *dep) {return (__be16 *)((char *)dep + -XFS_DIR2_DATA_ENTSIZE (dep->namelen) -sizeof (__be16)); +xfs_dir2_data_entsize (dep->namelen) -sizeof (__be16)); }/* * Pointer to a freespace's tag word. */ -#define XFS_DIR2_DATA_UNUSED_TAG_P (dup) \ - xfs_dir2_data_unused_tag_p(dup)static inline __be16 *xfs_dir2_data_unused_tag_p (xfs_dir2_data_unused_t *dup) {
fs/xfs/xfs_dir2_leaf.c +53 -53
347 lines not on this page · raw message
fs/xfs/xfs_dir2_leaf.h +6 -23
@@ -32,7 +32,7 @@ struct xfs_trans;#define XFS_DIR2_LEAF_SPACE 1#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_LEAF_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET)/* * Offset in data space of a data entry.
@@ -82,7 +82,6 @@ typedef struct xfs_dir2_leaf {* DB blocks here are logical directory block numbers, not filesystem blocks. */ -#define XFS_DIR2_MAX_LEAF_ENTS (mp) xfs_dir2_max_leaf_ents(mp)static inline int xfs_dir2_max_leaf_ents (struct xfs_mount *mp) { return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) /
@@ -92,7 +91,6 @@ static inline int xfs_dir2_max_leaf_ents/* * Get address of the bestcount field in the single-leaf block. */ -#define XFS_DIR2_LEAF_TAIL_P (mp,lp) xfs_dir2_leaf_tail_p(mp, lp)static inline xfs_dir2_leaf_tail_t *xfs_dir2_leaf_tail_p (struct xfs_mount *mp,xfs_dir2_leaf_t *lp) {
@@ -104,7 +102,6 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *m/* * Get address of the bests array in the single-leaf block. */ -#define XFS_DIR2_LEAF_BESTS_P (ltp) xfs_dir2_leaf_bests_p(ltp)static inline __be16 *xfs_dir2_leaf_bests_p (xfs_dir2_leaf_tail_t *ltp) {
@@ -114,7 +111,6 @@ xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail/* * Convert dataptr to byte in file space */ -#define XFS_DIR2_DATAPTR_TO_BYTE (mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)static inline xfs_dir2_off_t xfs_dir2_dataptr_to_byte (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) {
@@ -124,7 +120,6 @@ xfs_dir2_dataptr_to_byte(struct xfs_moun/* * Convert byte in file space to dataptr. It had better be aligned. */ -#define XFS_DIR2_BYTE_TO_DATAPTR (mp,by) xfs_dir2_byte_to_dataptr(mp,by)static inline xfs_dir2_dataptr_t xfs_dir2_byte_to_dataptr (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -134,7 +129,6 @@ xfs_dir2_byte_to_dataptr(struct xfs_moun/* * Convert byte in space to (DB) block */ -#define XFS_DIR2_BYTE_TO_DB (mp,by) xfs_dir2_byte_to_db(mp, by)static inline xfs_dir2_db_t xfs_dir2_byte_to_db (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -145,17 +139,15 @@ xfs_dir2_byte_to_db(struct xfs_mount *mp/* * Convert dataptr to a block number */ -#define XFS_DIR2_DATAPTR_TO_DB (mp,dp) xfs_dir2_dataptr_to_db(mp, dp)static inline xfs_dir2_db_t xfs_dir2_dataptr_to_db (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) { -return XFS_DIR2_BYTE_TO_DB (mp,XFS_DIR2_DATAPTR_TO_BYTE (mp, dp)); +return xfs_dir2_byte_to_db (mp,xfs_dir2_dataptr_to_byte (mp, dp)); }/* * Convert byte in space to offset in a block */ -#define XFS_DIR2_BYTE_TO_OFF (mp,by) xfs_dir2_byte_to_off(mp, by)static inline xfs_dir2_data_aoff_t xfs_dir2_byte_to_off (struct xfs_mount *mp,xfs_dir2_off_t by) {
@@ -166,18 +158,15 @@ xfs_dir2_byte_to_off(struct xfs_mount *m/* * Convert dataptr to a byte offset in a block */ -#define XFS_DIR2_DATAPTR_TO_OFF (mp,dp) xfs_dir2_dataptr_to_off(mp, dp)static inline xfs_dir2_data_aoff_t xfs_dir2_dataptr_to_off (struct xfs_mount *mp,xfs_dir2_dataptr_t dp) { -return XFS_DIR2_BYTE_TO_OFF (mp,XFS_DIR2_DATAPTR_TO_BYTE (mp, dp)); +return xfs_dir2_byte_to_off (mp,xfs_dir2_dataptr_to_byte (mp, dp)); }/* * Convert block and offset to byte in space */ -#define XFS_DIR2_DB_OFF_TO_BYTE (mp,db,o) \ - xfs_dir2_db_off_to_byte(mp, db, o)static inline xfs_dir2_off_t xfs_dir2_db_off_to_byte (struct xfs_mount *mp,xfs_dir2_db_t db,xfs_dir2_data_aoff_t o)
@@ -189,7 +178,6 @@ xfs_dir2_db_off_to_byte(struct xfs_mount/* * Convert block (DB) to block (dablk) */ -#define XFS_DIR2_DB_TO_DA (mp,db) xfs_dir2_db_to_da(mp, db)static inline xfs_dablk_t xfs_dir2_db_to_da (struct xfs_mount *mp,xfs_dir2_db_t db) {
@@ -199,29 +187,25 @@ xfs_dir2_db_to_da(struct xfs_mount *mp,/* * Convert byte in space to (DA) block */ -#define XFS_DIR2_BYTE_TO_DA (mp,by) xfs_dir2_byte_to_da(mp, by)static inline xfs_dablk_t xfs_dir2_byte_to_da (struct xfs_mount *mp,xfs_dir2_off_t by) { -return XFS_DIR2_DB_TO_DA (mp,XFS_DIR2_BYTE_TO_DB (mp, by)); +return xfs_dir2_db_to_da (mp,xfs_dir2_byte_to_db (mp, by)); }/* * Convert block and offset to dataptr */ -#define XFS_DIR2_DB_OFF_TO_DATAPTR (mp,db,o) \ - xfs_dir2_db_off_to_dataptr(mp, db, o)static inline xfs_dir2_dataptr_t xfs_dir2_db_off_to_dataptr (struct xfs_mount *mp,xfs_dir2_db_t db,xfs_dir2_data_aoff_t o) { -return XFS_DIR2_BYTE_TO_DATAPTR (mp,XFS_DIR2_DB_OFF_TO_BYTE (mp, db, o)); +return xfs_dir2_byte_to_dataptr (mp,xfs_dir2_db_off_to_byte (mp, db, o)); }/* * Convert block (dablk) to block (DB) */ -#define XFS_DIR2_DA_TO_DB (mp,da) xfs_dir2_da_to_db(mp, da)static inline xfs_dir2_db_t xfs_dir2_da_to_db (struct xfs_mount *mp,xfs_dablk_t da) {
@@ -231,11 +215,10 @@ xfs_dir2_da_to_db(struct xfs_mount *mp,/* * Convert block (dablk) to byte offset in space */ -#define XFS_DIR2_DA_TO_BYTE (mp,da) xfs_dir2_da_to_byte(mp, da)static inline xfs_dir2_off_t xfs_dir2_da_to_byte (struct xfs_mount *mp,xfs_dablk_t da) { -return XFS_DIR2_DB_OFF_TO_BYTE (mp,XFS_DIR2_DA_TO_DB (mp, da),0 ); +return xfs_dir2_db_off_to_byte (mp,xfs_dir2_da_to_db (mp, da),0 ); }/*
fs/xfs/xfs_dir2_node.c +33 -33
248 lines not on this page · raw message
fs/xfs/xfs_dir2_node.h +1 -3
@@ -36,7 +36,7 @@ struct xfs_trans;#define XFS_DIR2_FREE_SPACE 2#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)#define XFS_DIR2_FREE_FIRSTDB (mp) \ - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_FREE_OFFSET) + xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET)#define XFS_DIR2_FREE_MAGIC 0x58443246/* XD2F */
@@ -60,7 +60,6 @@ typedef struct xfs_dir2_free {/* * Convert data space db to the corresponding free db. */ -#define XFS_DIR2_DB_TO_FDB (mp,db) xfs_dir2_db_to_fdb(mp, db)static inline xfs_dir2_db_t xfs_dir2_db_to_fdb (struct xfs_mount *mp,xfs_dir2_db_t db) {
@@ -70,7 +69,6 @@ xfs_dir2_db_to_fdb(struct xfs_mount *mp,/* * Convert data space db to the corresponding index in a free db. */ -#define XFS_DIR2_DB_TO_FDINDEX (mp,db) xfs_dir2_db_to_fdindex(mp, db)static inline int xfs_dir2_db_to_fdindex (struct xfs_mount *mp,xfs_dir2_db_t db) {
fs/xfs/xfs_dir2_sf.c +102 -102
487 lines not on this page · raw message
fs/xfs/xfs_dir2_sf.h +2 -18
@@ -90,7 +90,6 @@ typedef struct xfs_dir2_sf {xfs_dir2_sf_entry_t list[1 ];/* shortform entries */ } xfs_dir2_sf_t; -#define XFS_DIR2_SF_HDR_SIZE (i8count) xfs_dir2_sf_hdr_size(i8count)static inline int xfs_dir2_sf_hdr_size (int i8count) { return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \
@@ -98,14 +97,11 @@ static inline int xfs_dir2_sf_hdr_size(i ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_INUMBERP (sfep) xfs_dir2_sf_inumberp(sfep)static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp (xfs_dir2_sf_entry_t *sfep) {return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]; } -#define XFS_DIR2_SF_GET_INUMBER (sfp, from) \ - xfs_dir2_sf_get_inumber(sfp, from)static inline xfs_intino_t xfs_dir2_sf_get_inumber (xfs_dir2_sf_t *sfp,xfs_dir2_inou_t *from) {
@@ -114,8 +110,6 @@ xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *s (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)); } -#define XFS_DIR2_SF_PUT_INUMBER (sfp,from,to) \ - xfs_dir2_sf_put_inumber(sfp,from,to)static inline void xfs_dir2_sf_put_inumber (xfs_dir2_sf_t *sfp,xfs_ino_t *from,xfs_dir2_inou_t *to) {
@@ -125,24 +119,18 @@ static inline void xfs_dir2_sf_put_inumbXFS_PUT_DIR_INO8 (*(from), (to)->i8); } -#define XFS_DIR2_SF_GET_OFFSET (sfep) \ - xfs_dir2_sf_get_offset(sfep)static inline xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset (xfs_dir2_sf_entry_t *sfep) {return INT_GET_UNALIGNED_16_BE (&(sfep)->offset.i); } -#define XFS_DIR2_SF_PUT_OFFSET (sfep,off) \ - xfs_dir2_sf_put_offset(sfep,off)static inline void xfs_dir2_sf_put_offset (xfs_dir2_sf_entry_t *sfep,xfs_dir2_data_aoff_t off) {INT_SET_UNALIGNED_16_BE (&(sfep)->offset.i, off); } -#define XFS_DIR2_SF_ENTSIZE_BYNAME (sfp,len) \ - xfs_dir2_sf_entsize_byname(sfp,len)static inline int xfs_dir2_sf_entsize_byname (xfs_dir2_sf_t *sfp,int len) { return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \
@@ -150,8 +138,6 @@ static inline int xfs_dir2_sf_entsize_by ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_ENTSIZE_BYENTRY (sfp,sfep) \ - xfs_dir2_sf_entsize_byentry(sfp,sfep)static inline int xfs_dir2_sf_entsize_byentry (xfs_dir2_sf_t *sfp,xfs_dir2_sf_entry_t *sfep) {
@@ -160,19 +146,17 @@ xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_ ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); } -#define XFS_DIR2_SF_FIRSTENTRY (sfp) xfs_dir2_sf_firstentry(sfp)static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry (xfs_dir2_sf_t *sfp) {return ((xfs_dir2_sf_entry_t *) \ - ((char *)(sfp) +XFS_DIR2_SF_HDR_SIZE (sfp->hdr.i8count))); + ((char *)(sfp) +xfs_dir2_sf_hdr_size (sfp->hdr.i8count))); } -#define XFS_DIR2_SF_NEXTENTRY (sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep)static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_nextentry (xfs_dir2_sf_t *sfp,xfs_dir2_sf_entry_t *sfep) {return ((xfs_dir2_sf_entry_t *) \ - ((char *)(sfep) +XFS_DIR2_SF_ENTSIZE_BYENTRY (sfp,sfep))); + ((char *)(sfep) +xfs_dir2_sf_entsize_byentry (sfp,sfep))); }/*
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Christoph Hellwig
Remove all the macros that just give inline functions uppercase names.
Signed-off-by Christoph Hellwig <[email protected]>This patch still hasn't made it to mainline, so here's a version rediffed for latest mainline because it's required for the next patch
It's in my test tree - I just haven't had a chance to review it properly and check it in yet because of all the other stuff I've got to do right now. Cleanups are not high priority compared to finding and fixing the numerous data corruption problems that have been uncovered recently...
At least it's being QA'd regularly. ;)
Cheers,
Dave.
Signature · 3 lines
Dave Chinner Principal Engineer SGI Australian Software Group