xfsprogs: bring code up to date with kernel
cover xfsprogs: bring code up to date with kernel
Hi folks,
This is an updated version of the patchset posted here:
http://oss.sgi.com/archives/xfs/2013-07/msg00454.html
Changes since the previous version:
- rebased onto master branch of repository
- updated to match current kernel code
- added several new patches for changes added to the kernel code
- fixed many bugs
- mkfs log sizing was wrong
- dtype output for block format directories didn't work
- repair was crashing on corrupt block format directories
- xfs_trans.h completely removed
There is not support for validating dtype in xfs_repair yet - that is part of a series of improved validation changes I'm making at the moment on top of this patchset, along with stuff like making xfs_db use libxfs infrastructure....
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/55 xfsprogs: introduce xfs_icreate.h
From: Dave Chinner <[email protected]>
Bring the new inode create item definitions across from kernel space for xfs_logprint to be able to parse.
--- include/Makefile | 2 +- include/xfs_icreate_item.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_log.h | 3 ++- include/xfs_trans.h | 7 +++++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 include/xfs_icreate_item.h
include/Makefile +1 -1
@@ -26,7 +26,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ - xfs_inode.h xfs_inode_item.h xfs_inum.h \ + xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/xfs_icreate_item.h new file +52 -0
52 lines not on this page · raw message
include/xfs_log.h +2 -1
@@ -88,7 +88,8 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)#define XLOG_REG_TYPE_UNMOUNT 17#define XLOG_REG_TYPE_COMMIT 18#define XLOG_REG_TYPE_TRANSHDR 19 -#define XLOG_REG_TYPE_MAX 19 +#define XLOG_REG_TYPE_ICREATE 20 +#define XLOG_REG_TYPE_MAX 20 typedef struct xfs_log_iovec { void *i_addr; /* beginning address of region */
include/xfs_trans.h +5 -2
@@ -48,6 +48,7 @@ typedef struct xfs_trans_header {#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ #define XFS_LI_DQUOT 0x123d#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f#define XFS_LI_TYPE_DESC \ { XFS_LI_EFI, "XFS_LI_EFI" }, \
@@ -56,7 +57,8 @@ typedef struct xfs_trans_header { { XFS_LI_INODE, "XFS_LI_INODE" }, \ { XFS_LI_BUF, "XFS_LI_BUF" }, \ { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ - { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" } + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" }/* * Transaction types. Used to distinguish types of buffers.
@@ -107,7 +109,8 @@ typedef struct xfs_trans_header {#define XFS_TRANS_SWAPEXT 40#define XFS_TRANS_SB_COUNT 41#define XFS_TRANS_CHECKPOINT 42 -#define XFS_TRANS_TYPE_MAX 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43/* new transaction types need to be reflected in xfs_logprint(8) */ #define XFS_TRANS_TYPES \
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/55] xfsprogs: introduce xfs_icreate.h
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Bring the new inode create item definitions across from kernel space for
xfs_logprintto be able to parse.Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/55 xfsprogs: port inode create transaction changes
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Bring across the relevant parts of the new inode create transaction sufficient to keep kernel/user code in sync and implement the infrastructure needed to make it work in xfsprogs.
--- include/libxfs.h | 1 + include/xfs_ialloc.h | 8 +++ include/xfs_icreate_item.h | 3 ++ libxfs/xfs.h | 5 ++ libxfs/xfs_ialloc.c | 87 +++++++++++++++++++++++++-------- libxfs/xfs_trans.c | 118 +++++++++++++++++++++++++++++---------------- 6 files changed, 160 insertions(+), 62 deletions(-)
include/libxfs.h +1 -0
@@ -57,6 +57,7 @@#include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> +#include <xfs/xfs_icreate_item.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
include/xfs_ialloc.h +8 -0
@@ -150,6 +150,14 @@ int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,int xfs_inobt_get_rec (struct xfs_btree_cur *cur,xfs_inobt_rec_incore_t *rec,int *stat); +/* +* Inode chunk initialisation routine +*/ +int xfs_ialloc_inode_init (struct xfs_mount *mp,struct xfs_trans *tp, +struct list_head *buffer_list, +xfs_agnumber_t agno,xfs_agblock_t agbno, +xfs_agblock_t length,unsigned int gen); +extern const struct xfs_buf_ops xfs_agi_buf_ops;#endif /* __XFS_IALLOC_H__ */
include/xfs_icreate_item.h +3 -0
@@ -36,6 +36,8 @@ struct xfs_icreate_log {__be32 icl_gen;/* inode generation number to use */ }; +#ifdef __KERNEL__ + /* in memory log item structure */ struct xfs_icreate_item { struct xfs_log_item ic_item;
@@ -48,5 +50,6 @@ void xfs_icreate_log(struct xfs_trans *tp, xfs_agnumber_t agno, xfs_agblock_t agbno, unsigned int count, unsigned int inode_size, xfs_agblock_t length, unsigned int generation); +#endif /* __KERNEL__ */ #endif /* XFS_ICREATE_ITEM_H */
libxfs/xfs.h +5 -0
@@ -176,6 +176,7 @@ roundup_pow_of_two(uint v)#define XBF_TRYLOCK XFS_BUF_TRYLOCK#define XBF_DONT_BLOCK 0#define XBF_UNMAPPED 0 +#define XBF_DONE 0#define XFS_BUF_GETERROR (bp) 0#define XFS_BUF_DONE (bp) ((bp)->b_flags |= LIBXFS_B_UPTODATE)#define XFS_BUF_ISDONE (bp) ((bp)->b_flags & LIBXFS_B_UPTODATE)
@@ -194,6 +195,7 @@ roundup_pow_of_two(uint v)#define xfs_buf_relse (bp) libxfs_putbuf(bp)#define xfs_buf_get (devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len)))#define xfs_bwrite (bp) libxfs_writebuf((bp), 0) +#define xfs_buf_delwri_queue (bp, bl) libxfs_writebuf((bp), 0)#define XBRW_READ LIBXFS_BREAD#define XBRW_WRITE LIBXFS_BWRITE
@@ -252,6 +254,7 @@ roundup_pow_of_two(uint v)#define xfs_trans_get_block_res (tp) 1#define xfs_trans_set_sync (tp) ((void) 0) +#define xfs_trans_ordered_buf (tp, bp) ((void) 0)#define xfs_trans_agblocks_delta (tp, d)#define xfs_trans_agflist_delta (tp, d)#define xfs_trans_agbtree_delta (tp, d)
@@ -325,6 +328,8 @@ do { \#define uuid_copy (s,d) platform_uuid_copy((s),(d))#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +/* * Prototypes for kernel static functions that are aren't in their * associated header files
libxfs/xfs_ialloc.c +66 -21
133 lines not on this page · raw message
libxfs/xfs_trans.c +77 -41
154 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/55] xfsprogs: port inode create transaction changes
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Bring across the relevant parts of the new inode create transaction sufficient to keep kernel/user code in sync and implement the infrastructure needed to make it work in xfsprogs.
Signed-off-by Dave Chinner<[email protected]>---
Same as previous posting. I said in the last patch posting that this had "parts of kernel commits 28c8e41a, ddf6ad01, b8402b47?, and b8402b47".
I did not thoroughly review the previous posting of this patch, so I am looking at it closer now.
There arguement difference in xfs_ialloc_get_rec() from Linux 3.11, but that is needed for patch 11.
Still looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/55 xfsprogs: teach logprint about icreate transaction
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/libxlog.h | 1 + logprint/log_misc.c | 36 ++++++++++++++++++++++++++++++++++++ logprint/log_print_all.c | 21 +++++++++++++++++++++ 3 files changed, 58 insertions(+)
include/libxlog.h +1 -0
@@ -51,6 +51,7 @@ struct xlog {#include <xfs/xfs_buf_item.h> #include <xfs/xfs_inode_item.h> #include <xfs/xfs_extfree_item.h> +#include <xfs/xfs_icreate_item.h> typedef union { xlog_rec_header_t hic_header;
logprint/log_misc.c +36 -0
@@ -70,6 +70,7 @@ char *trans_type[] = {"SWAPEXT" ,"SB_COUNT" ,"CHECKPOINT" , + "ICREATE", }; typedef struct xlog_split_item {
@@ -792,6 +793,35 @@ xlog_print_trans_dquot(xfs_caddr_t *ptr, int len, int *i, int num_ops) }/* xlog_print_trans_dquot */ +STATIC int +xlog_print_trans_icreate ( +xfs_caddr_t *ptr, +int len, +int *i, +int num_ops) +{ +struct xfs_icreate_log icl_buf = {0 }; +struct xfs_icreate_log *icl; + +memmove (&icl_buf, *ptr,MIN (sizeof (struct xfs_icreate_log ), len)); + icl = &icl_buf; + (*i)++; + *ptr += len; + +/* handle complete header only */ +if (len !=sizeof (struct xfs_icreate_log )) { +printf (_ ("ICR: split header, not printing\n" )); +return 1 ;/* to skip leftover in next region */ + } + +printf (_ ("ICR: #ag: %d agbno: 0x%x len: %d\n" +" cnt: %d isize: %d gen: 0x%x\n" ), +be32_to_cpu (icl->icl_ag),be32_to_cpu (icl->icl_agbno), +be32_to_cpu (icl->icl_length),be32_to_cpu (icl->icl_count), +be32_to_cpu (icl->icl_isize),be32_to_cpu (icl->icl_gen)); +return 0 ; +} +/****************************************************************************** * * Log print routines
@@ -974,6 +1004,12 @@ xlog_print_record(int fd, &i, num_ops);break ; } +case XFS_LI_ICREATE : { + skip =xlog_print_trans_icreate (&ptr, +be32_to_cpu (op_head->oh_len), + &i, num_ops); +break ; + }case XFS_LI_INODE : { skip = xlog_print_trans_inode(&ptr, be32_to_cpu(op_head->oh_len),
logprint/log_print_all.c +21 -0
@@ -432,6 +432,21 @@ xlog_recover_print_efi(free (f); } +STATIC void +xlog_recover_print_icreate ( +struct xlog_recover_item *item) +{ +struct xfs_icreate_log *icl; + + icl = (struct xfs_icreate_log *)item->ri_buf[0 ].i_addr; + +printf (_ (" ICR: #ag: %d agbno: 0x%x len: %d\n" +" cnt: %d isize: %d gen: 0x%x\n" ), +be32_to_cpu (icl->icl_ag),be32_to_cpu (icl->icl_agbno), +be32_to_cpu (icl->icl_length),be32_to_cpu (icl->icl_count), +be32_to_cpu (icl->icl_isize),be32_to_cpu (icl->icl_gen)); +} +void xlog_recover_print_logitem (xlog_recover_item_t *item)
@@ -440,6 +455,9 @@ xlog_recover_print_logitem(case XFS_LI_BUF :xlog_recover_print_buffer (item);break ; +case XFS_LI_ICREATE : +xlog_recover_print_icreate (item); +break ;case XFS_LI_INODE :xlog_recover_print_inode (item);break ;
@@ -471,6 +489,9 @@ xlog_recover_print_item(case XFS_LI_BUF :printf ("BUF" );break ; +case XFS_LI_ICREATE : +printf ("ICR" ); +break ;case XFS_LI_INODE :printf ("INO" );break ;
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 03/55] xfsprogs: teach logprint about icreate transaction
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
No change to patch from last posting.
When reviewing the patch before I said, "xfs_logprint can print the icreate log items. good layout of information."
Still looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/55 libxfs: fix directory/attribute format issues
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
directory data headers and attr leaf headers need padding for 32 bit systems to correctly align the data sections on 64 bit boundaries.
--- include/xfs_attr_leaf.h | 1 + include/xfs_dir2_format.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
include/xfs_attr_leaf.h +1 -0
@@ -128,6 +128,7 @@ struct xfs_attr3_leaf_hdr {__u8 holes;__u8 pad1;struct xfs_attr_leaf_map freemap[XFS_ATTR_LEAF_MAPSIZE ]; +__be32 pad2;/* 64 bit alignment */ };#define XFS_ATTR3_LEAF_CRC_OFF (offsetof(struct xfs_attr3_leaf_hdr, info.crc))
include/xfs_dir2_format.h +3 -2
@@ -260,6 +260,7 @@ struct xfs_dir3_blk_hdr {struct xfs_dir3_data_hdr {struct xfs_dir3_blk_hdr hdr;xfs_dir2_data_free_t best_free[XFS_DIR2_DATA_FD_COUNT ]; +__be32 pad;/* 64 bit alignment */ };#define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc)
@@ -471,7 +472,7 @@ struct xfs_dir3_leaf_hdr {struct xfs_da3_blkinfo info;/* header for da routines */ __be16 count;/* count of entries */ __be16 stale;/* count of stale entries */ -__be32 pad; +__be32 pad;/* 64 bit alignment */ };struct xfs_dir3_icleaf_hdr {
@@ -712,7 +713,7 @@ struct xfs_dir3_free_hdr {__be32 firstdb;/* db of first entry */ __be32 nvalid;/* count of valid entries */ __be32 nused;/* count of used entries */ -__be32 pad;/* 64 bit alignment. */ +__be32 pad;/* 64 bit alignment */ };struct xfs_dir3_free {
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/55] libxfs: fix directory/attribute format issues
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
directory data headers and attr leaf headers need padding for 32 bit systems to correctly align the data sections on 64 bit boundaries.
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed since the last posting. It brings xfsprogs to kernel commit 5170711d
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/55 libxfs: ensure btree root split sets blkno correctly
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
For CRC enabled filesystems, the BMBT is rooted in an inode, so it passes through a difference code path on root splits to the freespace and inode btrees. The inode based btree root has a corruption problem on split - it's the same problem we saw in the directory/attr code where headers are memcpy()d from one block to another without updating the self describing metadata.
Simple fix - when copying the header out of the root block, make sure the block number is updated correctly.
--- libxfs/xfs_btree.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
libxfs/xfs_btree.c +10 -0
@@ -2487,7 +2487,17 @@ xfs_btree_new_iroot(if (error) goto error0; +/* +* we can't just memcpy() the root in for CRC enabled btree blocks. +* In that case have to also ensure the blkno remains correct +*/ memcpy (cblock, block,xfs_btree_block_len (cur)); +if (cur->bc_flags &XFS_BTREE_CRC_BLOCKS ) { +if (cur->bc_flags &XFS_BTREE_LONG_PTRS ) + cblock->bb_u.l.bb_blkno =cpu_to_be64 (cbp->b_bn); +else + cblock->bb_u.s.bb_blkno =cpu_to_be64 (cbp->b_bn); + }be16_add_cpu (&block->bb_level,1 );xfs_btree_set_numrecs (block,1 );
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/55] libxfs: ensure btree root split sets blkno correctly
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
For CRC enabled filesystems, the BMBT is rooted in an inode, so it passes through a difference code path on root splits to the freespace and inode btrees. The inode based btree root has a corruption problem on split - it's the same problem we saw in the directory/attr code where headers are memcpy()d from one block to another without updating the self describing metadata.
Quoted 5 lines
Simple fix - when copying the header out of the root block, make sure the block number is updated correctly.
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed since last posting. It brings xfsprogs to kernel commit ade1335a
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/55 libxfs: fix byte swapping on constants
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The kernel code uses cpu_to_beXX() on constants in switch() statements for magic numbers in the btree code. Th ebyte swapping infratructure isn't hooked up to the proper byte swap macros to make this work, so fix it and then swap all the generic btree code over to match the kernel code.
--- include/swab.h | 6 +++--- libxfs/xfs_alloc_btree.c | 23 ++++++++++++++--------- libxfs/xfs_bmap_btree.c | 14 ++++++-------- libxfs/xfs_ialloc_btree.c | 16 +++++++++++----- 4 files changed, 34 insertions(+), 25 deletions(-)
include/swab.h +3 -3
@@ -96,15 +96,15 @@*/ # define __swab16 (x) \ (__builtin_constant_p((__u16)(x)) ? \ - ___swab16((x)) : \ + ___constant_swab16((x)) : \ __fswab16((x)))# define __swab32 (x) \ (__builtin_constant_p((__u32)(x)) ? \ - ___swab32((x)) : \ + ___constant_swab32((x)) : \ __fswab32((x)))# define __swab64 (x) \ (__builtin_constant_p((__u64)(x)) ? \ - ___swab64((x)) : \ + ___constant_swab64((x)) : \ __fswab64((x)))
libxfs/xfs_alloc_btree.c +14 -9
@@ -268,10 +268,15 @@ xfs_allocbt_verify(* During growfs operations, we can't verify the exact level or owner as * the perag is not fully initialised and hence not attached to the * buffer. In this case, check against the maximum tree depth. +* +* Similarly, during log recovery we will have a perag structure +* attached, but the agf information will not yet have been initialised +* from the on disk AGF. Again, we can only check against maximum limits +* in this case. */ level =be16_to_cpu (block->bb_level); -switch (cpu_to_be32 (block->bb_magic)) { -case XFS_ABTB_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_ABTB_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -282,14 +287,14 @@ xfs_allocbt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_ABTB_MAGIC : -if (pag) { +case cpu_to_be32 (XFS_ABTB_MAGIC ): +if (pag && pag->pagf_init) {if (level >= pag->pagf_levels[XFS_BTNUM_BNOi])return false; }else if (level >= mp->m_ag_maxlevels)return false;break ; -case XFS_ABTC_CRC_MAGIC : +case cpu_to_be32 (XFS_ABTC_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -300,8 +305,8 @@ xfs_allocbt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_ABTC_MAGIC : -if (pag) { +case cpu_to_be32 (XFS_ABTC_MAGIC ): +if (pag && pag->pagf_init) {if (level >= pag->pagf_levels[XFS_BTNUM_CNTi])return false; }else if (level >= mp->m_ag_maxlevels)
@@ -361,7 +366,7 @@ const struct xfs_buf_ops xfs_allocbt_buf_ops = { }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_allocbt_keys_inorder( struct xfs_btree_cur *cur,
@@ -483,7 +488,7 @@ static const struct xfs_btree_ops xfs_allocbt_ops = { .init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur, .key_diff = xfs_allocbt_key_diff, .buf_ops = &xfs_allocbt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_allocbt_keys_inorder, .recs_inorder = xfs_allocbt_recs_inorder,#endif
libxfs/xfs_bmap_btree.c +6 -8
@@ -708,13 +708,13 @@ xfs_bmbt_verify(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);unsigned int level; -switch (be32_to_cpu (block->bb_magic)) { -case XFS_BMAP_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_BMAP_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.l.bb_uuid, &mp->m_sb.sb_uuid))return false; -if (block->bb_u.l.bb_blkno !=cpu_to_be64 (bp->b_bn)) +if (be64_to_cpu (block->bb_u.l.bb_blkno) != bp->b_bn)return false;/* * XXX: need a better way of verifying the owner here. Right now
@@ -723,7 +723,7 @@ xfs_bmbt_verify(if (be64_to_cpu (block->bb_u.l.bb_owner) ==0 )return false;/* fall through */ -case XFS_BMAP_MAGIC : +case cpu_to_be32 (XFS_BMAP_MAGIC ):break ;default :return false;
@@ -759,7 +759,6 @@ static voidxfs_bmbt_read_verify ( struct xfs_buf *bp) { -xfs_bmbt_verify (bp);if (!(xfs_btree_lblock_verify_crc (bp) &&xfs_bmbt_verify (bp))) {trace_xfs_btree_corrupt (bp, _RET_IP_);
@@ -767,7 +766,6 @@ xfs_bmbt_read_verify( bp->b_target->bt_mount, bp->b_addr);xfs_buf_ioerror (bp,EFSCORRUPTED ); } - } static void
@@ -791,7 +789,7 @@ const struct xfs_buf_ops xfs_bmbt_buf_ops = { }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_bmbt_keys_inorder( struct xfs_btree_cur *cur,
@@ -920,7 +918,7 @@ static const struct xfs_btree_ops xfs_bmbt_ops = { .init_ptr_from_cur = xfs_bmbt_init_ptr_from_cur, .key_diff = xfs_bmbt_key_diff, .buf_ops = &xfs_bmbt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_bmbt_keys_inorder, .recs_inorder = xfs_bmbt_recs_inorder,#endif
libxfs/xfs_ialloc_btree.c +11 -5
@@ -175,9 +175,15 @@ xfs_inobt_verify(/* * During growfs operations, we can't verify the exact owner as the * perag is not fully initialised and hence not attached to the buffer. +* +* Similarly, during log recovery we will have a perag structure +* attached, but the agi information will not yet have been initialised +* from the on disk AGI. We don't currently use any of this information, +* but beware of the landmine (i.e. need to check pag->pagi_init) if we +* ever do. */ -switch (be32_to_cpu (block->bb_magic)) { -case XFS_IBT_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_IBT_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -188,7 +194,7 @@ xfs_inobt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_IBT_MAGIC : +case cpu_to_be32 (XFS_IBT_MAGIC ):break ;default :return 0 ;
@@ -246,7 +252,7 @@ const struct xfs_buf_ops xfs_inobt_buf_ops = { .verify_write = xfs_inobt_write_verify, }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_inobt_keys_inorder( struct xfs_btree_cur *cur,
@@ -350,7 +356,7 @@ static const struct xfs_btree_ops xfs_inobt_ops = { .init_ptr_from_cur = xfs_inobt_init_ptr_from_cur, .key_diff = xfs_inobt_key_diff, .buf_ops = &xfs_inobt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_inobt_keys_inorder, .recs_inorder = xfs_inobt_recs_inorder,#endif
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 06/55] libxfs: fix byte swapping on constants
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The kernel code uses
cpu_to_beXX()on constants inswitch()statements for magic numbers in the btree code. Th ebyte swapping infratructure isn't hooked up to the proper byte swap macros to make this work, so fix it and then swap all the generic btree code over to match the kernel code.Signed-off-by Dave Chinner<[email protected]>---
Patch has not changed since last posting.
sync to include/uapi/linux/swab.h and switch/case statements in xfs_allocbt_verify() like kernel commit ee1a47ab.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/55 libxfs: sync xfs_da_btree.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some variables we renamed in the kernel code, and there are a few other minor differences. Fix them up.
--- libxfs/xfs_da_btree.c | 63 +++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 30 deletions(-)
libxfs/xfs_da_btree.c +33 -30
@@ -480,8 +480,10 @@ xfs_da3_split(* There might be three blocks involved if a double split occurred, * and the original block 0 could be at any position in the list. * -* Note: the info structures being modified here for both v2 and v3 da -* headers, so we can do this linkage just using the v2 structures. +* Note: the magic numbers and sibling pointers are in the same +* physical place for both v2 and v3 headers (by design). Hence it +* doesn't matter which version of the xfs_da_intnode structure we use +* here as the result will be the same using either structure. */ node = oldblk->bp->b_addr;if (node->hdr.info.forw) {
@@ -820,7 +822,7 @@ xfs_da3_node_rebalance(*/ nodehdr2.count += count; tmp = count * (uint )sizeof (xfs_da_node_entry_t); - btree_s = &btree1[nodehdr1.count- count]; + btree_s = &btree1[nodehdr1.count - count]; btree_d = &btree2[0 ];memcpy (btree_d, btree_s, tmp); nodehdr1.count -= count;
@@ -1380,10 +1382,10 @@ xfs_da3_node_unbalance( {struct xfs_da_intnode *drop_node;struct xfs_da_intnode *save_node; -struct xfs_da_node_entry *dbtree; -struct xfs_da_node_entry *sbtree; -struct xfs_da3_icnode_hdr dhdr; -struct xfs_da3_icnode_hdr shdr; +struct xfs_da_node_entry *drop_btree; +struct xfs_da_node_entry *save_btree; +struct xfs_da3_icnode_hdr drop_hdr; +struct xfs_da3_icnode_hdr save_hdr;struct xfs_trans *tp;int sindex;int tmp;
@@ -1392,43 +1394,44 @@ xfs_da3_node_unbalance( drop_node = drop_blk->bp->b_addr; save_node = save_blk->bp->b_addr; -xfs_da3_node_hdr_from_disk (&dhdr, drop_node); -xfs_da3_node_hdr_from_disk (&shdr, save_node); - dbtree =xfs_da3_node_tree_p (drop_node); - sbtree =xfs_da3_node_tree_p (save_node); +xfs_da3_node_hdr_from_disk (&drop_hdr, drop_node); +xfs_da3_node_hdr_from_disk (&save_hdr, save_node); + drop_btree =xfs_da3_node_tree_p (drop_node); + save_btree =xfs_da3_node_tree_p (save_node); tp = state->args->trans;/* * If the dying block has lower hashvals, then move all the * elements in the remaining block up to make a hole. */ -if ((be32_to_cpu (dbtree[0 ].hashval) <be32_to_cpu (sbtree[0 ].hashval)) || - (be32_to_cpu (dbtree[dhdr.count -1 ].hashval) < -be32_to_cpu (sbtree[shdr.count -1 ].hashval))) { +if ((be32_to_cpu (drop_btree[0 ].hashval) < +be32_to_cpu (save_btree[0 ].hashval)) || + (be32_to_cpu (drop_btree[drop_hdr.count -1 ].hashval) < +be32_to_cpu (save_btree[save_hdr.count -1 ].hashval))) {/* XXX: check this - is memmove dst correct? */ - tmp = shdr.count * (uint )sizeof (xfs_da_node_entry_t); -memmove (&sbtree[dhdr.count], &sbtree[0 ], tmp); + tmp = save_hdr.count *sizeof (xfs_da_node_entry_t); +memmove (&save_btree[drop_hdr.count], &save_btree[0 ], tmp); sindex =0 ;xfs_trans_log_buf (tp, save_blk->bp, -XFS_DA_LOGRANGE (save_node, &sbtree[0 ], - (shdr.count + dhdr.count) * +XFS_DA_LOGRANGE (save_node, &save_btree[0 ], + (save_hdr.count + drop_hdr.count) *sizeof (xfs_da_node_entry_t))); }else { - sindex = shdr.count; + sindex = save_hdr.count;xfs_trans_log_buf (tp, save_blk->bp, -XFS_DA_LOGRANGE (save_node, &sbtree[sindex], - dhdr.count *sizeof (xfs_da_node_entry_t))); +XFS_DA_LOGRANGE (save_node, &save_btree[sindex], + drop_hdr.count *sizeof (xfs_da_node_entry_t))); }/* * Move all the B-tree elements from drop_blk to save_blk. */ - tmp = dhdr.count * (uint )sizeof (xfs_da_node_entry_t); -memcpy (&sbtree[sindex], &dbtree[0 ], tmp); - shdr.count += dhdr.count; + tmp = drop_hdr.count * (uint )sizeof (xfs_da_node_entry_t); +memcpy (&save_btree[sindex], &drop_btree[0 ], tmp); + save_hdr.count += drop_hdr.count; -xfs_da3_node_hdr_to_disk (save_node, &shdr); +xfs_da3_node_hdr_to_disk (save_node, &save_hdr);xfs_trans_log_buf (tp, save_blk->bp,XFS_DA_LOGRANGE (save_node, &save_node->hdr,xfs_da3_node_hdr_size (save_node)));
@@ -1436,7 +1439,7 @@ xfs_da3_node_unbalance(/* * Save the last hashval in the remaining block for upward propagation. */ - save_blk->hashval =be32_to_cpu (sbtree[shdr.count -1 ].hashval); + save_blk->hashval =be32_to_cpu (save_btree[save_hdr.count -1 ].hashval); }/*========================================================================
@@ -2201,8 +2204,6 @@ xfs_da3_swap_lastblock( }else {struct xfs_da3_icnode_hdr deadhdr; -ASSERT (dead_info->magic ==cpu_to_be16 (XFS_DA_NODE_MAGIC ) || - dead_info->magic ==cpu_to_be16 (XFS_DA3_NODE_MAGIC )); dead_node = (xfs_da_intnode_t *)dead_info;xfs_da3_node_hdr_from_disk (&deadhdr, dead_node); btree =xfs_da3_node_tree_p (dead_node);
@@ -2441,7 +2442,8 @@ xfs_buf_map_from_irec(ASSERT (nirecs >=1 );if (nirecs >1 ) { - map =kmem_zalloc (nirecs *sizeof (struct xfs_buf_map ),KM_SLEEP ); + map =kmem_zalloc (nirecs *sizeof (struct xfs_buf_map ), +KM_SLEEP |KM_NOFS );if (!map)return ENOMEM ; *mapp = map;
@@ -2497,7 +2499,8 @@ xfs_dabuf_map(* Optimize the one-block case. */ if (nfsb !=1 ) - irecs =kmem_zalloc (sizeof (irec) * nfsb,KM_SLEEP ); + irecs =kmem_zalloc (sizeof (irec) * nfsb, +KM_SLEEP |KM_NOFS ); nirecs = nfsb; error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs,
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/55] libxfs: sync xfs_da_btree.c
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some variables we renamed in the kernel code, and there are a few other minor differences. Fix them up.
Signed-off-by Dave Chinner<[email protected]>---
Patch has not changed since last posting. My review back then was [] is added to make sense of the comments:
okay, only difference [between the kernel/user source files] is the initializing of the pagb_tree in xfs_alloc_read_agf() [it is not in the xfsprogs]. [Okay, because we] Don't use the busy extent tree in user space.
Still looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/55] libxfs: sync xfs_da_btree.c
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some variables we renamed in the kernel code, and there are a few other minor differences. Fix them up.
Signed-off-by Dave Chinner<[email protected]>---
Opps put patch 8 comment on patch 7.
This also did not change in this repost. And the patch really
changed variable names in xfs_da3_node_unbalance(). add directory allocation NOFS per kernel commit b17cb364
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/55 libxfs: update xfs_alloc to current kernel version
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- libxfs/xfs_alloc.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
libxfs/xfs_alloc.c +19 -12
@@ -153,6 +153,7 @@ xfs_alloc_compute_diff(xfs_agblock_t wantbno,/* target starting block */ xfs_extlen_t wantlen, /* target length */ xfs_extlen_t alignment, /* target alignment */ + char userdata, /* are we allocating data? */ xfs_agblock_t freebno, /* freespace's starting block */ xfs_extlen_t freelen, /* freespace's length */ xfs_agblock_t *newbnop) /* result: best start block from free */
@@ -167,7 +168,14 @@ xfs_alloc_compute_diff(ASSERT (freelen >= wantlen); freeend = freebno + freelen; wantend = wantbno + wantlen; -if (freebno >= wantbno) { +/* +* We want to allocate from the start of a free extent if it is past +* the desired block or if we are allocating user data and the free +* extent is before desired block. The second case is there to allow +* for contiguous allocation from the remaining free space if the file +* grows in the short term. +*/ +if (freebno >= wantbno || (userdata && freeend < wantend)) {if ((newbno1 =roundup (freebno, alignment)) >= freeend) newbno1 =NULLAGBLOCK ; }else if (freeend >= wantend && alignment >1 ) {
@@ -783,7 +791,8 @@ xfs_alloc_find_best_extent(xfs_alloc_fix_len (args); sdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, *sbnoa, + args->alignment, + args->userdata, *sbnoa, *slena, &new);/*
@@ -954,7 +963,8 @@ restart:if (args->len < blen)continue ; ltdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, ltbnoa, ltlena, <new); + args->alignment, args->userdata, ltbnoa, + ltlena, <new);if (ltnew !=NULLAGBLOCK && (args->len > blen || ltdiff < bdiff)) { bdiff = ltdiff;
@@ -1106,7 +1116,8 @@ restart: args->len =XFS_EXTLEN_MIN (ltlena, args->maxlen);xfs_alloc_fix_len (args); ltdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, ltbnoa, ltlena, <new); + args->alignment, args->userdata, ltbnoa, + ltlena, <new); error = xfs_alloc_find_best_extent(args, &bno_cur_lt, &bno_cur_gt,
@@ -1122,7 +1133,8 @@ restart: args->len =XFS_EXTLEN_MIN (gtlena, args->maxlen);xfs_alloc_fix_len (args); gtdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, gtbnoa, gtlena, >new); + args->alignment, args->userdata, gtbnoa, + gtlena, >new); error = xfs_alloc_find_best_extent(args, &bno_cur_gt, &bno_cur_lt,
@@ -1181,7 +1193,7 @@ restart: } rlen = args->len; (void )xfs_alloc_compute_diff (args->agbno, rlen, args->alignment, - ltbnoa, ltlena, <new); + args->userdata, ltbnoa, ltlena, <new);ASSERT (ltnew >= ltbno);ASSERT (ltnew + rlen <= ltbnoa + ltlena);ASSERT (ltnew + rlen <=be32_to_cpu (XFS_BUF_TO_AGF (args->agbp)->agf_length));
@@ -2173,13 +2185,8 @@ xfs_agf_verify(struct xfs_agf *agf =XFS_BUF_TO_AGF (bp);if (xfs_sb_version_hascrc (&mp->m_sb) && - !uuid_equal (&agf->agf_uuid, &mp->m_sb.sb_uuid)) { -char uu[64 ], uu2[64 ]; -platform_uuid_unparse (&agf->agf_uuid, uu); -platform_uuid_unparse (&mp->m_sb.sb_uuid, uu2); - + !uuid_equal (&agf->agf_uuid, &mp->m_sb.sb_uuid))return false; - } if (!(agf->agf_magicnum == cpu_to_be32(XFS_AGF_MAGIC) && XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) &&
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 08/55] libxfs: update xfs_alloc to current kernel version
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
Patch has not changed since last post.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/55 libxfs: sync attr code with kernel
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- libxfs/xfs_attr.c | 6 +++--- libxfs/xfs_attr_leaf.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
libxfs/xfs_attr.c +3 -3
@@ -65,7 +65,7 @@ xfs_attr_name_to_xname(return 0 ; } -STATIC int +int xfs_inode_hasattr (struct xfs_inode *ip) {
@@ -268,7 +268,6 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error = xfs_trans_reserve(args.trans, args.total, XFS_ATTRSETM_LOG_RES(mp) + XFS_ATTRSETRT_LOG_RES(mp) * args.total,
@@ -587,6 +586,7 @@ xfs_attr_remove(return xfs_attr_remove_int (dp, &xname, flags); } +/*======================================================================== * External routines when attribute list is inside the inode *========================================================================*/
@@ -854,7 +854,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) error =xfs_attr3_leaf_lookup_int (bp, args);if (error ==ENOATTR ) {xfs_trans_brelse (args->trans, bp); -return (error); +return error; }xfs_attr3_leaf_remove (bp, args);
libxfs/xfs_attr_leaf.c +3 -4
@@ -51,7 +51,6 @@ STATIC int xfs_attr3_leaf_figure_balance(xfs_da_state_t *state,int *number_entries_in_blk1, int *number_usedbytes_in_blk1); -/* * Utility routines. */
@@ -1120,7 +1119,6 @@ xfs_attr3_leaf_add_work(struct xfs_attr_leaf_entry *entry;struct xfs_attr_leaf_name_local *name_loc;struct xfs_attr_leaf_name_remote *name_rmt; -struct xfs_attr_leaf_map *map;struct xfs_mount *mp;int tmp;int i;
@@ -1219,7 +1217,7 @@ xfs_attr3_leaf_add_work( tmp = (ichdr->count -1 ) *sizeof (xfs_attr_leaf_entry_t) +xfs_attr3_leaf_hdr_size (leaf); -for (i =0 ; i <XFS_ATTR_LEAF_MAPSIZE ; map++, i++) { +for (i =0 ; i <XFS_ATTR_LEAF_MAPSIZE ; i++) {if (ichdr->freemap[i].base == tmp) { ichdr->freemap[i].base +=sizeof (xfs_attr_leaf_entry_t); ichdr->freemap[i].size -=sizeof (xfs_attr_leaf_entry_t);
@@ -2337,7 +2335,7 @@ xfs_attr3_leaf_moveents(* Move the remaining entries down to fill the hole, * then zero the entries at the top. */ - tmp = (ichdr_s->count - count) -sizeof (xfs_attr_leaf_entry_t); + tmp = (ichdr_s->count - count) *sizeof (xfs_attr_leaf_entry_t); entry_s = &xfs_attr3_leaf_entryp (leaf_s)[start_s + count]; entry_d = &xfs_attr3_leaf_entryp (leaf_s)[start_s];memmove (entry_d, entry_s, tmp);
@@ -2431,6 +2429,7 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)return size; } +/*======================================================================== * Manage the INCOMPLETE flag in a leaf entry *========================================================================*/
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 09/55] libxfs: sync attr code with kernel
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed since the previous posting.
This patch starts the sync with the 3.12 kernel patch series.
When I reviewed these patches, I applied the kernel patch and compared the files that changed with the user patch. I will do spot checks as I go through this series again.
My review on the original post was:
syncs the code in libxfs/xfs_attr.c and libxfs/xfs_attr_leaf.c to kernel files with exception of the part in xfs_attr_shortform_to_leaf() that gets updated by patch 14/49.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/55 libxfs: sync dir2 kernel differences
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- libxfs/xfs_dir2.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs_dir2_data.c | 20 ++++++++++---------- libxfs/xfs_dir2_leaf.c | 4 ++-- libxfs/xfs_dir2_node.c | 26 ++++++++++++-------------- 4 files changed, 69 insertions(+), 26 deletions(-)
libxfs/xfs_dir2.c +45 -0
@@ -392,6 +392,51 @@ xfs_dir_replace( }/* +* See if this entry can be added to the directory without allocating space. +* First checks that the caller couldn't reserve enough space (resblks = 0). +*/ +int +xfs_dir_canenter ( +xfs_trans_t *tp, +xfs_inode_t *dp, +struct xfs_name *name,/* name of entry to add */ +uint resblks) +{ +xfs_da_args_t args; +int rval; +int v;/* type-checking value */ + +if (resblks) +return 0 ; + +ASSERT (S_ISDIR (dp->i_d.di_mode)); + +memset (&args,0 ,sizeof (xfs_da_args_t)); + args.name = name->name; + args.namelen = name->len; + args.hashval = dp->i_mount->m_dirnameops->hashname (name); + args.dp = dp; + args.whichfork =XFS_DATA_FORK ; + args.trans = tp; + args.op_flags =XFS_DA_OP_JUSTCHECK |XFS_DA_OP_ADDNAME | +XFS_DA_OP_OKNOENT ; + +if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) + rval =xfs_dir2_sf_addname (&args); +else if ((rval =xfs_dir2_isblock (tp, dp, &v))) +return rval; +else if (v) + rval =xfs_dir2_block_addname (&args); +else if ((rval =xfs_dir2_isleaf (tp, dp, &v))) +return rval; +else if (v) + rval =xfs_dir2_leaf_addname (&args); +else + rval =xfs_dir2_node_addname (&args); +return rval; +} + +/* * Utility routines. */
libxfs/xfs_dir2_data.c +10 -10
@@ -53,15 +53,15 @@ __xfs_dir3_data_check( bf =xfs_dir3_data_bestfree_p (hdr); p = (char *)xfs_dir3_data_entry_p (hdr); -switch (be32_to_cpu (hdr->magic)) { -case XFS_DIR2_BLOCK_MAGIC : -case XFS_DIR3_BLOCK_MAGIC : +switch (hdr->magic) { +case cpu_to_be32 (XFS_DIR3_BLOCK_MAGIC ): +case cpu_to_be32 (XFS_DIR2_BLOCK_MAGIC ): btp =xfs_dir2_block_tail_p (mp, hdr); lep =xfs_dir2_block_leaf_p (btp); endp = (char *)lep;break ; -case XFS_DIR2_DATA_MAGIC : -case XFS_DIR3_DATA_MAGIC : +case cpu_to_be32 (XFS_DIR3_DATA_MAGIC ): +case cpu_to_be32 (XFS_DIR2_DATA_MAGIC ): endp = (char *)hdr + mp->m_dirblksize;break ;default :
@@ -209,14 +209,14 @@ xfs_dir3_data_reada_verify(struct xfs_mount *mp = bp->b_target->bt_mount;struct xfs_dir2_data_hdr *hdr = bp->b_addr; -switch (be32_to_cpu (hdr->magic)) { -case XFS_DIR2_BLOCK_MAGIC : -case XFS_DIR3_BLOCK_MAGIC : +switch (hdr->magic) { +case cpu_to_be32 (XFS_DIR2_BLOCK_MAGIC ): +case cpu_to_be32 (XFS_DIR3_BLOCK_MAGIC ): bp->b_ops = &xfs_dir3_block_buf_ops; bp->b_ops->verify_read (bp);return ; -case XFS_DIR2_DATA_MAGIC : -case XFS_DIR3_DATA_MAGIC : +case cpu_to_be32 (XFS_DIR2_DATA_MAGIC ): +case cpu_to_be32 (XFS_DIR3_DATA_MAGIC ):xfs_dir3_data_verify (bp);return ;default :
libxfs/xfs_dir2_leaf.c +2 -2
@@ -247,14 +247,14 @@ xfs_dir3_leaf1_write_verify(__write_verify (bp,XFS_DIR2_LEAF1_MAGIC ); } -void +static void xfs_dir3_leafn_read_verify (struct xfs_buf *bp) {__read_verify (bp,XFS_DIR2_LEAFN_MAGIC ); } -void +static void xfs_dir3_leafn_write_verify (struct xfs_buf *bp) {
libxfs/xfs_dir2_node.c +12 -14
@@ -257,7 +257,6 @@ xfs_dir3_free_get_buf( hdr3->hdr.blkno =cpu_to_be64 (bp->b_bn); hdr3->hdr.owner =cpu_to_be64 (dp->i_ino);uuid_copy (&hdr3->hdr.uuid, &mp->m_sb.sb_uuid); - }else hdr.magic =XFS_DIR2_FREE_MAGIC ;xfs_dir3_free_hdr_to_disk (bp->b_addr, &hdr);
@@ -978,7 +977,7 @@ xfs_dir2_leafn_rebalance(xfs_dir2_leaf_t *leaf1;/* first leaf structure */ xfs_dir2_leaf_t *leaf2;/* second leaf structure */ int mid;/* midpoint leaf index */ -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN )int oldstale;/* old count of stale leaves */ #endif int oldsum;/* old total leaf count */
@@ -1007,7 +1006,7 @@ xfs_dir2_leafn_rebalance( ents2 =xfs_dir3_leaf_ents_p (leaf2); oldsum = hdr1.count + hdr2.count; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) oldstale = hdr1.stale + hdr2.stale;#endif mid = oldsum >>1 ;
@@ -1101,7 +1100,6 @@ xfs_dir3_data_block_free(__be16 *bests;struct xfs_dir3_icfree_hdr freehdr; -xfs_dir3_free_hdr_from_disk (&freehdr, free); bests =xfs_dir3_free_bests_p (tp->t_mountp, free);
@@ -1115,12 +1113,14 @@ xfs_dir3_data_block_free(return 0 ; } -/* -* One less used entry in the free table. Unused is not converted -* because we only need to know if it zero -*/ +/* One less used entry in the free table. */ freehdr.nused--; +/* +* If this was the last entry in the table, we can trim the table size +* back. There might be other entries at the end referring to +* non-existent data blocks, get those too. +*/ if (findex == freehdr.nvalid -1 ) {int i;/* free entry index */
@@ -1159,7 +1159,6 @@ xfs_dir3_data_block_free(*/ } -/* Log the free entry that changed, unless we got rid of it. */ if (logfree)xfs_dir2_free_log_bests (tp, fbp, findex, findex);
@@ -1275,9 +1274,8 @@ xfs_dir2_leafn_remove( {struct xfs_dir3_icfree_hdr freehdr;xfs_dir3_free_hdr_from_disk (&freehdr, free); -ASSERT (freehdr.firstdb == -xfs_dir3_free_max_bests (mp) * - (fdb -XFS_DIR2_FREE_FIRSTDB (mp))); +ASSERT (freehdr.firstdb ==xfs_dir3_free_max_bests (mp) * + (fdb -XFS_DIR2_FREE_FIRSTDB (mp))); }#endif /*
@@ -1425,7 +1423,7 @@ xfs_dir2_leafn_toosmall( leaf = blk->bp->b_addr;xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); ents =xfs_dir3_leaf_ents_p (leaf); -xfs_dir3_leaf_check (mp, blk->bp); +xfs_dir3_leaf_check (state->args->dp->i_mount, blk->bp); count = leafhdr.count - leafhdr.stale; bytes =xfs_dir3_leaf_hdr_size (leaf) + count *sizeof (ents[0 ]);
@@ -1863,7 +1861,7 @@ xfs_dir2_node_addname_int(* If there wasn't a freespace block, the read will * return a NULL fbp. Allocate and initialize a new one. */ -if (!fbp) { +if (!fbp) { error =xfs_dir2_grow_inode (args,XFS_DIR2_FREE_SPACE , &fbno);if (error)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/55] libxfs: sync dir2 kernel differences
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
syncs the libxfs/xfs_dir2.c, libxfs/xfs_dir2_data.c, libxfs/xfs_dir2_leaf.c, and libxfs/xfs_dir2_node.c to the Linux 3.12 to kernel patch 15-50.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/55] libxfs: sync dir2 kernel differences
In reply to Dave ChinnerQuoted 15 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>--- libxfs/xfs_dir2.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs_dir2_data.c | 20 ++++++++++---------- libxfs/xfs_dir2_leaf.c | 4 ++-- libxfs/xfs_dir2_node.c | 26 ++++++++++++-------------- 4 files changed, 69 insertions(+), 26 deletions(-)libxfs/xfs_dir2.c +0
-0
libxfs/xfs_dir2.c xfs_dir_replace( · line 399
Quoted 8 lines
libxfs/xfs_dir2.c +5
-0@@ -392,6 +392,51 @@ xfs_dir_replace( }/* +* See if this entry can be added to the directory without allocating space. +* First checks that the caller couldn't reserve enough space (resblks = 0). +*/ +int +xfs_dir_canenter(
Retroactive, post-merge question. :) This function isn't used in userspace, AFAICT. What's the intended libxfs philosophy - keep files as identical to kernelspace as possible, used code or not, or remove things which aren't used in userspace?
Thanks,
-Eric
Quoted 28 lines
libxfs/xfs_dir2.c +28
-0+ xfs_trans_t *tp, + xfs_inode_t *dp, + struct xfs_name *name, /* name of entry to add */ + uint resblks) +{ +xfs_da_args_t args; +int rval; +int v;/* type-checking value */ + +if (resblks) +return 0 ; + +ASSERT (S_ISDIR (dp->i_d.di_mode)); + +memset (&args,0 ,sizeof (xfs_da_args_t)); + args.name = name->name; + args.namelen = name->len; + args.hashval = dp->i_mount->m_dirnameops->hashname (name); + args.dp = dp; + args.whichfork =XFS_DATA_FORK ; + args.trans = tp; + args.op_flags =XFS_DA_OP_JUSTCHECK |XFS_DA_OP_ADDNAME | +XFS_DA_OP_OKNOENT ; + +if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) + rval =xfs_dir2_sf_addname (&args); +else if ((rval =xfs_dir2_isblock (tp, dp, &v))) +return rval;
libxfs/xfs_dir2.c xfs_dir_replace( · line 437
Quoted 10 lines
libxfs/xfs_dir2.c +10
-0+else if (v) + rval =xfs_dir2_block_addname (&args); +else if ((rval =xfs_dir2_isleaf (tp, dp, &v))) +return rval; +else if (v) + rval =xfs_dir2_leaf_addname (&args); +else + rval =xfs_dir2_node_addname (&args); +return rval; +}
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/55] libxfs: sync dir2 kernel differences
Quoted 18 lines · Eric Sandeen
Quoted 17 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>--- libxfs/xfs_dir2.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs_dir2_data.c | 20 ++++++++++---------- libxfs/xfs_dir2_leaf.c | 4 ++-- libxfs/xfs_dir2_node.c | 26 ++++++++++++-------------- 4 files changed, 69 insertions(+), 26 deletions(-)libxfs/xfs_dir2.c +0
-0@@ -392,6 +392,51 @@ xfs_dir_replace( }
Quoted 11 lines
libxfs/xfs_dir2.c xfs_dir_replace( · line 399
Quoted 6 lines
libxfs/xfs_dir2.c +5
-0/* +* See if this entry can be added to the directory without allocating space. +* First checks that the caller couldn't reserve enough space (resblks = 0). +*/ +int +xfs_dir_canenter(Retroactive, post-merge question. :) This function isn't used in userspace, AFAICT. What's the intended libxfs philosophy - keep files as identical to kernelspace as possible, used code or not, or remove things which aren't used in userspace?
A bit of history here. Going back to when the GPL'd version of xfscmds was created, the intention was that libxfs would be a minimal, cut down version of the kernel code that only had the exact functionality that the userspace tools required. That lasted while Nathan was the maintainer - most of the changes were being made by SGI, and were being made to both Irix and GPL'd code bases and so there was significant amounts of code shuffling internally and so a minimal implementation made sense.
With the demise of Irix, there was much less code shuffling going on, and all development work moved over to Linux, leading to the situation where there was only one kernel code base to maintain, and one userspace to maintain.
When Nathan left, regular updates to the libxfs code pretty much stopped - there weren't a lot of people that grokked the libxfs codebase and so it was mostly left alone. There was a major update for ~2.9.13 with all the xfs repair work that was done back in 2008 done by Barry Naujok, and since then there's only been sporadic, massive kernel code syncs that have involved diffs > +/-10000 lines that are impossible to review.
So, come the CRC work, another major sync was needed, and I decided to make such sycnhronisation work easy in a way that Christoph had mentioned a few times over the past couple of years. That is, libxfs basically becomes a shared copy of the code with minimal differences and we separate all the kernel code out into kernel-only and shared-libxfs code.
That's where we are now - with almost all the libxfs code synced in user and kernel space.
Yes, this means that there are some dead functions in userspace, but it means that it is trivial to spot differences between the user and kernel code, and that is far more important from a maintenance perspective that having a bit of dead code lying around.
Once this started to fall into place, I started finding lots of little differences that needed fixing that were hidden by the verbosity of previous sync efforts. Indeed, this command points out interesting little things like:
$ for f in `ls libxfs |grep xfs_ |grep -v trace`; do diff -u
libxfs/$f ../kern/xfsdev/fs/xfs/$f; done |less
....
@@ -612,6 +635,7 @@
xfs_trans_log_buf(tp, bp, 0, size - 1); bp->b_ops = blk1->bp->b_ops;
+ xfs_trans_buf_copy_type(bp, blk1->bp);
blk1->bp = bp;
blk1->blkno = blkno;Which indicate that some bug fixes from teh kernel code haven't been brought across.
There's still more work to do - xfs-rtalloc.c still needs splitting, and xfs_btree.c has some readahead differences that need to be sorted, but overall the idea is that libxfs and the include/xfs_*h files are as close to identical to the kernel code as possible....
The other advantage of this is that patches made to the kernel apply with a minimum of massaging to userspace, which makes keeping the userspace code up to data a lot easier.
I've mentioned it before - I'd like to end up with a fs/xfs/libxfs/ directory in the kernel that is essentially identical in all ways to the userspace libxfs, so all we need to do is copy files to keep them in sync. We're not there yet, but it's definitely getting closer to being a reality. If we get to this stage, then getting userspace support up and running for new features will not require any kernel patch ftuzing at all - just copy the files, and start working on tool support...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/55] libxfs: sync dir2 kernel differences
Quoted 105 lines · Dave Chinner
Quoted 18 lines · Eric Sandeen
Quoted 17 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>--- libxfs/xfs_dir2.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs_dir2_data.c | 20 ++++++++++---------- libxfs/xfs_dir2_leaf.c | 4 ++-- libxfs/xfs_dir2_node.c | 26 ++++++++++++-------------- 4 files changed, 69 insertions(+), 26 deletions(-)libxfs/xfs_dir2.c +0
-0@@ -392,6 +392,51 @@ xfs_dir_replace( }Quoted 11 lines
libxfs/xfs_dir2.c xfs_dir_replace( · line 399
Quoted 6 lines
libxfs/xfs_dir2.c +5
-0/* +* See if this entry can be added to the directory without allocating space. +* First checks that the caller couldn't reserve enough space (resblks = 0). +*/ +int +xfs_dir_canenter(Retroactive, post-merge question. :) This function isn't used in userspace, AFAICT. What's the intended libxfs philosophy - keep files as identical to kernelspace as possible, used code or not, or remove things which aren't used in userspace?
A bit of history here. Going back to when the GPL'd version of xfscmds was created, the intention was that libxfs would be a minimal, cut down version of the kernel code that only had the exact functionality that the userspace tools required. That lasted while Nathan was the maintainer - most of the changes were being made by SGI, and were being made to both Irix and GPL'd code bases and so there was significant amounts of code shuffling internally and so a minimal implementation made sense.
With the demise of Irix, there was much less code shuffling going on, and all development work moved over to Linux, leading to the situation where there was only one kernel code base to maintain, and one userspace to maintain.
When Nathan left, regular updates to the libxfs code pretty much stopped - there weren't a lot of people that grokked the libxfs codebase and so it was mostly left alone. There was a major update for ~2.9.13 with all the xfs repair work that was done back in 2008 done by Barry Naujok, and since then there's only been sporadic, massive kernel code syncs that have involved diffs > +/-10000 lines that are impossible to review.
So, come the CRC work, another major sync was needed, and I decided to make such sycnhronisation work easy in a way that Christoph had mentioned a few times over the past couple of years. That is, libxfs basically becomes a shared copy of the code with minimal differences and we separate all the kernel code out into kernel-only and shared-libxfs code.
That's where we are now - with almost all the libxfs code synced in user and kernel space.
Yes, this means that there are some dead functions in userspace, but it means that it is trivial to spot differences between the user and kernel code, and that is far more important from a maintenance perspective that having a bit of dead code lying around.
Once this started to fall into place, I started finding lots of little differences that needed fixing that were hidden by the verbosity of previous sync efforts. Indeed, this command points out interesting little things like:
$ for f in `ls libxfs |grep xfs_ |grep -v trace`; do diff -u libxfs/$f ../kern/xfsdev/fs/xfs/$f; done |less ....(quoted diff) +1
-0@@ -612,6 +635,7 @@ xfs_trans_log_buf(tp, bp, 0, size - 1); bp->b_ops = blk1->bp->b_ops; + xfs_trans_buf_copy_type(bp, blk1->bp); blk1->bp = bp; blk1->blkno = blkno;Which indicate that some bug fixes from teh kernel code haven't been brought across.
There's still more work to do -
xfs-rtalloc.cstill needs splitting, andxfs_btree.chas some readahead differences that need to be sorted, but overall the idea is that libxfs and theinclude/xfs_*hfiles are as close to identical to the kernel code as possible....The other advantage of this is that patches made to the kernel apply with a minimum of massaging to userspace, which makes keeping the userspace code up to data a lot easier.
I've mentioned it before - I'd like to end up with a
fs/xfs/libxfs/directory in the kernel that is essentially identical in all ways to the userspace libxfs, so all we need to do is copy files to keep them in sync. We're not there yet, but it's definitely getting closer to being a reality. If we get to this stage, then getting userspace support up and running for new features will not require any kernel patch ftuzing at all - just copy the files, and start working on tool support...
Quoted 1 line
From the horse's mouth:
$ $ head -44 libxfs/xfs.h |tail -27
/*
* This header is effectively a "namespace multiplexor" for the
* user level XFS code. It provides all of the necessary stuff
* such that we can build some parts of the XFS kernel code in
* user space in a controlled fashion, and translates the names
* used in the kernel into the names which libxfs is going to
* make available to user tools.
*
* It should only ever be #include'd by XFS "kernel" code being
* compiled in user space.
*
* Our goals here are to...
* o "share" large amounts of complex code between user and * kernel space; * o shield the user tools from changes in the bleeding * edge kernel code, merging source changes when * convenient and not immediately (no symlinks); * o i.e. be able to merge changes to the kernel source back * into the affected user tools in a controlled fashion; * o provide a _minimalist_ life-support system for kernel * code in user land, not the "everything + the kitchen * sink" model which libsim had mutated into; * o allow the kernel code to be completely free of code * specifically there to support the user level build.
*/
$
FYI, the symlink model was what the irix source tree used to link the XFS kernel code to the xfscmds userspace source tree. Libsim was the "ifdef SIM" hackery all through the Irix kernel code used to exclude kernel-only code from the xfscmds build....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/55 libxfs: sync xfs_ialloc.c to the kernel code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
include the missing xfs_difree() function. it's not used by userspace, but it makes no sense to have just this one arbitrary difference between the kernel and userspace files.
--- libxfs/xfs.h | 1 + libxfs/xfs_ialloc.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 177 insertions(+), 10 deletions(-)
libxfs/xfs.h +1 -0
@@ -208,6 +208,7 @@ roundup_pow_of_two(uint v)#define XFS_MOUNT_SMALL_INUMS 0/* ignored in userspace */ #define XFS_MOUNT_WSYNC 0/* ignored in userspace */ #define XFS_MOUNT_NOALIGN 0/* ignored in userspace */ +#define XFS_MOUNT_IKEEP 0/* ignored in userspace */ #define xfs_icsb_modify_counters (mp, field, delta, rsvd) \ xfs_mod_incore_sb(mp, field, delta, rsvd)
libxfs/xfs_ialloc.c +176 -10
232 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 11/55] libxfs: sync xfs_ialloc.c to the kernel code
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
include the missing
xfs_difree()function. it's not used by userspace, but it makes no sense to have just this one arbitrary difference between the kernel and userspace files.Signed-off-by Dave Chinner<[email protected]>---
No change in this reposting of the patch.
adds xfs_difree(). Adds parts of kernel patches 83a9ba00 and 43df2ee6.
changed variable "offset_agbno" in xfs_imap() from "xfs_agblock_t to "int" so patch 13/49 can move it back to "offset_agbno". good stuff.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/55 xfsprogs: define min/max once and use them everywhere.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/libxfs.h | 1 - include/platform_defs.h.in | 5 +++++ io/init.h | 3 --- libxfs/rdwr.c | 1 - 4 files changed, 5 insertions(+), 5 deletions(-)
include/libxfs.h +0 -1
@@ -72,7 +72,6 @@#define __round_mask (x, y) ((__typeof__(x))((y)-1))#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1)#define round_down (x, y) ((x) & ~__round_mask(x, y)) -#define min (a,b) ((a) < (b) ? (a) : (b))/* * Argument structure for libxfs_init().
include/platform_defs.h.in +5 -0
@@ -173,4 +173,9 @@ typedef unsigned short umode_t; #define __arch_pack #endif +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + #endif /* __XFS_PLATFORM_DEFS_H__ */
io/init.h +0 -3
@@ -26,7 +26,4 @@ extern int expert;extern size_t pagesize;extern struct timeval stopwatch; -#define min (a,b) (((a)<(b))?(a):(b)) -#define max (a,b) (((a)>(b))?(a):(b)) -extern void init_cvtnum (size_t *blocksize,size_t *sectsize);
libxfs/rdwr.c +0 -1
@@ -22,7 +22,6 @@#include "init.h" #define BDSTRAT_SIZE (256 * 1024) -#define min (x, y) ((x) < (y) ? (x) : (y))#define IO_BCOMPARE_CHECK
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 12/55] xfsprogs: define min/max once and use them everywhere.
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
no change in this reporting of the patch.
remove private min/max and define it in include/platform_defs.h where it is included in xfs.h and libxfs.h.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/55 libxfs: fix compile warnings
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
--- copy/xfs_copy.c | 12 ++++++++++-- db/bmroot.c | 6 +++--- libxfs/xfs.h | 8 +++++++- libxfs/xfs_attr_remote.c | 8 ++++---- libxfs/xfs_bmap.c | 3 --- libxfs/xfs_da_btree.c | 6 +++--- libxfs/xfs_dir2_node.c | 2 ++ libxfs/xfs_ialloc.c | 2 +- libxfs/xfs_rtalloc.c | 4 ++-- repair/attr_repair.c | 2 ++ repair/incore_ino.c | 2 ++ repair/scan.c | 1 + 12 files changed, 37 insertions(+), 19 deletions(-)
copy/xfs_copy.c +10 -2
@@ -434,6 +434,10 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag, off =XFS_AG_DADDR (mp, agno,XFS_SB_DADDR ); buf->position = (xfs_off_t ) off * (xfs_off_t )BBSIZE ; length = buf->length = first_agbno * blocksize; +if (length ==0 ) { +do_log (_ ("ag header buffer invalid!\n" )); +exit (1 ); + }/* handle alignment stuff */
@@ -449,7 +453,6 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag,if (buf->length % buf->min_io_size !=0 ) buf->length =roundup (buf->length, buf->min_io_size); -ASSERT (length !=0 );read_wbuf (fd, buf, mp);ASSERT (buf->length >= length);
@@ -936,7 +939,12 @@ main(int argc, char **argv)for (;;) {/* none of this touches the w_buf buffer */ -ASSERT (current_level < btree_levels); +if (current_level >= btree_levels) { +do_log ( +_ ("Error: current level %d >= btree levels %d\n" ), + current_level, btree_levels); +exit (1 ); + } current_level++;
db/bmroot.c +3 -3
@@ -91,13 +91,13 @@ bmroota_key_offset( int idx) {xfs_bmdr_block_t *block; -/* REFERENCED */ -xfs_dinode_t *dip; +#ifdef DEBUG +xfs_dinode_t *dip = obj; +#endif xfs_bmdr_key_t *kp;ASSERT (bitoffs (startoff) ==0 );ASSERT (obj == iocur_top->data); - dip = obj; block = (xfs_bmdr_block_t *)((char *)obj +byteize (startoff));ASSERT (XFS_DFORK_Q (dip) && (char *)block ==XFS_DFORK_APTR (dip));ASSERT (be16_to_cpu (block->bb_level) >0 );
libxfs/xfs.h +7 -1
@@ -189,7 +189,9 @@ roundup_pow_of_two(uint v)/* avoid gcc warning */ #define xfs_incore (bt,blkno,len,lockit) ({ \ typeof(blkno) __foo = (blkno); \ + typeof(len) __bar = (len); \ (blkno) = __foo; \ + (len) = __bar;/* no set-but-unused warning */ \NULL ; \ })#define xfs_buf_relse (bp) libxfs_putbuf(bp)
@@ -259,7 +261,11 @@ roundup_pow_of_two(uint v)#define xfs_trans_agblocks_delta (tp, d)#define xfs_trans_agflist_delta (tp, d)#define xfs_trans_agbtree_delta (tp, d) -#define xfs_trans_buf_set_type (tp, bp, t) +#define xfs_trans_buf_set_type(tp, bp, t) ({ \ + int __t = (t); \ + __t = __t; /* no set-but-unused warning */ \ +}) +#define xfs_trans_buf_copy_type (dbp, sbp)#define xfs_buf_readahead (a,b,c,ops) ((void) 0)/* no readahead */
libxfs/xfs_attr_remote.c +4 -4
@@ -214,7 +214,7 @@ xfs_attr_rmtval_copyout(xfs_ino_t ino, int *offset, int *valuelen, - char **dst) + __uint8_t **dst) { char *src = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -261,7 +261,7 @@ xfs_attr_rmtval_copyin(xfs_ino_t ino, int *offset, int *valuelen, - char **src) + __uint8_t **src) { char *dst = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -314,7 +314,7 @@ xfs_attr_rmtval_get(struct xfs_mount *mp = args->dp->i_mount;struct xfs_buf *bp;xfs_dablk_t lblkno = args->rmtblkno; -char *dst = args->value; +__uint8_t *dst = args->value;int valuelen = args->valuelen;int nmap;int error;
@@ -378,7 +378,7 @@ xfs_attr_rmtval_set(struct xfs_bmbt_irec map;xfs_dablk_t lblkno;xfs_fileoff_t lfileoff =0 ; -char *src = args->value; +__uint8_t *src = args->value;int blkcnt;int valuelen;int nmap;
libxfs/xfs_bmap.c +0 -3
@@ -4437,12 +4437,9 @@ xfs_bmapi_allocate(struct xfs_ifork *ifp =XFS_IFORK_PTR (bma->ip, whichfork);int tmp_logflags =0 ;int error; -int rt;ASSERT (bma->length >0 ); - rt = (whichfork ==XFS_DATA_FORK ) &&XFS_IS_REALTIME_INODE (bma->ip); -/* * For the wasdelay case, we could also just allocate the stuff asked * for in this bmap call but that wouldn't be as good.
libxfs/xfs_da_btree.c +3 -3
@@ -376,7 +376,7 @@ xfs_da3_split(struct xfs_da_intnode *node;struct xfs_buf *bp;int max; -int action; +int action =0 ;int error;int i;
@@ -2431,9 +2431,9 @@ static intxfs_buf_map_from_irec ( struct xfs_mount *mp, struct xfs_buf_map **mapp, - unsigned int *nmaps, + int *nmaps, struct xfs_bmbt_irec *irecs, - unsigned int nirecs) + int nirecs) { struct xfs_buf_map *map;int i;
libxfs/xfs_dir2_node.c +2 -0
@@ -295,11 +295,13 @@ xfs_dir2_free_log_header(struct xfs_trans *tp, struct xfs_buf *bp) { +#ifdef DEBUG xfs_dir2_free_t *free; /* freespace structure */ free = bp->b_addr;ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); +#endif xfs_trans_log_buf (tp, bp,0 ,xfs_dir3_free_hdr_size (tp->t_mountp) -1 ); }
libxfs/xfs_ialloc.c +1 -1
@@ -1319,7 +1319,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agblock_t offset_agbno;/* blks from chunk start to inode */ ASSERT (ino !=NULLFSINO );
libxfs/xfs_rtalloc.c +2 -2
@@ -431,8 +431,8 @@ xfs_rtfree_range( {xfs_rtblock_t end;/* end of the freed extent */ int error;/* error value */ -xfs_rtblock_t postblock;/* first block freed > end */ -xfs_rtblock_t preblock;/* first block freed < start */ +xfs_rtblock_t postblock =0 ;/* first block freed > end */ +xfs_rtblock_t preblock =0 ;/* first block freed < start */ end = start + len -1 ;/*
repair/attr_repair.c +2 -0
@@ -1631,9 +1631,11 @@ process_attributes( {int err;__u8 aformat = dip->di_aformat; +#ifdef DEBUG xfs_attr_shortform_t *asf; asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR (dip); +#endif if (aformat ==XFS_DINODE_FMT_LOCAL ) { ASSERT(be16_to_cpu(asf->hdr.totsize) <=
repair/incore_ino.c +2 -0
@@ -167,6 +167,7 @@ __uint32_t num_inode_references(struct ino_tree_node *irec, int ino_offset)default :ASSERT (0 ); } +return 0 ; } void set_inode_disk_nlinks(struct ino_tree_node *irec, int ino_offset,
@@ -207,6 +208,7 @@ __uint32_t get_inode_disk_nlinks(struct ino_tree_node *irec, int ino_offset)default :ASSERT (0 ); } +return 0 ; }/*
repair/scan.c +1 -0
@@ -520,6 +520,7 @@ scan_allocbt( name ="cnt" ;break ;default : + name ="(unknown)" ;assert (0 );break ; }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 13/55] libxfs: fix compile warnings
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
Signed-off-by Dave Chinner<[email protected]>---
no change in the reposting of the patch
convert a couple ASSERT to warn/exits, variable sign correction, non-DEBUG unused variable, default string value.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/55 xfs: remove local fork format handling from xfs_bmapi_write()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The conversion from local format to extent format requires interpretation of the data in the fork being converted, so it cannot be done in a generic way. It is up to the caller to convert the fork format to extent format before calling into xfs_bmapi_write() so format conversion can be done correctly.
The code in xfs_bmapi_write() to convert the format is used implicitly by the attribute and directory code, but they specifically zero the fork size so that the conversion does not do any allocation or manipulation. Move this conversion into the shortform to leaf functions for the dir/attr code so the conversions are explicitly controlled by all callers.
Now we can remove the conversion code in xfs_bmapi_write.
--- include/xfs_bmap.h | 1 + libxfs/xfs_attr_leaf.c | 2 + libxfs/xfs_bmap.c | 197 ++++++++++++++++++++---------------------------- libxfs/xfs_dir2_block.c | 19 +++-- 4 files changed, 97 insertions(+), 122 deletions(-)
include/xfs_bmap.h +1 -0
@@ -169,6 +169,7 @@ void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,#endif int xfs_bmap_add_attrfork (struct xfs_inode *ip,int size,int rsvd); +void xfs_bmap_local_to_extents_empty (struct xfs_inode *ip,int whichfork);void xfs_bmap_add_free (xfs_fsblock_t bno,xfs_filblks_t len,struct xfs_bmap_free *flist,struct xfs_mount *mp);void xfs_bmap_cancel (struct xfs_bmap_free *flist);
libxfs/xfs_attr_leaf.c +2 -0
@@ -654,6 +654,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) sf = (xfs_attr_shortform_t *)tmpbuffer;xfs_idata_realloc (dp, -size,XFS_ATTR_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_ATTR_FORK ); + bp =NULL ; error =xfs_da_grow_inode (args, &blkno);if (error) {
libxfs/xfs_bmap.c +83 -114
255 lines not on this page · raw message
libxfs/xfs_dir2_block.c +11 -8
@@ -1051,13 +1051,15 @@ xfs_dir2_sf_to_block(__be16 *tagp;/* end of data entry */ xfs_trans_t *tp;/* transaction pointer */ struct xfs_name name; +struct xfs_ifork *ifp;trace_xfs_dir2_sf_to_block (args); dp = args->dp; tp = args->trans; mp = dp->i_mount; -ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); + ifp =XFS_IFORK_PTR (dp,XFS_DATA_FORK ); +ASSERT (ifp->if_flags &XFS_IFINLINE );/* * Bomb out if the shortform directory is way too short. */
@@ -1066,22 +1068,23 @@ xfs_dir2_sf_to_block(return XFS_ERROR (EIO ); } - oldsfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; + oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; -ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); -ASSERT (dp->i_df.if_u1.if_data !=NULL ); +ASSERT (ifp->if_bytes == dp->i_d.di_size); +ASSERT (ifp->if_u1.if_data !=NULL );ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (oldsfp->i8count)); +ASSERT (dp->i_d.di_nextents ==0 );/* * Copy the directory into a temporary buffer. * Then pitch the incore inode data so we can make extents. */ - sfp =kmem_alloc (dp->i_df.if_bytes,KM_SLEEP ); -memcpy (sfp, oldsfp, dp->i_df.if_bytes); + sfp =kmem_alloc (ifp->if_bytes,KM_SLEEP ); +memcpy (sfp, oldsfp, ifp->if_bytes); -xfs_idata_realloc (dp, -dp->i_df.if_bytes,XFS_DATA_FORK ); +xfs_idata_realloc (dp, -ifp->if_bytes,XFS_DATA_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_DATA_FORK ); dp->i_d.di_size =0 ; -xfs_trans_log_inode (tp, dp,XFS_ILOG_CORE );/* * Add block 0 to the inode.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/55] xfs: remove local fork format handling from xfs_bmapi_write()
Quoted 15 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The conversion from local format to extent format requires interpretation of the data in the fork being converted, so it cannot be done in a generic way. It is up to the caller to convert the fork format to extent format before calling into
xfs_bmapi_write()so format conversion can be done correctly.The code in
xfs_bmapi_write()to convert the format is used implicitly by the attribute and directory code, but they specifically zero the fork size so that the conversion does not do any allocation or manipulation. Move this conversion into the shortform to leaf functions for the dir/attr code so the conversions are explicitly controlled by all callers.
Quoted 4 lines
Now we can remove the conversion code in
xfs_bmapi_write.Signed-off-by Dave Chinner<[email protected]>---
This reposted patch has not changed.
same as kernel commit f3508bcd.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/55 libxfs: local to remote format support of remote symlinks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
This conversion was overlooked earlier on. Now that the differences between userspace and kernel space are getting smaller this bug is obvious. Fix it.
--- include/xfs_symlink.h | 2 ++ libxfs/xfs_bmap.c | 12 ------------ libxfs/xfs_symlink.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-)
include/xfs_symlink.h +2 -0
@@ -31,6 +31,8 @@ struct xfs_dsymlink_hdr {int xfs_symlink_blocks (struct xfs_mount *mp,int pathlen);bool xfs_symlink_hdr_ok (struct xfs_mount *mp,xfs_ino_t ino,uint32_t offset,uint32_t size,struct xfs_buf *bp); +void xfs_symlink_local_to_remote (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_inode *ip,struct xfs_ifork *ifp);extern const struct xfs_buf_ops xfs_symlink_buf_ops;
libxfs/xfs_bmap.c +0 -12
@@ -1221,18 +1221,6 @@ xfs_bmap_add_attrfork_extents(return error; } -STATIC void -xfs_symlink_local_to_remote ( -struct xfs_trans *tp, -struct xfs_buf *bp, -struct xfs_inode *ip, -struct xfs_ifork *ifp) -{ -/* remote symlink blocks are not verifiable until CRCs come along */ - bp->b_ops =NULL ; -memcpy (bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); -} -/* * Called from xfs_bmap_add_attrfork to handle local format files. Each * different data fork content type needs a different callout to do the
libxfs/xfs_symlink.c +29 -0
@@ -145,3 +145,32 @@ const struct xfs_buf_ops xfs_symlink_buf_ops = { .verify_write = xfs_symlink_write_verify, }; +void +xfs_symlink_local_to_remote ( +struct xfs_trans *tp, +struct xfs_buf *bp, +struct xfs_inode *ip, +struct xfs_ifork *ifp) +{ +struct xfs_mount *mp = ip->i_mount; +char *buf; + +if (!xfs_sb_version_hascrc (&mp->m_sb)) { + bp->b_ops =NULL ; +memcpy (bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); +return ; + } + +/* +* As this symlink fits in an inode literal area, it must also fit in +* the smallest buffer the filesystem supports. +*/ +ASSERT (BBTOB (bp->b_length) >= + ifp->if_bytes +sizeof (struct xfs_dsymlink_hdr )); + + 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); +memcpy (buf, ifp->if_u1.if_data, ifp->if_bytes); +}
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/55] libxfs: local to remote format support of remote symlinks
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
This conversion was overlooked earlier on. Now that the differences between userspace and kernel space are getting smaller this bug is obvious. Fix it.
Signed-off-by Dave Chinner<[email protected]>---
This reposted patch has not changed.
same content for xfs_symlink_local_to_remote() as kernel commit f948dd76 and moved from xfs_bmap.c to xfs_symlink.c
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/55 xfs: separate out log format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace.
--- include/Makefile | 4 +- include/libxfs.h | 4 +- include/libxlog.h | 6 - include/xfs_log.h | 190 ------------- include/xfs_log_format.h | 178 ++++++++++++ include/xfs_log_priv.h | 692 ---------------------------------------------- libxfs/rdwr.c | 2 - libxlog/xfs_log_recover.c | 3 + 8 files changed, 186 insertions(+), 893 deletions(-) delete mode 100644 include/xfs_log.h create mode 100644 include/xfs_log_format.h delete mode 100644 include/xfs_log_priv.h
include/Makefile +3 -1
@@ -27,7 +27,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ - xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ + xfs_log_format.h \ + xfs_log_recover.h \ + xfs_metadump.h \ xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +2 -2
@@ -59,6 +59,8 @@#include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item.h> +#include <xfs/xfs_log_format.h> +#ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif
@@ -613,8 +615,6 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */#include <xfs/xfs_attr_remote.h> #include <xfs/xfs_quota.h> #include <xfs/xfs_trans_space.h> -#include <xfs/xfs_log.h> -#include <xfs/xfs_log_priv.h> #define XFS_INOBT_IS_FREE_DISK (rp,i) \ ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
include/libxlog.h +0 -6
@@ -53,12 +53,6 @@ struct xlog {#include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h> -typedef union { -xlog_rec_header_t hic_header; -xlog_rec_ext_header_t hic_xheader; -char hic_sector[XLOG_HEADER_SIZE ]; -}xlog_in_core_2_t ; -/* * macros mapping kernel code to user code */
include/xfs_log.h deleted +0 -190
190 lines not on this page · raw message
include/xfs_log_format.h new file +178 -0
178 lines not on this page · raw message
include/xfs_log_priv.h deleted +0 -692
692 lines not on this page · raw message
libxfs/rdwr.c +0 -2
@@ -17,8 +17,6 @@*/ #include <xfs/libxfs.h> -#include <xfs/xfs_log.h> -#include <xfs/xfs_log_priv.h> #include "init.h" #define BDSTRAT_SIZE (256 * 1024)
libxlog/xfs_log_recover.c +3 -0
@@ -26,6 +26,7 @@ (0 ); \ }) +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1)/* * Verify the given count of basic blocks is valid number of blocks
@@ -1034,6 +1035,8 @@ xlog_recover_add_item(list_add_tail (&item->ri_list, head); } +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) + STATIC int xlog_recover_add_to_cont_trans( struct xlog *log,
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 16/55] xfs: separate out log format definitions
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that
xfs_log.handxfs_log_priv.hno longer need to be shared with userspace.Signed-off-by Dave Chinner<[email protected]>---
This reposted patch has not changed
sync the new user/kernel xfs_log_priv.h to patch 01/50 of the for Linux 3.12 kernel patch series which also means remove kernel-only headers (xfs_log.h, xfs_log_priv.h) from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/55 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
--- include/Makefile | 4 +- include/libxfs.h | 5 +- include/libxlog.h | 1 - include/xfs_inode.h | 70 ------------------ include/xfs_inode_item.h | 170 ------------------------------------------ include/xfs_log_format.h | 189 +++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_types.h | 6 ++ libxfs/trans.c | 2 +- 8 files changed, 202 insertions(+), 245 deletions(-) delete mode 100644 include/xfs_inode_item.h
include/Makefile +3 -1
@@ -26,7 +26,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ - xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ + xfs_icreate_item.h \ + xfs_inode.h \ + xfs_inum.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \
include/libxfs.h +3 -2
@@ -36,6 +36,9 @@#include <xfs/xfs_types.h> #include <xfs/xfs_fs.h> #include <xfs/xfs_arch.h> + +#include <xfs/xfs_log_format.h> +#include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h> #include <xfs/xfs_sb.h>
@@ -50,7 +53,6 @@#include <xfs/xfs_dinode.h> #include <xfs/xfs_inode.h> #include <xfs/xfs_buf_item.h> -#include <xfs/xfs_inode_item.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
@@ -59,7 +61,6 @@#include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item.h> -#include <xfs/xfs_log_format.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
include/libxlog.h +0 -1
@@ -49,7 +49,6 @@ struct xlog {#include <xfs/xfs_log_recover.h> #include <xfs/xfs_buf_item.h> -#include <xfs/xfs_inode_item.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_inode.h +0 -70
88 lines not on this page · raw message
include/xfs_inode_item.h deleted +0 -170
170 lines not on this page · raw message
include/xfs_log_format.h +189 -0
199 lines not on this page · raw message
include/xfs_types.h +6 -0
@@ -147,6 +147,12 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)/* +* Inode fork identifiers. +*/ +#define XFS_DATA_FORK 0 +#define XFS_ATTR_FORK 1 + +/* * Min numbers of data/attr fork btree root pointers. */ #define MINDBTPTRS 3
libxfs/trans.c +1 -1
@@ -226,7 +226,7 @@ libxfs_trans_inode_alloc_buf(* to be logged when the transaction is committed. The inode must * already be associated with the given transaction. * -* The values for fieldmask are defined in xfs_inode_item.h. We always +* The values for fieldmask are defined in xfs_log_format.h. We always * log all of the core inode if any of it has changed, and we always log * all of the inline data/extents/b-tree root if any of them has changed. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 17/55] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner<[email protected]>---
This patch has not been changed in the repost.
sync the new user/kernel xfs_inode.h and xfs_log_format.h to patch 02/49 of the for Linux 3.12 kernel patch series which also means remove kernel-only headers.
---
The quota entries will be removed from xfsprogs version of xfs_inode, so my earlier review point of a missing "i_pdquot" from kernel commit 92f8ff73 no longer matters.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/55 xfs: split out buf log item format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/Makefile | 4 +- include/libxfs.h | 6 +- include/libxlog.h | 1 - include/xfs_buf_item.h | 172 ----------------------------------------------- include/xfs_log_format.h | 97 ++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 175 deletions(-) delete mode 100644 include/xfs_buf_item.h
include/Makefile +3 -1
@@ -23,7 +23,9 @@ QAHFILES = libxfs.h libxlog.h \ swab.h \ xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \ xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \ - xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ + xfs_btree_trace.h \ + xfs_cksum.h \ + xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_icreate_item.h \
include/libxfs.h +5 -1
@@ -52,7 +52,6 @@#include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_inode.h> -#include <xfs/xfs_buf_item.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
@@ -438,6 +437,11 @@ typedef struct xfs_buf_log_item {xfs_buf_log_format_t bli_format;/* in-log header */ } xfs_buf_log_item_t; +#define XFS_BLI_DIRTY (1<<0) +#define XFS_BLI_HOLD (1<<1) +#define XFS_BLI_STALE (1<<2) +#define XFS_BLI_INODE_ALLOC_BUF (1<<3) +#include <xfs/xfs_trans.h> typedef struct xfs_trans {
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_buf_item.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_buf_item.h deleted +0 -172
172 lines not on this page · raw message
include/xfs_log_format.h +97 -0
101 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/55] xfs: split out buf log item format definitions
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed from the last post.
sync the new user/kernel xfs_buf_log_item to 03/50 of the for Linux 3.12 kernel patch series which also means remove kernel-only in xfs_buf_item.h
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/55 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
--- include/Makefile | 3 +- include/libxlog.h | 1 - include/xfs_extfree_item.h | 161 --------------------------------------------- include/xfs_log_format.h | 83 +++++++++++++++++++++++ 4 files changed, 85 insertions(+), 163 deletions(-) delete mode 100644 include/xfs_extfree_item.h
include/Makefile +2 -1
@@ -27,7 +27,8 @@ QAHFILES = libxfs.h libxlog.h \ xfs_cksum.h \ xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ - xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ + xfs_ialloc.h \ + xfs_ialloc_btree.h \ xfs_icreate_item.h \ xfs_inode.h \ xfs_inum.h \
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h> /*
include/xfs_extfree_item.h deleted +0 -161
161 lines not on this page · raw message
include/xfs_log_format.h +83 -0
87 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/55] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed from the past posting.
This patch is the user equivalent of the for Linux 3.12 kernel patch 04/50.
sync the shared user/kernel extent free items to xfs_log_format.h. The kernel only extent free items remain in the header file, xfs_extfree_item.h, which is removed from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/55 xfs: separate dquot on disk format definitions out of xfs_quota.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
--- include/Makefile | 1 + include/libxfs.h | 1 + include/xfs_format.h | 86 ++++++++++++++++++++++++++++++ include/xfs_log_format.h | 64 ++++++++++++++++++++++ include/xfs_quota.h | 134 ----------------------------------------------- include/xfs_types.h | 6 +++ 6 files changed, 158 insertions(+), 134 deletions(-) create mode 100644 include/xfs_format.h
include/Makefile +1 -0
@@ -27,6 +27,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_cksum.h \ xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ + xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ xfs_icreate_item.h \
include/libxfs.h +1 -0
@@ -37,6 +37,7 @@#include <xfs/xfs_fs.h> #include <xfs/xfs_arch.h> +#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> #include <xfs/xfs_bit.h>
include/xfs_format.h new file +86 -0
86 lines not on this page · raw message
include/xfs_log_format.h +64 -0
68 lines not on this page · raw message
include/xfs_quota.h +0 -134
152 lines not on this page · raw message
include/xfs_types.h +6 -0
@@ -178,4 +178,10 @@ struct xfs_name { int len; }; +/* +* uid_t and gid_t are hard-coded to 32 bits in the inode. +* Hence, an 'id' in a dquot is 32 bits.. +*/ +typedef __uint32_t xfs_dqid_t ; +#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 20/55] xfs: separate dquot on disk format definitions out of xfs_quota.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
Finally, a change from the former patch series.
quota entries moved to new xfs_format.h. quota log entries including XFS_MOUNT_QUOTA_ALL to xfs_log_format.h and a def to xfs_types.h - all synced to kernel patch 05/50. xfs_quota.h is not synced to kernel 05/50, but in user patch 24/49 is xfs_quota.h is removed (because it will be kernel-only).
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/55 xfs: separate icreate log format definitions from xfs_icreate_item.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
--- include/Makefile | 1 - include/libxfs.h | 1 - include/libxlog.h | 1 - include/xfs_icreate_item.h | 55 ---------------------------------------------- include/xfs_log_format.h | 18 +++++++++++++++ 5 files changed, 18 insertions(+), 58 deletions(-) delete mode 100644 include/xfs_icreate_item.h
include/Makefile +0 -1
@@ -30,7 +30,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ - xfs_icreate_item.h \ xfs_inode.h \ xfs_inum.h \ xfs_log_format.h \
include/libxfs.h +0 -1
@@ -59,7 +59,6 @@#include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> -#include <xfs/xfs_icreate_item.h> #ifndef ARRAY_SIZE
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_icreate_item.h> /* * macros mapping kernel code to user code
include/xfs_icreate_item.h deleted +0 -55
55 lines not on this page · raw message
include/xfs_log_format.h +18 -0
@@ -608,4 +608,22 @@ typedef struct xfs_qoff_logformat { XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|\ XFS_PQUOTA_CHKD) +/* +* Inode create log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */ +__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */ +__be32 icl_length;/* length of extent to initialise */ +__be32 icl_gen;/* inode generation number to use */ +}; +#endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 21/55] xfs: separate icreate log format definitions from xfs_icreate_item.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
This patch has not changed since the former post.
xfsprogs equivalent of the for 3.12 kernel patch 06/50.
move the shared xfs_icreate structure to xfs_log_format.h - varies from the kernel only by the XFS_MOUNT_QUOTA_ALL entry (added xfsprogs).
xfs_icreate_item.h is now kernel-only, remove from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/55 xfs: split out on-disk transaction definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There's a bunch of definitions in xfs_trans.h that define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains in xfs_trans.h are kernel only definitions.
--- include/xfs_log_format.h | 207 +++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_trans.h | 207 +---------------------------------------------- 2 files changed, 208 insertions(+), 206 deletions(-)
include/xfs_log_format.h +207 -0
@@ -187,6 +187,213 @@ typedef struct xfs_log_iovec {/* +* Transaction Header definitions. +* +* This is the structure written in the log at the head of every transaction. It +* identifies the type and id of the transaction, and contains the number of +* items logged by the transaction so we know how many to expect during +* recovery. +* +* Do not change the below structure without redoing the code in +* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). +*/ +typedef struct xfs_trans_header { +uint th_magic;/* magic number */ +uint th_type;/* transaction type */ +__int32_t th_tid;/* transaction id (unused) */ +uint th_num_items;/* num items logged by trans */ +}xfs_trans_header_t ; + +#define XFS_TRANS_HEADER_MAGIC 0x5452414e/* TRAN */ + +/* +* Log item types. +*/ +#define XFS_LI_EFI 0x1236 +#define XFS_LI_EFD 0x1237 +#define XFS_LI_IUNLINK 0x1238 +#define XFS_LI_INODE 0x123b/* aligned ino chunks, var-size ibufs */ +#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ +#define XFS_LI_DQUOT 0x123d +#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f + +#define XFS_LI_TYPE_DESC \ + { XFS_LI_EFI, "XFS_LI_EFI" }, \ + { XFS_LI_EFD, "XFS_LI_EFD" }, \ + { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ + { XFS_LI_INODE, "XFS_LI_INODE" }, \ + { XFS_LI_BUF, "XFS_LI_BUF" }, \ + { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" } + +/* +* Transaction types. Used to distinguish types of buffers. +*/ +#define XFS_TRANS_SETATTR_NOT_SIZE 1 +#define XFS_TRANS_SETATTR_SIZE 2 +#define XFS_TRANS_INACTIVE 3 +#define XFS_TRANS_CREATE 4 +#define XFS_TRANS_CREATE_TRUNC 5 +#define XFS_TRANS_TRUNCATE_FILE 6 +#define XFS_TRANS_REMOVE 7 +#define XFS_TRANS_LINK 8 +#define XFS_TRANS_RENAME 9 +#define XFS_TRANS_MKDIR 10 +#define XFS_TRANS_RMDIR 11 +#define XFS_TRANS_SYMLINK 12 +#define XFS_TRANS_SET_DMATTRS 13 +#define XFS_TRANS_GROWFS 14 +#define XFS_TRANS_STRAT_WRITE 15 +#define XFS_TRANS_DIOSTRAT 16 +/* 17 was XFS_TRANS_WRITE_SYNC */ +#define XFS_TRANS_WRITEID 18 +#define XFS_TRANS_ADDAFORK 19 +#define XFS_TRANS_ATTRINVAL 20 +#define XFS_TRANS_ATRUNCATE 21 +#define XFS_TRANS_ATTR_SET 22 +#define XFS_TRANS_ATTR_RM 23 +#define XFS_TRANS_ATTR_FLAG 24 +#define XFS_TRANS_CLEAR_AGI_BUCKET 25 +#define XFS_TRANS_QM_SBCHANGE 26 +/* +* Dummy entries since we use the transaction type to index into the +* trans_type[] in xlog_recover_print_trans_head() +*/ +#define XFS_TRANS_DUMMY1 27 +#define XFS_TRANS_DUMMY2 28 +#define XFS_TRANS_QM_QUOTAOFF 29 +#define XFS_TRANS_QM_DQALLOC 30 +#define XFS_TRANS_QM_SETQLIM 31 +#define XFS_TRANS_QM_DQCLUSTER 32 +#define XFS_TRANS_QM_QINOCREATE 33 +#define XFS_TRANS_QM_QUOTAOFF_END 34 +#define XFS_TRANS_SB_UNIT 35 +#define XFS_TRANS_FSYNC_TS 36 +#define XFS_TRANS_GROWFSRT_ALLOC 37 +#define XFS_TRANS_GROWFSRT_ZERO 38 +#define XFS_TRANS_GROWFSRT_FREE 39 +#define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_SB_COUNT 41 +#define XFS_TRANS_CHECKPOINT 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43 +/* new transaction types need to be reflected in xfs_logprint(8) */ + +#define XFS_TRANS_TYPES \ + { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ + { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ + { XFS_TRANS_INACTIVE, "INACTIVE" }, \ + { XFS_TRANS_CREATE, "CREATE" }, \ + { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ + { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ + { XFS_TRANS_REMOVE, "REMOVE" }, \ + { XFS_TRANS_LINK, "LINK" }, \ + { XFS_TRANS_RENAME, "RENAME" }, \ + { XFS_TRANS_MKDIR, "MKDIR" }, \ + { XFS_TRANS_RMDIR, "RMDIR" }, \ + { XFS_TRANS_SYMLINK, "SYMLINK" }, \ + { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ + { XFS_TRANS_GROWFS, "GROWFS" }, \ + { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ + { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ + { XFS_TRANS_WRITEID, "WRITEID" }, \ + { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ + { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ + { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ + { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ + { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ + { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ + { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ + { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ + { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ + { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ + { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ + { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ + { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ + { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ + { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ + { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ + { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ + { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ + { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ + { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ + { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ + { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ + { XFS_TRANS_DUMMY1, "DUMMY1" }, \ + { XFS_TRANS_DUMMY2, "DUMMY2" }, \ + { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } + +/* +* This structure is used to track log items associated with +* a transaction. It points to the log item and keeps some +* flags to track the state of the log item. It also tracks +* the amount of space needed to log the item it describes +* once we get to commit processing (see xfs_trans_commit()). +*/ +struct xfs_log_item_desc { +struct xfs_log_item *lid_item; +struct list_head lid_trans; +unsigned char lid_flags; +}; + +#define XFS_LID_DIRTY 0x1 + +/* +* Values for t_flags. +*/ +#define XFS_TRANS_DIRTY 0x01/* something needs to be logged */ +#define XFS_TRANS_SB_DIRTY 0x02/* superblock is modified */ +#define XFS_TRANS_PERM_LOG_RES 0x04/* xact took a permanent log res */ +#define XFS_TRANS_SYNC 0x08/* make commit synchronous */ +#define XFS_TRANS_DQ_DIRTY 0x10/* at least one dquot in trx dirty */ +#define XFS_TRANS_RESERVE 0x20/* OK to use reserved data blocks */ +#define XFS_TRANS_FREEZE_PROT 0x40/* Transaction has elevated writer +count in superblock */ + +/* +* Values for call flags parameter. +*/ +#define XFS_TRANS_RELEASE_LOG_RES 0x4 +#define XFS_TRANS_ABORT 0x8 + +/* +* Field values for xfs_trans_mod_sb. +*/ +#define XFS_TRANS_SB_ICOUNT 0x00000001 +#define XFS_TRANS_SB_IFREE 0x00000002 +#define XFS_TRANS_SB_FDBLOCKS 0x00000004 +#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 +#define XFS_TRANS_SB_FREXTENTS 0x00000010 +#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 +#define XFS_TRANS_SB_DBLOCKS 0x00000040 +#define XFS_TRANS_SB_AGCOUNT 0x00000080 +#define XFS_TRANS_SB_IMAXPCT 0x00000100 +#define XFS_TRANS_SB_REXTSIZE 0x00000200 +#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 +#define XFS_TRANS_SB_RBLOCKS 0x00000800 +#define XFS_TRANS_SB_REXTENTS 0x00001000 +#define XFS_TRANS_SB_REXTSLOG 0x00002000 + +/* +* Here we centralize the specification of XFS meta-data buffer +* reference count values. This determine how hard the buffer +* cache tries to hold onto the buffer. +*/ +#define XFS_AGF_REF 4 +#define XFS_AGI_REF 4 +#define XFS_AGFL_REF 3 +#define XFS_INO_BTREE_REF 3 +#define XFS_ALLOC_BTREE_REF 2 +#define XFS_BMAP_BTREE_REF 2 +#define XFS_DIR_BTREE_REF 2 +#define XFS_INO_REF 2 +#define XFS_ATTR_BTREE_REF 1 +#define XFS_DQUOT_REF 1 + + +/* * Inode Log Item Format definitions. * * This is the structure used to lay out an inode log item in the
include/xfs_trans.h +1 -206
220 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 22/55] xfs: split out on-disk transaction definitions
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There's a bunch of definitions in
xfs_trans.hthat define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains inxfs_trans.hare kernel only definitions.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 07/50.
Yeah, this patch syncs up to the kernel very nicely (this is where the sync started to deviate in the previous series).
Minor log reservation differences in xfs_trans.h but we know they are addressed in future patches.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/55 xfs: introduce xfs_rtalloc_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h so we don't need to share xfs_rtalloc.h with userspace anymore.
This removes the final __KERNEL__ region from the XFS kernel codebase. Yay!
--- include/Makefile | 5 +- include/libxfs.h | 1 - include/xfs_format.h | 41 +++++++++++++ include/xfs_rtalloc.h | 166 -------------------------------------------------- include/xfs_types.h | 10 +++ 5 files changed, 55 insertions(+), 168 deletions(-) delete mode 100644 include/xfs_rtalloc.h
include/Makefile +4 -1
@@ -35,7 +35,10 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ + xfs_mount.h \ + xfs_quota.h \ + xfs_sb.h \ + xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h
include/libxfs.h +0 -1
@@ -614,7 +614,6 @@ extern int libxfs_nproc(void);extern unsigned long libxfs_physmem (void );/* in kilobytes */ #include <xfs/xfs_ialloc.h> -#include <xfs/xfs_rtalloc.h> #include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_remote.h>
include/xfs_format.h +41 -0
47 lines not on this page · raw message
include/xfs_rtalloc.h deleted +0 -166
166 lines not on this page · raw message
include/xfs_types.h +10 -0
@@ -184,4 +184,14 @@ struct xfs_name {*/ typedef __uint32_t xfs_dqid_t ; +/* +* Constants for bit manipulations. +*/ +#define XFS_NBBYLOG 3/* log2(NBBY) */ +#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ +#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) +#define XFS_NBWORD (1 << XFS_NBWORDLOG) +#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) + +#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 23/55] xfs: introduce xfs_rtalloc_defs.h
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from
xfs_rtalloc.htoxfs_rt_alloc_defs.hso we don't need to sharexfs_rtalloc.hwith userspace anymore.This removes the final
__KERNEL__region from the XFS kernel codebase. Yay!Signed-off-by Dave Chinner<[email protected]>---
No change in this patch from previous post. Synced files look good.
xfsprogs equivalent of the for 3.12 kernel patch 08/50.
move shared items from xfs_rtalloc.h to xfs_format.h. xfs_rtalloc.h is now kernel-only, remove from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/55 xfs: introduce xfs_quota_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to xfs_quota_defs.h so we can unshare xfs_quota.h and remove the __KERNEL__ regions from it.
--- include/Makefile | 2 +- include/libxfs.h | 2 +- include/xfs_quota.h | 262 ----------------------------------------------- include/xfs_quota_defs.h | 157 ++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 264 deletions(-) delete mode 100644 include/xfs_quota.h create mode 100644 include/xfs_quota_defs.h
include/Makefile +1 -1
@@ -36,7 +36,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_recover.h \ xfs_metadump.h \ xfs_mount.h \ - xfs_quota.h \ + xfs_quota_defs.h \ xfs_sb.h \ xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +1 -1
@@ -39,6 +39,7 @@#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> +#include <xfs/xfs_quota_defs.h> #include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h>
@@ -617,7 +618,6 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */#include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_remote.h> -#include <xfs/xfs_quota.h> #include <xfs/xfs_trans_space.h> #define XFS_INOBT_IS_FREE_DISK (rp,i) \
include/xfs_quota.h deleted +0 -262
262 lines not on this page · raw message
include/xfs_quota_defs.h new file +157 -0
157 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 24/55] xfs: introduce xfs_quota_defs.h
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to
xfs_quota_defs.hso we can unsharexfs_quota.hand remove the__KERNEL__regions from it.Signed-off-by Dave Chinner<[email protected]>---
This patch compares different from the previous series because of the new quota header entry. I compares cleanly.
xfsprogs equivalent of the for 3.12 kernel patch 09/50.
move remaining quota shared entries from xfs_quota.h to xfs_quota_defs.h - as mentioned in patch 20, xfs_quota.h is now kernel-only and removed.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/55 libxfs: introduce xfs_trans_resv.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The log space reservation calculation code has been separated from the core transaction code in kernelspace. THi smeans we can add it here in preparation for removing xfs_trans.c to further reduce the differences between kernel and usrspace files.
--- include/Makefile | 5 +- include/libxfs.h | 23 +- include/xfs_mount.h | 33 +-- include/xfs_trans.h | 331 ----------------------- include/xfs_trans_resv.h | 137 ++++++++++ libxfs/Makefile | 7 +- libxfs/xfs.h | 2 + libxfs/xfs_trans.c | 576 +--------------------------------------- libxfs/xfs_trans_resv.c | 677 +++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 8 +- 10 files changed, 851 insertions(+), 948 deletions(-) delete mode 100644 include/xfs_trans.h create mode 100644 include/xfs_trans_resv.h create mode 100644 libxfs/xfs_trans_resv.c
include/Makefile +4 -1
@@ -39,7 +39,10 @@ QAHFILES = libxfs.h libxlog.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_symlink.h \ - xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h + xfs_trace.h \ + xfs_trans_resv.h \ + xfs_trans_space.h \ + xfs_dfrag.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h HFILES += $(PKG_PLATFORM).h
include/libxfs.h +20 -3
@@ -40,6 +40,7 @@#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> #include <xfs/xfs_quota_defs.h> +#include <xfs/xfs_trans_resv.h> #include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h>
@@ -204,7 +205,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_litino;/* size of inode union area */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ -xfs_trans_reservations_t m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ int m_dalign;/* stripe unit */ int m_swidth;/* stripe width */
@@ -408,7 +409,6 @@ extern int libxfs_ihash_size;extern void libxfs_iomove (xfs_buf_t *,uint ,int ,void *,int ); -/* * Transaction interface */
@@ -443,7 +443,18 @@ typedef struct xfs_buf_log_item {#define XFS_BLI_STALE (1<<2)#define XFS_BLI_INODE_ALLOC_BUF (1<<3) -#include <xfs/xfs_trans.h> +typedef struct xfs_dq_logitem { +xfs_log_item_t qli_item;/* common portion */ +struct xfs_dquot *qli_dquot;/* dquot ptr */ +xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ +xfs_dq_logformat_t qli_format;/* logged structure */ +}xfs_dq_logitem_t ; + +typedef struct xfs_qoff_logitem { +xfs_log_item_t qql_item;/* common portion */ +struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ +xfs_qoff_logformat_t qql_format;/* logged structure */ +}xfs_qoff_logitem_t ; typedef struct xfs_trans { unsigned int t_type; /* transaction type */
@@ -458,6 +469,9 @@ typedef struct xfs_trans {struct list_head t_items;/* first log item desc chunk */ } xfs_trans_t; +extern void xfs_trans_init (struct xfs_mount *); +extern int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *); +extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *,int );extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *);extern int libxfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint ,uint ,uint );
@@ -700,6 +714,9 @@ void xfs_dinode_from_disk(struct xfs_icdinode *,#define libxfs_symlink_blocks xfs_symlink_blocks#define libxfs_symlink_hdr_ok xfs_symlink_hdr_ok +/* xfs_trans_resv.h */ +#define libxfs_trans_resv_calc xfs_trans_resv_calc +/* xfs_rtalloc.c */ int libxfs_rtfree_extent (struct xfs_trans *,xfs_rtblock_t ,xfs_extlen_t );
include/xfs_mount.h +1 -32
@@ -18,37 +18,6 @@#ifndef __XFS_MOUNT_H__#define __XFS_MOUNT_H__ -typedef struct xfs_trans_reservations { -uint tr_write;/* extent alloc trans */ -uint tr_itruncate;/* truncate trans */ -uint tr_rename;/* rename trans */ -uint tr_link;/* link trans */ -uint tr_remove;/* unlink trans */ -uint tr_symlink;/* symlink trans */ -uint tr_create;/* create trans */ -uint tr_mkdir;/* mkdir trans */ -uint tr_ifree;/* inode free trans */ -uint tr_ichange;/* inode update trans */ -uint tr_growdata;/* fs data section grow trans */ -uint tr_swrite;/* sync write inode trans */ -uint tr_addafork;/* cvt inode to attributed trans */ -uint tr_writeid;/* write setuid/setgid file */ -uint tr_attrinval;/* attr fork buffer invalidation */ -uint tr_attrsetm;/* set/create an attribute at mount time */ -uint tr_attrsetrt;/* set/create an attribute at runtime */ -uint tr_attrrm;/* remove an attribute */ -uint tr_clearagi;/* clear bad agi unlinked ino bucket */ -uint tr_growrtalloc;/* grow realtime allocations */ -uint tr_growrtzero;/* grow realtime zeroing */ -uint tr_growrtfree;/* grow realtime freeing */ -uint tr_qm_sbchange;/* change quota flags */ -uint tr_qm_setqlim;/* adjust quota limits */ -uint tr_qm_dqalloc;/* allocate quota on disk */ -uint tr_qm_quotaoff;/* turn quota off */ -uint tr_qm_equotaoff;/* end of turn quota off */ -uint tr_sb;/* modify superblock */ -}xfs_trans_reservations_t ; -#ifndef __KERNEL__#define xfs_daddr_to_agno (mp,d) \
@@ -174,7 +143,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ uint m_qflags;/* quota status flags */ -xfs_trans_reservations_t m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ __uint64_t m_resblks;/* total reserved blocks */ __uint64_t m_resblks_avail;/* available reserved blocks */
include/xfs_trans.h deleted +0 -331
331 lines not on this page · raw message
include/xfs_trans_resv.h new file +137 -0
137 lines not on this page · raw message
libxfs/Makefile +5 -2
@@ -16,8 +16,11 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_trans.c xfs_attr.c xfs_attr_remote.c \ - crc32.c xfs_symlink.c + xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ + crc32.c \ + xfs_symlink.c \ + xfs_trans.c \ + xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c PCFILES = darwin.c freebsd.c irix.c linux.c
libxfs/xfs.h +2 -0
@@ -100,6 +100,8 @@ typedef __uint32_t inst_t; /* an instruction */#define __return_address __builtin_return_address(0)#endif +#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 +/* miscellaneous kernel routines not in user space */ #define down_read (a) ((void) 0)#define up_read (a) ((void) 0)
libxfs/xfs_trans.c +1 -575
588 lines not on this page · raw message
libxfs/xfs_trans_resv.c new file +677 -0
677 lines not on this page · raw message
mkfs/maxtrres.c +4 -4
@@ -52,11 +52,11 @@ max_attrsetm_trans_res_adjust(static int max_trans_res_by_mount ( -xfs_mount_t *mp) +struct xfs_mount *mp) { -uint *p; -int rval; -xfs_trans_reservations_t *tr = &mp->m_reservations; +uint *p; +int rval; +struct xfs_trans_resv *tr = &mp->m_reservations;for (rval =0 , p = (uint *)tr; p < (uint *)(tr +1 ); p++) {if ((int )*p > rval)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 25/55] libxfs: introduce xfs_trans_resv.c
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The log space reservation calculation code has been separated from the core transaction code in kernelspace. THi smeans we can add it here in preparation for removing
xfs_trans.cto further reduce the differences between kernel and usrspace files.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 11/50.
This moves the transaction reservation value code from xfs_trans.[ch] to a new files xfs_trans_resv.[ch]. At the end of this patch, xfs_trans_resv.[ch] are the same as the kernel files. At this point, that is all that matters.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/55 libxfs: move transaction code to trans.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is very little code left in xfs_trans.c. So little it is not worthtrying to share this file with kernel space any more. Move the code to libxfs/trans.c, and remove libxfs/xfs_trans.c.
--- libxfs/Makefile | 1 - libxfs/trans.c | 118 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs.h | 6 +++ libxfs/xfs_trans.c | 139 ----------------------------------------------------- 4 files changed, 124 insertions(+), 140 deletions(-) delete mode 100644 libxfs/xfs_trans.c
libxfs/Makefile +0 -1
@@ -19,7 +19,6 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ crc32.c \ xfs_symlink.c \ - xfs_trans.c \ xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c
libxfs/trans.c +118 -0
129 lines not on this page · raw message
libxfs/xfs.h +6 -0
@@ -235,12 +235,14 @@ roundup_pow_of_two(uint v)#define xfs_mod_incore_sb libxfs_mod_incore_sb#define xfs_trans_alloc libxfs_trans_alloc +#define xfs_trans_add_item libxfs_trans_add_item#define xfs_trans_bhold libxfs_trans_bhold#define xfs_trans_binval libxfs_trans_binval#define xfs_trans_bjoin libxfs_trans_bjoin#define xfs_trans_brelse libxfs_trans_brelse#define xfs_trans_commit libxfs_trans_commit#define xfs_trans_cancel libxfs_trans_cancel +#define xfs_trans_del_item libxfs_trans_del_item#define xfs_trans_dup libxfs_trans_dup#define xfs_trans_get_buf libxfs_trans_get_buf#define xfs_trans_getsb libxfs_trans_getsb
@@ -248,12 +250,14 @@ roundup_pow_of_two(uint v)#define xfs_trans_ihold libxfs_trans_ihold#define xfs_trans_ijoin libxfs_trans_ijoin#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref +#define xfs_trans_init libxfs_trans_init#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf#define xfs_trans_log_buf libxfs_trans_log_buf#define xfs_trans_log_inode libxfs_trans_log_inode#define xfs_trans_mod_sb libxfs_trans_mod_sb#define xfs_trans_read_buf libxfs_trans_read_buf#define xfs_trans_read_buf_map libxfs_trans_read_buf_map +#define xfs_trans_roll libxfs_trans_roll#define xfs_trans_get_buf_map libxfs_trans_get_buf_map#define xfs_trans_reserve libxfs_trans_reserve
@@ -373,6 +377,8 @@ void xfs_mount_common(xfs_mount_t *, xfs_sb_t *);/* * logitem.c and trans.c prototypes */ +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);/* xfs_trans_item.c */ void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *);
libxfs/xfs_trans.c deleted +0 -139
139 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 26/55] libxfs: move transaction code to trans.c
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is very little code left in
xfs_trans.c. So little it is not worthtrying to share this file with kernel space any more. Move the code tolibxfs/trans.c, and removelibxfs/xfs_trans.c.Signed-off-by Dave Chinner<[email protected]>---
No change in this patch from previous post.
xfsprogs equivalent of the for 3.12 kernel patch 11/50.
change zone allocator/zone free to calloc/free, change function names to libxfs_trans_XX.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 27/55 xfs: move inode fork definitions to a new header file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from xfs_inode.h.
Do the same for the all the C code that currently resides in xfs_inode.c for the same reason.
--- include/xfs_bmap_btree.h | 2 + include/xfs_inode.h | 134 +--- include/xfs_inode_fork.h | 171 +++++ libxfs/Makefile | 7 +- libxfs/xfs_inode.c | 1878 +-------------------------------------------- libxfs/xfs_inode_fork.c | 1890 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 2072 insertions(+), 2010 deletions(-) create mode 100644 include/xfs_inode_fork.h create mode 100644 libxfs/xfs_inode_fork.c
include/xfs_bmap_btree.h +2 -0
@@ -197,6 +197,8 @@ typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;#define XFS_BMDR_SPACE_CALC (nrecs) \ (int)(sizeof(xfs_bmdr_block_t) + \ ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))) +#define XFS_BMAP_BMDR_SPACE (bb) \ + (XFS_BMDR_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))/* * Maximum number of bmap btree levels.
include/xfs_inode.h +1 -133
158 lines not on this page · raw message
include/xfs_inode_fork.h new file +171 -0
171 lines not on this page · raw message
libxfs/Makefile +6 -1
@@ -12,7 +12,12 @@ LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ - xfs_alloc.c xfs_ialloc.c xfs_inode.c xfs_btree.c xfs_alloc_btree.c \ + xfs_alloc.c \ + xfs_alloc_btree.c \ + xfs_btree.c \ + xfs_ialloc.c \ + xfs_inode.c \ + xfs_inode_fork.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \
libxfs/xfs_inode.c +2 -1876
1,916 lines not on this page · raw message
libxfs/xfs_inode_fork.c new file +1890 -0
734 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 27/55] xfs: move inode fork definitions to a new header file
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from
xfs_inode.h.
Quoted 5 lines
Do the same for the all the C code that currently resides in
xfs_inode.cfor the same reason.Signed-off-by Dave Chinner<[email protected]>---
No change from previous post.
xfsprogs equivalent of the for 3.12 kernel patch 12/50.
move remaining shared inode to new xfs_inode_fork.c/h. new function prototypes.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 28/55 xfs: move unrealted definitions out of xfs_inode.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/Makefile | 1 + include/libxfs.h | 1 + include/xfs_inode.h | 36 ------------------------------------ include/xfs_log_format.h | 7 +++++++ libxfs/xfs.h | 3 +++ 5 files changed, 12 insertions(+), 36 deletions(-)
include/Makefile +1 -0
@@ -31,6 +31,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ xfs_inode.h \ + xfs_inode_fork.h \ xfs_inum.h \ xfs_log_format.h \ xfs_log_recover.h \
include/libxfs.h +1 -0
@@ -54,6 +54,7 @@#include <xfs/xfs_ialloc_btree.h> #include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> +#include <xfs/xfs_inode_fork.h> #include <xfs/xfs_inode.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h>
include/xfs_inode.h +0 -36
@@ -34,35 +34,6 @@ struct xfs_imap {ushort im_boffset;/* inode offset in block in bytes */ }; -/* -* This is the xfs in-core inode structure. -* Most of the on-disk inode is embedded in the i_d field. -* -* The extent pointers/inline file space, however, are managed -* separately. The memory for this information is pointed to by -* the if_u1 unions depending on the type of the data. -* This is used to linearize the array of extents for fast in-core -* access. This is used until the file's number of extents -* surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers -* are accessed through the buffer cache. -* -* Other state kept in the in-core inode is used for identification, -* locking, transactional updating, etc of the inode. -* -* Generally, we do not want to hold the i_rlock while holding the -* i_ilock. Hierarchy is i_iolock followed by i_rlock. -* -* xfs_iptr_t contains all the inode fields up to and including the -* i_mnext and i_mprev fields, it is used as a marker in the inode -* chain off the mount structure by xfs_sync calls. -*/ -/* -* Flags for xfs_ichgtime(). -*/ -#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ -#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ -#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ -#ifdef __KERNEL__
@@ -398,13 +369,6 @@ do { \#endif /* __KERNEL__ */ -/* -* Flags for xfs_iget() -*/ -#define XFS_IGET_CREATE 0x1 -#define XFS_IGET_UNTRUSTED 0x2 -#define XFS_IGET_DONTCACHE 0x4 -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *,struct xfs_imap *,struct xfs_dinode **,struct xfs_buf **,uint ,uint );
include/xfs_log_format.h +7 -0
@@ -392,6 +392,13 @@ struct xfs_log_item_desc {#define XFS_ATTR_BTREE_REF 1#define XFS_DQUOT_REF 1 +/* +* Flags for xfs_trans_ichgtime(). +*/ +#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ +#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ +#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ +/* * Inode Log Item Format definitions.
libxfs/xfs.h +3 -0
@@ -68,6 +68,9 @@ typedef __uint32_t inst_t; /* an instruction */#define IHOLD (ip) ((void) 0) +#define XFS_IGET_CREATE 0x1 +#define XFS_IGET_UNTRUSTED 0x2 +/* stop unused var warnings by assigning mp to itself */ #define XFS_CORRUPTION_ERROR (e,l,mp,m) do { \ (mp) = (mp); \
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/55] xfs: move unrealted definitions out of xfs_inode.h
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
User equivalent of the for Linux 3.12 kernel patch 13/50.
This moves the last shared inode items to xfs_trans.h and removes the kernel-only xfs_inode.h. Fixes my concerns I had in previous post.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 29/55 xfs: introduce xfs_inode_buf.c for inode buffer operations
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
--- include/Makefile | 2 +- include/libxfs.h | 2 +- include/xfs_inode.h | 393 --------------------------------------------- include/xfs_inode_buf.h | 53 ++++++ libxfs/Makefile | 2 +- libxfs/init.c | 3 +- libxfs/xfs_inode.c | 419 ------------------------------------------------ libxfs/xfs_inode_buf.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 466 insertions(+), 816 deletions(-) delete mode 100644 include/xfs_inode.h create mode 100644 include/xfs_inode_buf.h delete mode 100644 libxfs/xfs_inode.c create mode 100644 libxfs/xfs_inode_buf.c
include/Makefile +1 -1
@@ -30,7 +30,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ - xfs_inode.h \ + xfs_inode_buf.h \ xfs_inode_fork.h \ xfs_inum.h \ xfs_log_format.h \
include/libxfs.h +1 -1
@@ -55,7 +55,7 @@#include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_inode_fork.h> -#include <xfs/xfs_inode.h> +#include <xfs/xfs_inode_buf.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
include/xfs_inode.h deleted +0 -393
393 lines not on this page · raw message
include/xfs_inode_buf.h new file +53 -0
53 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -16,7 +16,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc_btree.c \ xfs_btree.c \ xfs_ialloc.c \ - xfs_inode.c \ + xfs_inode_buf.c \ xfs_inode_fork.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \
libxfs/init.c +2 -1
@@ -32,6 +32,8 @@ int use_xfs_buf_lock; /* global flag: use xfs_buf_t locks for MT */static void manage_zones (int );/* setup global zones */ +kmem_zone_t *xfs_inode_zone; +/* * dev_map - map open devices to fd. */
@@ -369,7 +371,6 @@ manage_zones(int release) {extern kmem_zone_t *xfs_buf_zone;extern kmem_zone_t *xfs_ili_zone; -extern kmem_zone_t *xfs_inode_zone;extern kmem_zone_t *xfs_ifork_zone;extern kmem_zone_t *xfs_buf_item_zone;extern kmem_zone_t *xfs_da_state_zone;
libxfs/xfs_inode.c deleted +0 -419
419 lines not on this page · raw message
libxfs/xfs_inode_buf.c new file +408 -0
408 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/55] xfs: introduce xfs_inode_buf.c for inode buffer operations
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 13/50.
Did not change from previous posting. I am more okay with the patch this time.
Moves the last shared inode items to xfs_trans.h and removes the kernel-only xfs_inode.h.
Sources do not have icreate patch (kernel commit cca9f93a) which is not appropriate for xfsprogs...mentioned because it is a code difference.
The uuid_copy being renamed to platform_uuid_copy() is not a biggy, xfs.h does the same in a define.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/55 xfs: split out the remote symlink handling
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
--- include/Makefile | 1 - include/libxfs.h | 1 - include/xfs_format.h | 42 ++++++++++ include/xfs_symlink.h | 47 ----------- libxfs/Makefile | 2 +- libxfs/xfs_symlink.c | 176 ----------------------------------------- libxfs/xfs_symlink_remote.c | 185 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 228 insertions(+), 226 deletions(-) delete mode 100644 include/xfs_symlink.h delete mode 100644 libxfs/xfs_symlink.c create mode 100644 libxfs/xfs_symlink_remote.c
include/Makefile +0 -1
@@ -39,7 +39,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ - xfs_symlink.h \ xfs_trace.h \ xfs_trans_resv.h \ xfs_trans_space.h \
include/libxfs.h +0 -1
@@ -61,7 +61,6 @@#include <xfs/xfs_btree_trace.h> #include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> -#include <xfs/xfs_symlink.h> #ifndef ARRAY_SIZE
include/xfs_format.h +42 -0
53 lines not on this page · raw message
include/xfs_symlink.h deleted +0 -47
47 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -23,7 +23,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ crc32.c \ - xfs_symlink.c \ + xfs_symlink_remote.c \ xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c
libxfs/xfs_symlink.c deleted +0 -176
176 lines not on this page · raw message
libxfs/xfs_symlink_remote.c new file +185 -0
185 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 30/55] xfs: split out the remote symlink handling
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
No change in repost.
user equivalent of the for Linux 3.12 kernel patch 19/50.
moves the shared symlink information from xfs_symlink.c/h to xfs_format.h and xfs_symlink_remote.c/h.
xfs_symlink.c/h is kernel-only and these files are removed from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 31/55 libxfs: switch over to xfs_sb.c and remove xfs_mount.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of xfs_mount.c, we don't need xfs_mount.c anymore. Copy in xfs_sb.c and remove xfs_mount.c
--- include/Makefile | 1 - include/libxfs.h | 14 +- include/libxlog.h | 4 - include/xfs_mount.h | 372 ------------------------- include/xfs_sb.h | 26 ++ include/xfs_trace.h | 1 + libxfs/Makefile | 10 +- libxfs/init.c | 2 +- libxfs/xfs.h | 1 + libxfs/xfs_mount.c | 721 ------------------------------------------------ libxfs/xfs_sb.c | 771 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 818 insertions(+), 1105 deletions(-) delete mode 100644 include/xfs_mount.h delete mode 100644 libxfs/xfs_mount.c create mode 100644 libxfs/xfs_sb.c
include/Makefile +0 -1
@@ -36,7 +36,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_trace.h \
include/libxfs.h +11 -3
@@ -47,7 +47,6 @@#include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> #include <xfs/xfs_dir2.h> -#include <xfs/xfs_mount.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -323,6 +322,11 @@ enum xfs_buf_flags_t { /* b_flags bits */#define xfs_buf_set_ref (bp,ref) ((void) 0)#define xfs_buf_ioerror (bp,err) (bp)->b_error = (err); +#define xfs_daddr_to_agno (mp,d) \ + ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) +#define xfs_daddr_to_agbno (mp,d) \ + ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) +/* Buffer Cache Interfaces */ extern struct cache *libxfs_bcache;
@@ -477,7 +481,6 @@ extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *);extern int libxfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint ,uint ,uint );extern int libxfs_trans_commit (xfs_trans_t *,uint );extern void libxfs_trans_cancel (xfs_trans_t *,int ); -extern void libxfs_mod_sb (xfs_trans_t *,__int64_t );extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *,xfs_mount_t *,int ); extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
@@ -705,7 +708,7 @@ void xfs_dinode_from_disk(struct xfs_icdinode *,#define libxfs_idata_realloc xfs_idata_realloc#define libxfs_idestroy_fork xfs_idestroy_fork -/* xfs_mount.h */ +/* xfs_sb.h */ #define libxfs_mod_sb xfs_mod_sb#define libxfs_sb_from_disk xfs_sb_from_disk#define libxfs_sb_to_disk xfs_sb_to_disk
@@ -730,4 +733,9 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);#include <xfs/xfs_cksum.h> +#define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) +#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) +#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) +#define xfs_hex_dump (d,n) ((void) 0) +#endif /* __LIBXFS_H__ */
include/libxlog.h +0 -4
@@ -66,10 +66,6 @@ struct xlog {#define XFS_MOUNT_WAS_CLEAN 0x1#define unlikely (x) (x) -#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) -#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) -#define xfs_hex_dump (d,n) ((void) 0) -extern void xlog_warn (char *fmt,...);extern void xlog_exit (char *fmt,...);extern void xlog_panic (char *fmt,...);
include/xfs_mount.h deleted +0 -372
372 lines not on this page · raw message
include/xfs_sb.h +26 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -630,6 +631,12 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/* * end of superblock version macros */
@@ -666,4 +673,23 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)#define XFS_B_TO_FSBT (mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)#define XFS_B_FSB_OFFSET (mp,b) ((b) & (mp)->m_blockmask) +/* +* perag get/put wrappers for ref counting +*/ +extern struct xfs_perag *xfs_perag_get (struct xfs_mount *,xfs_agnumber_t ); +extern struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *,xfs_agnumber_t , +int tag); +extern void xfs_perag_put (struct xfs_perag *pag); +extern int xfs_initialize_perag_data (struct xfs_mount *,xfs_agnumber_t ); + +extern void xfs_sb_calc_crc (struct xfs_buf *); +extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); +extern void xfs_sb_mount_common (struct xfs_mount *,struct xfs_sb *); +extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); +extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
include/xfs_trace.h +1 -0
@@ -162,6 +162,7 @@/* set c = c to avoid unused var warnings */ #define trace_xfs_perag_get (a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_get_tag (a,b,c,d) ((c) = (c))#define trace_xfs_perag_put (a,b,c,d) ((c) = (c))#endif /* __TRACE_H__ */
libxfs/Makefile +7 -3
@@ -11,9 +11,13 @@ LT_REVISION = 0 LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h -CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ +CFILES = cache.c \ + crc32.c \ + init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc.c \ xfs_alloc_btree.c \ + xfs_attr.c \ + xfs_attr_remote.c \ xfs_btree.c \ xfs_ialloc.c \ xfs_inode_buf.c \
@@ -21,8 +25,8 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ - crc32.c \ + xfs_rtalloc.c \ + xfs_sb.c \ xfs_symlink_remote.c \ xfs_trans_resv.c
libxfs/init.c +1 -1
@@ -692,7 +692,7 @@ libxfs_mount(INIT_RADIX_TREE (&mp->m_perag_tree,GFP_KERNEL ); sbp = &(mp->m_sb); -xfs_mount_common (mp, sb); +xfs_sb_mount_common (mp, sb);xfs_alloc_compute_maxlevels (mp);xfs_bmap_compute_maxlevels (mp,XFS_DATA_FORK );
libxfs/xfs.h +1 -0
@@ -345,6 +345,7 @@ do { \#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +#define xfs_sb_validate_fsb_count (sbp, nblks) (0)/* * Prototypes for kernel static functions that are aren't in their
libxfs/xfs_mount.c deleted +0 -721
721 lines not on this page · raw message
libxfs/xfs_sb.c new file +771 -0
771 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cSigned-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 20/49. This patch leaves xfs_sb.c/xfs_sb.h difference.
For example in xfs_sb.h the user header is missing the project inode test in xfs_is_quota_inode().
Shouldn't xfs_sb.[ch] synced to the kernel files at this point?
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cSigned-off-by Dave Chinner<[email protected]>---
Quoted 7 lines
user equivalent of the for Linux 3.12 kernel patch 20/49. This patch leaves
xfs_sb.c/xfs_sb.hdifference.For example in
xfs_sb.hthe user header is missing the project inode test inxfs_is_quota_inode().Shouldn't xfs_sb.[ch] synced to the kernel files at this point?
No, they don't end up perfectly synced because of the different error messages in the code and some of the checks aren't relevant to userspace. Looks like there's some new whitespace differences, and that I missed a pquota change as well. I'll send a new version later today.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 25 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cSigned-off-by Dave Chinner<[email protected]>---
Quoted 7 lines
user equivalent of the for Linux 3.12 kernel patch 20/49. This patch leaves
xfs_sb.c/xfs_sb.hdifference.For example in
xfs_sb.hthe user header is missing the project inode test inxfs_is_quota_inode().Shouldn't xfs_sb.[ch] synced to the kernel files at this point?
No, they don't end up perfectly synced because of the different error messages in the code and some of the checks aren't relevant to userspace. Looks like there's some new whitespace differences, and that I missed a pquota change as well. I'll send a new version later today.
Quoted 3 lines
Cheers,
Dave.
Okay. Thanks for the work. We can bring that series in early next week.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 31/55 libxfs: switch over to xfs_sb.c and remove xfs_mount.c
libxfs: switch over to xfs_sb.c and remove xfs_mount.c
From: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of xfs_mount.c, we don't need xfs_mount.c anymore. Copy in xfs_sb.c and remove xfs_mount.c
---
v2: fix missing pquota changes and other minor differences.
include/Makefile | 1 -
include/libxfs.h | 14 +-
include/libxlog.h | 4 -
include/xfs_mount.h | 372 ---------------------------------------
include/xfs_sb.h | 26 +++
include/xfs_trace.h | 1 +
libxfs/Makefile | 10 +-
libxfs/init.c | 2 +-
libxfs/xfs.h | 1 +
libxfs/{xfs_mount.c => xfs_sb.c} | 289 ++++++++++++++++++------------
10 files changed, 223 insertions(+), 497 deletions(-)include/Makefile +0 -1
@@ -36,7 +36,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_trace.h \
include/libxfs.h +11 -3
@@ -47,7 +47,6 @@#include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> #include <xfs/xfs_dir2.h> -#include <xfs/xfs_mount.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -323,6 +322,11 @@ enum xfs_buf_flags_t { /* b_flags bits */#define xfs_buf_set_ref (bp,ref) ((void) 0)#define xfs_buf_ioerror (bp,err) (bp)->b_error = (err); +#define xfs_daddr_to_agno (mp,d) \ + ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) +#define xfs_daddr_to_agbno (mp,d) \ + ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) +/* Buffer Cache Interfaces */ extern struct cache *libxfs_bcache;
@@ -477,7 +481,6 @@ extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *);extern int libxfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint ,uint ,uint );extern int libxfs_trans_commit (xfs_trans_t *,uint );extern void libxfs_trans_cancel (xfs_trans_t *,int ); -extern void libxfs_mod_sb (xfs_trans_t *,__int64_t );extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *,xfs_mount_t *,int ); extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
@@ -705,7 +708,7 @@ void xfs_dinode_from_disk(struct xfs_icdinode *,#define libxfs_idata_realloc xfs_idata_realloc#define libxfs_idestroy_fork xfs_idestroy_fork -/* xfs_mount.h */ +/* xfs_sb.h */ #define libxfs_mod_sb xfs_mod_sb#define libxfs_sb_from_disk xfs_sb_from_disk#define libxfs_sb_to_disk xfs_sb_to_disk
@@ -730,4 +733,9 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);#include <xfs/xfs_cksum.h> +#define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) +#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) +#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) +#define xfs_hex_dump (d,n) ((void) 0) +#endif /* __LIBXFS_H__ */
include/libxlog.h +0 -4
@@ -66,10 +66,6 @@ struct xlog {#define XFS_MOUNT_WAS_CLEAN 0x1#define unlikely (x) (x) -#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) -#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) -#define xfs_hex_dump (d,n) ((void) 0) -extern void xlog_warn (char *fmt,...);extern void xlog_exit (char *fmt,...);extern void xlog_panic (char *fmt,...);
include/xfs_mount.h deleted +0 -372
372 lines not on this page · raw message
include/xfs_sb.h +26 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -630,6 +631,12 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/* * end of superblock version macros */
@@ -666,4 +673,23 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)#define XFS_B_TO_FSBT (mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)#define XFS_B_FSB_OFFSET (mp,b) ((b) & (mp)->m_blockmask) +/* +* perag get/put wrappers for ref counting +*/ +extern struct xfs_perag *xfs_perag_get (struct xfs_mount *,xfs_agnumber_t ); +extern struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *,xfs_agnumber_t , +int tag); +extern void xfs_perag_put (struct xfs_perag *pag); +extern int xfs_initialize_perag_data (struct xfs_mount *,xfs_agnumber_t ); + +extern void xfs_sb_calc_crc (struct xfs_buf *); +extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); +extern void xfs_sb_mount_common (struct xfs_mount *,struct xfs_sb *); +extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); +extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
include/xfs_trace.h +1 -0
@@ -162,6 +162,7 @@/* set c = c to avoid unused var warnings */ #define trace_xfs_perag_get (a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_get_tag (a,b,c,d) ((c) = (c))#define trace_xfs_perag_put (a,b,c,d) ((c) = (c))#endif /* __TRACE_H__ */
libxfs/Makefile +7 -3
@@ -11,9 +11,13 @@ LT_REVISION = 0 LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h -CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ +CFILES = cache.c \ + crc32.c \ + init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc.c \ xfs_alloc_btree.c \ + xfs_attr.c \ + xfs_attr_remote.c \ xfs_btree.c \ xfs_ialloc.c \ xfs_inode_buf.c \
@@ -21,8 +25,8 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ - crc32.c \ + xfs_rtalloc.c \ + xfs_sb.c \ xfs_symlink_remote.c \ xfs_trans_resv.c
libxfs/init.c +1 -1
@@ -692,7 +692,7 @@ libxfs_mount(INIT_RADIX_TREE (&mp->m_perag_tree,GFP_KERNEL ); sbp = &(mp->m_sb); -xfs_mount_common (mp, sb); +xfs_sb_mount_common (mp, sb);xfs_alloc_compute_maxlevels (mp);xfs_bmap_compute_maxlevels (mp,XFS_DATA_FORK );
libxfs/xfs.h +1 -0
@@ -345,6 +345,7 @@ do { \#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +#define xfs_sb_validate_fsb_count (sbp, nblks) (0)/* * Prototypes for kernel static functions that are aren't in their
libxfs/xfs_sb.c renamed from libxfs/xfs_mount.c +176 -113
417 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V2] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 13 lines · Dave Chinner
include/xfs_sb.h +1
-0@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
include/xfs_sb.h static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp) · line 640
Quoted 10 lines
include/xfs_sb.h +6
-0@@ -630,6 +631,12 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/*
Thanks Dave for doing all this work.
The current kernel xfs_sb.h has an additional
" || ino == sbp->sb_pquotino"
from kernel commit d892d586 that is not making it into user xfs_sb.h.
It is wrong to add it here but in a follow up patch (Chandra?).
I am happy with the kernel / user sync series.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v3 31/55 libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 27 lines · Mark Tinguely
Quoted 13 lines · Dave Chinner
include/xfs_sb.h +1
-0@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */ include/xfs_sb.h static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp) · line 640
Quoted 10 lines
include/xfs_sb.h +6
-0@@ -630,6 +631,12 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/* Thanks Dave for doing all this work.
Quoted 5 lines
The current kernel
xfs_sb.hhas an additional
" || ino ==sbp->sb_pquotino"
from kernel commitd892d586that is not making it into userxfs_sb.h.It is wrong to add it here but in a follow up patch (Chandra?).
No, it should be added here because the rest of the libxfs code supports the separate pquota inode, specifically the libxfs/xfs_sb.c code that sets up the inodes for the rest of libxfs to use.
New patch below, which also requires an update to the xfs-dir-dtype patch which I'll post in reply to that patch rather than here.
Cheers,
Dave.
Signature · 27 lines
Dave Chinner [email protected] libxfs: switch over to xfs_sb.c and remove xfs_mount.c From: Dave Chinner <[email protected]> Now that the kernel code has split the superblock specific code out of xfs_mount.c, we don't need xfs_mount.c anymore. Copy in xfs_sb.c and remove xfs_mount.c Signed-off-by: Dave Chinner <[email protected]> --- V3: update for a current kernel xfs_sb.h V2: update for a current kernel xfs_sb.c include/Makefile | 1 - include/libxfs.h | 14 +- include/libxlog.h | 4 - include/xfs_mount.h | 372 --------------------------------------- include/xfs_sb.h | 29 +++ include/xfs_trace.h | 1 + libxfs/Makefile | 10 +- libxfs/init.c | 2 +- libxfs/xfs.h | 1 + libxfs/{xfs_mount.c => xfs_sb.c} | 289 ++++++++++++++++++------------ 10 files changed, 226 insertions(+), 497 deletions(-)
include/Makefile +0 -1
@@ -36,7 +36,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_trace.h \
include/libxfs.h +11 -3
@@ -47,7 +47,6 @@#include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> #include <xfs/xfs_dir2.h> -#include <xfs/xfs_mount.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -323,6 +322,11 @@ enum xfs_buf_flags_t { /* b_flags bits */#define xfs_buf_set_ref (bp,ref) ((void) 0)#define xfs_buf_ioerror (bp,err) (bp)->b_error = (err); +#define xfs_daddr_to_agno (mp,d) \ + ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) +#define xfs_daddr_to_agbno (mp,d) \ + ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) +/* Buffer Cache Interfaces */ extern struct cache *libxfs_bcache;
@@ -477,7 +481,6 @@ extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *);extern int libxfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint ,uint ,uint );extern int libxfs_trans_commit (xfs_trans_t *,uint );extern void libxfs_trans_cancel (xfs_trans_t *,int ); -extern void libxfs_mod_sb (xfs_trans_t *,__int64_t );extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *,xfs_mount_t *,int ); extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
@@ -705,7 +708,7 @@ void xfs_dinode_from_disk(struct xfs_icdinode *,#define libxfs_idata_realloc xfs_idata_realloc#define libxfs_idestroy_fork xfs_idestroy_fork -/* xfs_mount.h */ +/* xfs_sb.h */ #define libxfs_mod_sb xfs_mod_sb#define libxfs_sb_from_disk xfs_sb_from_disk#define libxfs_sb_to_disk xfs_sb_to_disk
@@ -730,4 +733,9 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);#include <xfs/xfs_cksum.h> +#define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) +#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) +#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) +#define xfs_hex_dump (d,n) ((void) 0) +#endif /* __LIBXFS_H__ */
include/libxlog.h +0 -4
@@ -66,10 +66,6 @@ struct xlog {#define XFS_MOUNT_WAS_CLEAN 0x1#define unlikely (x) (x) -#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) -#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) -#define xfs_hex_dump (d,n) ((void) 0) -extern void xlog_warn (char *fmt,...);extern void xlog_exit (char *fmt,...);extern void xlog_panic (char *fmt,...);
include/xfs_mount.h deleted +0 -372
372 lines not on this page · raw message
include/xfs_sb.h +29 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -634,6 +635,15 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)* end of superblock version macros */ +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || + ino == sbp->sb_gquotino || + ino == sbp->sb_pquotino); +} + +#define XFS_SB_DADDR ((xfs_daddr_t)0)/* daddr in filesystem/ag */ #define XFS_SB_BLOCK (mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)#define XFS_BUF_TO_SBP (bp) ((xfs_dsb_t *)((bp)->b_addr))
@@ -666,4 +676,23 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)#define XFS_B_TO_FSBT (mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)#define XFS_B_FSB_OFFSET (mp,b) ((b) & (mp)->m_blockmask) +/* +* perag get/put wrappers for ref counting +*/ +extern struct xfs_perag *xfs_perag_get (struct xfs_mount *,xfs_agnumber_t ); +extern struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *,xfs_agnumber_t , +int tag); +extern void xfs_perag_put (struct xfs_perag *pag); +extern int xfs_initialize_perag_data (struct xfs_mount *,xfs_agnumber_t ); + +extern void xfs_sb_calc_crc (struct xfs_buf *); +extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); +extern void xfs_sb_mount_common (struct xfs_mount *,struct xfs_sb *); +extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); +extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
include/xfs_trace.h +1 -0
@@ -162,6 +162,7 @@/* set c = c to avoid unused var warnings */ #define trace_xfs_perag_get (a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_get_tag (a,b,c,d) ((c) = (c))#define trace_xfs_perag_put (a,b,c,d) ((c) = (c))#endif /* __TRACE_H__ */
libxfs/Makefile +7 -3
@@ -11,9 +11,13 @@ LT_REVISION = 0 LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h -CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ +CFILES = cache.c \ + crc32.c \ + init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc.c \ xfs_alloc_btree.c \ + xfs_attr.c \ + xfs_attr_remote.c \ xfs_btree.c \ xfs_ialloc.c \ xfs_inode_buf.c \
@@ -21,8 +25,8 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ - crc32.c \ + xfs_rtalloc.c \ + xfs_sb.c \ xfs_symlink_remote.c \ xfs_trans_resv.c
libxfs/init.c +1 -1
@@ -692,7 +692,7 @@ libxfs_mount(INIT_RADIX_TREE (&mp->m_perag_tree,GFP_KERNEL ); sbp = &(mp->m_sb); -xfs_mount_common (mp, sb); +xfs_sb_mount_common (mp, sb);xfs_alloc_compute_maxlevels (mp);xfs_bmap_compute_maxlevels (mp,XFS_DATA_FORK );
libxfs/xfs.h +1 -0
@@ -345,6 +345,7 @@ do { \#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +#define xfs_sb_validate_fsb_count (sbp, nblks) (0)/* * Prototypes for kernel static functions that are aren't in their
libxfs/xfs_sb.c renamed from libxfs/xfs_mount.c +176 -113
417 lines not on this page · raw message
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V3] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 10 lines · Dave Chinner
libxfs: switch over to
xfs_sb.cand removexfs_mount.cFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cSigned-off-by Dave Chinner <[email protected]>---
Applies clean for me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V3] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
libxfs: switch over to
xfs_sb.cand removexfs_mount.cFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.c
Quoted 6 lines
Quoted 2 lines
Signed-off-by Dave Chinner <[email protected]>---
Applies clean for me.
Reviewed-by Mark Tinguely <[email protected]>
patch 31 V2/V3 break the compilation of xfsprogs.
I get:
...
configure: creating ./config.status
config.status: creating include/builddefs
config.status: creating include/platform_defs.h
config.status: executing libtool commands
Building include
[LN] xfs
[LN] disk
Building libxfs
[CC] gen_crc32table
[GENERATE] crc32table.h
[TEST] CRC32CRC_LE_BITS = 32
crc32: tests passed, 225944 bytes in 117 usec
crc32c: tests passed, 225944 bytes in 121 usec
gmake[3]: *** No rule to make target .ltdep', needed by ltdepend'. Stop. gmake[2]: *** [libxfs] Error 2
make[1]: *** [default] Error 2
make: *** [default] Error 2
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V3] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
Quoted 33 lines · Mark Tinguely
Quoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
libxfs: switch over to
xfs_sb.cand removexfs_mount.cFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cQuoted 6 lines
Quoted 2 lines
Signed-off-by Dave Chinner <[email protected]>---
Applies clean for me.
Reviewed-by Mark Tinguely <[email protected]>patch 31 V2/V3 break the compilation of xfsprogs.
I get:
...configure: creating ./config.status
config.status: creatinginclude/builddefs
config.status: creatinginclude/platform_defs.h
config.status: executing libtool commands
Building include
[LN] xfs
[LN] disk
Building libxfs
[CC]gen_crc32table
[GENERATE]crc32table.h
Quoted 9 lines
[TEST] CRC32
CRC_LE_BITS= 32
crc32: tests passed, 225944 bytes in 117 usec
crc32c: tests passed, 225944 bytes in 121 usec
gmake[3]: *** No rule to make target.ltdep', needed byltdepend'. Stop. gmake[2]: *** [libxfs] Error 2
make[1]: *** [default] Error 2
make: *** [default] Error 2
Auugh, I think I had a bad version of quilt. on another machine it applied and compiled correctly.
I put reviewed-by in the files and sent to Rich to commit.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V3] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
In reply to Mark TinguelyQuoted 34 lines · Mark Tinguely
Quoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
libxfs: switch over to
xfs_sb.cand removexfs_mount.cFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.cQuoted 6 lines
Quoted 2 lines
Signed-off-by Dave Chinner <[email protected]>---
Applies clean for me.
Reviewed-by Mark Tinguely <[email protected]>patch 31 V2/V3 break the compilation of xfsprogs.
I get:
...configure: creating ./config.status
config.status: creatinginclude/builddefs
config.status: creatinginclude/platform_defs.h
config.status: executing libtool commands
Building include
[LN] xfs
[LN] disk
Building libxfs[CC] gen_crc32table [GENERATE] crc32table.h [TEST] CRC32
Quoted 7 lines
CRC_LE_BITS= 32
crc32: tests passed, 225944 bytes in 117 usec
crc32c: tests passed, 225944 bytes in 121 usec
gmake[3]: *** No rule to make target.ltdep', needed byltdepend'. Stop. gmake[2]: *** [libxfs] Error 2
make[1]: *** [default] Error 2
make: *** [default] Error 2
That's a dependency build problem because the dependencies changed and weren't rebuilt. make distclean and start again, and the dependencies will get rebuilt correctly.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/55 V3] libxfs: switch over to xfs_sb.c and remove xfs_mount.c
In reply to Mark TinguelyQuoted 10 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
libxfs: switch over to
xfs_sb.cand removexfs_mount.cFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of
xfs_mount.c, we don't needxfs_mount.canymore. Copy inxfs_sb.cand removexfs_mount.c
Quoted 7 lines
Quoted 2 lines
Signed-off-by Dave Chinner <[email protected]>---
Applies clean for me.
Reviewed-by Mark Tinguely <[email protected]>
Oops, on testing V2/V3 of the patch, the libxfs/xfs_mount.c was left in these reposted patches and libxfs/xfs_sb.c was not and the reposeted patches won't compile.
My mistake for concentrating on the header file when reviewing and not the whole re-post.
Looks like everything is fine if using the libxfs/xfs_sb.c from the first post.
--Mark
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 32/55 xfs: create xfs_bmap_util.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is a bunch of code in xfs_bmap.c that is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code to xfs_bmap_util.c, and the declarations to xfs_bmap_util.h.
The biggest issue here is xfs_bmap_finish() - userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to include xfs_bmap_util.c as well.
It also introduces and interesting dance for the stack switching code in xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved to xfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.
--- include/xfs_bmap.h | 51 ------------ libxfs/xfs.h | 34 ++++++++ libxfs/xfs_bmap.c | 222 +++-------------------------------------------------- 3 files changed, 43 insertions(+), 264 deletions(-)
include/xfs_bmap.h +0 -51
@@ -108,38 +108,6 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) }/* -* Argument structure for xfs_bmap_alloc. -*/ -typedef struct xfs_bmalloca { -xfs_fsblock_t *firstblock;/* i/o first block allocated */ -struct xfs_bmap_free *flist;/* bmap freelist */ -struct xfs_trans *tp;/* transaction pointer */ -struct xfs_inode *ip;/* incore inode pointer */ -struct xfs_bmbt_irec prev;/* extent before the new one */ -struct xfs_bmbt_irec got;/* extent after, or delayed */ - -xfs_fileoff_t offset;/* offset in file filling in */ -xfs_extlen_t length;/* i/o length asked/allocated */ -xfs_fsblock_t blkno;/* starting block of new extent */ - -struct xfs_btree_cur *cur;/* btree cursor */ -xfs_extnum_t idx;/* current extent index */ -int nallocs;/* number of extents alloc'd */ -int logflags;/* flags for transaction logging */ - -xfs_extlen_t total;/* total blocks needed for xaction */ -xfs_extlen_t minlen;/* minimum allocation size (blocks) */ -xfs_extlen_t minleft;/* amount must be left after alloc */ -char eof;/* set if allocating past last extent */ -char wasdel;/* replacing a delayed allocation */ -char userdata;/* set if is user data */ -char aeof;/* allocated space at eof */ -char conv;/* overwriting unwritten extents */ -int flags; -int stack_switch; -}xfs_bmalloca_t ; - -/* * Flags for xfs_bmap_add_extent*. */ #define BMAP_LEFT_CONTIG (1 << 0)
@@ -202,23 +170,4 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx, xfs_extnum_t num);uint xfs_default_attroffset (struct xfs_inode *ip); -#ifdef __KERNEL__ -/* bmap to userspace formatter - copy to user & advance pointer */ -typedef int (*xfs_bmap_format_t )(void **,struct getbmapx *,int *); - -int xfs_bmap_finish (struct xfs_trans **tp,struct xfs_bmap_free *flist, -int *committed); -int xfs_getbmap (struct xfs_inode *ip,struct getbmapx *bmv, -xfs_bmap_format_t formatter,void *arg); -int xfs_bmap_eof (struct xfs_inode *ip,xfs_fileoff_t endoff, -int whichfork,int *eof); -int xfs_bmap_count_blocks (struct xfs_trans *tp,struct xfs_inode *ip, -int whichfork,int *count); -int xfs_bmap_punch_delalloc_range (struct xfs_inode *ip, -xfs_fileoff_t start_fsb,xfs_fileoff_t length); - -xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb); - -#endif /* __KERNEL__ */ -#endif /* __XFS_BMAP_H__ */
libxfs/xfs.h +34 -0
@@ -51,6 +51,40 @@typedef __uint32_t uint_t ;typedef __uint32_t inst_t ;/* an instruction */ +/* +* Argument structure for xfs_bmap_alloc. +*/ +typedef struct xfs_bmalloca { +xfs_fsblock_t *firstblock;/* i/o first block allocated */ +struct xfs_bmap_free *flist;/* bmap freelist */ +struct xfs_trans *tp;/* transaction pointer */ +struct xfs_inode *ip;/* incore inode pointer */ +struct xfs_bmbt_irec prev;/* extent before the new one */ +struct xfs_bmbt_irec got;/* extent after, or delayed */ + +xfs_fileoff_t offset;/* offset in file filling in */ +xfs_extlen_t length;/* i/o length asked/allocated */ +xfs_fsblock_t blkno;/* starting block of new extent */ + +struct xfs_btree_cur *cur;/* btree cursor */ +xfs_extnum_t idx;/* current extent index */ +int nallocs;/* number of extents alloc'd */ +int logflags;/* flags for transaction logging */ + +xfs_extlen_t total;/* total blocks needed for xaction */ +xfs_extlen_t minlen;/* minimum allocation size (blocks) */ +xfs_extlen_t minleft;/* amount must be left after alloc */ +char eof;/* set if allocating past last extent */ +char wasdel;/* replacing a delayed allocation */ +char userdata;/* set if is user data */ +char aeof;/* allocated space at eof */ +char conv;/* overwriting unwritten extents */ +char stack_switch; +int flags; +}xfs_bmalloca_t ; + +#define xfs_bmapi_allocate __xfs_bmapi_allocate +#ifndef EWRONGFS #define EWRONGFS EINVAL#endif
libxfs/xfs_bmap.c +9 -213
290 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 32/55] xfs: create xfs_bmap_util.[ch]
Quoted 12 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is a bunch of code in
xfs_bmap.cthat is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code toxfs_bmap_util.c, and the declarations toxfs_bmap_util.h.The biggest issue here is
xfs_bmap_finish()- userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to includexfs_bmap_util.cas well.
Quoted 8 lines
It also introduces and interesting dance for the stack switching code in
xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved toxfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.Signed-off-by Dave Chinner<[email protected]>---
Skipped patch 31 because there are issues that I do not see resolved by the end of the series. I will come back to it.
This patch did not change from last posting. User equivalent of kernel patch 21/50.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 33/55 xfsprogs: sync minor kernel header differences
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are lots of little differences between kernel and userspace headers noticable now that the files are largely the same. Clean up all the formatting, whitespace and other minor differences in the userspace headers.
--- include/libxfs.h | 8 +++++--- include/xfs_ag.h | 2 +- include/xfs_alloc_btree.h | 3 +-- include/xfs_attr_remote.h | 28 +++++++++++----------------- include/xfs_bmap_btree.h | 3 +-- include/xfs_btree.h | 3 +-- include/xfs_dinode.h | 3 --- include/xfs_dir2.h | 11 +---------- include/xfs_dir2_format.h | 22 ++++++++++++++-------- include/xfs_fs.h | 26 +++++++++++++++----------- include/xfs_ialloc_btree.h | 3 +-- include/xfs_inode_buf.h | 1 - libxfs/xfs.h | 2 ++ 13 files changed, 53 insertions(+), 62 deletions(-)
include/libxfs.h +5 -3
@@ -46,7 +46,6 @@#include <xfs/xfs_inum.h> #include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> -#include <xfs/xfs_dir2.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -235,6 +234,11 @@ extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *,extern void libxfs_umount (xfs_mount_t *);extern void libxfs_rtmount_destroy (xfs_mount_t *); +/* +* xfs/xfs_dir2_format.h needs struct xfs_mount to be defined +*/ +#include <xfs/xfs_dir2_format.h> +#include <xfs/xfs_dir2.h> /* * Simple I/O interface
@@ -611,8 +615,6 @@ extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, uint, xfs_inode_t **, xfs_daddr_t);extern void libxfs_iput (xfs_inode_t *,uint ); -#include <xfs/xfs_dir2_format.h> -/* Shared utility routines */ extern unsigned int libxfs_log2_roundup (unsigned int i);
include/xfs_ag.h +1 -1
@@ -102,7 +102,7 @@ typedef struct xfs_agf {#define XFS_AGF_LONGEST 0x00000400#define XFS_AGF_BTREEBLKS 0x00000800#define XFS_AGF_UUID 0x00001000 -#define XFS_AGF_NUM_BITS 12 +#define XFS_AGF_NUM_BITS 13#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)#define XFS_AGF_FLAGS \
include/xfs_alloc_btree.h +1 -2
@@ -64,8 +64,7 @@ typedef __be32 xfs_alloc_ptr_t;*/ #define XFS_ALLOC_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_SBLOCK_CRC_LEN : \ - XFS_BTREE_SBLOCK_LEN) + XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)/* * Record, key, and pointer address macros for btree blocks.
include/xfs_attr_remote.h +11 -17
@@ -1,25 +1,19 @@/* * Copyright (c) 2013 Red Hat, Inc. +* All Rights Reserved. * -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2.1 of the GNU Lesser General Public License -* as published by the Free Software Foundation. +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. * -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. * -* Further, this software is distributed without any warranty that it is -* free of the rightful claim of any third person regarding infringement -* or the like. Any license provided herein, whether implied or -* otherwise, applies only to this software file. Patent licenses, if -* any, provided herein do not apply to combinations of this program with -* other software, or any other product whatsoever. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, -* USA. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_ATTR_REMOTE_H__#define __XFS_ATTR_REMOTE_H__
include/xfs_bmap_btree.h +1 -2
@@ -140,8 +140,7 @@ typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;*/ #define XFS_BMBT_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_LBLOCK_CRC_LEN : \ - XFS_BTREE_LBLOCK_LEN) + XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN)#define XFS_BMBT_REC_ADDR (mp, block, index) \ ((xfs_bmbt_rec_t *) \
include/xfs_btree.h +1 -2
@@ -93,7 +93,6 @@ struct xfs_btree_block {#define XFS_BTREE_LBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.l.bb_crc) -/* * Generic key, ptr and record wrapper structures. *
@@ -214,7 +213,7 @@ struct xfs_btree_ops {const struct xfs_buf_ops *buf_ops; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN )/* check that k1 is lower than k2 */ int (*keys_inorder)(struct xfs_btree_cur *cur, union xfs_btree_key *k1,
include/xfs_dinode.h +0 -3
@@ -132,9 +132,6 @@ typedef enum xfs_dinode_fmt {#define XFS_LITINO (mp, version) \ ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version))) -#define XFS_BROOT_SIZE_ADJ (ip) \ - (XFS_BMBT_BLOCK_LEN((ip)->i_mount) - sizeof(xfs_bmdr_block_t)) -/* * Inode data & attribute fork sizes, per inode. */
include/xfs_dir2.h +1 -10
@@ -28,14 +28,6 @@ struct xfs_dir2_sf_entry;struct xfs_dir2_data_hdr ;struct xfs_dir2_data_entry ;struct xfs_dir2_data_unused ; -struct xfs_dir2_data_free ; - -typedef uint xfs_dir2_data_aoff_t ;/* argument form */ - -/* -* Directory block number (logical dirblk in file) -*/ -typedef __uint32_t xfs_dir2_db_t ;extern struct xfs_name xfs_name_dotdot;
@@ -71,7 +63,7 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_sf_to_block (struct xfs_da_args *args);/* -* used by db +* Interface routines used by userspace utilities */ extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
@@ -110,5 +102,4 @@ extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; -#endif /* __XFS_DIR2_H__ */
include/xfs_dir2_format.h +14 -8
@@ -73,6 +73,7 @@*/ typedef __uint16_t xfs_dir2_data_off_t ;#define NULLDATAOFF 0xffffU +typedef uint xfs_dir2_data_aoff_t ;/* argument form */ /* * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
@@ -93,6 +94,11 @@ typedef __uint32_t xfs_dir2_dataptr_t;typedef xfs_off_t xfs_dir2_off_t ;/* +* Directory block number (logical dirblk in file) +*/ +typedef __uint32_t xfs_dir2_db_t ; + +/* * Inode number stored as 8 8-bit values. */ typedef struct {__uint8_t i[8 ]; }xfs_dir2_ino8_t ;
@@ -144,19 +150,19 @@ static inline int xfs_dir2_sf_hdr_size(int i8count) (sizeof (xfs_dir2_ino8_t) -sizeof (xfs_dir2_ino4_t)); } -static inline xfs_dir2_data_aoff_t +static inline xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset (xfs_dir2_sf_entry_t *sfep) {return get_unaligned_be16 (&sfep->offset.i); } -static inline void +static inline void xfs_dir2_sf_put_offset (xfs_dir2_sf_entry_t *sfep,xfs_dir2_data_aoff_t off) {put_unaligned_be16 (off, &sfep->offset.i); } -static inline int +static inline int xfs_dir2_sf_entsize (struct xfs_dir2_sf_hdr *hdr,int len) { return sizeof(struct xfs_dir2_sf_entry) + /* namelen + offset */
@@ -166,14 +172,14 @@ xfs_dir2_sf_entsize(struct xfs_dir2_sf_hdr *hdr, int len) sizeof(xfs_dir2_ino4_t)); } -static inline struct xfs_dir2_sf_entry * +static inline struct xfs_dir2_sf_entry *xfs_dir2_sf_firstentry (struct xfs_dir2_sf_hdr *hdr) {return (struct xfs_dir2_sf_entry *) ((char *)hdr +xfs_dir2_sf_hdr_size (hdr->i8count)); } -static inline struct xfs_dir2_sf_entry * +static inline struct xfs_dir2_sf_entry *xfs_dir2_sf_nextentry (struct xfs_dir2_sf_hdr *hdr,struct xfs_dir2_sf_entry *sfep) {
@@ -238,7 +244,7 @@ typedef struct xfs_dir2_data_free {*/ typedef struct xfs_dir2_data_hdr {__be32 magic;/* XFS_DIR2_DATA_MAGIC or */ -/* XFS_DIR2_BLOCK_MAGIC */ +/* XFS_DIR2_BLOCK_MAGIC */ xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT ]; }xfs_dir2_data_hdr_t ;
@@ -265,7 +271,7 @@ struct xfs_dir3_data_hdr {#define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc) -static inline struct xfs_dir2_data_free * +static inline struct xfs_dir2_data_free *xfs_dir3_data_bestfree_p (struct xfs_dir2_data_hdr *hdr) { if (hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -514,7 +520,7 @@ struct xfs_dir3_leaf {#define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc)extern void xfs_dir3_leaf_hdr_from_disk (struct xfs_dir3_icleaf_hdr *to, -struct xfs_dir2_leaf *from); +struct xfs_dir2_leaf *from);static inline int xfs_dir3_leaf_hdr_size (struct xfs_dir2_leaf *lp)
include/xfs_fs.h +15 -11
@@ -311,6 +311,17 @@ typedef struct xfs_bstat { } xfs_bstat_t;/* +* Project quota id helpers (previously projid was 16bit only +* and using two 16bit values to hold new 32bit projid was choosen +* to retain compatibility with "old" filesystems). +*/ +static inline __uint32_t +bstat_get_projid (struct xfs_bstat *bs) +{ +return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; +} + +/* * The user-level BulkStat Request interface structure. */ typedef struct xfs_fsop_bulkreq {
@@ -511,10 +522,14 @@ typedef struct xfs_handle {#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ +/* XFS_IOC_FREEZE -- FIFREEZE 119 */ /* XFS_IOC_THAW -- FITHAW 120 */ +#ifndef FIFREEZE #define XFS_IOC_FREEZE _IOWR('X', 119, int)#define XFS_IOC_THAW _IOWR('X', 120, int) +#endif +#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
@@ -537,15 +552,4 @@ typedef struct xfs_handle {#define BBTOB (bbs) ((bbs) << BBSHIFT)#endif -/* -* Project quota id helpers (previously projid was 16bit only -* and using two 16bit values to hold new 32bit projid was choosen -* to retain compatibility with "old" filesystems). -*/ -static inline __uint32_t -bstat_get_projid (struct xfs_bstat *bs) -{ -return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; -} -#endif /* __XFS_FS_H__ */
include/xfs_ialloc_btree.h +1 -2
@@ -80,8 +80,7 @@ typedef __be32 xfs_inobt_ptr_t;*/ #define XFS_INOBT_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_SBLOCK_CRC_LEN : \ - XFS_BTREE_SBLOCK_LEN) + XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)/* * Record, key, and pointer address macros for btree blocks.
include/xfs_inode_buf.h +0 -1
@@ -40,7 +40,6 @@ int xfs_iread(struct xfs_mount *, struct xfs_trans *,void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *);void xfs_dinode_to_disk (struct xfs_dinode *,struct xfs_icdinode *); -bool xfs_can_free_eofblocks (struct xfs_inode *,bool );#if defined(DEBUG )void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *);
libxfs/xfs.h +2 -0
@@ -437,3 +437,5 @@ xfs_buf_t *xfs_trans_buf_item_match(xfs_trans_t *, struct xfs_buftarg *,/* local source files */ int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );void xfs_trans_mod_sb (xfs_trans_t *,uint ,long ); +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/55] xfsprogs: sync minor kernel header differences
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are lots of little differences between kernel and userspace headers noticable now that the files are largely the same. Clean up all the formatting, whitespace and other minor differences in the userspace headers.
Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 22/50.
this has been greatly improved in this release.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/55 xfs: don't special case shared superblock mounts
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
--- include/xfs_sb.h | 7 ------- 1 file changed, 7 deletions(-)
include/xfs_sb.h +0 -7
@@ -355,15 +355,8 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp) (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))return 0 ; -#ifdef __KERNEL__if (sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN )return 0 ; -#else -if ((sbp->sb_versionnum &XFS_SB_VERSION_SHAREDBIT ) && - sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN ) -return 0 ; -#endif -return 1 ; }if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 )
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/55] xfs: don't special case shared superblock mounts
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
Signed-off-by Dave Chinner<[email protected]>---
matches kernel patch 28/50. No change from previous post. Only difference in xfs_sb.h was introduced in user patch 31/55.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 35/55 xfs: move swap extent code to xfs_extent_ops
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Swapping extents is clearly an extent operaiton, and it is not shared with userspace. Move the code to xfs_extent_ops.[ch], and the userspace ioctl structure definition to xfs_fs.h where most of the other ioctl structure definitions are. The means xfs_dfrag.h is no longer needed in userspace.
--- fsr/xfs_fsr.c | 1 - include/Makefile | 3 +-- include/xfs_dfrag.h | 53 ----------------------------------------------------- include/xfs_fs.h | 15 +++++++++++++++ 4 files changed, 16 insertions(+), 56 deletions(-) delete mode 100644 include/xfs_dfrag.h
fsr/xfs_fsr.c +0 -1
@@ -20,7 +20,6 @@#include <xfs/xfs.h> #include <xfs/xfs_types.h> #include <xfs/jdm.h> -#include <xfs/xfs_dfrag.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_attr_sf.h>
include/Makefile +1 -2
@@ -40,8 +40,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_sb.h \ xfs_trace.h \ xfs_trans_resv.h \ - xfs_trans_space.h \ - xfs_dfrag.h + xfs_trans_space.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h HFILES += $(PKG_PLATFORM).h
include/xfs_dfrag.h deleted +0 -53
53 lines not on this page · raw message
include/xfs_fs.h +15 -0
@@ -461,6 +461,21 @@ typedef struct xfs_handle { + (handle).ha_fid.fid_len)/* +* Structure passed to XFS_IOC_SWAPEXT +*/ +typedef struct xfs_swapext +{ +__int64_t sx_version;/* version */ +#define XFS_SX_VERSION 0 +__int64_t sx_fdtarget;/* fd of target file */ +__int64_t sx_fdtmp;/* fd of tmp file */ +xfs_off_t sx_offset;/* offset into file */ +xfs_off_t sx_length;/* leng from offset */ +char sx_pad[16 ];/* pad space, unused */ +xfs_bstat_t sx_stat;/* stat of target b4 copy */ +}xfs_swapext_t ; + +/* * Flags for going down operation */ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0/* going down */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 35/55] xfs: move swap extent code to xfs_extent_ops
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Swapping extents is clearly an extent operaiton, and it is not shared with userspace. Move the code to xfs_extent_ops.[ch], and the userspace ioctl structure definition to
xfs_fs.hwhere most of the other ioctl structure definitions are. The meansxfs_dfrag.his no longer needed in userspace.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 27/50.
same as the previous post. looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 36/55 xfs: kill __KERNEL__ check for debug code in allocation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of __KERNEL__ users.
--- libxfs/xfs_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libxfs/xfs_alloc.c +3 -3
@@ -856,7 +856,7 @@ xfs_alloc_ag_vextent_near(xfs_agblock_t ltnew;/* useful start bno of left side */ xfs_extlen_t rlen;/* length of returned extent */ int forced =0 ; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Randomly don't execute the first algorithm. */
@@ -916,8 +916,8 @@ restart:xfs_extlen_t blen=0 ;xfs_agblock_t bnew=0 ; -#if defined(DEBUG ) && defined(__KERNEL__) -if (!dofirst) +#ifdef DEBUG +if (dofirst)break ;#endif /*
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 36/55] xfs: kill __KERNEL__ check for debug code in allocation code
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of
__KERNEL__users.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 29/50. Did not change from last post. Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/55 xfs: remove __KERNEL__ from debug code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the __KERNEL__ part of the defines, and let userspace handle the debug code appropriately.
--- include/xfs_bmap.h | 2 +- libxfs/xfs_dir2_data.c | 4 ++-- libxfs/xfs_rtalloc.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
include/xfs_bmap.h +1 -1
@@ -127,7 +127,7 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) { BMAP_RIGHT_FILLING, "RF" }, \ { BMAP_ATTRFORK, "ATTR" } -#if defined(__KERNEL) && defined(DEBUG ) +#ifdef DEBUG void xfs_bmap_trace_exlist (struct xfs_inode *ip,xfs_extnum_t cnt,int whichfork,unsigned long caller_ip);#define XFS_BMAP_TRACE_EXLIST (ip,c,w) \
libxfs/xfs_dir2_data.c +2 -2
@@ -315,7 +315,7 @@ xfs_dir2_data_freefind(xfs_dir2_data_free_t *dfp;/* bestfree entry */ xfs_dir2_data_aoff_t off;/* offset value needed */ struct xfs_dir2_data_free *bf; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG int matched;/* matched the value */ int seenzero;/* saw a 0 bestfree entry */ #endif
@@ -323,7 +323,7 @@ xfs_dir2_data_freefind( off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); bf =xfs_dir3_data_bestfree_p (hdr); -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Validate some consistency in the bestfree table. * Check order, non-overlapping entries, and if we find the
libxfs/xfs_rtalloc.c +1 -1
@@ -735,7 +735,7 @@ xfs_rtfree_extent(ASSERT (mp->m_rbmip->i_itemp !=NULL );ASSERT (xfs_isilocked (mp->m_rbmip,XFS_ILOCK_EXCL )); -#if defined(__KERNEL__) && defined(DEBUG ) +#ifdef DEBUG /* * Check to see that this whole range is currently allocated. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/55] xfs: remove __KERNEL__ from debug code
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the
__KERNEL__part of the defines, and let userspace handle the debug code appropriately.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 30/50.
the real time kernel and user xfs_rtalloc.c files are not synced. It is okay with me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/55] xfs: remove __KERNEL__ from debug code
Quoted 7 lines · Mark Tinguely
Quoted 6 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the
__KERNEL__part of the defines, and let userspace handle the debug code appropriately.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 30/50.
the real time kernel and user
xfs_rtalloc.cfiles are not synced. It is okay with me.Reviewed-by Mark Tinguely <[email protected]>
Yes, they still need to be split up on the kernel side. the rtdev is not a high priority for testing, so I haven't done this yet...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/55] xfs: remove __KERNEL__ from debug code
Quoted 15 lines · Dave Chinner
Quoted 14 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the
__KERNEL__part of the defines, and let userspace handle the debug code appropriately.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 30/50.
the real time kernel and user
xfs_rtalloc.cfiles are not synced. It is okay with me.
Quoted 8 lines
Quoted 1 line
Reviewed-by Mark Tinguely<[email protected]>Yes, they still need to be split up on the kernel side. the rtdev is not a high priority for testing, so I haven't done this yet...
Cheers,
Dave.
Noticed that. It is fine with me.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 38/55 xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
--- libxfs/xfs_dir2_leaf.c | 4 ---- 1 file changed, 4 deletions(-)
libxfs/xfs_dir2_leaf.c +0 -4
@@ -1568,10 +1568,6 @@ xfs_dir2_leaf_search_hash( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); -#ifndef __KERNEL__ -if (!leafhdr.count) -return 0 ; -#endif /* * Note, the table cannot be empty, so we have to go through the loop. * Binary search the leaf entries looking for our hash value.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 38/55] xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 31/50. Looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 39/55 xfs: move kernel specific type definitions to xfs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_types.h is shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines to xfs_linux.h so we can remove the __KERNEL__ guards from xfs_types.h
--- include/xfs_types.h | 36 ------------------------------------ 1 file changed, 36 deletions(-)
include/xfs_types.h +0 -36
@@ -18,42 +18,6 @@#ifndef __XFS_TYPES_H__#define __XFS_TYPES_H__ -#ifdef __KERNEL__ - -/* -* Additional type declarations for XFS -*/ -typedef signed char __int8_t ; -typedef unsigned char __uint8_t ; -typedef signed short int __int16_t ; -typedef unsigned short int __uint16_t ; -typedef signed int __int32_t ; -typedef unsigned int __uint32_t ; -typedef signed long long int __int64_t ; -typedef unsigned long long int __uint64_t ; - -typedef __uint32_t inst_t ;/* an instruction */ - -typedef __s64 xfs_off_t ;/* <file offset> type */ -typedef unsigned long long xfs_ino_t ;/* <inode> type */ -typedef __s64 xfs_daddr_t ;/* <disk address> type */ -typedef char *xfs_caddr_t ;/* <core address> type */ -typedef __u32 xfs_dev_t ; -typedef __u32 xfs_nlink_t ; - -/* __psint_t is the same size as a pointer */ -#if (BITS_PER_LONG ==32 ) -typedef __int32_t __psint_t ; -typedef __uint32_t __psunsigned_t ; -#elif (BITS_PER_LONG ==64 ) -typedef __int64_t __psint_t ; -typedef __uint64_t __psunsigned_t ; -#else -#error BITS_PER_LONG must be 32 or 64 -#endif - -#endif /* __KERNEL__ */ -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 39/55] xfs: move kernel specific type definitions to xfs.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs_types.his shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines toxfs_linux.hso we can remove the__KERNEL__guards fromxfs_types.hSigned-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 33/50 Same as previous post. Looks good to me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 40/55 xfs: make struct xfs_perag kernel only
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The struct xfs_perag has many kernel-only definitions in it, requiring a __KERNEL__ guard so userspace can use it to. Move it to xfs_mount.h so that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another __KERNEL__ check in the XFS header files.
--- include/libxfs.h | 31 +++++++++++++++++++++++++++++++ include/xfs_ag.h | 53 ----------------------------------------------------- 2 files changed, 31 insertions(+), 53 deletions(-)
include/libxfs.h +31 -0
@@ -218,6 +218,37 @@ typedef struct xfs_mount {xfs_dablk_t m_dirfreeblk;/* blockno of dirfreeindex v2 */ } xfs_mount_t; +/* +* Per-ag incore structure, copies of information in agf and agi, +* to improve the performance of allocation group selection. +*/ +typedef struct xfs_perag { +struct xfs_mount *pag_mount;/* owner filesystem */ +xfs_agnumber_t pag_agno;/* AG this structure belongs to */ +atomic_t pag_ref;/* perag reference count */ +char pagf_init;/* this agf's entry is initialized */ +char pagi_init;/* this agi's entry is initialized */ +char pagf_metadata;/* the agf is preferred to be metadata */ +char pagi_inodeok;/* The agi is ok for inodes */ +__uint8_t pagf_levels[XFS_BTNUM_AGF ]; +/* # of levels in bno & cnt btree */ +__uint32_t pagf_flcount;/* count of blocks in freelist */ +xfs_extlen_t pagf_freeblks;/* total free blocks */ +xfs_extlen_t pagf_longest;/* longest free space */ +__uint32_t pagf_btreeblks;/* # of blocks held in AGF btrees */ +xfs_agino_t pagi_freecount;/* number of free inodes */ +xfs_agino_t pagi_count;/* number of allocated inodes */ + +/* +* Inode allocation search lookup optimisation. +* If the pagino matches, the search for new inodes +* doesn't need to search the near ones again straight away +*/ +xfs_agino_t pagl_pagino; +xfs_agino_t pagl_leftrec; +xfs_agino_t pagl_rightrec; +int pagb_count;/* pagb slots in use */ +}xfs_perag_t ;#define LIBXFS_MOUNT_ROOTINOS 0x0001#define LIBXFS_MOUNT_DEBUGGER 0x0002
include/xfs_ag.h +0 -53
59 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 40/55] xfs: make struct xfs_perag kernel only
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The struct
xfs_peraghas many kernel-only definitions in it, requiring a__KERNEL__guard so userspace can use it to. Move it toxfs_mount.hso that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another__KERNEL__check in the XFS header files.Signed-off-by Dave Chinner<[email protected]>---
Yeah, this is the end of the kernel / user sync part of the series. Thanks Dave.
The major difference seem to come from this series user patch 31/55.
Other differences between kernel/user header/sources are in:
include major difference to TOT:
struct xfs_perag is in xfs_ag.h user and xfs_mount.h in kernel.
some differences betweenxfs_alloc_btree.c xfs_bmap_btree.c xfs_btree.c xfs_ialloc_btree.c xfs_inode_buf.c xfs_rtalloc.c
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 40/55] xfs: make struct xfs_perag kernel only
Quoted 12 lines · Mark Tinguely
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The struct
xfs_peraghas many kernel-only definitions in it, requiring a__KERNEL__guard so userspace can use it to. Move it toxfs_mount.hso that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another__KERNEL__check in the XFS header files.Signed-off-by Dave Chinner<[email protected]>---
Quoted 8 lines
Yeah, this is the end of the kernel / user sync part of the series. Thanks Dave.
The major difference seem to come from this series user patch 31/55.
Other differences between kernel/user header/sources are in:
include major difference to TOT:
structxfs_peragis inxfs_ag.huser andxfs_mount.hin kernel.
It is in include/libxfs.h in userspace, as it is different to the version that the kernel uses.
Quoted 2 lines
some differences between
xfs_alloc_btree.cxfs_bmap_btree.c
btree trace code is the difference here - that needs to be unified but userspace has different infrastructure right now. Not important right now.
Quoted 1 line
xfs_btree.c
readahead functions are missing. userspace defined readhead to a nop, so not a high priority. It should be done, though.
Quoted 1 line
xfs_ialloc_btree.c
btree trace code again.
Quoted 1 line
xfs_inode_buf.c
Doesn't have the new log readahead verifier support, and doesn't do the "no inode read on create" shortcut which we shouldn't do in userspace, anyway. Minor differences, not immediately important.
Oh, uuid/platform_uuid thingy. Will need to clean that up, too, on the next round of updates.
Quoted 1 line
xfs_rtalloc.c
Not yet split up.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 41/55 xfs: Introduce a new structure to hold transaction reservation items
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Introduce a new structure xfs_trans_res to hold transaction reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the log count as well as log flags for permanent log reservation.
--- include/libxfs.h | 2 +- include/xfs_trans_resv.h | 125 ++++++++++++++++++++++++++--------------------- libxfs/trans.c | 2 +- libxfs/xfs_trans_resv.c | 121 ++++++++++++++++++++++++++++++++++----------- mkfs/maxtrres.c | 17 ++++--- 5 files changed, 172 insertions(+), 95 deletions(-)
include/libxfs.h +1 -1
@@ -203,7 +203,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_litino;/* size of inode union area */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ -struct xfs_trans_resv m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_resv;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ int m_dalign;/* stripe unit */ int m_swidth;/* stripe width */
include/xfs_trans_resv.h +68 -57
142 lines not on this page · raw message
libxfs/trans.c +1 -1
@@ -33,7 +33,7 @@ voidlibxfs_trans_init ( struct xfs_mount *mp) { -xfs_trans_resv_calc (mp, &mp->m_reservations); +xfs_trans_resv_calc (mp, &mp->m_resv); }/*
libxfs/xfs_trans_resv.c +93 -28
125 lines not on this page · raw message
mkfs/maxtrres.c +9 -8
@@ -47,22 +47,23 @@ max_attrsetm_trans_res_adjust( nblks +=XFS_B_TO_FSB (mp, size); nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); res =XFS_ATTRSETM_LOG_RES (mp) +XFS_ATTRSETRT_LOG_RES (mp) * nblks; - mp->m_reservations.tr_attrsetm = res; + mp->m_resv.tr_attrsetm.tr_logres = res; }static int max_trans_res_by_mount (struct xfs_mount *mp) { -uint *p; -int rval; -struct xfs_trans_resv *tr = &mp->m_reservations; +struct xfs_trans_resv *tr = &mp->m_resv; +struct xfs_trans_res *p; +struct xfs_trans_res rval = {0 }; -for (rval =0 , p = (uint *)tr; p < (uint *)(tr +1 ); p++) { -if ((int )*p > rval) - rval = (int )*p; +for (p = (struct xfs_trans_res *)tr; + p < (struct xfs_trans_res *)(tr +1 ); p++) { +if (p->tr_logres > rval.tr_logres) + rval = *p; } -return rval; +return rval.tr_logres; }int
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 41/55] xfs: Introduce a new structure to hold transaction reservation items
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
Introduce a new structure
xfs_trans_resto hold transaction reservation item info per log ticket.We also need to improve
xfs_trans_resv_calc()by initializing the log count as well as log flags for permanent log reservation.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/55 xfs: Introduce tr_fsyncts to m_reservation
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
A preparation step.
For now fsync_ts transaction use the pre-calculated log reservation size of tr_swrite.
This patch introduce a new item tr_fsyncts to mp->m_reservations structure so that we can fetch the log reservation value for it in a same manner to others.
--- include/xfs_trans_resv.h | 3 ++- libxfs/xfs_trans_resv.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
include/xfs_trans_resv.h +2 -1
@@ -62,6 +62,7 @@ struct xfs_trans_resv {struct xfs_trans_res tr_qm_quotaoff;/* turn quota off */ struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */ struct xfs_trans_res tr_sb;/* modify superblock */ +struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ };/*
@@ -109,7 +110,7 @@ struct xfs_trans_resv {* Logging the inode timestamps on an fsync -- same as SWRITE * as long as SWRITE logs the entire inode core */ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres)#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
libxfs/xfs_trans_resv.c +1 -0
@@ -734,6 +734,7 @@ xfs_trans_resv_calc( resp->tr_ichange.tr_logres =xfs_calc_ichange_reservation (mp); resp->tr_growdata.tr_logres =xfs_calc_growdata_reservation (mp); resp->tr_swrite.tr_logres =xfs_calc_swrite_reservation (mp); + resp->tr_fsyncts.tr_logres =xfs_calc_swrite_reservation (mp); resp->tr_writeid.tr_logres =xfs_calc_writeid_reservation (mp); resp->tr_attrsetrt.tr_logres =xfs_calc_attrsetrt_reservation (mp); resp->tr_clearagi.tr_logres =xfs_calc_clear_agi_bucket_reservation (mp);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 42/55] xfs: Introduce tr_fsyncts to m_reservation
Quoted 4 lines · Dave Chinner
From: Jie Liu<[email protected]>
A preparation step.
Quoted 8 lines
For now
fsync_tstransaction use the pre-calculated log reservation size oftr_swrite.
This patch introduce a new itemtr_fsynctstomp->m_reservationsstructure so that we can fetch the log reservation value for it in a same manner to others.Signed-off-by Jie Liu<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 43/55 xfs: Make writeid transaction use tr_writeid
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
tr_writeid is defined at mp->m_resv structure, however, it does not really being used when it should be..
This patch changes it to tr_writeid to fetch the correct log reservation size.
--- include/xfs_trans_resv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/xfs_trans_resv.h +1 -1
@@ -111,7 +111,7 @@ struct xfs_trans_resv {* as long as SWRITE logs the entire inode core */ #define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 43/55] xfs: Make writeid transaction use tr_writeid
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
tr_writeidis defined atmp->m_resvstructure, however, it does not really being used when it should be..This patch changes it to
tr_writeidto fetch the correct log reservation size.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 44/55 xfs: refactor xfs_trans_reserve() interface
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
With the new xfs_trans_res structure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refine xfs_trans_reserve() interface to be more neat.
Also, introduce a new helper M_RES() to return a pointer to the mp->m_resv structure to simplify the input.
--- include/libxfs.h | 3 +- include/xfs_trans_resv.h | 3 ++ libxfs/trans.c | 20 +++++------ libxfs/util.c | 15 +++++--- libxfs/xfs_attr.c | 33 +++++++++--------- libxfs/xfs_bmap.c | 4 +-- libxfs/xfs_trans_resv.c | 7 ++-- mkfs/proto.c | 24 ++++++++----- mkfs/xfs_mkfs.c | 5 ++- repair/phase5.c | 3 +- repair/phase6.c | 89 +++++++++++++++++++++++------------------------- repair/phase7.c | 7 ++-- 12 files changed, 115 insertions(+), 98 deletions(-)
include/libxfs.h +2 -1
@@ -513,7 +513,8 @@ extern int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *,int );extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); -extern int libxfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint ,uint ,uint ); +extern int libxfs_trans_reserve (struct xfs_trans *,struct xfs_trans_res *, +uint ,uint );extern int libxfs_trans_commit (xfs_trans_t *,uint );extern void libxfs_trans_cancel (xfs_trans_t *,int );extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *,xfs_mount_t *,int );
include/xfs_trans_resv.h +3 -0
@@ -65,6 +65,9 @@ struct xfs_trans_resv {struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ }; +/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv) +/* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent.
libxfs/trans.c +9 -11
@@ -91,7 +91,7 @@ libxfs_trans_roll( struct xfs_inode *dp) {struct xfs_trans *trans; -unsigned int logres, count; +struct xfs_trans_res tres;int error;/*
@@ -103,8 +103,8 @@ libxfs_trans_roll(/* * Copy the critical parameters from one trans to the next. */ - logres = trans->t_log_res; - count = trans->t_log_count; + tres.tr_logres = trans->t_log_res; + tres.tr_logcount = trans->t_log_count; *tpp =xfs_trans_dup (trans);/*
@@ -128,8 +128,8 @@ libxfs_trans_roll(* across this call, or that anything that is locked be logged in * the prior and the next transactions. */ - error =xfs_trans_reserve (trans,0 , logres,0 , -XFS_TRANS_PERM_LOG_RES , count); + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (trans, &tres,0 ,0 );/* * Ensure that the inode is in the new transaction and locked. */
@@ -176,12 +176,10 @@ libxfs_trans_dup(int libxfs_trans_reserve ( -xfs_trans_t *tp, -uint blocks, -uint logspace, -uint rtextents, -uint flags, -uint logcount) +struct xfs_trans *tp, +struct xfs_trans_res *resp, +uint blocks, +uint rtextents) {xfs_sb_t *mpsb = &tp->t_mountp->m_sb;
libxfs/util.c +11 -4
@@ -473,7 +473,8 @@ libxfs_alloc_file_space( tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); resblks = (uint )XFS_DIOSTRAT_SPACE_RES (mp, datablocks); - error =xfs_trans_reserve (tp, resblks,0 ,0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks,0 );if (error)break ;xfs_trans_ijoin (tp, ip,0 );
@@ -536,7 +537,6 @@ libxfs_inode_alloc(struct fsxattr *fsx, xfs_inode_t **ipp) { - int i; xfs_buf_t *ialloc_context;xfs_inode_t *ip;xfs_trans_t *ntp;
@@ -555,13 +555,20 @@ libxfs_inode_alloc( }if (ialloc_context) { +struct xfs_trans_res tres; +xfs_trans_bhold (*tp, ialloc_context); + tres.tr_logres = (*tp)->t_log_res; + tres.tr_logcount = (*tp)->t_log_count; + ntp =xfs_trans_dup (*tp);xfs_trans_commit (*tp,0 ); *tp = ntp; -if ((i =xfs_trans_reserve (*tp,0 ,0 ,0 ,0 ,0 ))) { + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (*tp, &tres,0 ,0 ); +if (error) {fprintf (stderr,_ ("%s: cannot reserve space: %s\n" ), - progname,strerror (i)); + progname,strerror (error));exit (1 ); }xfs_trans_bjoin (*tp, ialloc_context);
libxfs/xfs_attr.c +16 -17
@@ -202,13 +202,14 @@ xfs_attr_set_int( int valuelen, int flags) { -xfs_da_args_t args; -xfs_fsblock_t firstblock; -xfs_bmap_free_t flist; -int error, err2, committed; -xfs_mount_t *mp = dp->i_mount; -int rsvd = (flags &ATTR_ROOT ) !=0 ; -int local; +xfs_da_args_t args; +xfs_fsblock_t firstblock; +xfs_bmap_free_t flist; +int error, err2, committed; +struct xfs_mount *mp = dp->i_mount; +struct xfs_trans_res tres; +int rsvd = (flags &ATTR_ROOT ) !=0 ; +int local;/* * Attach the dquots to the inode.
@@ -268,11 +269,11 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error =xfs_trans_reserve (args.trans, args.total, -XFS_ATTRSETM_LOG_RES (mp) + -XFS_ATTRSETRT_LOG_RES (mp) * args.total, -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRSET_LOG_COUNT ); + tres.tr_logres =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * args.total; + tres.tr_logcount =XFS_ATTRSET_LOG_COUNT ; + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (args.trans, &tres, args.total,0 );if (error) {xfs_trans_cancel (args.trans,0 );return (error);
@@ -492,11 +493,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)if (flags &ATTR_ROOT ) args.trans->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (args.trans, -XFS_ATTRRM_SPACE_RES (mp), -XFS_ATTRRM_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRRM_LOG_COUNT ))) { + error =xfs_trans_reserve (args.trans, &M_RES (mp)->tr_attrrm, +XFS_ATTRRM_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (args.trans,0 );return (error); }
libxfs/xfs_bmap.c +2 -2
@@ -1113,8 +1113,8 @@ xfs_bmap_add_attrfork( blks =XFS_ADDAFORK_SPACE_RES (mp);if (rsvd) tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp, blks,XFS_ADDAFORK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ADDAFORK_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_addafork, blks,0 ); +if (error) goto error0;xfs_ilock (ip,XFS_ILOCK_EXCL ); error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
libxfs/xfs_trans_resv.c +4 -3
@@ -522,7 +522,8 @@ xfs_calc_attrsetm_reservation(* Since the runtime attribute transaction space is dependent on the total * blocks needed for the 1st bmap, here we calculate out the space unit for * one block so that the caller could figure out the total space according -* to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp). +* to the attibute extent length in blocks by: +* ext * M_RES(mp)->tr_attrsetrt.tr_logres */ STATIC uint xfs_calc_attrsetrt_reservation(
@@ -594,14 +595,14 @@ xfs_calc_qm_setqlim_reservation(/* * Allocating quota on disk if needed. -* the write transaction log space: XFS_WRITE_LOG_RES(mp) +* the write transaction log space: M_RES(mp)->tr_write.tr_logres * the unit of quota allocation: one system block size */ STATIC uintxfs_calc_qm_dqalloc_reservation (struct xfs_mount *mp) { -return XFS_WRITE_LOG_RES (mp) + +return M_RES (mp)->tr_write.tr_logres +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ) -1 ); }
mkfs/proto.c +16 -8
@@ -119,7 +119,9 @@ getres( mp = tp->t_mountp;for (i =0 , r =MKFS_BLOCKRES (blocks); r >= blocks; r--) { - i =libxfs_trans_reserve (tp, r,0 ,0 ,0 ,0 ); +struct xfs_trans_res tres = {0 }; + + i =libxfs_trans_reserve (tp, &tres, r,0 );if (i ==0 )return ; }
@@ -617,13 +619,16 @@ rtinit(xfs_trans_t *tp;struct cred creds;struct fsxattr fsxattrs; +struct xfs_trans_res tres = {0 };/* * First, allocate the inodes. */ tp =libxfs_trans_alloc (mp,0 ); -if ((i =libxfs_trans_reserve (tp,MKFS_BLOCKRES_INODE ,0 ,0 ,0 ,0 ))) + i =libxfs_trans_reserve (tp, &tres,MKFS_BLOCKRES_INODE ,0 ); +if (i)res_failed (i); +memset (&creds,0 ,sizeof (creds));memset (&fsxattrs,0 ,sizeof (fsxattrs)); error = libxfs_inode_alloc(&tp, NULL, S_IFREG, 1, 0,
@@ -660,9 +665,11 @@ rtinit(* Next, give the bitmap file some zero-filled blocks. */ tp =libxfs_trans_alloc (mp,0 ); -if ((i =libxfs_trans_reserve (tp, mp->m_sb.sb_rbmblocks + - (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ) -1 ),0 ,0 ,0 ,0 ))) + i =libxfs_trans_reserve (tp, &tres, mp->m_sb.sb_rbmblocks + + (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ) -1 ),0 ); +if (i)res_failed (i); +libxfs_trans_ijoin (tp, rbmip,0 );libxfs_trans_ihold (tp, rbmip); bno =0 ;
@@ -696,9 +703,9 @@ rtinit(*/ tp =libxfs_trans_alloc (mp,0 ); nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog; -if ((i =libxfs_trans_reserve (tp, - nsumblocks + (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ) -1 ), -0 ,0 ,0 ,0 ))) + i =libxfs_trans_reserve (tp, &tres, nsumblocks + + (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ) -1 ),0 ); +if (i)res_failed (i);libxfs_trans_ijoin (tp, rsumip,0 );libxfs_trans_ihold (tp, rsumip);
@@ -733,7 +740,8 @@ rtinit(*/ for (bno =0 ; bno < mp->m_sb.sb_rextents; bno = ebno) { tp =libxfs_trans_alloc (mp,0 ); -if ((i =libxfs_trans_reserve (tp,0 ,0 ,0 ,0 ,0 ))) + i =libxfs_trans_reserve (tp, &tres,0 ,0 ); +if (i)res_failed (i);libxfs_trans_ijoin (tp, rbmip,0 );libxfs_trans_ihold (tp, rbmip);
mkfs/xfs_mkfs.c +4 -1
@@ -2821,6 +2821,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),for (agno =0 ; agno < agcount; agno++) {xfs_alloc_arg_t args;xfs_trans_t *tp; +struct xfs_trans_res tres = {0 };memset (&args,0 ,sizeof (args)); args.tp = tp =libxfs_trans_alloc (mp,0 );
@@ -2828,8 +2829,10 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), args.agno = agno; args.alignment =1 ; args.pag =xfs_perag_get (mp,agno); -if ((c =libxfs_trans_reserve (tp, worst_freelist,0 ,0 ,0 ,0 ))) + c =libxfs_trans_reserve (tp, &tres, worst_freelist,0 ); +if (c)res_failed (c); +libxfs_alloc_fix_freelist (&args,0 );xfs_perag_put (args.pag);libxfs_trans_commit (tp,0 );
repair/phase5.c +2 -1
@@ -1405,6 +1405,7 @@ build_agf_agfl(xfs_mount_t *mp, {xfs_alloc_arg_t args;xfs_trans_t *tp; +struct xfs_trans_res tres = {0 };memset (&args,0 ,sizeof (args)); args.tp = tp =libxfs_trans_alloc (mp,0 );
@@ -1412,7 +1413,7 @@ build_agf_agfl(xfs_mount_t *mp, args.agno = agno; args.alignment =1 ; args.pag =xfs_perag_get (mp,agno); -libxfs_trans_reserve (tp,XFS_MIN_FREELIST (agf, mp),0 ,0 ,0 ,0 ); +libxfs_trans_reserve (tp, &tres,XFS_MIN_FREELIST (agf, mp),0 );libxfs_alloc_fix_freelist (&args,0 );xfs_perag_put (args.pag);libxfs_trans_commit (tp,0 );
repair/phase6.c +43 -46
221 lines not on this page · raw message
repair/phase7.c +3 -4
@@ -68,13 +68,12 @@ update_inode_nlinks(xfs_inode_t *ip;int error;int dirty; +int nres; tp =libxfs_trans_alloc (mp,XFS_TRANS_REMOVE ); - error =libxfs_trans_reserve (tp, (no_modify ?0 :10 ), -XFS_REMOVE_LOG_RES (mp),0 ,XFS_TRANS_PERM_LOG_RES , -XFS_REMOVE_LOG_COUNT ); - + nres = no_modify ?0 :10 ; + error =libxfs_trans_reserve (tp, &M_RES (mp)->tr_remove, nres,0 );ASSERT (error ==0 ); error =libxfs_trans_iget (mp, tp, ino,0 ,0 , &ip);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 44/55] xfs: refactor xfs_trans_reserve() interface
Quoted 7 lines · Dave Chinner
From: Jie Liu<[email protected]>
With the new
xfs_trans_resstructure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refinexfs_trans_reserve()interface to be more neat.
Quoted 6 lines
Also, introduce a new helper
M_RES()to return a pointer to themp->m_resvstructure to simplify the input.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 45/55 xfs: Get rid of all XFS_XXX_LOG_RES() macro
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Get rid of all XFS_XXX_LOG_RES() macros since they are obsoleted now.
--- include/xfs_trans_resv.h | 36 ------------------------------------ mkfs/maxtrres.c | 5 +++-- 2 files changed, 3 insertions(+), 38 deletions(-)
include/xfs_trans_resv.h +0 -36
@@ -92,42 +92,6 @@ struct xfs_trans_resv { (XFS_DAENTER_BLOCKS (mp,XFS_DATA_FORK ) + \XFS_DAENTER_BMAPS (mp,XFS_DATA_FORK ) +1 ) - -#define XFS_WRITE_LOG_RES (mp) ((mp)->m_resv.tr_write.tr_logres) -#define XFS_RENAME_LOG_RES (mp) ((mp)->m_resv.tr_rename.tr_logres) -#define XFS_LINK_LOG_RES (mp) ((mp)->m_resv.tr_link.tr_logres) -#define XFS_REMOVE_LOG_RES (mp) ((mp)->m_resv.tr_remove.tr_logres) -#define XFS_SYMLINK_LOG_RES (mp) ((mp)->m_resv.tr_symlink.tr_logres) -#define XFS_CREATE_LOG_RES (mp) ((mp)->m_resv.tr_create.tr_logres) -#define XFS_MKDIR_LOG_RES (mp) ((mp)->m_resv.tr_mkdir.tr_logres) -#define XFS_IFREE_LOG_RES (mp) ((mp)->m_resv.tr_ifree.tr_logres) -#define XFS_SWRITE_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) -#define XFS_ICHANGE_LOG_RES (mp) ((mp)->m_resv.tr_ichange.tr_logres) -#define XFS_GROWDATA_LOG_RES (mp) ((mp)->m_resv.tr_growdata.tr_logres) -#define XFS_ITRUNCATE_LOG_RES (mp) ((mp)->m_resv.tr_itruncate.tr_logres) -#define XFS_GROWRTZERO_LOG_RES (mp) ((mp)->m_resv.tr_growrtzero.tr_logres) -#define XFS_GROWRTFREE_LOG_RES (mp) ((mp)->m_resv.tr_growrtfree.tr_logres) -#define XFS_GROWRTALLOC_LOG_RES (mp) ((mp)->m_resv.tr_growrtalloc.tr_logres) - -/* -* Logging the inode timestamps on an fsync -- same as SWRITE -* as long as SWRITE logs the entire inode core -*/ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres) -#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres) -#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres) -#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_resv.tr_attrsetrt.tr_logres) -#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_resv.tr_attrrm.tr_logres) -#define XFS_SB_LOG_RES (mp) ((mp)->m_resv.tr_sb.tr_logres) -#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres) -#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres) -#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres) -#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres) -#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres) -#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_resv.tr_clearagi.tr_logres) -/* * Various log count values. */
mkfs/maxtrres.c +3 -2
@@ -46,8 +46,9 @@ max_attrsetm_trans_res_adjust( nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); nblks +=XFS_B_TO_FSB (mp, size); nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); - res =XFS_ATTRSETM_LOG_RES (mp) +XFS_ATTRSETRT_LOG_RES (mp) * nblks; - mp->m_resv.tr_attrsetm.tr_logres = res; + res =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * nblks; +M_RES (mp)->tr_attrsetm.tr_logres = res; } static int
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 45/55] xfs: Get rid of all XFS_XXX_LOG_RES() macro
Quoted 7 lines · Dave Chinner
From: Jie Liu<[email protected]>
Get rid of all
XFS_XXX_LOG_RES()macros since they are obsoleted now.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 46/55 xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Add source files for xfs_log_rlimit.c The new file is used for log size calculations and validation shared with userspace.
[dchinner: xfs_log_calc_max_attrsetm_res() does not modify the tr_attrsetm reservation, just calculates the maximum. ]
[dchinner: rework loop in xfs_log_get_max_trans_res() ]
[dchinner: implement xfs_log_calc_unit_res() in util.c to give mkfs a worse case calculation of the log size needed. ]
--- include/xfs_fs.h | 4 +- include/xfs_log_format.h | 11 +++- libxfs/Makefile | 15 ++++-- libxfs/util.c | 107 +++++++++++++++++++++++++++++++++++++ libxfs/xfs.h | 8 +++ libxfs/xfs_log_rlimit.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 66 +++++++---------------- mkfs/xfs_mkfs.c | 105 ++++++++++++++++++++---------------- mkfs/xfs_mkfs.h | 6 +-- 9 files changed, 356 insertions(+), 102 deletions(-) create mode 100644 libxfs/xfs_log_rlimit.c
include/xfs_fs.h +3 -1
@@ -240,7 +240,9 @@ typedef struct xfs_fsop_resblks {/* -* Minimum and maximum sizes need for growth checks +* Minimum and maximum sizes need for growth checks. +* +* Block counts are in units of filesystem blocks, not basic blocks. */ #define XFS_MIN_AG_BLOCKS 64#define XFS_MIN_LOG_BLOCKS 512ULL
include/xfs_log_format.h +10 -1
@@ -18,6 +18,9 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +struct xfs_trans_res ; +/* * On-disk Log Format definitions. *
@@ -49,6 +52,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
@@ -133,7 +139,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1
@@ -840,4 +845,8 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); + +#endif /* __XFS_LOG_FORMAT_H__ */
libxfs/Makefile +12 -3
@@ -17,14 +17,23 @@ CFILES = cache.c \ xfs_alloc.c \ xfs_alloc_btree.c \ xfs_attr.c \ + xfs_attr_leaf.c \ xfs_attr_remote.c \ + xfs_bmap.c \ + xfs_bmap_btree.c \ xfs_btree.c \ + xfs_da_btree.c \ + xfs_dir2.c \ + xfs_dir2_block.c \ + xfs_dir2_data.c \ + xfs_dir2_leaf.c \ + xfs_dir2_node.c \ + xfs_dir2_sf.c \ xfs_ialloc.c \ xfs_inode_buf.c \ xfs_inode_fork.c \ - xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ - xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ - xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ + xfs_ialloc_btree.c \ + xfs_log_rlimit.c \ xfs_rtalloc.c \ xfs_sb.c \ xfs_symlink_remote.c \
libxfs/util.c +107 -0
113 lines not on this page · raw message
libxfs/xfs.h +8 -0
@@ -208,6 +208,14 @@ roundup_pow_of_two(uint v)return 0 ; } +static inline __uint64_t +roundup_64 (__uint64_t x,__uint32_t y) +{ + x += y -1 ; +do_div (x, y); +return x * y; +} +/* buffer management */ #define XFS_BUF_LOCK 0#define XFS_BUF_TRYLOCK 0
libxfs/xfs_log_rlimit.c new file +136 -0
136 lines not on this page · raw message
mkfs/maxtrres.c +18 -48
94 lines not on this page · raw message
mkfs/xfs_mkfs.c +59 -46
147 lines not on this page · raw message
mkfs/xfs_mkfs.h +3 -3
@@ -54,8 +54,7 @@#define XFS_MIN_REC_DIRSIZE 12/* 4096 byte dirblocks (V2) */ #define XFS_DFL_DIR_VERSION 2/* default directory version */ #define XFS_DFL_LOG_SIZE 1000/* default log size, blocks */ -#define XFS_MIN_LOG_FACTOR 3/* min log size factor */ -#define XFS_DFL_LOG_FACTOR 16/* default log size, factor */ +#define XFS_DFL_LOG_FACTOR 5/* default log size, factor */ /* with max trans reservation */ #define XFS_MAX_INODE_SIG_BITS 32/* most significant bits in an * inode number that we'll
@@ -82,6 +81,7 @@ extern void res_failed (int err);/* maxtrres.c */ extern int max_trans_res (int crcs_enabled,int dirversion, -int sectorlog,int blocklog,int inodelog,int dirblocklog); +int sectorlog,int blocklog,int inodelog,int dirblocklog, +int logversion,int log_sunit);#endif /* __XFS_MKFS_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 8 lines · Dave Chinner
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ]
Quoted 8 lines
[dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Already reviewed in other posting.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Jie Liu <[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]
2 things:
Ben, seems like your workflow lost the:
From: Jie Liu <[email protected]>
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Thanks,
-Eric
Quoted 656 lines
Signed-off-by Jie Liu <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- include/xfs_fs.h | 4 +- include/xfs_log_format.h | 11 +++- libxfs/Makefile | 15 ++++-- libxfs/util.c | 107 +++++++++++++++++++++++++++++++++++++ libxfs/xfs.h | 8 +++ libxfs/xfs_log_rlimit.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 66 +++++++---------------- mkfs/xfs_mkfs.c | 105 ++++++++++++++++++++---------------- mkfs/xfs_mkfs.h | 6 +-- 9 files changed, 356 insertions(+), 102 deletions(-) create mode 100644 libxfs/xfs_log_rlimit.cinclude/xfs_fs.h +3
-1@@ -240,7 +240,9 @@ typedef struct xfs_fsop_resblks {/* -* Minimum and maximum sizes need for growth checks +* Minimum and maximum sizes need for growth checks. +* +* Block counts are in units of filesystem blocks, not basic blocks. */ #define XFS_MIN_AG_BLOCKS 64#define XFS_MIN_LOG_BLOCKS 512ULLinclude/xfs_log_format.h +10
-1@@ -18,6 +18,9 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +struct xfs_trans_res ; +/* * On-disk Log Format definitions. * @@ -49,6 +52,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))@@ -133,7 +139,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1@@ -840,4 +845,8 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); + +#endif /* __XFS_LOG_FORMAT_H__ */ libxfs/Makefile +12
-3@@ -17,14 +17,23 @@ CFILES = cache.c \ xfs_alloc.c \ xfs_alloc_btree.c \ xfs_attr.c \ + xfs_attr_leaf.c \ xfs_attr_remote.c \ + xfs_bmap.c \ + xfs_bmap_btree.c \ xfs_btree.c \ + xfs_da_btree.c \ + xfs_dir2.c \ + xfs_dir2_block.c \ + xfs_dir2_data.c \ + xfs_dir2_leaf.c \ + xfs_dir2_node.c \ + xfs_dir2_sf.c \ xfs_ialloc.c \ xfs_inode_buf.c \ xfs_inode_fork.c \ - xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ - xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ - xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ + xfs_ialloc_btree.c \ + xfs_log_rlimit.c \ xfs_rtalloc.c \ xfs_sb.c \ xfs_symlink_remote.c \libxfs/util.c +107
-0@@ -22,6 +22,113 @@#include <stdarg.h> /* +* Calculate the worst case log unit reservation for a given superblock +* configuration. Copied and munged from the kernel code, and assumes a +* worse case header usage (maximum log buffer sizes) +*/ +int +xfs_log_calc_unit_res ( +struct xfs_mount *mp, +int unit_bytes) +{ +int iclog_space; +int iclog_header_size; +int iclog_size; +uint num_headers; + +if (xfs_sb_version_haslogv2 (&mp->m_sb)) { + iclog_size =XLOG_MAX_RECORD_BSIZE ; + iclog_header_size =BBTOB (iclog_size /XLOG_HEADER_CYCLE_SIZE ); + }else { + iclog_size =XLOG_BIG_RECORD_BSIZE ; + iclog_header_size =BBSIZE ; + } + +/* +* Permanent reservations have up to 'cnt'-1 active log operations +* in the log. A unit in this case is the amount of space for one +* of these log operations. Normal reservations have a cnt of 1 +* and their unit amount is the total amount of space required. +* +* The following lines of code account for non-transaction data +* which occupy space in the on-disk log. +* +* Normal form of a transaction is: +* <oph><trans-hdr><start-oph><reg1-oph><reg1><reg2-oph>...<commit-oph> +* and then there are LR hdrs, split-recs and roundoff at end of syncs. +* +* We need to account for all the leadup data and trailer data +* around the transaction data. +* And then we need to account for the worst case in terms of using +* more space. +* The worst case will happen if: +* - the placement of the transaction happens to be such that the +* roundoff is at its maximum +* - the transaction data is synced before the commit record is synced +* i.e. <transaction-data><roundoff> | <commit-rec><roundoff> +* Therefore the commit record is in its own Log Record. +* This can happen as the commit record is called with its +* own region to xlog_write(). +* This then means that in the worst case, roundoff can happen for +* the commit-rec as well. +* The commit-rec is smaller than padding in this scenario and so it is +* not added separately. +*/ + +/* for trans header */ + unit_bytes +=sizeof (xlog_op_header_t); + unit_bytes +=sizeof (xfs_trans_header_t); + +/* for start-rec */ + unit_bytes +=sizeof (xlog_op_header_t); + +/* +* for LR headers - the space for data in an iclog is the size minus +* the space used for the headers. If we use the iclog size, then we +* undercalculate the number of headers required. +* +* Furthermore - the addition of op headers for split-recs might +* increase the space required enough to require more log and op +* headers, so take that into account too. +* +* IMPORTANT: This reservation makes the assumption that if this +* transaction is the first in an iclog and hence has the LR headers +* accounted to it, then the remaining space in the iclog is +* exclusively for this transaction. i.e. if the transaction is larger +* than the iclog, it will be the only thing in that iclog. +* Fundamentally, this means we must pass the entire log vector to +* xlog_write to guarantee this. +*/ + iclog_space = iclog_size - iclog_header_size; + num_headers =howmany (unit_bytes, iclog_space); + +/* for split-recs - ophdrs added when data split over LRs */ + unit_bytes +=sizeof (xlog_op_header_t) * num_headers; + +/* add extra header reservations if we overrun */ +while (!num_headers || +howmany (unit_bytes, iclog_space) > num_headers) { + unit_bytes +=sizeof (xlog_op_header_t); + num_headers++; + } + unit_bytes += iclog_header_size * num_headers; + +/* for commit-rec LR header - note: padding will subsume the ophdr */ + unit_bytes += iclog_header_size; + +/* for roundoff padding for transaction data and one for commit record */ +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) { +/* log su roundoff */ + unit_bytes +=2 * mp->m_sb.sb_logsunit; + }else { +/* BB roundoff */ + unit_bytes +=2 *BBSIZE ; + } + +return unit_bytes; +} + +/* * Change the requested timestamp in the given inode. * * This was once shared with the kernel, but has diverged to the point libxfs/xfs.h +8
-0@@ -208,6 +208,14 @@ roundup_pow_of_two(uint v)return 0 ; } +static inline __uint64_t +roundup_64 (__uint64_t x,__uint32_t y) +{ + x += y -1 ; +do_div (x, y); +return x * y; +} +/* buffer management */ #define XFS_BUF_LOCK 0#define XFS_BUF_TRYLOCK 0libxfs/xfs_log_rlimit.c new file +136
-0@@ -0,0 +1,136 @@ +/* +* Copyright (c) 2013 Jie Liu. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include <xfs.h> + +/* +* Calculate the maximum length in bytes that would be required for a local +* attribute value as large attributes out of line are not logged. +*/ +STATIC int +xfs_log_calc_max_attrsetm_res ( +struct xfs_mount *mp) +{ +int size; +int nblks; + + size =xfs_attr_leaf_entsize_local_max (mp->m_sb.sb_blocksize) - +MAXNAMELEN -1 ; + nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); + nblks +=XFS_B_TO_FSB (mp, size); + nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); + +return M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * nblks; +} + +/* +* Iterate over the log space reservation table to figure out and return +* the maximum one in terms of the pre-calculated values which were done +* at mount time. +*/ +STATIC void +xfs_log_get_max_trans_res ( +struct xfs_mount *mp, +struct xfs_trans_res *max_resp) +{ +struct xfs_trans_res *resp; +struct xfs_trans_res *end_resp; +int log_space =0 ; +int attr_space; + + attr_space =xfs_log_calc_max_attrsetm_res (mp); + + resp = (struct xfs_trans_res *)M_RES (mp); + end_resp = (struct xfs_trans_res *)(M_RES (mp) +1 ); +for (; resp < end_resp; resp++) { +int tmp = resp->tr_logcount >1 ? + resp->tr_logres * resp->tr_logcount : + resp->tr_logres; +if (log_space < tmp) { + log_space = tmp; + *max_resp = *resp;/* struct copy */ + } + } + +if (attr_space > log_space) { + *max_resp =M_RES (mp)->tr_attrsetm;/* struct copy */ + max_resp->tr_logres = attr_space; + } +} + +/* +* Calculate the minimum valid log size for the given superblock configuration. +* Used to calculate the minimum log size at mkfs time, and to determine if +* the log is large enough or not at mount time. Returns the minimum size in +* filesystem block size units. +*/ +int +xfs_log_calc_minimum_size ( +struct xfs_mount *mp) +{ +struct xfs_trans_res tres = {0 }; +int max_logres; +int min_logblks =0 ; +int lsunit =0 ; + +xfs_log_get_max_trans_res (mp, &tres); + + max_logres =xfs_log_calc_unit_res (mp, tres.tr_logres); +if (tres.tr_logcount >1 ) + max_logres *= tres.tr_logcount; + +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) + lsunit =BTOBB (mp->m_sb.sb_logsunit); + +/* +* Two factors should be taken into account for calculating the minimum +* log space. +* 1) The fundamental limitation is that no single transaction can be +* larger than half size of the log. +* +* From mkfs.xfs, this is considered by the XFS_MIN_LOG_FACTOR +* define, which is set to 3. That means we can definitely fit +* maximally sized 2 transactions in the log. We'll use this same +* value here. +* +* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. +* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* +* Also, the log size should be a multiple of the log stripe unit, round +* it up to lsunit boundary if lsunit is specified. +*/ +if (lsunit) { + min_logblks =roundup_64 (BTOBB (max_logres), lsunit) + +2 * lsunit; + }else + min_logblks =BTOBB (max_logres) +2 *BBSIZE ; + min_logblks *=XFS_MIN_LOG_FACTOR ; + +return XFS_BB_TO_FSB (mp, min_logblks); +}mkfs/maxtrres.c +18
-48@@ -27,46 +27,6 @@#include <xfs/libxfs.h> #include "xfs_mkfs.h" -static void -max_attrsetm_trans_res_adjust ( -xfs_mount_t *mp) -{ -int local; -int size; -int nblks; -int res; - -/* -* Determine space the maximal sized attribute will use, -* to calculate the largest reservation size needed. -*/ - size =libxfs_attr_leaf_newentsize (MAXNAMELEN ,64 *1024 , - mp->m_sb.sb_blocksize, &local); -ASSERT (!local); - nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); - nblks +=XFS_B_TO_FSB (mp, size); - nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); - res =M_RES (mp)->tr_attrsetm.tr_logres + -M_RES (mp)->tr_attrsetrt.tr_logres * nblks; -M_RES (mp)->tr_attrsetm.tr_logres = res; -} - -static int -max_trans_res_by_mount ( -struct xfs_mount *mp) -{ -struct xfs_trans_resv *tr = &mp->m_resv; -struct xfs_trans_res *p; -struct xfs_trans_res rval = {0 }; - -for (p = (struct xfs_trans_res *)tr; - p < (struct xfs_trans_res *)(tr +1 ); p++) { -if (p->tr_logres > rval.tr_logres) - rval = *p; - } -return rval.tr_logres; -} - int max_trans_res( int crcs_enabled,@@ -74,11 +34,13 @@ max_trans_res(int sectorlog, int blocklog, int inodelog, - int dirblocklog) + int dirblocklog, + int logversion, + int log_sunit) { xfs_sb_t *sbp;xfs_mount_t mount; -int maxres, maxfsb; +int maxfsb;memset (&mount,0 ,sizeof (mount)); sbp = &mount.m_sb;@@ -93,19 +55,27 @@ max_trans_res( sbp->sb_inodesize =1 << inodelog; sbp->sb_inopblock =1 << (blocklog - inodelog); sbp->sb_dirblklog = dirblocklog - blocklog; + +if (log_sunit >0 ) { + log_sunit <<= blocklog; + logversion =2 ; + }else + log_sunit =1 ; + sbp->sb_logsunit = log_sunit; + sbp->sb_versionnum = (crcs_enabled ?XFS_SB_VERSION_5 :XFS_SB_VERSION_4 ) | - (dirversion ==2 ?XFS_SB_VERSION_DIRV2BIT :0 ); + (dirversion ==2 ?XFS_SB_VERSION_DIRV2BIT :0 ) | + (logversion >1 ?XFS_SB_VERSION_LOGV2BIT :0 );libxfs_mount (&mount, sbp,0 ,0 ,0 ,0 ); -max_attrsetm_trans_res_adjust (&mount); - maxres =max_trans_res_by_mount (&mount); - maxfsb =XFS_B_TO_FSB (&mount, maxres); + maxfsb =xfs_log_calc_minimum_size (&mount);libxfs_umount (&mount);#if 0 -printf ("#define\tMAXTRRES_S%d_B%d_I%d_D%d_V%d\t%lld\n" , - sectorlog, blocklog, inodelog, dirblocklog, dirversion, maxfsb); +printf ("#define\tMAXTRRES_S%d_B%d_I%d_D%d_V%d_LSU%d\t%d\n" , + sectorlog, blocklog, inodelog, dirblocklog, dirversion, + log_sunit, maxfsb);#endif return maxfsb;mkfs/xfs_mkfs.c +59
-46@@ -922,7 +922,6 @@ main(int lssflag;int lsu;int lsunit; -int max_tr_res;int min_logblocks;xfs_mount_t *mp;xfs_mount_t mbuf;@@ -2111,50 +2110,6 @@ reported by the device (%u).\n"), sectorsize, xi.rtbsize); } - max_tr_res =max_trans_res (crcs_enabled, dirversion, - sectorlog, blocklog, inodelog, dirblocklog); -ASSERT (max_tr_res); - min_logblocks = max_tr_res *XFS_MIN_LOG_FACTOR ; - min_logblocks =MAX (XFS_MIN_LOG_BLOCKS , min_logblocks); -if (!logsize && dblocks >= (1024 *1024 *1024 ) >> blocklog) - min_logblocks =MAX (min_logblocks,XFS_MIN_LOG_BYTES >>blocklog); -if (logsize && xi.logBBsize >0 && logblocks >DTOBT (xi.logBBsize)) { -fprintf (stderr, -_ ("size %s specified for log subvolume is too large, maximum is %lld blocks\n" ), - logsize, (long long )DTOBT (xi.logBBsize)); -usage (); - }else if (!logsize && xi.logBBsize >0 ) { - logblocks =DTOBT (xi.logBBsize); - }else if (logsize && !xi.logdev && !loginternal) { -fprintf (stderr, -_ ("size specified for non-existent log subvolume\n" )); -usage (); - }else if (loginternal && logsize && logblocks >= dblocks) { -fprintf (stderr,_ ("size %lld too large for internal log\n" ), - (long long )logblocks); -usage (); - }else if (!loginternal && !xi.logdev) { - logblocks =0 ; - }else if (loginternal && !logsize) { -/* -* With a 2GB max log size, default to maximum size -* at 4TB. This keeps the same ratio from the older -* max log size of 128M at 256GB fs size. IOWs, -* the ratio of fs size to log size is 2048:1. -*/ - logblocks = (dblocks << blocklog) /2048 ; - logblocks = logblocks >> blocklog; - logblocks =MAX (min_logblocks, logblocks); - logblocks =MAX (logblocks, -MAX (XFS_DFL_LOG_SIZE , - max_tr_res *XFS_DFL_LOG_FACTOR )); - logblocks =MIN (logblocks,XFS_MAX_LOG_BLOCKS ); -if ((logblocks << blocklog) >XFS_MAX_LOG_BYTES ) { - logblocks =XFS_MAX_LOG_BYTES >> blocklog; - } - } -validate_log_size (logblocks, blocklog, min_logblocks); -if (rtsize && xi.rtsize >0 && rtblocks >DTOBT (xi.rtsize)) { fprintf(stderr, _("size %s specified for rt subvolume is too large, "@@ -2363,6 +2318,60 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),fprintf (stderr,_ ("log stripe unit adjusted to 32KiB\n" )); } + min_logblocks =max_trans_res (crcs_enabled, dirversion, + sectorlog, blocklog, inodelog, dirblocklog, + logversion, lsunit); +ASSERT (min_logblocks); + min_logblocks =MAX (XFS_MIN_LOG_BLOCKS , min_logblocks); +if (!logsize && dblocks >= (1024 *1024 *1024 ) >> blocklog) + min_logblocks =MAX (min_logblocks,XFS_MIN_LOG_BYTES >>blocklog); +if (logsize && xi.logBBsize >0 && logblocks >DTOBT (xi.logBBsize)) { +fprintf (stderr, +_ ("size %s specified for log subvolume is too large, maximum is %lld blocks\n" ), + logsize, (long long )DTOBT (xi.logBBsize)); +usage (); + }else if (!logsize && xi.logBBsize >0 ) { + logblocks =DTOBT (xi.logBBsize); + }else if (logsize && !xi.logdev && !loginternal) { +fprintf (stderr, +_ ("size specified for non-existent log subvolume\n" )); +usage (); + }else if (loginternal && logsize && logblocks >= dblocks) { +fprintf (stderr,_ ("size %lld too large for internal log\n" ), + (long long )logblocks); +usage (); + }else if (!loginternal && !xi.logdev) { + logblocks =0 ; + }else if (loginternal && !logsize) { +/* +* With a 2GB max log size, default to maximum size +* at 4TB. This keeps the same ratio from the older +* max log size of 128M at 256GB fs size. IOWs, +* the ratio of fs size to log size is 2048:1. +*/ + logblocks = (dblocks << blocklog) /2048 ; + logblocks = logblocks >> blocklog; + logblocks =MAX (min_logblocks, logblocks); + +/* +* If the default log size doesn't fit in the AG size, use the +* minimum log size instead. This ensures small filesystems +* don't use excessive amounts of space for the log. +*/ +if (min_logblocks *XFS_DFL_LOG_FACTOR >= agsize) { + logblocks = min_logblocks; + }else { + logblocks =MAX (logblocks, +MAX (XFS_DFL_LOG_SIZE , + min_logblocks *XFS_DFL_LOG_FACTOR )); + } + logblocks =MIN (logblocks,XFS_MAX_LOG_BLOCKS ); +if ((logblocks << blocklog) >XFS_MAX_LOG_BYTES ) { + logblocks =XFS_MAX_LOG_BYTES >> blocklog; + } + } +validate_log_size (logblocks, blocklog, min_logblocks); + protostring =setup_proto (protofile); bsize =1 << (blocklog -BBSHIFT ); mp = &mbuf;@@ -2371,6 +2380,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), sbp->sb_blocklog = (__uint8_t )blocklog; sbp->sb_sectlog = (__uint8_t )sectorlog; sbp->sb_agblklog = (__uint8_t )libxfs_log2_roundup ((unsigned int )agsize); + sbp->sb_agblocks = (xfs_agblock_t )agsize; mp->m_blkbb_log = sbp->sb_blocklog -BBSHIFT ; mp->m_sectbb_log = sbp->sb_sectlog -BBSHIFT ;@@ -2382,6 +2392,9 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),if (!logsize) { logblocks =MIN (logblocks,XFS_ALLOC_AG_MAX_USABLE (mp)); + +/* revalidate the log size is valid if we changed it */ +validate_log_size (logblocks, blocklog, min_logblocks); }if (logblocks > agsize -XFS_PREALLOC_BLOCKS (mp)) { fprintf(stderr,@@ -2389,6 +2402,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), (long long)logblocks);usage (); } +if (laflag) {if (logagno >= agcount) { fprintf(stderr,@@ -2457,7 +2471,6 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), sbp->sb_logstart = logstart; sbp->sb_rootino = sbp->sb_rbmino = sbp->sb_rsumino =NULLFSINO ; sbp->sb_rextsize = rtextblocks; - sbp->sb_agblocks = (xfs_agblock_t )agsize; sbp->sb_agcount = (xfs_agnumber_t )agcount; sbp->sb_rbmblocks = nbmblocks; sbp->sb_logblocks = (xfs_extlen_t )logblocks;mkfs/xfs_mkfs.h +1
-2@@ -54,8 +54,7 @@#define XFS_MIN_REC_DIRSIZE 12/* 4096 byte dirblocks (V2) */ #define XFS_DFL_DIR_VERSION 2/* default directory version */ #define XFS_DFL_LOG_SIZE 1000/* default log size, blocks */ -#define XFS_MIN_LOG_FACTOR 3/* min log size factor */ -#define XFS_DFL_LOG_FACTOR 16/* default log size, factor */ +#define XFS_DFL_LOG_FACTOR 5/* default log size, factor */ /* with max trans reservation */ #define XFS_MAX_INODE_SIG_BITS 32/* most significant bits in an * inode number that we'll
mkfs/xfs_mkfs.h extern void res_failed (int err); · line 87
Quoted 8 lines
mkfs/xfs_mkfs.h +2
-1@@ -82,6 +81,7 @@ extern void res_failed (int err);/* maxtrres.c */ extern int max_trans_res (int crcs_enabled,int dirversion, -int sectorlog,int blocklog,int inodelog,int dirblocklog); +int sectorlog,int blocklog,int inodelog,int dirblocklog, +int logversion,int log_sunit);#endif /* __XFS_MKFS_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu <[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu <[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2
-fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2
-fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2
-fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2
-fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2
-fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2
-fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2
fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2
-Eric
Quoted 3 lines
Thanks,
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 46 lines · Eric Sandeen
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu<[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
(quoted diff) +5
-5-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2
Review
Quoted 10 lines
(quoted diff) +2
-3-fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2 -fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2 fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2 -Eric
Separate outputs for different versions of the OS version like we do for 16/32 bit tests' output?
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 53 lines · Mark Tinguely
Quoted 52 lines · Eric Sandeen
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu<[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
(quoted diff) +7
-7-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2 -fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2 -fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2
Quoted 7 lines
Quoted 4 lines
fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2-Eric
Separate outputs for different versions of the OS version like we do for 16/32 bit tests' output?
I'm not sure what we'd switch on....
Dave, a) was the change intentional (I think it was) and b) any suggestion for handling this test?
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 57 lines · Eric Sandeen
Quoted 56 lines · Mark Tinguely
Quoted 55 lines · Eric Sandeen
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu<[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
(quoted diff) +7
-7-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2 -fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2 -fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2 fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
-Eric
Separate outputs for different versions of the OS version like we do for 16/32 bit tests' output?
I'm not sure what we'd switch on....
I was thinking of the output of uname(1). Probably easier to filter the results in the test on the OS version rather than have separate golden outputs.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 58 lines · Mark Tinguely
Quoted 57 lines · Eric Sandeen
Quoted 56 lines · Mark Tinguely
Quoted 55 lines · Eric Sandeen
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu<[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
(quoted diff) +7
-7-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2 -fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2 -fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2 fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
-Eric
Separate outputs for different versions of the OS version like we do for 16/32 bit tests' output?
I'm not sure what we'd switch on....
I was thinking of the output of uname(1). Probably easier to filter the results in the test on the OS version rather than have separate golden outputs.
The behavior depends on the xfsprogs version, though, not the kernel version.
I .... guess we could do mkfs.xfs -V and split on that.
I do want to make sure it's all intentional though, first.
-Eric
Quoted 2 lines
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/55] xfs: Add xfs_log_rlimit.c
Quoted 68 lines · Eric Sandeen
Quoted 58 lines · Mark Tinguely
Quoted 57 lines · Eric Sandeen
Quoted 56 lines · Mark Tinguely
Quoted 55 lines · Eric Sandeen
Quoted 19 lines · Eric Sandeen
Quoted 5 lines · Dave Chinner
Quoted 5 lines
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.Quoted 7 lines
Quoted 7 lines
[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]2 things:
Ben, seems like your workflow lost the:
From: Jie Liu<[email protected]>
Quoted 7 lines
at the top - in git, the author is listed as Dave in git.
(Although those [parentheticals] were pretty fundamental changes, something I just gave Rich a hard time for) ;)
Also, this now breaks xfstest xfs/216 as a result of the mkfs changes. What are the plans for that?
Sorry, to be clear, it breaks that test (and others, pretty sure) because the log sizes for small filesystems are significantly bigger:
(quoted diff) +7
-7-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 +fssize=1g log =internal log bsize=4096 blocks=12800, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 +fssize=2g log =internal log bsize=4096 blocks=12800, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 +fssize=4g log =internal log bsize=4096 blocks=12800, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 +fssize=8g log =internal log bsize=4096 blocks=12800, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 +fssize=16g log =internal log bsize=4096 blocks=12800, version=2 -fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=32g log =internal log bsize=4096 blocks=12800, version=2 -fssize=64g log =internal log bsize=4096 blocks=8192, version=2 +fssize=64g log =internal log bsize=4096 blocks=12800, version=2 fssize=128g log =internal log bsize=4096 blocks=16384, version=2 fssize=256g log =internal log bsize=4096 blocks=32768, version=2Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
-Eric
Separate outputs for different versions of the OS version like we do for 16/32 bit tests' output?
I'm not sure what we'd switch on....
I was thinking of the output of uname(1). Probably easier to filter the results in the test on the OS version rather than have separate golden outputs.
Quoted 7 lines
The behavior depends on the xfsprogs version, though, not the kernel version.
I .... guess we could do mkfs.xfs -V and split on that.
I do want to make sure it's all intentional though, first.
-Eric
Sorry, I was thinking of the same change that went into the kernel. The min log size should be at least 3 time the max transaction size. That accounts for the bigger entries.
I would be happy to use the new calculations as the correct output since the new calculations are the right thing to do. Goes back to how long should xfstests support older kernels, xfsprogs, etc.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 47/55 xfs: Add read-only support for dirent filetype field
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the xfs_name structures passed around is added, but the directory code does not use this field yet. That will be in the next patch.
--- db/check.c | 12 +-- db/dir2.c | 10 +-- db/dir2sf.c | 9 ++- db/metadump.c | 10 +-- include/xfs_da_btree.h | 1 + include/xfs_dir2.h | 9 ++- include/xfs_dir2_format.h | 183 ++++++++++++++++++++++++++++++++++++++++------ include/xfs_sb.h | 28 ++++--- include/xfs_types.h | 1 + libxfs/xfs_dir2.c | 5 +- libxfs/xfs_dir2_block.c | 18 ++--- libxfs/xfs_dir2_data.c | 13 ++-- libxfs/xfs_dir2_leaf.c | 6 +- libxfs/xfs_dir2_node.c | 8 +- libxfs/xfs_dir2_priv.h | 44 +++++------ libxfs/xfs_dir2_sf.c | 122 ++++++++++++++++++------------- logprint/log_misc.c | 58 ++++++++------- repair/dir2.c | 37 +++++----- repair/dir2.h | 1 + repair/phase6.c | 22 +++--- 20 files changed, 384 insertions(+), 213 deletions(-)
db/check.c +6 -6
@@ -2310,7 +2310,7 @@ process_data_dir_v2( (int)((char *)dep - (char *)data)); error++; } - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep);if ((char *)tagp >= endptr) {if (!sflag || v) dbprintf(_("dir %lld block %d bad entry at %d\n"),
@@ -2325,7 +2325,7 @@ process_data_dir_v2( xname.name = dep->name; xname.len = dep->namelen;dir_hash_add (mp->m_dirnameops->hashname (&xname), addr); - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); count++; lastfree =0 ; lino =be64_to_cpu (dep->inumber);
@@ -3436,7 +3436,7 @@ process_sf_dir_v2( sfe =xfs_dir2_sf_firstentry (sf); offset =XFS_DIR3_DATA_FIRST_OFFSET (mp);for (i = sf->count -1 , i8 =0 ; i >=0 ; i--) { -if ((__psint_t )sfe +xfs_dir2_sf_entsize (sf, sfe->namelen) - +if ((__psint_t )sfe +xfs_dir3_sf_entsize (mp, sf, sfe->namelen) - (__psint_t )sf >be64_to_cpu (dip->di_size)) {if (!sflag) dbprintf(_("dir %llu bad size in entry at %d\n"),
@@ -3445,7 +3445,7 @@ process_sf_dir_v2( error++;break ; } - lino =xfs_dir2_sfe_get_ino (sf, sfe); + lino =xfs_dir3_sfe_get_ino (mp, sf, sfe);if (lino >XFS_DIR2_MAX_SHORT_INUM ) i8++; cid =find_inode (lino,1 );
@@ -3475,8 +3475,8 @@ process_sf_dir_v2( } offset =xfs_dir2_sf_get_offset (sfe) + -xfs_dir2_sf_entsize (sf, sfe->namelen); - sfe =xfs_dir2_sf_nextentry (sf, sfe); +xfs_dir3_sf_entsize (mp, sf, sfe->namelen); + sfe =xfs_dir3_sf_nextentry (mp, sf, sfe); }if (i <0 && (__psint_t )sfe - (__psint_t )sf !=be64_to_cpu (dip->di_size)) {
db/dir2.c +5 -5
@@ -222,7 +222,7 @@ __dir2_data_entries_count( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return i;
@@ -246,7 +246,7 @@ __dir2_data_entry_offset( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return ptr;
@@ -495,7 +495,7 @@ dir2_data_union_tag_count( end = (char *)&dep->namelen +sizeof (dep->namelen);if (end > (char *)obj + mp->m_dirblksize)return 0 ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); } end = (char *)tagp +sizeof (*tagp);return end <= (char *)obj + mp->m_dirblksize;
@@ -517,7 +517,7 @@ dir2_data_union_tag_offset(return bitize ((int )((char *)xfs_dir2_data_unused_tag_p (dup) - (char *)dup)); dep = (xfs_dir2_data_entry_t *)dup; -return bitize ((int )((char *)xfs_dir2_data_entry_tag_p (dep) - +return bitize ((int )((char *)xfs_dir3_data_entry_tag_p (mp, dep) - (char *)dep)); }
@@ -592,7 +592,7 @@ dir2_data_union_size(return bitize (be16_to_cpu (dup->length)); else { dep = (xfs_dir2_data_entry_t *)dup; -return bitize (xfs_dir2_data_entsize (dep->namelen)); +return bitize (xfs_dir3_data_entsize (mp, dep->namelen)); } }
db/dir2sf.c +5 -4
@@ -24,6 +24,7 @@#include "bit.h" #include "dir2.h" #include "dir2sf.h" +#include "init.h" static int dir2_inou_i4_count (void *obj,int startoff);static int dir2_inou_i8_count (void *obj,int startoff);
@@ -155,8 +156,8 @@ dir2_sf_entry_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); -return bitize ((int )xfs_dir2_sf_entsize (sf, e->namelen)); + e =xfs_dir3_sf_nextentry (mp, sf, e); +return bitize ((int )xfs_dir3_sf_entsize (mp, sf, e->namelen)); }/*ARGSUSED*/
@@ -200,7 +201,7 @@ dir2_sf_list_offset( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
@@ -220,6 +221,6 @@ dir2sf_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < sf->count; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
db/metadump.c +5 -5
@@ -939,7 +939,7 @@ obfuscate_sf_dir( namelen = ino_dir_size - ((char *)&sfep->name[0 ] - (char *)sfp); }else if ((char *)sfep - (char *)sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) > +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) {if (show_warnings) print_warning("entry length in dir inode %llu "
@@ -950,11 +950,11 @@ obfuscate_sf_dir( (char *)sfp); } -generate_obfuscated_name (xfs_dir2_sfe_get_ino (sfp, sfep), +generate_obfuscated_name (xfs_dir3_sfe_get_ino (mp, sfp, sfep), namelen, &sfep->name[0 ]); sfep = (xfs_dir2_sf_entry_t *)((char *)sfep + -xfs_dir2_sf_entsize (sfp, namelen)); +xfs_dir3_sf_entsize (mp, sfp, namelen)); } }
@@ -1184,7 +1184,7 @@ obfuscate_dir_data_blocks( } dep = (xfs_dir2_data_entry_t *)ptr; - length =xfs_dir2_data_entsize (dep->namelen); + length =xfs_dir3_data_entsize (mp, dep->namelen);if (dir_offset + length > dir_data.end_of_data || ptr + length > endptr) {
@@ -1194,7 +1194,7 @@ obfuscate_dir_data_blocks( (long long)cur_ino);break ; } -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != dir_offset) { dir_data.bad_block =1 ;break ;
include/xfs_da_btree.h +1 -0
@@ -176,6 +176,7 @@ enum xfs_dacmp { typedef struct xfs_da_args { const __uint8_t *name; /* string (maybe not NULL terminated) */ int namelen; /* length of string (maybe no NULL) */ + __uint8_t filetype; /* filetype of inode for directories */ __uint8_t *value; /* set of bytes (maybe contain NULLs) */ int valuelen; /* length of value */ int flags; /* argument flags (eg: ATTR_NOCREATE) */
include/xfs_dir2.h +5 -4
@@ -68,10 +68,11 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp);extern void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *sfp,xfs_ino_t ino); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep); -extern void xfs_dir2_sfe_put_ino (struct xfs_dir2_sf_hdr *, -struct xfs_dir2_sf_entry *sfep,xfs_ino_t ino); +extern xfs_ino_t xfs_dir3_sfe_get_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *sfp,struct xfs_dir2_sf_entry *sfep); +extern void xfs_dir3_sfe_put_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *hdr,struct xfs_dir2_sf_entry *sfep, +xfs_ino_t ino);extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);
include/xfs_dir2_format.h +160 -23
260 lines not on this page · raw message
include/xfs_sb.h +19 -9
@@ -555,12 +555,6 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; } -static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -} - -/* * Extended v5 superblock feature masks. These are to be used for new v5 * superblock features only.
@@ -599,7 +593,9 @@ xfs_sb_has_ro_compat_feature(return (sbp->sb_features_ro_compat & feature) !=0 ; } +#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0)/* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALLstatic inline bool xfs_sb_has_incompat_feature(
@@ -624,16 +620,30 @@ static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } -static inline bool -xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +/* +* V5 superblock specific feature checks +*/ +static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) { -return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; +} + +static inline int xfs_sb_version_hasftype (struct xfs_sb *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && +xfs_sb_has_incompat_feature (sbp,XFS_SB_FEAT_INCOMPAT_FTYPE ); }/* * end of superblock version macros */ +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +#define XFS_SB_DADDR ((xfs_daddr_t)0)/* daddr in filesystem/ag */ #define XFS_SB_BLOCK (mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)#define XFS_BUF_TO_SBP (bp) ((xfs_dsb_t *)((bp)->b_addr))
include/xfs_types.h +1 -0
@@ -140,6 +140,7 @@ typedef enum {struct xfs_name {const unsigned char *name;int len; +int type; };/*
libxfs/xfs_dir2.c +4 -1
@@ -18,7 +18,8 @@#include <xfs.h> -struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 }; +struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 ,XFS_DIR3_FT_DIR }; +/* * ASCII case-insensitive (ie. A-Z) support for directories that was
@@ -367,6 +368,7 @@ xfs_dir_replace(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.inumber = inum; args.dp = dp;
@@ -414,6 +416,7 @@ xfs_dir_canenter(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.dp = dp; args.whichfork =XFS_DATA_FORK ;
libxfs/xfs_dir2_block.c +9 -9
@@ -107,7 +107,7 @@ const struct xfs_buf_ops xfs_dir3_block_buf_ops = { .verify_write = xfs_dir3_block_write_verify, }; -static int +int xfs_dir3_block_read( struct xfs_trans *tp, struct xfs_inode *dp,
@@ -350,7 +350,7 @@ xfs_dir2_block_addname(if (error)return error; - len =xfs_dir2_data_entsize (args->namelen); + len =xfs_dir3_data_entsize (mp, args->namelen);/* * Set up pointers to parts of the block.
@@ -530,7 +530,7 @@ xfs_dir2_block_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, args->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Clean up the bestfree array and log the header, tail, and entry.
@@ -780,7 +780,7 @@ xfs_dir2_block_removename( needlog = needscan =0 ;xfs_dir2_data_make_free (tp, bp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Fix up the block tail. */
@@ -1140,7 +1140,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (dp->i_ino); dep->namelen =1 ; dep->name[0 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[0 ].hashval =cpu_to_be32 (xfs_dir_hash_dot);
@@ -1153,7 +1153,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (xfs_dir2_sf_get_parent_ino (sfp)); dep->namelen =2 ; dep->name[0 ] = dep->name[1 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[1 ].hashval =cpu_to_be32 (xfs_dir_hash_dotdot);
@@ -1198,10 +1198,10 @@ xfs_dir2_sf_to_block(* Copy a real entry. */ dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); - dep->inumber =cpu_to_be64 (xfs_dir2_sfe_get_ino (sfp, sfep)); + dep->inumber =cpu_to_be64 (xfs_dir3_sfe_get_ino (mp, sfp, sfep)); dep->namelen = sfep->namelen;memcpy (dep->name, sfep->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); name.name = sfep->name;
@@ -1214,7 +1214,7 @@ xfs_dir2_sf_to_block(if (++i == sfp->count) sfep =NULL ;else - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); }/* Done with the temporary buffer */ kmem_free (sfp);
libxfs/xfs_dir2_data.c +7 -6
@@ -131,7 +131,7 @@ __xfs_dir3_data_check(XFS_WANT_CORRUPTED_RETURN ( !xfs_dir_ino_validate (mp,be64_to_cpu (dep->inumber)));XFS_WANT_CORRUPTED_RETURN ( -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) == +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) == (char *)dep - (char *)hdr); count++; lastfree =0 ;
@@ -150,7 +150,7 @@ __xfs_dir3_data_check( }XFS_WANT_CORRUPTED_RETURN (i <be32_to_cpu (btp->count)); } - p +=xfs_dir2_data_entsize (dep->namelen); + p +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Need to have seen all the entries and all the bestfree slots.
@@ -520,8 +520,8 @@ xfs_dir2_data_freescan(else { dep = (xfs_dir2_data_entry_t *)p;ASSERT ((char *)dep - (char *)hdr == -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep))); - p +=xfs_dir2_data_entsize (dep->namelen); +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep))); + p +=xfs_dir3_data_entsize (mp, dep->namelen); } } }
@@ -611,7 +611,8 @@ xfs_dir2_data_log_entry(struct xfs_buf *bp, xfs_dir2_data_entry_t *dep) /* data entry pointer */ { - xfs_dir2_data_hdr_t *hdr = bp->b_addr; + struct xfs_dir2_data_hdr *hdr = bp->b_addr; +struct xfs_mount *mp = tp->t_mountp; ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -619,7 +620,7 @@ xfs_dir2_data_log_entry( hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));xfs_trans_log_buf (tp, bp, (uint)((char *)dep - (char *)hdr), - (uint)((char *)(xfs_dir2_data_entry_tag_p (dep) +1 ) - + (uint)((char *)(xfs_dir3_data_entry_tag_p (mp, dep) +1 ) - (char *)hdr -1 )); }
libxfs/xfs_dir2_leaf.c +3 -3
@@ -677,7 +677,7 @@ xfs_dir2_leaf_addname( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); bestsp =xfs_dir2_leaf_bests_p (ltp); - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * See if there are any entries with the same hash value
@@ -878,7 +878,7 @@ xfs_dir2_leaf_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Need to scan fix up the bestfree table.
@@ -1409,7 +1409,7 @@ xfs_dir2_leaf_removename(*/ xfs_dir2_data_make_free (tp, dbp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * We just mark the leaf entry stale by putting a null in it. */
libxfs/xfs_dir2_node.c +4 -4
@@ -587,7 +587,7 @@ xfs_dir2_leafn_lookup_for_addname(ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); } - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * Loop over leaf entries with the right hash value. */
@@ -1241,7 +1241,7 @@ xfs_dir2_leafn_remove( longest =be16_to_cpu (bf[0 ].length); needlog = needscan =0 ;xfs_dir2_data_make_free (tp, dbp, off, -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Rescan the data block freespaces for bestfree. * Log the data block header if needed.
@@ -1693,7 +1693,7 @@ xfs_dir2_node_addname_int( dp = args->dp; mp = dp->i_mount; tp = args->trans; - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * If we came in with a freespace block that means that lookup * found an entry with our hash value. This is the freespace
@@ -1989,7 +1989,7 @@ xfs_dir2_node_addname_int( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, dbp, dep);/*
libxfs/xfs_dir2_priv.h +17 -27
93 lines not on this page · raw message
libxfs/xfs_dir2_sf.c +72 -50
319 lines not on this page · raw message
logprint/log_misc.c +30 -28
114 lines not on this page · raw message
repair/dir2.c +19 -18
@@ -651,6 +651,7 @@ _("would correct bad hashval in interior dir block\n"*/ void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep) {
@@ -680,10 +681,10 @@ process_sf_dir2_fixi8(xfs_dir2_sf_put_offset (newsfep,xfs_dir2_sf_get_offset (oldsfep));memmove (newsfep->name, oldsfep->name, newsfep->namelen); - ino =xfs_dir2_sfe_get_ino (oldsfp, oldsfep); -xfs_dir2_sfe_put_ino (newsfp, newsfep, ino); - oldsfep =xfs_dir2_sf_nextentry (oldsfp, oldsfep); - newsfep =xfs_dir2_sf_nextentry (newsfp, newsfep); + ino =xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep); +xfs_dir3_sfe_put_ino (mp, newsfp, newsfep, ino); + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep); + newsfep =xfs_dir3_sf_nextentry (mp, newsfp, newsfep); } *next_sfep = newsfep;free (oldsfp);
@@ -708,8 +709,8 @@ process_sf_dir2_fixoff(for (i =0 ; i < sfp->count; i++) {xfs_dir2_sf_put_offset (sfep, offset); - offset +=xfs_dir2_data_entsize (sfep->namelen); - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + offset +=xfs_dir3_data_entsize (mp, sfep->namelen); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); } }
@@ -771,7 +772,7 @@ process_sf_dir2(/* * check for bad entry count */ -if (num_entries *xfs_dir2_sf_entsize (sfp,1 ) + +if (num_entries *xfs_dir3_sf_entsize (mp, sfp,1 ) +xfs_dir2_sf_hdr_size (0 ) > max_size || num_entries ==0 ) num_entries =0xFF ;
@@ -787,7 +788,7 @@ process_sf_dir2( sfep = next_sfep; junkit =0 ; bad_sfnamelen =0 ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep);/* * if entry points to self, junk it since only '.' or '..' * should do that and shortform dirs don't contain either
@@ -904,7 +905,7 @@ _("zero length entry in shortform dir %" PRIu64 ""),break ; } }else if ((__psint_t ) sfep - (__psint_t ) sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) { bad_sfnamelen =1 ;
@@ -975,7 +976,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), bad_offset =1 ; } offset =xfs_dir2_sf_get_offset (sfep) + -xfs_dir2_data_entsize (namelen); +xfs_dir3_data_entsize (mp, namelen);/* * junk the entry by copying up the rest of the
@@ -992,7 +993,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), name[namelen] ='\0' ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen);be64_add_cpu (&dip->di_size, -tmp_elen); ino_dir_size -= tmp_elen;
@@ -1046,8 +1047,8 @@ _("would have junked entry \"%s\" in directory inode %" PRIu64 "\n"), next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -1078,7 +1079,7 @@ _("would have corrected i8 count in directory %" PRIu64 " from %d to %d\n"),_ ("corrected i8 count in directory %" PRIu64", was %d, now %d\n" ), ino, sfp->i8count, i8);if (i8 ==0 ) -process_sf_dir2_fixi8 (sfp, &next_sfep); +process_sf_dir2_fixi8 (mp, sfp, &next_sfep);else sfp->i8count = i8; *dino_dirty =1 ;
@@ -1271,12 +1272,12 @@ process_dir2_data(continue ; } dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); lastfree =0 ; }/*
@@ -1533,7 +1534,7 @@ _("entry \"%*.*s\" in directory inode %" PRIu64 " points to self: "),/* * Advance to the next entry. */ - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Check the bestfree table.
repair/dir2.h +1 -0
@@ -72,6 +72,7 @@ process_dir2(void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep);
repair/phase6.c +11 -11
@@ -1518,12 +1518,12 @@ longform_dir2_entry_check_data(/* validate data entry size */ dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* did we find an empty or corrupt block? */
@@ -1612,7 +1612,7 @@ longform_dir2_entry_check_data( } addr =xfs_dir2_db_off_to_dataptr (mp, db, ptr - (char *)d); dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); inum =be64_to_cpu (dep->inumber); lastfree =0 ;/*
@@ -2244,7 +2244,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, bad_sfnamelen =0 ; tmp_sfep =NULL ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep); namelen = sfep->namelen;
@@ -2273,7 +2273,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,break ; } }else if (no_modify && (__psint_t ) sfep - (__psint_t ) sfp + - +xfs_dir2_sf_entsize (sfp, sfep->namelen) + +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ip->i_d.di_size) { bad_sfnamelen =1 ;
@@ -2303,7 +2303,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,if (no_modify &&verify_inum (mp, lino)) { next_sfep = (xfs_dir2_sf_entry_t *)((__psint_t )sfep + -xfs_dir2_sf_entsize (sfp, sfep->namelen)); +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen));continue ; }
@@ -2411,7 +2411,7 @@ do_junkit:if (lino == orphanage_ino) orphanage_ino =0 ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen); tmp_sfep = (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + tmp_elen);
@@ -2464,8 +2464,8 @@ do_junkit: next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -2476,7 +2476,7 @@ do_junkit: }else {if (i8 ==0 ) { tmp_sfep = next_sfep; -process_sf_dir2_fixi8 (sfp, &tmp_sfep); +process_sf_dir2_fixi8 (mp, sfp, &tmp_sfep); bytes_deleted += (__psint_t )next_sfep - (__psint_t )tmp_sfep;
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 47/55] xfs: Add read-only support for dirent filetype field
Quoted 26 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Quoted 7 lines
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the
xfs_namestructures passed around is added, but the directory code does not use this field yet. That will be in the next patch.Signed-off-by Dave Chinner<[email protected]>---
Looks good. Same as kernel
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH v2 47/55 xfs: Add read-only support for dirent filetype field
In reply to Dave Chinnerxfs: Add read-only support for dirent filetype field
From: Dave Chinner <[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the xfs_name structures passed around is added, but the directory code does not use this field yet. That will be in the next patch.
---
V2: rebase for changes in xfs_sb.h earlier in series as a result of
review comments.
db/check.c | 12 +-- db/dir2.c | 10 +-- db/dir2sf.c | 9 ++- db/metadump.c | 10 +-- include/xfs_da_btree.h | 1 + include/xfs_dir2.h | 9 ++- include/xfs_dir2_format.h | 183 ++++++++++++++++++++++++++++++++++++++++------ include/xfs_sb.h | 23 ++++-- include/xfs_types.h | 1 + libxfs/xfs_dir2.c | 5 +- libxfs/xfs_dir2_block.c | 18 ++--- libxfs/xfs_dir2_data.c | 13 ++-- libxfs/xfs_dir2_leaf.c | 6 +- libxfs/xfs_dir2_node.c | 8 +- libxfs/xfs_dir2_priv.h | 44 +++++------ libxfs/xfs_dir2_sf.c | 122 ++++++++++++++++++------------- logprint/log_misc.c | 58 ++++++++------- repair/dir2.c | 37 +++++----- repair/dir2.h | 1 + repair/phase6.c | 22 +++--- 20 files changed, 381 insertions(+), 211 deletions(-)
db/check.c +6 -6
@@ -2310,7 +2310,7 @@ process_data_dir_v2( (int)((char *)dep - (char *)data)); error++; } - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep);if ((char *)tagp >= endptr) {if (!sflag || v) dbprintf(_("dir %lld block %d bad entry at %d\n"),
@@ -2325,7 +2325,7 @@ process_data_dir_v2( xname.name = dep->name; xname.len = dep->namelen;dir_hash_add (mp->m_dirnameops->hashname (&xname), addr); - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); count++; lastfree =0 ; lino =be64_to_cpu (dep->inumber);
@@ -3436,7 +3436,7 @@ process_sf_dir_v2( sfe =xfs_dir2_sf_firstentry (sf); offset =XFS_DIR3_DATA_FIRST_OFFSET (mp);for (i = sf->count -1 , i8 =0 ; i >=0 ; i--) { -if ((__psint_t )sfe +xfs_dir2_sf_entsize (sf, sfe->namelen) - +if ((__psint_t )sfe +xfs_dir3_sf_entsize (mp, sf, sfe->namelen) - (__psint_t )sf >be64_to_cpu (dip->di_size)) {if (!sflag) dbprintf(_("dir %llu bad size in entry at %d\n"),
@@ -3445,7 +3445,7 @@ process_sf_dir_v2( error++;break ; } - lino =xfs_dir2_sfe_get_ino (sf, sfe); + lino =xfs_dir3_sfe_get_ino (mp, sf, sfe);if (lino >XFS_DIR2_MAX_SHORT_INUM ) i8++; cid =find_inode (lino,1 );
@@ -3475,8 +3475,8 @@ process_sf_dir_v2( } offset =xfs_dir2_sf_get_offset (sfe) + -xfs_dir2_sf_entsize (sf, sfe->namelen); - sfe =xfs_dir2_sf_nextentry (sf, sfe); +xfs_dir3_sf_entsize (mp, sf, sfe->namelen); + sfe =xfs_dir3_sf_nextentry (mp, sf, sfe); }if (i <0 && (__psint_t )sfe - (__psint_t )sf !=be64_to_cpu (dip->di_size)) {
db/dir2.c +5 -5
@@ -222,7 +222,7 @@ __dir2_data_entries_count( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return i;
@@ -246,7 +246,7 @@ __dir2_data_entry_offset( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return ptr;
@@ -495,7 +495,7 @@ dir2_data_union_tag_count( end = (char *)&dep->namelen +sizeof (dep->namelen);if (end > (char *)obj + mp->m_dirblksize)return 0 ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); } end = (char *)tagp +sizeof (*tagp);return end <= (char *)obj + mp->m_dirblksize;
@@ -517,7 +517,7 @@ dir2_data_union_tag_offset(return bitize ((int )((char *)xfs_dir2_data_unused_tag_p (dup) - (char *)dup)); dep = (xfs_dir2_data_entry_t *)dup; -return bitize ((int )((char *)xfs_dir2_data_entry_tag_p (dep) - +return bitize ((int )((char *)xfs_dir3_data_entry_tag_p (mp, dep) - (char *)dep)); }
@@ -592,7 +592,7 @@ dir2_data_union_size(return bitize (be16_to_cpu (dup->length)); else { dep = (xfs_dir2_data_entry_t *)dup; -return bitize (xfs_dir2_data_entsize (dep->namelen)); +return bitize (xfs_dir3_data_entsize (mp, dep->namelen)); } }
db/dir2sf.c +5 -4
@@ -24,6 +24,7 @@#include "bit.h" #include "dir2.h" #include "dir2sf.h" +#include "init.h" static int dir2_inou_i4_count (void *obj,int startoff);static int dir2_inou_i8_count (void *obj,int startoff);
@@ -155,8 +156,8 @@ dir2_sf_entry_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); -return bitize ((int )xfs_dir2_sf_entsize (sf, e->namelen)); + e =xfs_dir3_sf_nextentry (mp, sf, e); +return bitize ((int )xfs_dir3_sf_entsize (mp, sf, e->namelen)); }/*ARGSUSED*/
@@ -200,7 +201,7 @@ dir2_sf_list_offset( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
@@ -220,6 +221,6 @@ dir2sf_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < sf->count; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
db/metadump.c +5 -5
@@ -939,7 +939,7 @@ obfuscate_sf_dir( namelen = ino_dir_size - ((char *)&sfep->name[0 ] - (char *)sfp); }else if ((char *)sfep - (char *)sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) > +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) {if (show_warnings) print_warning("entry length in dir inode %llu "
@@ -950,11 +950,11 @@ obfuscate_sf_dir( (char *)sfp); } -generate_obfuscated_name (xfs_dir2_sfe_get_ino (sfp, sfep), +generate_obfuscated_name (xfs_dir3_sfe_get_ino (mp, sfp, sfep), namelen, &sfep->name[0 ]); sfep = (xfs_dir2_sf_entry_t *)((char *)sfep + -xfs_dir2_sf_entsize (sfp, namelen)); +xfs_dir3_sf_entsize (mp, sfp, namelen)); } }
@@ -1184,7 +1184,7 @@ obfuscate_dir_data_blocks( } dep = (xfs_dir2_data_entry_t *)ptr; - length =xfs_dir2_data_entsize (dep->namelen); + length =xfs_dir3_data_entsize (mp, dep->namelen);if (dir_offset + length > dir_data.end_of_data || ptr + length > endptr) {
@@ -1194,7 +1194,7 @@ obfuscate_dir_data_blocks( (long long)cur_ino);break ; } -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != dir_offset) { dir_data.bad_block =1 ;break ;
include/xfs_da_btree.h +1 -0
@@ -176,6 +176,7 @@ enum xfs_dacmp { typedef struct xfs_da_args { const __uint8_t *name; /* string (maybe not NULL terminated) */ int namelen; /* length of string (maybe no NULL) */ + __uint8_t filetype; /* filetype of inode for directories */ __uint8_t *value; /* set of bytes (maybe contain NULLs) */ int valuelen; /* length of value */ int flags; /* argument flags (eg: ATTR_NOCREATE) */
include/xfs_dir2.h +5 -4
@@ -68,10 +68,11 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp);extern void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *sfp,xfs_ino_t ino); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep); -extern void xfs_dir2_sfe_put_ino (struct xfs_dir2_sf_hdr *, -struct xfs_dir2_sf_entry *sfep,xfs_ino_t ino); +extern xfs_ino_t xfs_dir3_sfe_get_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *sfp,struct xfs_dir2_sf_entry *sfep); +extern void xfs_dir3_sfe_put_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *hdr,struct xfs_dir2_sf_entry *sfep, +xfs_ino_t ino);extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);
include/xfs_dir2_format.h +160 -23
260 lines not on this page · raw message
include/xfs_sb.h +16 -7
@@ -555,12 +555,6 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; } -static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -} - -/* * Extended v5 superblock feature masks. These are to be used for new v5 * superblock features only.
@@ -599,7 +593,9 @@ xfs_sb_has_ro_compat_feature(return (sbp->sb_features_ro_compat & feature) !=0 ; } +#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0)/* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALLstatic inline bool xfs_sb_has_incompat_feature(
@@ -619,11 +615,25 @@ xfs_sb_has_incompat_log_feature(return (sbp->sb_features_log_incompat & feature) !=0 ; } +/* +* V5 superblock specific feature checks +*/ +static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; +} +static inline int xfs_sb_version_has_pquotino (xfs_sb_t *sbp) {return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; } +static inline int xfs_sb_version_hasftype (struct xfs_sb *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && +xfs_sb_has_incompat_feature (sbp,XFS_SB_FEAT_INCOMPAT_FTYPE ); +} +/* * end of superblock version macros */
@@ -636,7 +646,6 @@ xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino) ino == sbp->sb_pquotino); } -#define XFS_SB_DADDR ((xfs_daddr_t)0)/* daddr in filesystem/ag */ #define XFS_SB_BLOCK (mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)#define XFS_BUF_TO_SBP (bp) ((xfs_dsb_t *)((bp)->b_addr))
include/xfs_types.h +1 -0
@@ -140,6 +140,7 @@ typedef enum {struct xfs_name {const unsigned char *name;int len; +int type; };/*
libxfs/xfs_dir2.c +4 -1
@@ -18,7 +18,8 @@#include <xfs.h> -struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 }; +struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 ,XFS_DIR3_FT_DIR }; +/* * ASCII case-insensitive (ie. A-Z) support for directories that was
@@ -367,6 +368,7 @@ xfs_dir_replace(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.inumber = inum; args.dp = dp;
@@ -414,6 +416,7 @@ xfs_dir_canenter(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.dp = dp; args.whichfork =XFS_DATA_FORK ;
libxfs/xfs_dir2_block.c +9 -9
@@ -107,7 +107,7 @@ const struct xfs_buf_ops xfs_dir3_block_buf_ops = { .verify_write = xfs_dir3_block_write_verify, }; -static int +int xfs_dir3_block_read( struct xfs_trans *tp, struct xfs_inode *dp,
@@ -350,7 +350,7 @@ xfs_dir2_block_addname(if (error)return error; - len =xfs_dir2_data_entsize (args->namelen); + len =xfs_dir3_data_entsize (mp, args->namelen);/* * Set up pointers to parts of the block.
@@ -530,7 +530,7 @@ xfs_dir2_block_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, args->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Clean up the bestfree array and log the header, tail, and entry.
@@ -780,7 +780,7 @@ xfs_dir2_block_removename( needlog = needscan =0 ;xfs_dir2_data_make_free (tp, bp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Fix up the block tail. */
@@ -1140,7 +1140,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (dp->i_ino); dep->namelen =1 ; dep->name[0 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[0 ].hashval =cpu_to_be32 (xfs_dir_hash_dot);
@@ -1153,7 +1153,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (xfs_dir2_sf_get_parent_ino (sfp)); dep->namelen =2 ; dep->name[0 ] = dep->name[1 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[1 ].hashval =cpu_to_be32 (xfs_dir_hash_dotdot);
@@ -1198,10 +1198,10 @@ xfs_dir2_sf_to_block(* Copy a real entry. */ dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); - dep->inumber =cpu_to_be64 (xfs_dir2_sfe_get_ino (sfp, sfep)); + dep->inumber =cpu_to_be64 (xfs_dir3_sfe_get_ino (mp, sfp, sfep)); dep->namelen = sfep->namelen;memcpy (dep->name, sfep->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); name.name = sfep->name;
@@ -1214,7 +1214,7 @@ xfs_dir2_sf_to_block(if (++i == sfp->count) sfep =NULL ;else - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); }/* Done with the temporary buffer */ kmem_free (sfp);
libxfs/xfs_dir2_data.c +7 -6
@@ -131,7 +131,7 @@ __xfs_dir3_data_check(XFS_WANT_CORRUPTED_RETURN ( !xfs_dir_ino_validate (mp,be64_to_cpu (dep->inumber)));XFS_WANT_CORRUPTED_RETURN ( -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) == +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) == (char *)dep - (char *)hdr); count++; lastfree =0 ;
@@ -150,7 +150,7 @@ __xfs_dir3_data_check( }XFS_WANT_CORRUPTED_RETURN (i <be32_to_cpu (btp->count)); } - p +=xfs_dir2_data_entsize (dep->namelen); + p +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Need to have seen all the entries and all the bestfree slots.
@@ -520,8 +520,8 @@ xfs_dir2_data_freescan(else { dep = (xfs_dir2_data_entry_t *)p;ASSERT ((char *)dep - (char *)hdr == -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep))); - p +=xfs_dir2_data_entsize (dep->namelen); +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep))); + p +=xfs_dir3_data_entsize (mp, dep->namelen); } } }
@@ -611,7 +611,8 @@ xfs_dir2_data_log_entry(struct xfs_buf *bp, xfs_dir2_data_entry_t *dep) /* data entry pointer */ { - xfs_dir2_data_hdr_t *hdr = bp->b_addr; + struct xfs_dir2_data_hdr *hdr = bp->b_addr; +struct xfs_mount *mp = tp->t_mountp; ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -619,7 +620,7 @@ xfs_dir2_data_log_entry( hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));xfs_trans_log_buf (tp, bp, (uint)((char *)dep - (char *)hdr), - (uint)((char *)(xfs_dir2_data_entry_tag_p (dep) +1 ) - + (uint)((char *)(xfs_dir3_data_entry_tag_p (mp, dep) +1 ) - (char *)hdr -1 )); }
libxfs/xfs_dir2_leaf.c +3 -3
@@ -677,7 +677,7 @@ xfs_dir2_leaf_addname( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); bestsp =xfs_dir2_leaf_bests_p (ltp); - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * See if there are any entries with the same hash value
@@ -878,7 +878,7 @@ xfs_dir2_leaf_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Need to scan fix up the bestfree table.
@@ -1409,7 +1409,7 @@ xfs_dir2_leaf_removename(*/ xfs_dir2_data_make_free (tp, dbp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * We just mark the leaf entry stale by putting a null in it. */
libxfs/xfs_dir2_node.c +4 -4
@@ -587,7 +587,7 @@ xfs_dir2_leafn_lookup_for_addname(ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); } - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * Loop over leaf entries with the right hash value. */
@@ -1241,7 +1241,7 @@ xfs_dir2_leafn_remove( longest =be16_to_cpu (bf[0 ].length); needlog = needscan =0 ;xfs_dir2_data_make_free (tp, dbp, off, -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Rescan the data block freespaces for bestfree. * Log the data block header if needed.
@@ -1693,7 +1693,7 @@ xfs_dir2_node_addname_int( dp = args->dp; mp = dp->i_mount; tp = args->trans; - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * If we came in with a freespace block that means that lookup * found an entry with our hash value. This is the freespace
@@ -1989,7 +1989,7 @@ xfs_dir2_node_addname_int( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, dbp, dep);/*
libxfs/xfs_dir2_priv.h +17 -27
93 lines not on this page · raw message
libxfs/xfs_dir2_sf.c +72 -50
319 lines not on this page · raw message
logprint/log_misc.c +30 -28
114 lines not on this page · raw message
repair/dir2.c +19 -18
@@ -651,6 +651,7 @@ _("would correct bad hashval in interior dir block\n"*/ void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep) {
@@ -680,10 +681,10 @@ process_sf_dir2_fixi8(xfs_dir2_sf_put_offset (newsfep,xfs_dir2_sf_get_offset (oldsfep));memmove (newsfep->name, oldsfep->name, newsfep->namelen); - ino =xfs_dir2_sfe_get_ino (oldsfp, oldsfep); -xfs_dir2_sfe_put_ino (newsfp, newsfep, ino); - oldsfep =xfs_dir2_sf_nextentry (oldsfp, oldsfep); - newsfep =xfs_dir2_sf_nextentry (newsfp, newsfep); + ino =xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep); +xfs_dir3_sfe_put_ino (mp, newsfp, newsfep, ino); + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep); + newsfep =xfs_dir3_sf_nextentry (mp, newsfp, newsfep); } *next_sfep = newsfep;free (oldsfp);
@@ -708,8 +709,8 @@ process_sf_dir2_fixoff(for (i =0 ; i < sfp->count; i++) {xfs_dir2_sf_put_offset (sfep, offset); - offset +=xfs_dir2_data_entsize (sfep->namelen); - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + offset +=xfs_dir3_data_entsize (mp, sfep->namelen); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); } }
@@ -771,7 +772,7 @@ process_sf_dir2(/* * check for bad entry count */ -if (num_entries *xfs_dir2_sf_entsize (sfp,1 ) + +if (num_entries *xfs_dir3_sf_entsize (mp, sfp,1 ) +xfs_dir2_sf_hdr_size (0 ) > max_size || num_entries ==0 ) num_entries =0xFF ;
@@ -787,7 +788,7 @@ process_sf_dir2( sfep = next_sfep; junkit =0 ; bad_sfnamelen =0 ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep);/* * if entry points to self, junk it since only '.' or '..' * should do that and shortform dirs don't contain either
@@ -904,7 +905,7 @@ _("zero length entry in shortform dir %" PRIu64 ""),break ; } }else if ((__psint_t ) sfep - (__psint_t ) sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) { bad_sfnamelen =1 ;
@@ -975,7 +976,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), bad_offset =1 ; } offset =xfs_dir2_sf_get_offset (sfep) + -xfs_dir2_data_entsize (namelen); +xfs_dir3_data_entsize (mp, namelen);/* * junk the entry by copying up the rest of the
@@ -992,7 +993,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), name[namelen] ='\0' ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen);be64_add_cpu (&dip->di_size, -tmp_elen); ino_dir_size -= tmp_elen;
@@ -1046,8 +1047,8 @@ _("would have junked entry \"%s\" in directory inode %" PRIu64 "\n"), next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -1078,7 +1079,7 @@ _("would have corrected i8 count in directory %" PRIu64 " from %d to %d\n"),_ ("corrected i8 count in directory %" PRIu64", was %d, now %d\n" ), ino, sfp->i8count, i8);if (i8 ==0 ) -process_sf_dir2_fixi8 (sfp, &next_sfep); +process_sf_dir2_fixi8 (mp, sfp, &next_sfep);else sfp->i8count = i8; *dino_dirty =1 ;
@@ -1271,12 +1272,12 @@ process_dir2_data(continue ; } dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); lastfree =0 ; }/*
@@ -1533,7 +1534,7 @@ _("entry \"%*.*s\" in directory inode %" PRIu64 " points to self: "),/* * Advance to the next entry. */ - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Check the bestfree table.
repair/dir2.h +1 -0
@@ -72,6 +72,7 @@ process_dir2(void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep);
repair/phase6.c +11 -11
@@ -1518,12 +1518,12 @@ longform_dir2_entry_check_data(/* validate data entry size */ dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* did we find an empty or corrupt block? */
@@ -1612,7 +1612,7 @@ longform_dir2_entry_check_data( } addr =xfs_dir2_db_off_to_dataptr (mp, db, ptr - (char *)d); dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); inum =be64_to_cpu (dep->inumber); lastfree =0 ;/*
@@ -2244,7 +2244,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, bad_sfnamelen =0 ; tmp_sfep =NULL ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep); namelen = sfep->namelen;
@@ -2273,7 +2273,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,break ; } }else if (no_modify && (__psint_t ) sfep - (__psint_t ) sfp + - +xfs_dir2_sf_entsize (sfp, sfep->namelen) + +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ip->i_d.di_size) { bad_sfnamelen =1 ;
@@ -2303,7 +2303,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,if (no_modify &&verify_inum (mp, lino)) { next_sfep = (xfs_dir2_sf_entry_t *)((__psint_t )sfep + -xfs_dir2_sf_entsize (sfp, sfep->namelen)); +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen));continue ; }
@@ -2411,7 +2411,7 @@ do_junkit:if (lino == orphanage_ino) orphanage_ino =0 ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen); tmp_sfep = (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + tmp_elen);
@@ -2464,8 +2464,8 @@ do_junkit: next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -2476,7 +2476,7 @@ do_junkit: }else {if (i8 ==0 ) { tmp_sfep = next_sfep; -process_sf_dir2_fixi8 (sfp, &tmp_sfep); +process_sf_dir2_fixi8 (mp, sfp, &tmp_sfep); bytes_deleted += (__psint_t )next_sfep - (__psint_t )tmp_sfep;
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 48/55 xfs: Add write support for dirent filetype field
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Add support to propagate and add filetype values into the on-disk directs. This involves passing the filetype into the xfs_da_args structure along with the name and namelength for direct operations, and encoding it into the dirent at the same time we write the inode number into the dirent.
--- include/xfs_sb.h | 3 ++- libxfs/xfs_dir2_block.c | 7 +++++++ libxfs/xfs_dir2_data.c | 2 ++ libxfs/xfs_dir2_leaf.c | 3 +++ libxfs/xfs_dir2_node.c | 3 +++ libxfs/xfs_dir2_sf.c | 35 +++++++++++++++++++++++++++-------- 6 files changed, 44 insertions(+), 9 deletions(-)
include/xfs_sb.h +2 -1
@@ -594,7 +594,8 @@ xfs_sb_has_ro_compat_feature( }#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0)/* filetype in dirent */ -#define XFS_SB_FEAT_INCOMPAT_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_ALL \ + (XFS_SB_FEAT_INCOMPAT_FTYPE)#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL static inline bool
libxfs/xfs_dir2_block.c +7 -0
@@ -530,6 +530,7 @@ xfs_dir2_block_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, args->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/*
@@ -622,6 +623,7 @@ xfs_dir2_block_lookup(* Fill in inode number, CI name if appropriate, release the block. */ args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (mp, dep); error =xfs_dir_cilookup_result (args, dep->name, dep->namelen);xfs_trans_brelse (args->trans, bp);return XFS_ERROR (error);
@@ -854,6 +856,7 @@ xfs_dir2_block_replace(* Change the inode number to the new value. */ dep->inumber =cpu_to_be64 (args->inumber); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype);xfs_dir2_data_log_entry (args->trans, bp, dep);xfs_dir3_data_check (dp, bp);return 0 ;
@@ -1140,6 +1143,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (dp->i_ino); dep->namelen =1 ; dep->name[0 ] ='.' ; +xfs_dir3_dirent_put_ftype (mp, dep,XFS_DIR3_FT_DIR ); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep);
@@ -1153,6 +1157,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (xfs_dir2_sf_get_parent_ino (sfp)); dep->namelen =2 ; dep->name[0 ] = dep->name[1 ] ='.' ; +xfs_dir3_dirent_put_ftype (mp, dep,XFS_DIR3_FT_DIR ); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep);
@@ -1200,6 +1205,8 @@ xfs_dir2_sf_to_block( dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); dep->inumber =cpu_to_be64 (xfs_dir3_sfe_get_ino (mp, sfp, sfep)); dep->namelen = sfep->namelen; +xfs_dir3_dirent_put_ftype (mp, dep, +xfs_dir3_sfe_get_ftype (mp, sfp, sfep));memcpy (dep->name, sfep->name, dep->namelen); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);
libxfs/xfs_dir2_data.c +2 -0
@@ -133,6 +133,8 @@ __xfs_dir3_data_check(XFS_WANT_CORRUPTED_RETURN (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) == (char *)dep - (char *)hdr); +XFS_WANT_CORRUPTED_RETURN ( +xfs_dir3_dirent_get_ftype (mp, dep) <XFS_DIR3_FT_MAX ); count++; lastfree =0 ; if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
libxfs/xfs_dir2_leaf.c +3 -0
@@ -878,6 +878,7 @@ xfs_dir2_leaf_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/*
@@ -1207,6 +1208,7 @@ xfs_dir2_leaf_lookup(* Return the found inode number & CI name if appropriate */ args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (dp->i_mount, dep); error =xfs_dir_cilookup_result (args, dep->name, dep->namelen);xfs_trans_brelse (tp, dbp);xfs_trans_brelse (tp, lbp);
@@ -1537,6 +1539,7 @@ xfs_dir2_leaf_replace(* Put the new inode number in, log it. */ dep->inumber =cpu_to_be64 (args->inumber); +xfs_dir3_dirent_put_ftype (dp->i_mount, dep, args->filetype); tp = args->trans;xfs_dir2_data_log_entry (tp, dbp, dep);xfs_dir3_leaf_check (dp->i_mount, lbp);
libxfs/xfs_dir2_node.c +3 -0
@@ -798,6 +798,7 @@ xfs_dir2_leafn_lookup_for_entry(xfs_trans_brelse (tp, state->extrablk.bp); args->cmpresult = cmp; args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (mp, dep); *indexp = index; state->extravalid =1 ; state->extrablk.bp = curbp;
@@ -1989,6 +1990,7 @@ xfs_dir2_node_addname_int( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, dbp, dep);
@@ -2209,6 +2211,7 @@ xfs_dir2_node_replace(* Fill in the new inode number and log the entry. */ dep->inumber =cpu_to_be64 (inum); +xfs_dir3_dirent_put_ftype (state->mp, dep, args->filetype);xfs_dir2_data_log_entry (args->trans, state->extrablk.bp, dep); rval =0 ; }
libxfs/xfs_dir2_sf.c +27 -8
@@ -316,6 +316,8 @@ xfs_dir2_block_to_sf(memcpy (sfep->name, dep->name, dep->namelen);xfs_dir3_sfe_put_ino (mp, sfp, sfep,be64_to_cpu (dep->inumber)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_dirent_get_ftype (mp, dep)); sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); }
@@ -479,6 +481,8 @@ xfs_dir2_sf_addname_easy(xfs_dir2_sf_put_offset (sfep, offset);memcpy (sfep->name, args->name, sfep->namelen);xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (dp->i_mount, sfp, sfep, args->filetype); +/* * Update the header and inode. */
@@ -572,6 +576,7 @@ xfs_dir2_sf_addname_hard(xfs_dir2_sf_put_offset (sfep, offset);memcpy (sfep->name, args->name, sfep->namelen);xfs_dir3_sfe_put_ino (mp, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, args->filetype); sfp->count++;#if XFS_BIG_INUMS if (args->inumber >XFS_DIR2_MAX_SHORT_INUM && !objchange)
@@ -808,6 +813,7 @@ xfs_dir2_sf_lookup(if (args->namelen ==1 && args->name[0 ] =='.' ) { args->inumber = dp->i_ino; args->cmpresult =XFS_CMP_EXACT ; + args->filetype =XFS_DIR3_FT_DIR ;return XFS_ERROR (EEXIST ); }/*
@@ -817,6 +823,7 @@ xfs_dir2_sf_lookup( args->name[0] == '.' && args->name[1] == '.') { args->inumber =xfs_dir2_sf_get_parent_ino (sfp); args->cmpresult =XFS_CMP_EXACT ; + args->filetype =XFS_DIR3_FT_DIR ;return XFS_ERROR (EEXIST ); }/*
@@ -836,6 +843,8 @@ xfs_dir2_sf_lookup( args->cmpresult = cmp; args->inumber =xfs_dir3_sfe_get_ino (dp->i_mount, sfp, sfep); + args->filetype =xfs_dir3_sfe_get_ftype (dp->i_mount, + sfp, sfep);if (cmp ==XFS_CMP_EXACT )return XFS_ERROR (EEXIST ); ci_sfep = sfep;
@@ -1035,6 +1044,8 @@ xfs_dir2_sf_replace(#endif xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (dp->i_mount, sfp, sfep, + args->filetype);break ; } }
@@ -1101,10 +1112,12 @@ xfs_dir2_sf_toino4(int oldsize;/* old inode size */ xfs_dir2_sf_entry_t *sfep;/* new sf entry */ xfs_dir2_sf_hdr_t *sfp;/* new sf directory */ +struct xfs_mount *mp;trace_xfs_dir2_sf_toino4 (args); dp = args->dp; + mp = dp->i_mount;/* * Copy the old directory to the buffer.
@@ -1142,13 +1155,15 @@ xfs_dir2_sf_toino4(for (i =0 , sfep =xfs_dir2_sf_firstentry (sfp), oldsfep =xfs_dir2_sf_firstentry (oldsfp); i < sfp->count; - i++, sfep =xfs_dir3_sf_nextentry (dp->i_mount, sfp, sfep), - oldsfep =xfs_dir3_sf_nextentry (dp->i_mount, oldsfp, oldsfep)) { + i++, sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep), + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset;memcpy (sfep->name, oldsfep->name, sfep->namelen); -xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, -xfs_dir3_sfe_get_ino (dp->i_mount, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ino (mp, sfp, sfep, +xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_sfe_get_ftype (mp, oldsfp, oldsfep)); }/* * Clean up the inode.
@@ -1176,10 +1191,12 @@ xfs_dir2_sf_toino8(int oldsize;/* old inode size */ xfs_dir2_sf_entry_t *sfep;/* new sf entry */ xfs_dir2_sf_hdr_t *sfp;/* new sf directory */ +struct xfs_mount *mp;trace_xfs_dir2_sf_toino8 (args); dp = args->dp; + mp = dp->i_mount;/* * Copy the old directory to the buffer.
@@ -1217,13 +1234,15 @@ xfs_dir2_sf_toino8(for (i =0 , sfep =xfs_dir2_sf_firstentry (sfp), oldsfep =xfs_dir2_sf_firstentry (oldsfp); i < sfp->count; - i++, sfep =xfs_dir3_sf_nextentry (dp->i_mount, sfp, sfep), - oldsfep =xfs_dir3_sf_nextentry (dp->i_mount, oldsfp, oldsfep)) { + i++, sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep), + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset;memcpy (sfep->name, oldsfep->name, sfep->namelen); -xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, -xfs_dir3_sfe_get_ino (dp->i_mount, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ino (mp, sfp, sfep, +xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_sfe_get_ftype (mp, oldsfp, oldsfep)); }/* * Clean up the inode.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 48/55] xfs: Add write support for dirent filetype field
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Add support to propagate and add filetype values into the on-disk directs. This involves passing the filetype into the
xfs_da_argsstructure along with the name and namelength for direct operations, and encoding it into the dirent at the same time we write the inode number into the dirent.Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 49/55 xfsprogs: add dtype support to mkfs and db
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that we have an extra field in the dirent, add support into xfs_db to be able to view it when looking at directory structures.
Add support to mkfs to create filesystems with filetype - we'll always set it on CRC enabled filesystems so all new v5 filesystems will have this functionality enabled.
--- db/dir2.c | 43 +++++++++++++++++++++++++++++++++++++++++-- db/dir2.h | 1 + db/dir2sf.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- db/dir2sf.h | 3 +++ db/field.c | 7 +++++++ db/field.h | 3 +++ db/inode.c | 23 +++++++++++++++++++++-- mkfs/xfs_mkfs.c | 7 +++++++ 8 files changed, 134 insertions(+), 5 deletions(-)
db/dir2.c +41 -2
@@ -596,6 +596,25 @@ dir2_data_union_size( } } +static int +dir3_data_union_ftype_offset ( +void *obj, +int startoff, +int idx) +{ +xfs_dir2_data_entry_t *dep; +xfs_dir2_data_unused_t *dup; + +ASSERT (bitoffs (startoff) ==0 ); +ASSERT (idx ==0 ); + dup = (xfs_dir2_data_unused_t *)((char *)obj +byteize (startoff)); +if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) +return bitize ((int )((char *)xfs_dir2_data_unused_tag_p (dup) - + (char *)dup)); + dep = (xfs_dir2_data_entry_t *)dup; +return bitize ((int )((char *)&dep->name[dep->namelen] - (char *)dep)); +} +/* * Free block functions */
@@ -851,7 +870,7 @@ const field_t dir3_hfld[] = {const field_t dir3_flds[] = { {"bhdr" ,FLDT_DIR3_DATA_HDR ,OI (B3OFF (hdr)), dir3_block_hdr_count,FLD_COUNT ,TYP_NONE }, - {"bu" ,FLDT_DIR2_DATA_UNION , dir2_block_u_offset, dir2_block_u_count, + {"bu" ,FLDT_DIR3_DATA_UNION , dir2_block_u_offset, dir2_block_u_count,FLD_ARRAY |FLD_OFFSET |FLD_COUNT ,TYP_NONE }, {"bleaf" ,FLDT_DIR2_LEAF_ENTRY , dir2_block_leaf_offset, dir2_block_leaf_count,FLD_ARRAY |FLD_OFFSET |FLD_COUNT ,TYP_NONE },
@@ -859,7 +878,7 @@ const field_t dir3_flds[] = { dir3_block_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE }, {"dhdr" ,FLDT_DIR3_DATA_HDR ,OI (D3OFF (hdr)), dir3_data_hdr_count, FLD_COUNT, TYP_NONE }, - { "du", FLDT_DIR2_DATA_UNION, dir2_data_u_offset, dir2_data_u_count, + { "du", FLDT_DIR3_DATA_UNION, dir2_data_u_offset, dir2_data_u_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE }, { "lhdr", FLDT_DIR3_LEAF_HDR, OI(L3OFF(hdr)), dir3_leaf_hdr_count, FLD_COUNT, TYP_NONE },
@@ -880,6 +899,26 @@ const field_t dir3_flds[] = { { NULL } }; +#define D3EOFF (f) bitize(offsetof(xfs_dir2_data_entry_t, f)) +#define D3UOFF (f) bitize(offsetof(xfs_dir2_data_unused_t, f)) +const field_t dir3_data_union_flds[] = { + {"freetag" ,FLDT_UINT16X ,OI (D3UOFF (freetag)), + dir2_data_union_freetag_count,FLD_COUNT ,TYP_NONE }, + {"inumber" ,FLDT_INO ,OI (D3EOFF (inumber)), + dir2_data_union_inumber_count,FLD_COUNT ,TYP_INODE }, + {"length" ,FLDT_DIR2_DATA_OFF ,OI (D3UOFF (length)), + dir2_data_union_length_count,FLD_COUNT ,TYP_NONE }, + {"namelen" ,FLDT_UINT8D ,OI (D3EOFF (namelen)), + dir2_data_union_namelen_count,FLD_COUNT ,TYP_NONE }, + {"name" ,FLDT_CHARNS ,OI (D3EOFF (name)), dir2_data_union_name_count, +FLD_COUNT ,TYP_NONE }, + {"filetype" ,FLDT_UINT8D , dir3_data_union_ftype_offset,C1 , +FLD_OFFSET ,TYP_NONE }, + {"tag" ,FLDT_DIR2_DATA_OFF , dir2_data_union_tag_offset, + dir2_data_union_tag_count,FLD_OFFSET |FLD_COUNT ,TYP_NONE }, + {NULL } +}; +#define DBH3OFF (f) bitize(offsetof(struct xfs_dir3_blk_hdr, f))const field_t dir3_blkhdr_flds[] = { {"magic" ,FLDT_UINT32X ,OI (DBH3OFF (magic)),C1 ,0 ,TYP_NONE },
db/dir2.h +1 -0
@@ -48,6 +48,7 @@ extern const field_t dir3_blkhdr_flds[];extern const field_t dir3_data_hdr_flds[];extern const field_t dir3_free_hdr_flds[];extern const field_t dir3_leaf_hdr_flds[]; +extern const field_t dir3_data_union_flds[];extern const field_t da3_blkinfo_flds[];extern const field_t da3_node_hdr_flds[];
db/dir2sf.c +51 -1
67 lines not on this page · raw message
db/dir2sf.h +3 -0
@@ -21,6 +21,9 @@ extern const field_t dir2_inou_flds[];extern const field_t dir2_sf_hdr_flds[];extern const field_t dir2_sf_entry_flds[]; +extern const field_t dir3sf_flds[]; +extern const field_t dir3_sf_entry_flds[]; +extern int dir2sf_size (void *obj,int startoff,int idx);extern int dir2_inou_size (void *obj,int startoff,int idx);extern int dir2_sf_entry_size (void *obj,int startoff,int idx);
db/field.c +7 -0
@@ -235,6 +235,13 @@ const ftattr_t ftattrtab[] = { SI(bitsz(struct xfs_dir3_free_hdr)), 0, NULL, dir3_free_hdr_flds }, { FLDT_DIR3_LEAF_HDR, "dir3_leaf_hdr", NULL, (char *)dir3_leaf_hdr_flds, SI(bitsz(struct xfs_dir3_leaf_hdr)), 0, NULL, dir3_leaf_hdr_flds }, + { FLDT_DIR3_DATA_UNION, "dir3_data_union", NULL, + (char *)dir3_data_union_flds, dir2_data_union_size,FTARG_SIZE ,NULL , + dir3_data_union_flds }, + { FLDT_DIR3_SF_ENTRY, "dir3_sf_entry", NULL, (char *)dir3_sf_entry_flds, + dir2_sf_entry_size, FTARG_SIZE, NULL, dir3_sf_entry_flds }, + { FLDT_DIR3SF, "dir3sf", NULL, (char *)dir3sf_flds, dir2sf_size, + FTARG_SIZE, NULL, dir3sf_flds },/* dir v2/3 node fields */ { FLDT_DA_BLKINFO, "dir_blkinfo", NULL, (char *)da_blkinfo_flds,
db/field.h +3 -0
@@ -116,6 +116,9 @@ typedef enum fldt {FLDT_DIR3_DATA_HDR ,FLDT_DIR3_FREE_HDR ,FLDT_DIR3_LEAF_HDR , +FLDT_DIR3_DATA_UNION , +FLDT_DIR3_SF_ENTRY , +FLDT_DIR3SF ,/* dir v2/3 node fields */ FLDT_DA_BLKINFO,
db/inode.c +21 -2
@@ -47,6 +47,7 @@ static int inode_u_c_count(void *obj, int startoff);static int inode_u_dev_count (void *obj,int startoff);static int inode_u_muuid_count (void *obj,int startoff);static int inode_u_sfdir2_count (void *obj,int startoff); +static int inode_u_sfdir3_count (void *obj,int startoff);static int inode_u_symlink_count (void *obj,int startoff); static const cmdinfo_t inode_cmd =
@@ -78,7 +79,7 @@ const field_t inode_crc_flds[] = { {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 , TYP_INODE }, { "v3", FLDT_DINODE_V3, OI(OFF(magic)), C1, 0, TYP_NONE }, - { "u", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE }, + { "u3", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE }, { "a", FLDT_DINODE_A, inode_a_offset, inode_a_count, FLD_COUNT|FLD_OFFSET, TYP_NONE }, { NULL }
@@ -193,6 +194,7 @@ const field_t inode_u_flds[] = { { "dev", FLDT_DEV, NULL, inode_u_dev_count, FLD_COUNT, TYP_NONE }, { "muuid", FLDT_UUID, NULL, inode_u_muuid_count, FLD_COUNT, TYP_NONE }, { "sfdir2", FLDT_DIR2SF, NULL, inode_u_sfdir2_count, FLD_COUNT, TYP_NONE }, + { "sfdir3", FLDT_DIR3SF, NULL, inode_u_sfdir3_count, FLD_COUNT, TYP_NONE }, { "symlink", FLDT_CHARNS, NULL, inode_u_symlink_count, FLD_COUNT, TYP_NONE }, { NULL }
@@ -557,7 +559,24 @@ inode_u_sfdir2_count(ASSERT ((char *)XFS_DFORK_DPTR (dip) - (char *)dip ==byteize (startoff));return dip->di_format ==XFS_DINODE_FMT_LOCAL && (be16_to_cpu (dip->di_mode) &S_IFMT ) ==S_IFDIR && -xfs_sb_version_hasdirv2 (&mp->m_sb); +xfs_sb_version_hasdirv2 (&mp->m_sb) && + !xfs_sb_version_hasftype (&mp->m_sb); +} + +static int +inode_u_sfdir3_count ( +void *obj, +int startoff) +{ +xfs_dinode_t *dip; + +ASSERT (bitoffs (startoff) ==0 ); +ASSERT (obj == iocur_top->data); + dip = obj; +ASSERT ((char *)XFS_DFORK_DPTR (dip) - (char *)dip ==byteize (startoff)); +return dip->di_format ==XFS_DINODE_FMT_LOCAL && + (be16_to_cpu (dip->di_mode) &S_IFMT ) ==S_IFDIR && +xfs_sb_version_hasftype (&mp->m_sb); }int
mkfs/xfs_mkfs.c +7 -0
@@ -2521,6 +2521,13 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), lsectorsize != BBSIZE), nci, sbp->sb_features2 != 0);/* +* dirent filetype field always enabled on v5 superblocks +*/ +if (crcs_enabled) { + sbp->sb_features_incompat =XFS_SB_FEAT_INCOMPAT_FTYPE ; + } + +/* * Due to a structure alignment issue, sb_features2 ended up in one * of two locations, the second "incorrect" location represented by * the sb_bad_features2 field. To avoid older kernels mounting
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 49/55] xfsprogs: add dtype support to mkfs and db
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now that we have an extra field in the dirent, add support into
xfs_dbto be able to view it when looking at directory structures.Add support to mkfs to create filesystems with filetype - we'll always set it on CRC enabled filesystems so all new v5 filesystems will have this functionality enabled.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 50/55 xfs: di_flushiter considered harmful
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When we made all inode updates transactional, we no longer needed the log recovery detection for inodes being newer on disk than the transaction being replayed - it was redundant as replay of the log would always result in the latest version of the inode woul dbe on disk. It was redundant, but left in place because it wasn't considered to be a problem.
However, with the new "don't read inodes on create" optimisation, flushiter has come back to bite us. Essentially, the optimisation made always initialises flushiter to zero in the create transaction, and so if we then crash and run recovery and the inode already on disk has a non-zero flushiter it will skip recovery of that inode. As a result, log recovery does the wrong thing and we end up with a corrupt filesystem.
Because we have to support old kernel to new kernl upgrades, we can't just get rid of the flushiter support in log recovery as we might be upgrading from a kernel that doesn't have fully transaction inode updates. Unfortunately, for v4 superblocks there is no way to guarantee that log recovery knows about this fact.
We cannot add a new inode format flag to say it's a "special inode create" because it won't be understood by older kernels and so recovery could do the wrong thing on downgrade. We cannot specially detect the combination of zero mode/non-zero flushiter on disk to non-zero mode, zero flushiter in the log item during recovery because wrapping of the flushiter can result in false detection.
Hence that makes this "don't use flushiter" optimisation limited to a disk format that guarantees that we don't need it. And that means the only fix here is to limit the "no read IO on create" optimisation to version 5 superblocks....
--- include/xfs_dinode.h | 3 +++ libxfs/xfs_inode_buf.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-)
include/xfs_dinode.h +3 -0
@@ -39,6 +39,9 @@ typedef struct xfs_timestamp {* There is a very similar struct icdinode in xfs_inode which matches the * layout of the first 96 bytes of this structure, but is kept in native * format instead of big endian. +* +* Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed +* padding field for v3 inodes. */ typedef struct xfs_dinode { __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
libxfs/xfs_inode_buf.c +3 -1
@@ -213,7 +213,6 @@ xfs_dinode_to_disk( to->di_projid_lo =cpu_to_be16 (from->di_projid_lo); to->di_projid_hi =cpu_to_be16 (from->di_projid_hi);memcpy (to->di_pad, from->di_pad,sizeof (to->di_pad)); - to->di_flushiter =cpu_to_be16 (from->di_flushiter); to->di_atime.t_sec =cpu_to_be32 (from->di_atime.t_sec); to->di_atime.t_nsec =cpu_to_be32 (from->di_atime.t_nsec); to->di_mtime.t_sec =cpu_to_be32 (from->di_mtime.t_sec);
@@ -241,6 +240,9 @@ xfs_dinode_to_disk( to->di_lsn =cpu_to_be64 (from->di_lsn);memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2));platform_uuid_copy (&to->di_uuid, &from->di_uuid); + to->di_flushiter =0 ; + }else { + to->di_flushiter =cpu_to_be16 (from->di_flushiter); } }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 50/55] xfs: di_flushiter considered harmful
Quoted 30 lines · Dave Chinner
From: Dave Chinner<[email protected]>
When we made all inode updates transactional, we no longer needed the log recovery detection for inodes being newer on disk than the transaction being replayed - it was redundant as replay of the log would always result in the latest version of the inode woul dbe on disk. It was redundant, but left in place because it wasn't considered to be a problem.
However, with the new "don't read inodes on create" optimisation, flushiter has come back to bite us. Essentially, the optimisation made always initialises flushiter to zero in the create transaction, and so if we then crash and run recovery and the inode already on disk has a non-zero flushiter it will skip recovery of that inode. As a result, log recovery does the wrong thing and we end up with a corrupt filesystem.
Because we have to support old kernel to new kernl upgrades, we can't just get rid of the flushiter support in log recovery as we might be upgrading from a kernel that doesn't have fully transaction inode updates. Unfortunately, for v4 superblocks there is no way to guarantee that log recovery knows about this fact.
We cannot add a new inode format flag to say it's a "special inode create" because it won't be understood by older kernels and so recovery could do the wrong thing on downgrade. We cannot specially detect the combination of zero mode/non-zero flushiter on disk to non-zero mode, zero flushiter in the log item during recovery because wrapping of the flushiter can result in false detection.
Quoted 7 lines
Hence that makes this "don't use flushiter" optimisation limited to a disk format that guarantees that we don't need it. And that means the only fix here is to limit the "no read IO on create" optimisation to version 5 superblocks....
Signed-off-by Dave Chinner<[email protected]>---
user space portion of kernel commit e60896
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 51/55 xfs: fix calculation of the number of node entries in a dir3 node
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The calculation doesn't take into account the size of the dir v3 header, so overestimates the hash entries in a node. This causes directory buffer overruns when splitting and merging nodes.
--- include/xfs_da_btree.h | 11 +++++++++-- libxfs/xfs_dir2.c | 16 ++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-)
include/xfs_da_btree.h +9 -2
@@ -133,12 +133,19 @@ extern void xfs_da3_node_hdr_to_disk(struct xfs_da_intnode *to, struct xfs_da3_icnode_hdr *from);static inline int -xfs_da3_node_hdr_size (struct xfs_da_intnode *dap) +__xfs_da3_node_hdr_size (bool v3) { -if (dap->hdr.info.magic ==cpu_to_be16 (XFS_DA3_NODE_MAGIC )) +if (v3)return sizeof (struct xfs_da3_node_hdr );return sizeof (struct xfs_da_node_hdr ); } +static inline int +xfs_da3_node_hdr_size (struct xfs_da_intnode *dap) +{ +bool v3 = dap->hdr.info.magic ==cpu_to_be16 (XFS_DA3_NODE_MAGIC ); + +return __xfs_da3_node_hdr_size (v3); +}static inline struct xfs_da_node_entry *xfs_da3_node_tree_p (struct xfs_da_intnode *dap)
libxfs/xfs_dir2.c +10 -6
@@ -71,6 +71,9 @@ voidxfs_dir_mount ( xfs_mount_t *mp) { +int nodehdr_size; + +ASSERT (xfs_sb_version_hasdirv2 (&mp->m_sb));ASSERT ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <=XFS_MAX_BLOCKSIZE );
@@ -79,12 +82,13 @@ xfs_dir_mount( 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); - mp->m_dir_node_ents = - (mp->m_dirblksize - (uint )sizeof (xfs_da_node_hdr_t)) / - (uint )sizeof (xfs_da_node_entry_t); + + nodehdr_size =__xfs_da3_node_hdr_size (xfs_sb_version_hascrc (&mp->m_sb)); + mp->m_attr_node_ents = (mp->m_sb.sb_blocksize - nodehdr_size) / + (uint )sizeof (xfs_da_node_entry_t); + mp->m_dir_node_ents = (mp->m_dirblksize - nodehdr_size) / + (uint )sizeof (xfs_da_node_entry_t); + mp->m_dir_magicpct = (mp->m_dirblksize *37 ) /100 ;if (xfs_sb_version_hasasciici (&mp->m_sb)) mp->m_dirnameops = &xfs_ascii_ci_nameops;
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 51/55] xfs: fix calculation of the number of node entries in a dir3 node
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The calculation doesn't take into account the size of the dir v3 header, so overestimates the hash entries in a node. This causes directory buffer overruns when splitting and merging nodes.
Signed-off-by Dave Chinner<[email protected]>---
Looks good, same as kernel commit 37804376.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 52/55 xfs: btree block LSN escaping to disk uninitialised
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When testing LSN ordering code for v5 superblocks, it was discovered that the the LSN embedded in the generic btree blocks was occasionally uninitialised. These values didn't get written to disk by metadata writeback - they got written by previous transactions in log recovery.
The issue is here that the when the block is first allocated and initialised, the LSN field was not initialised - it gets overwritten before IO is issued on the buffer - but the value that is logged by transactions that modify the header before it is written to disk (and initialised) contain garbage. Hence the first recovery of the buffer will stamp garbage into the LSN field, and that can cause subsequent transactions to not replay correctly.
The fix is simply to initialise the bb_lsn field to zero when we initialise the block for the first time.
--- libxfs/xfs_btree.c | 2 ++ 1 file changed, 2 insertions(+)
libxfs/xfs_btree.c +2 -0
@@ -921,6 +921,7 @@ xfs_btree_init_block_int( buf->bb_u.l.bb_owner =cpu_to_be64 (owner);uuid_copy (&buf->bb_u.l.bb_uuid, &mp->m_sb.sb_uuid); buf->bb_u.l.bb_pad =0 ; + buf->bb_u.l.bb_lsn =0 ; } }else {/* owner is a 32 bit value on short blocks */
@@ -932,6 +933,7 @@ xfs_btree_init_block_int( buf->bb_u.s.bb_blkno =cpu_to_be64 (blkno); buf->bb_u.s.bb_owner =cpu_to_be32 (__owner);uuid_copy (&buf->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid); + buf->bb_u.s.bb_lsn =0 ; } } }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 52/55] xfs: btree block LSN escaping to disk uninitialised
Quoted 16 lines · Dave Chinner
From: Dave Chinner<[email protected]>
When testing LSN ordering code for v5 superblocks, it was discovered that the the LSN embedded in the generic btree blocks was occasionally uninitialised. These values didn't get written to disk by metadata writeback - they got written by previous transactions in log recovery.
The issue is here that the when the block is first allocated and initialised, the LSN field was not initialised - it gets overwritten before IO is issued on the buffer - but the value that is logged by transactions that modify the header before it is written to disk (and initialised) contain garbage. Hence the first recovery of the buffer will stamp garbage into the LSN field, and that can cause subsequent transactions to not replay correctly.
Quoted 5 lines
The fix is simply to initialise the
bb_lsnfield to zero when we initialise the block for the first time.Signed-off-by Dave Chinner<[email protected]>---
Looks good, same as kernel commit b58fa554.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 53/55 xfs: inode log reservations are too small
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
We've been seeing occasional problems with log space leaks and transaction underruns such as this for some time:
XFS (dm-0): xlog_write: reservation summary:
trans type = FSYNC_TS (36)
unit res = 2740 bytes
current res = -4 bytes
total reg = 0 bytes (o/flow = 0 bytes)
ophdrs = 0 (ophdr space = 0 bytes)
ophdr + reg = 0 bytes
num regions = 0
Turns out that xfstests generic/311 is reliably reproducing this problem with the test it runs at sequence 16 of it execution. It is a 100% reliable reproducer with the mkfs configuration of "-b size=1024 -m crc=1" on a 10GB scratch device.
The problem? Inode forks in btree format are logged in memory format, not disk format (i.e. bmbt format, not bmdr format). That means there is a btree block header being logged, when such a structure is never written to the inode fork in bmdr format. The bmdr header in the inode is only 4 bytes, while the bmbt header is 24 bytes for v4 filesystems and 72 bytes for v5 filesystems.
We currently reserve the inode size plus the rounded up overhead of a logging a buffer, which is 128 bytes. That means the reservation for a 512 byte inode is 640 bytes. What we can actually log is:
inode core, data and attr fork = 512 bytes inode log format + log op header = 56 + 12 = 68 bytes data fork bmbt hdr = 24/72 bytes
attr fork bmbt hdr = 24/72 bytes
So, for a v2 inodes we can log at least 628 bytes, but if we split that inode over the end of the log across log buffers, we need to also another log op header, which takes us to 640 bytes. If there's another reservation taken out of this that I haven't taken into account (perhaps multiple iclog splits?) or I haven't corectly calculated the bmbt format space used (entirely possible), then we will overun it.
For v3 inodes the maximum is actually 724 bytes, and even a single maximally sized btree format fork can blow it (652 bytes). And that's exactly what is happening with the FSYNC_TS transaction in the above output - it's consumed 644 bytes of space after the CIL context took the space reserved for it (2100 bytes).
This problem has always been present in the XFS code - the btree format inode forks have always been logged in this manner. Hence there has always been the possibility of an overrun with such a transaction. The CRC code has just exposed it frequently enough to be able to debug and understand the root cause....
So, let's fix all the inode log space reservations.
[ I'm so glad we spent the effort to clean up the transaction
reservation code. This is an easy fix now. ]
--- libxfs/xfs_trans_resv.c | 72 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 19 deletions(-)
libxfs/xfs_trans_resv.c +53 -19
@@ -48,6 +48,39 @@ xfs_calc_buf_res( }/* +* Logging inodes is really tricksy. They are logged in memory format, +* which means that what we write into the log doesn't directory translate into +* the amount of space they use on disk. +* +* Case in point - btree format forks in memory format use more space than the +* on-disk format. In memory, the buffer contains a normal btree block header so +* the btree code can treat it as though it is just another generic buffer. +* However, when we write it to the inode fork, we don't write all of this +* header as it isn't needed. e.g. the root is only ever in the inode, so +* there's no need for sibling pointers which would waste 16 bytes of space. +* +* Hence when we have an inode with a maximally sized btree format fork, then +* amount of information we actually log is greater than the size of the inode +* on disk. Hence we need an inode reservation function that calculates all this +* correctly. So, we log: +* +* - log op headers for object +* - inode log format object +* - the entire inode contents (core + 2 forks) +* - two bmap btree block headers +*/ +STATIC uint +xfs_calc_inode_res ( +struct xfs_mount *mp, +uint ninodes) +{ +return ninodes * (sizeof (struct xlog_op_header ) + +sizeof (struct xfs_inode_log_format ) + + mp->m_sb.sb_inodesize + +2 *XFS_BMBT_BLOCK_LEN (mp)); +} + +/* * Various log reservation values. * * These are based on the size of the file system block because that is what
@@ -86,7 +119,7 @@ xfs_calc_write_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 1) + xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), XFS_FSB_TO_B(mp, 1)) + xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
@@ -115,7 +148,7 @@ xfs_calc_itruncate_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 1) + xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1, XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
@@ -145,7 +178,7 @@ xfs_calc_rename_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - MAX((xfs_calc_buf_res(4, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 4) + xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
@@ -170,7 +203,7 @@ xfs_calc_link_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 2) + xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
@@ -195,7 +228,7 @@ xfs_calc_remove_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 2) + xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
@@ -222,7 +255,7 @@ STATIC uintxfs_calc_create_resv_modify ( struct xfs_mount *mp) { -return xfs_calc_buf_res (2 , mp->m_sb.sb_inodesize) + +return xfs_calc_inode_res (mp,2 ) +xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize) + (uint )XFS_FSB_TO_B (mp,1 ) +xfs_calc_buf_res (XFS_DIROP_LOG_COUNT (mp),XFS_FSB_TO_B (mp,1 ));
@@ -332,7 +365,7 @@ xfs_calc_ifree_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + -xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize) + +xfs_calc_inode_res (mp,1 ) +xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,1 )) + MAX((__uint16_t)XFS_FSB_TO_B(mp, 1),
@@ -353,9 +386,8 @@ xfs_calc_ichange_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + - mp->m_sb.sb_inodesize + - mp->m_sb.sb_sectsize + -512 ; +xfs_calc_inode_res (mp,1 ) + +xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize); }
@@ -391,7 +423,7 @@ xfs_calc_growrtalloc_reservation(return xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ),XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize) + +xfs_calc_inode_res (mp,1 ) +xfs_calc_buf_res (XFS_ALLOCFREE_LOG_COUNT (mp,1 ),XFS_FSB_TO_B (mp,1 )); }
@@ -423,7 +455,7 @@ xfs_calc_growrtfree_reservation( struct xfs_mount *mp) {return xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize) + -xfs_calc_buf_res (2 , mp->m_sb.sb_inodesize) + +xfs_calc_inode_res (mp,2 ) +xfs_calc_buf_res (1 , mp->m_sb.sb_blocksize) +xfs_calc_buf_res (1 , mp->m_rsumsize); }
@@ -436,7 +468,7 @@ STATIC uintxfs_calc_swrite_reservation ( struct xfs_mount *mp) { -return xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize); +return xfs_calc_inode_res (mp,1 ); }/*
@@ -444,9 +476,10 @@ xfs_calc_swrite_reservation(* inode */ STATIC uint -xfs_calc_writeid_reservation (xfs_mount_t *mp) +xfs_calc_writeid_reservation ( +struct xfs_mount *mp) { -return xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize); +return xfs_calc_inode_res (mp,1 ); }/*
@@ -462,7 +495,7 @@ xfs_calc_addafork_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + -xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize) + +xfs_calc_inode_res (mp,1 ) +xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (1 , mp->m_dirblksize) + xfs_calc_buf_res(XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1,
@@ -486,7 +519,7 @@ STATIC uintxfs_calc_attrinval_reservation ( struct xfs_mount *mp) { - return MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + + return MAX((xfs_calc_inode_res(mp, 1) + xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK), XFS_FSB_TO_B(mp, 1))), (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
@@ -510,7 +543,7 @@ xfs_calc_attrsetm_reservation( struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + -xfs_calc_buf_res (1 , mp->m_sb.sb_inodesize) + +xfs_calc_inode_res (mp,1 ) +xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (XFS_DA_NODE_MAXDEPTH ,XFS_FSB_TO_B (mp,1 )); }
@@ -550,7 +583,7 @@ xfs_calc_attrrm_reservation( struct xfs_mount *mp) { return XFS_DQUOT_LOGRES(mp) + - MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) + + MAX((xfs_calc_inode_res(mp, 1) + xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1)) + (uint)XFS_FSB_TO_B(mp,
@@ -602,6 +635,7 @@ STATIC uintxfs_calc_qm_dqalloc_reservation ( struct xfs_mount *mp) { +ASSERT (M_RES (mp)->tr_write.tr_logres);return M_RES (mp)->tr_write.tr_logres +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ) -1 );
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 53/55] xfs: inode log reservations are too small
Quoted 55 lines · Dave Chinner
From: Dave Chinner<[email protected]>
We've been seeing occasional problems with log space leaks and transaction underruns such as this for some time:
XFS (dm-0):
xlog_write: reservation summary:
trans type =FSYNC_TS(36)
unit res = 2740 bytes
current res = -4 bytes
total reg = 0 bytes (o/flow = 0 bytes)
ophdrs = 0 (ophdr space = 0 bytes)
ophdr + reg = 0 bytes
num regions = 0Turns out that xfstests generic/311 is reliably reproducing this problem with the test it runs at sequence 16 of it execution. It is a 100% reliable reproducer with the mkfs configuration of "-b size=1024 -m crc=1" on a 10GB scratch device.
The problem? Inode forks in btree format are logged in memory format, not disk format (i.e. bmbt format, not bmdr format). That means there is a btree block header being logged, when such a structure is never written to the inode fork in bmdr format. The bmdr header in the inode is only 4 bytes, while the bmbt header is 24 bytes for v4 filesystems and 72 bytes for v5 filesystems.
We currently reserve the inode size plus the rounded up overhead of a logging a buffer, which is 128 bytes. That means the reservation for a 512 byte inode is 640 bytes. What we can actually log is:
inode core, data and attr fork = 512 bytes inode log format + log op header = 56 + 12 = 68 bytes data fork bmbt hdr = 24/72 bytes
attr fork bmbt hdr = 24/72 bytesSo, for a v2 inodes we can log at least 628 bytes, but if we split that inode over the end of the log across log buffers, we need to also another log op header, which takes us to 640 bytes. If there's another reservation taken out of this that I haven't taken into account (perhaps multiple iclog splits?) or I haven't corectly calculated the bmbt format space used (entirely possible), then we will overun it.
For v3 inodes the maximum is actually 724 bytes, and even a single maximally sized btree format fork can blow it (652 bytes). And that's exactly what is happening with the
FSYNC_TStransaction in the above output - it's consumed 644 bytes of space after the CIL context took the space reserved for it (2100 bytes).This problem has always been present in the XFS code - the btree format inode forks have always been logged in this manner. Hence there has always been the possibility of an overrun with such a transaction. The CRC code has just exposed it frequently enough to be able to debug and understand the root cause....
Quoted 7 lines
So, let's fix all the inode log space reservations.
[ I'm so glad we spent the effort to clean up the transaction
reservation code. This is an easy fix now. ]Signed-off-by Dave Chinner<[email protected]>---
Looks good, same as kernel commit 23956703.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 54/55 repair: fix segv on directory block read failure
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
We try to read all blocks in the directory, but if we have a block form directory we only have one block and so we need to fail if there is a read error. Otherwise we try to derefence a null buffer pointer.
While fixing the error handling for a read failure, fix the bug that caused the read failure - trying to verify a block format buffer with the data format buffer verifier.
--- repair/phase6.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
repair/phase6.c +21 -3
@@ -2064,7 +2064,7 @@ longform_dir2_entry_check(xfs_mount_t *mp,int isleaf;xfs_fileoff_t next_da_bno;int seeval; -int fixit; +int fixit =0 ;xfs_dir2_db_t db; *need_dot =1 ;
@@ -2091,6 +2091,8 @@ longform_dir2_entry_check(xfs_mount_t *mp,for (da_bno =0 , next_da_bno =0 ; next_da_bno !=NULLFILEOFF && da_bno < mp->m_dirleafblk; da_bno = (xfs_dablk_t )next_da_bno) { +const struct xfs_buf_ops *ops; + next_da_bno = da_bno + mp->m_dirblkfsbs -1 ;if (bmap_next_offset (NULL , ip, &next_da_bno,XFS_DATA_FORK ))break ;
@@ -2104,13 +2106,28 @@ longform_dir2_entry_check(xfs_mount_t *mp,_ ("realloc failed in longform_dir2_entry_check (%zu bytes)\n" ), num_bps * sizeof(struct xfs_buf*)); } + +if (isblock) + ops = &xfs_dir3_block_buf_ops; +else + ops = &xfs_dir3_data_buf_ops;if (libxfs_da_read_buf (NULL , ip, da_bno,-1 , &bplist[db], -XFS_DATA_FORK , &xfs_dir3_data_buf_ops)) { +XFS_DATA_FORK , ops)) {do_warn (_ ("can't read data block %u for directory inode %" PRIu64"\n" ), da_bno, ino); *num_illegal +=1 ; -continue ;/* try and read all "data" blocks */ + +/* +* we try to read all "data" blocks, but if we are in +* block form and we fail, there isn't anything else to +* read, and nothing we can do but trash it. +*/ +if (isblock) { + fixit++; + goto out_fix; + } +continue ; } longform_dir2_entry_check_data(mp, ip, num_illegal, need_dot, irec, ino_offset, &bplist[db], hashtab,
@@ -2141,6 +2158,7 @@ longform_dir2_entry_check(xfs_mount_t *mp, freetab); } } +out_fix:if (!no_modify && (fixit || dotdot_update)) {dir_hash_dup_names (hashtab);for (i =0 ; i < freetab->naents; i++)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 54/55] repair: fix segv on directory block read failure
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
We try to read all blocks in the directory, but if we have a block form directory we only have one block and so we need to fail if there is a read error. Otherwise we try to derefence a null buffer pointer.
Quoted 5 lines
While fixing the error handling for a read failure, fix the bug that caused the read failure - trying to verify a block format buffer with the data format buffer verifier.
Signed-off-by Dave Chinner <[email protected]>
I independently hit this, and had a similar but crummier fix. ;)
(and missed the root cause, because the fs I ran it on was so corrupt, there was no element of surprise)
Quoted 59 lines
--- repair/phase6.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)repair/phase6.c +20
-3@@ -2064,7 +2064,7 @@ longform_dir2_entry_check(xfs_mount_t *mp,int isleaf;xfs_fileoff_t next_da_bno;int seeval; -int fixit; +int fixit =0 ;xfs_dir2_db_t db; *need_dot =1 ;@@ -2091,6 +2091,8 @@ longform_dir2_entry_check(xfs_mount_t *mp,for (da_bno =0 , next_da_bno =0 ; next_da_bno !=NULLFILEOFF && da_bno < mp->m_dirleafblk; da_bno = (xfs_dablk_t )next_da_bno) { +const struct xfs_buf_ops *ops; + next_da_bno = da_bno + mp->m_dirblkfsbs -1 ;if (bmap_next_offset (NULL , ip, &next_da_bno,XFS_DATA_FORK ))break ;@@ -2104,13 +2106,28 @@ longform_dir2_entry_check(xfs_mount_t *mp,_ ("realloc failed in longform_dir2_entry_check (%zu bytes)\n" ), num_bps * sizeof(struct xfs_buf*)); } + +if (isblock) + ops = &xfs_dir3_block_buf_ops; +else + ops = &xfs_dir3_data_buf_ops;if (libxfs_da_read_buf (NULL , ip, da_bno,-1 , &bplist[db], -XFS_DATA_FORK , &xfs_dir3_data_buf_ops)) { +XFS_DATA_FORK , ops)) {do_warn (_ ("can't read data block %u for directory inode %" PRIu64"\n" ), da_bno, ino); *num_illegal +=1 ; -continue ;/* try and read all "data" blocks */ + +/* +* we try to read all "data" blocks, but if we are in +* block form and we fail, there isn't anything else to +* read, and nothing we can do but trash it. +*/ +if (isblock) { + fixit++; + goto out_fix; + } +continue ; } longform_dir2_entry_check_data(mp, ip, num_illegal, need_dot, irec, ino_offset, &bplist[db], hashtab,
repair/phase6.c longform_dir2_entry_check(xfs_mount_t *mp, · line 2164
Quoted 7 lines
repair/phase6.c +1
-0@@ -2141,6 +2158,7 @@ longform_dir2_entry_check(xfs_mount_t *mp, freetab); } } +out_fix:if (!no_modify && (fixit || dotdot_update)) {dir_hash_dup_names (hashtab);for (i =0 ; i < freetab->naents; i++)
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 55/55 xfsprogs: cleanup miscellaneous merge faults
In reply to Dave ChinnerFrom: Ben Myers <[email protected]>
* clean up a few extra tabs
* xfs_buf_map->xfs_buf_ops in libxfs_readbuf and libxfs_readbuf_map args
* don't call the write verifier twice
* put the multithreaded scan_ags back
--- include/libxfs.h | 2 +- libxfs/rdwr.c | 20 ++------------------ repair/scan.c | 3 +-- 3 files changed, 4 insertions(+), 21 deletions(-)
include/libxfs.h +1 -1
@@ -589,7 +589,7 @@ typedef struct xfs_inode {xfs_mount_t *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_buftarg i_dev;/* dev for this inode */ +struct xfs_buftarg i_dev;/* dev for this inode */ xfs_ifork_t *i_afp;/* attribute fork pointer */ xfs_ifork_t i_df;/* data fork */ xfs_trans_t *i_transp;/* ptr to owning transaction */
libxfs/rdwr.c +2 -18
@@ -198,9 +198,9 @@ libxfs_log_header(#undef libxfs_putbufxfs_buf_t *libxfs_readbuf (struct xfs_buftarg *,xfs_daddr_t ,int ,int , -const struct xfs_buf_map *); +const struct xfs_buf_ops *);xfs_buf_t *libxfs_readbuf_map (struct xfs_buftarg *,struct xfs_buf_map *, -int ,int ,const struct xfs_buf_map *); +int ,int ,const struct xfs_buf_ops *);int libxfs_writebuf (xfs_buf_t *,int );xfs_buf_t *libxfs_getbuf (struct xfs_buftarg *,xfs_daddr_t ,int );xfs_buf_t *libxfs_getbuf_map (struct xfs_buftarg *,struct xfs_buf_map *,int );
@@ -831,22 +831,6 @@ libxfs_writebufr(xfs_buf_t *bp) } } -/* -* clear any pre-existing error status on the buffer. This can occur if -* the buffer is corrupt on disk and the repair process doesn't clear -* the error before fixing and writing it back. -*/ - bp->b_error =0 ; -if (bp->b_ops) { - bp->b_ops->verify_write (bp); -if (bp->b_error) { -fprintf (stderr, -_ ("%s: write verifer failed on bno 0x%llx/0x%x\n" ), - __func__, (long long )bp->b_bn, bp->b_bcount); -return bp->b_error; - } - } -if (!(bp->b_flags &LIBXFS_B_DISCONTIG )) { error =__write_buf (fd, bp->b_addr, bp->b_bcount,LIBXFS_BBTOOFF64 (bp->b_bn), bp->b_flags);
repair/scan.c +1 -2
@@ -1370,8 +1370,7 @@ scan_ags( }memset (agcnts,0 , mp->m_sb.sb_agcount *sizeof (*agcnts)); -create_work_queue (&wq, mp,1 ); -//create_work_queue(&wq, mp, scan_threads); +create_work_queue (&wq, mp, scan_threads);for (i =0 ; i < mp->m_sb.sb_agcount; i++)queue_work (&wq, scan_ag, i, &agcnts[i]);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 55/55] xfsprogs: cleanup miscellaneous merge faults
Quoted 10 lines · Dave Chinner
From: Ben Myers<[email protected]>
* clean up a few extra tabs
*xfs_buf_map->xfs_buf_opsinlibxfs_readbufandlibxfs_readbuf_mapargs
* don't call the write verifier twice
* put the multithreadedscan_agsbackSigned-off-by Ben Myers<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs