xfsprogs: patch queue for crc-dev
cover xfsprogs: patch queue for crc-dev
Hi folks,
This is the latest patchset for the crc-dev branch of xfsprogs. It follows up on the last series of 22 patches to get libxf sin sync with the kernel code but adding all the changes from the kernel size to remove __KERNEL__ from the code. Hence there's a fair bit more code churn in the patch set, but overall the diffstat is a significant reduction in code in libxfs. Like the kernel side patchset, there is a lot of new files that are shared with the kernel, and the diffstat reflects that:
90 files changed, 3573 insertions(+), 4863 deletions(-)
rename include/{xfs_buf_item.h => xfs_buf_item_format.h} (62%)
delete mode 100644 include/xfs_dfrag.h
create mode 100644 include/xfs_dquot_format.h
rename include/{xfs_extfree_item.h => xfs_extfree_item_format.h} (69%)
create mode 100644 include/xfs_icreate_item.h
create mode 100644 include/xfs_icreate_item_format.h
delete mode 100644 include/xfs_inode.h
create mode 100644 include/xfs_inode_buf.h
create mode 100644 include/xfs_inode_fork.h
rename include/{xfs_inode_item.h => xfs_inode_item_format.h} (61%)
delete mode 100644 include/xfs_log.h
create mode 100644 include/xfs_log_format.h
delete mode 100644 include/xfs_log_priv.h
delete mode 100644 include/xfs_mount.h
delete mode 100644 include/xfs_quota.h
create mode 100644 include/xfs_quota_defs.h
delete mode 100644 include/xfs_rtalloc.h
create mode 100644 include/xfs_rtalloc_defs.h
delete mode 100644 include/xfs_symlink.h
create mode 100644 include/xfs_symlink_remote.h
delete mode 100644 include/xfs_trans.h
create mode 100644 include/xfs_trans_format.h
create mode 100644 include/xfs_trans_resv.h
create mode 100644 libxfs/xfs_inode_buf.c
rename libxfs/{xfs_inode.c => xfs_inode_fork.c} (82%)
create mode 100644 libxfs/xfs_log_rlimit.c
rename libxfs/{xfs_mount.c => xfs_sb.c} (94%)
rename libxfs/{xfs_symlink.c => xfs_symlink_remote.c} (68%)
rename libxfs/{xfs_trans.c => xfs_trans_resv.c} (67%)Overall, it's a significant reduction in the amount of code, and it cleans up quite a bit of the nasty header file dependency issues as the majority of the new shared header files are not dependent on each other. Having header files like xfs_mount.h, xfs_trans.h, xfs_log.h and xfs_log_priv.h no longer present in userspace makes a big difference to the clarity of the libxfs header files...
The only other major addition to the series is Jeff Liu's log reservation calculation patchset, which allows mkfs to calculate the minmum log size based on log reservation sizes rather than transaction reservation sizes. This causes a significant increase in the default size of the log for small filesystems - many xfstests now fail because the default log size doesn't fit inside a 16MB AG anymore. Hence mkfs will need some further tweaking here to avoid those failures. xfs/216 gives a pretty good overview of the difference in default sizes:
QA output created by 216
-fssize=1g log =internal log bsize=4096 blocks=2560, version=2 -fssize=2g log =internal log bsize=4096 blocks=2560, version=2 -fssize=4g log =internal log bsize=4096 blocks=2560, version=2 -fssize=8g log =internal log bsize=4096 blocks=2560, version=2 -fssize=16g log =internal log bsize=4096 blocks=2560, version=2 -fssize=32g log =internal log bsize=4096 blocks=4096, version=2 +fssize=1g log =internal log bsize=4096 blocks=4896, version=2 +fssize=2g log =internal log bsize=4096 blocks=4896, version=2 +fssize=4g log =internal log bsize=4096 blocks=4896, version=2 +fssize=8g log =internal log bsize=4096 blocks=4896, version=2 +fssize=16g log =internal log bsize=4096 blocks=4896, version=2 +fssize=32g log =internal log bsize=4096 blocks=4896, version=2 fssize=64g log =internal log bsize=4096 blocks=8192, version=2
Which indicate worst case log reservation is roughly 2x larger than the worst case transaction reservation for small filesystems. I'm surprised that we haven't had more problems with this in the past than we have...
Thoughts, comments, flames?
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/50 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
@@ -435,6 +435,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)
@@ -443,6 +458,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 ;
@@ -474,6 +492,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/50 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/libxfs.h | 1 - include/xfs_mount.h | 17 -- include/xfs_sb.h | 19 ++ include/xfs_trace.h | 1 + libxfs/Makefile | 2 +- libxfs/init.c | 2 +- libxfs/xfs.h | 1 + libxfs/xfs_mount.c | 627 ------------------------------------------------ libxfs/xfs_sb.c | 666 +++++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 689 insertions(+), 647 deletions(-) delete mode 100644 libxfs/xfs_mount.c create mode 100644 libxfs/xfs_sb.c
include/libxfs.h +0 -1
@@ -456,7 +456,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,
include/xfs_mount.h +0 -17
@@ -383,21 +383,4 @@ extern void xfs_set_low_space_thresholds(struct xfs_mount *);#endif /* __KERNEL__ */ -/* -* perag get/put wrappers for ref counting -*/ -struct xfs_perag *xfs_perag_get (struct xfs_mount *mp,xfs_agnumber_t agno); -struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *mp,xfs_agnumber_t agno, -int tag); -void xfs_perag_put (struct xfs_perag *pag); - -extern void xfs_sb_calc_crc (struct xfs_buf *); -extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); -extern int xfs_initialize_perag (struct xfs_mount *,xfs_agnumber_t , -xfs_agnumber_t *); -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 const struct xfs_buf_ops xfs_sb_buf_ops; -#endif /* __XFS_MOUNT_H__ */
include/xfs_sb.h +19 -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 */
@@ -661,4 +662,22 @@ xfs_sb_has_incompat_log_feature(#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 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 +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_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 \ + xfs_sb.c xfs_rtalloc.c xfs_trans.c xfs_attr.c xfs_attr_remote.c \ crc32.c xfs_symlink.c CFILES += $(PKG_PLATFORM).c
libxfs/init.c +1 -1
@@ -691,7 +691,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
@@ -329,6 +329,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 -627
627 lines not on this page · raw message
libxfs/xfs_sb.c new file +666 -0
666 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/50 libxfs: move the transaction reservation structures
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
To prepare for getting rid of xfs_mount.h, we need to move the definition of the struct for pre-calculated transaction reservations out of xfs_mount.h. Move it to xfs_trans.h along with all the other transaction reservation definitions.
--- include/libxfs.h | 5 ++--- include/xfs_mount.h | 30 ------------------------------ include/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 2 +- 4 files changed, 33 insertions(+), 34 deletions(-)
include/libxfs.h +2 -3
@@ -58,6 +58,7 @@#include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item.h> +#include <xfs/xfs_trans.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
@@ -202,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 */ -xfs_trans_reservations_t m_reservations;/* precomputed res values */ +struct xfs_trans_reservations m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ int m_dalign;/* stripe unit */ int m_swidth;/* stripe width */
@@ -436,8 +437,6 @@ typedef struct xfs_buf_log_item {xfs_buf_log_format_t bli_format;/* in-log header */ } xfs_buf_log_item_t; -#include <xfs/xfs_trans.h> - typedef struct xfs_trans { unsigned int t_type; /* transaction type */ unsigned int t_log_res; /* amt of log space resvd */
include/xfs_mount.h +0 -30
@@ -18,36 +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__
include/xfs_trans.h +30 -0
@@ -209,6 +209,36 @@ struct xfs_log_item_desc {#define XFS_TRANS_SB_REXTENTS 0x00001000#define XFS_TRANS_SB_REXTSLOG 0x00002000 +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 */ +};/* * Per-extent log reservation for the allocation btree changes
mkfs/maxtrres.c +1 -1
@@ -56,7 +56,7 @@ max_trans_res_by_mount( {uint *p;int rval; -xfs_trans_reservations_t *tr = &mp->m_reservations; +struct xfs_trans_reservations *tr = &mp->m_reservations;for (rval =0 , p = (uint *)tr; p < (uint *)(tr +1 ); p++) {if ((int )*p > rval)
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/50 xfsprogs: remove xfs_mount.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It is no longer used by anything in userspace, so we don't need it anymore. Remove it.
--- include/Makefile | 2 +- include/libxfs.h | 7 +- include/xfs_mount.h | 356 --------------------------------------------------- 3 files changed, 6 insertions(+), 359 deletions(-) delete mode 100644 include/xfs_mount.h
include/Makefile +1 -1
@@ -28,7 +28,7 @@ QAHFILES = libxfs.h libxlog.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_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.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 HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h
include/libxfs.h +5 -2
@@ -41,7 +41,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>
@@ -600,6 +599,10 @@ extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...);extern void cmn_err (int ,char *, ...);enum ce {CE_DEBUG ,CE_CONT ,CE_NOTE ,CE_WARN ,CE_ALERT ,CE_PANIC }; +#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))#define LIBXFS_BBTOOFF64 (bbs) (((xfs_off_t)(bbs)) << BBSHIFT)extern int libxfs_nproc (void );
@@ -686,7 +689,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
include/xfs_mount.h deleted +0 -356
356 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/50 libxfs: update xfs_inode.h to match new kernel version
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Much of the kernel specific guts of xfs_inode.h have been moved to a kernel only header file. Update the userspace header and libxfs xfs_inode.c file to match the new kernel version.
--- include/xfs_inode.h | 339 ++------------------------------------------------- libxfs/xfs.h | 1 + libxfs/xfs_inode.c | 170 ++++++++++++++------------ 3 files changed, 99 insertions(+), 411 deletions(-)
include/xfs_inode.h +7 -332
@@ -21,6 +21,7 @@struct posix_acl ;struct xfs_dinode ;struct xfs_inode ; +struct xfs_inode_log_item ;/* * Fork identifiers.
@@ -152,7 +153,7 @@ typedef struct xfs_icdinode {__uint32_t di_gen;/* generation number */ /* di_next_unlinked is the only non-core field in the old dinode */ -__be32 di_next_unlinked;/* agi unlinked list ptr */ +xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ /* start of the extended dinode, writable fields */ __uint32_t di_crc;/* CRC of the inode */
@@ -237,335 +238,7 @@ static inline uint xfs_icdinode_size(int version)#ifdef __KERNEL__ -struct xfs_buf ; -struct xfs_bmap_free ; -struct xfs_bmbt_irec ; -struct xfs_inode_log_item ; -struct xfs_mount ; -struct xfs_trans ; -struct xfs_dquot ; - -typedef struct xfs_inode { -/* Inode linking and identification information. */ -struct xfs_mount *i_mount;/* fs mount struct ptr */ -struct xfs_dquot *i_udquot;/* user dquot */ -struct xfs_dquot *i_gdquot;/* group dquot */ - -/* Inode location stuff */ -xfs_ino_t i_ino;/* inode number (agno/agino)*/ -struct xfs_imap i_imap;/* location for xfs_imap() */ - -/* Extent information. */ -xfs_ifork_t *i_afp;/* attribute fork pointer */ -xfs_ifork_t i_df;/* data fork */ - -/* Transaction and locking information. */ -struct xfs_inode_log_item *i_itemp;/* logging information */ -mrlock_t i_lock;/* inode lock */ -mrlock_t i_iolock;/* inode IO lock */ -atomic_t i_pincount;/* inode pin count */ -spinlock_t i_flags_lock;/* inode i_flags lock */ -/* Miscellaneous state. */ -unsigned long i_flags;/* see defined flags below */ -unsigned int i_delayed_blks;/* count of delay alloc blks */ - -xfs_icdinode_t i_d;/* most of ondisk inode */ - -/* VFS inode */ -struct inode i_vnode;/* embedded VFS inode */ -}xfs_inode_t ; - -/* Convert from vfs inode to xfs inode */ -static inline struct xfs_inode *XFS_I (struct inode *inode) -{ - return container_of(inode, struct xfs_inode, i_vnode); -} - -/* convert from xfs inode to vfs inode */ -static inline struct inode *VFS_I (struct xfs_inode *ip) -{ -return &ip->i_vnode; -} - -/* -* For regular files we only update the on-disk filesize when actually -* writing data back to disk. Until then only the copy in the VFS inode -* is uptodate. -*/ -static inline xfs_fsize_t XFS_ISIZE (struct xfs_inode *ip) -{ -if (S_ISREG (ip->i_d.di_mode)) -return i_size_read (VFS_I (ip)); -return ip->i_d.di_size; -} - -/* -* If this I/O goes past the on-disk inode size update it unless it would -* be past the current in-core inode size. -*/ -static inline xfs_fsize_t -xfs_new_eof (struct xfs_inode *ip,xfs_fsize_t new_size) -{ -xfs_fsize_t i_size =i_size_read (VFS_I (ip)); - -if (new_size > i_size) - new_size = i_size; -return new_size > ip->i_d.di_size ? new_size :0 ; -} - -/* -* i_flags helper functions -*/ -static inline void -__xfs_iflags_set (xfs_inode_t *ip,unsigned short flags) -{ - ip->i_flags |= flags; -} - -static inline void -xfs_iflags_set (xfs_inode_t *ip,unsigned short flags) -{ -spin_lock (&ip->i_flags_lock); -__xfs_iflags_set (ip, flags); -spin_unlock (&ip->i_flags_lock); -} - -static inline void -xfs_iflags_clear (xfs_inode_t *ip,unsigned short flags) -{ -spin_lock (&ip->i_flags_lock); - ip->i_flags &= ~flags; -spin_unlock (&ip->i_flags_lock); -} - -static inline int -__xfs_iflags_test (xfs_inode_t *ip,unsigned short flags) -{ -return (ip->i_flags & flags); -} - -static inline int -xfs_iflags_test (xfs_inode_t *ip,unsigned short flags) -{ -int ret; -spin_lock (&ip->i_flags_lock); - ret =__xfs_iflags_test (ip, flags); -spin_unlock (&ip->i_flags_lock); -return ret; -} - -static inline int -xfs_iflags_test_and_clear (xfs_inode_t *ip,unsigned short flags) -{ -int ret; - -spin_lock (&ip->i_flags_lock); - ret = ip->i_flags & flags; -if (ret) - ip->i_flags &= ~flags; -spin_unlock (&ip->i_flags_lock); -return ret; -} - -static inline int -xfs_iflags_test_and_set (xfs_inode_t *ip,unsigned short flags) -{ -int ret; - -spin_lock (&ip->i_flags_lock); - ret = ip->i_flags & flags; -if (!ret) - ip->i_flags |= flags; -spin_unlock (&ip->i_flags_lock); -return ret; -} - -/* -* Project quota id helpers (previously projid was 16bit only -* and using two 16bit values to hold new 32bit projid was chosen -* to retain compatibility with "old" filesystems). -*/ -static inline prid_t -xfs_get_projid (struct xfs_inode *ip) -{ -return (prid_t )ip->i_d.di_projid_hi <<16 | ip->i_d.di_projid_lo; -} - -static inline void -xfs_set_projid (struct xfs_inode *ip, -prid_t projid) -{ - ip->i_d.di_projid_hi = (__uint16_t) (projid >>16 ); - ip->i_d.di_projid_lo = (__uint16_t) (projid &0xffff ); -} - -/* -* In-core inode flags. -*/ -#define XFS_IRECLAIM (1 << 0)/* started reclaiming this inode */ -#define XFS_ISTALE (1 << 1)/* inode has been staled */ -#define XFS_IRECLAIMABLE (1 << 2)/* inode can be reclaimed */ -#define XFS_INEW (1 << 3)/* inode has just been allocated */ -#define XFS_IFILESTREAM (1 << 4)/* inode is in a filestream dir. */ -#define XFS_ITRUNCATED (1 << 5)/* truncated down so flush-on-close */ -#define XFS_IDIRTY_RELEASE (1 << 6)/* dirty release already seen */ -#define __XFS_IFLOCK_BIT 7/* inode is being flushed right now */ -#define XFS_IFLOCK (1 << __XFS_IFLOCK_BIT) -#define __XFS_IPINNED_BIT 8/* wakeup key for zero pin count */ -#define XFS_IPINNED (1 << __XFS_IPINNED_BIT) -#define XFS_IDONTCACHE (1 << 9)/* don't cache the inode long term */ - -/* -* Per-lifetime flags need to be reset when re-using a reclaimable inode during -* inode lookup. This prevents unintended behaviour on the new inode from -* ocurring. -*/ -#define XFS_IRECLAIM_RESET_FLAGS \ - (XFS_IRECLAIMABLE | XFS_IRECLAIM | \ - XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | \ - XFS_IFILESTREAM); - -/* -* Synchronize processes attempting to flush the in-core inode back to disk. -*/ - -extern void __xfs_iflock (struct xfs_inode *ip); - -static inline int xfs_iflock_nowait (struct xfs_inode *ip) -{ -return !xfs_iflags_test_and_set (ip,XFS_IFLOCK ); -} - -static inline void xfs_iflock (struct xfs_inode *ip) -{ -if (!xfs_iflock_nowait (ip)) -__xfs_iflock (ip); -} - -static inline void xfs_ifunlock (struct xfs_inode *ip) -{ -xfs_iflags_clear (ip,XFS_IFLOCK ); -smp_mb (); -wake_up_bit (&ip->i_flags, __XFS_IFLOCK_BIT); -} - -static inline int xfs_isiflocked (struct xfs_inode *ip) -{ -return xfs_iflags_test (ip,XFS_IFLOCK ); -} - -/* -* Flags for inode locking. -* Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield) -* 1<<16 - 1<<32-1 -- lockdep annotation (integers) -*/ -#define XFS_IOLOCK_EXCL (1<<0) -#define XFS_IOLOCK_SHARED (1<<1) -#define XFS_ILOCK_EXCL (1<<2) -#define XFS_ILOCK_SHARED (1<<3) - -#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \ - | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED) - -#define XFS_LOCK_FLAGS \ - { XFS_IOLOCK_EXCL, "IOLOCK_EXCL" }, \ - { XFS_IOLOCK_SHARED, "IOLOCK_SHARED" }, \ - { XFS_ILOCK_EXCL, "ILOCK_EXCL" }, \ - { XFS_ILOCK_SHARED, "ILOCK_SHARED" } - - -/* -* Flags for lockdep annotations. -* -* XFS_LOCK_PARENT - for directory operations that require locking a -* parent directory inode and a child entry inode. The parent gets locked -* with this flag so it gets a lockdep subclass of 1 and the child entry -* lock will have a lockdep subclass of 0. -* -* XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary -* inodes do not participate in the normal lock order, and thus have their -* own subclasses. -* -* XFS_LOCK_INUMORDER - for locking several inodes at the some time -* with xfs_lock_inodes(). This flag is used as the starting subclass -* and each subsequent lock acquired will increment the subclass by one. -* So the first lock acquired will have a lockdep subclass of 4, the -* second lock will have a lockdep subclass of 5, and so on. It is -* the responsibility of the class builder to shift this to the correct -* portion of the lock_mode lockdep mask. -*/ -#define XFS_LOCK_PARENT 1 -#define XFS_LOCK_RTBITMAP 2 -#define XFS_LOCK_RTSUM 3 -#define XFS_LOCK_INUMORDER 4 - -#define XFS_IOLOCK_SHIFT 16 -#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT) - -#define XFS_ILOCK_SHIFT 24 -#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) -#define XFS_ILOCK_RTBITMAP (XFS_LOCK_RTBITMAP << XFS_ILOCK_SHIFT) -#define XFS_ILOCK_RTSUM (XFS_LOCK_RTSUM << XFS_ILOCK_SHIFT) - -#define XFS_IOLOCK_DEP_MASK 0x00ff0000 -#define XFS_ILOCK_DEP_MASK 0xff000000 -#define XFS_LOCK_DEP_MASK (XFS_IOLOCK_DEP_MASK | XFS_ILOCK_DEP_MASK) - -#define XFS_IOLOCK_DEP (flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLOCK_SHIFT) -#define XFS_ILOCK_DEP (flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT) - -/* -* For multiple groups support: if S_ISGID bit is set in the parent -* directory, group of new file is set to that of the parent, and -* new subdirectory gets S_ISGID bit from parent. -*/ -#define XFS_INHERIT_GID (pip) \ - (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ - ((pip)->i_d.di_mode & S_ISGID)) - - -/* -* xfs_inode.c prototypes. -*/ -void xfs_ilock (xfs_inode_t *,uint ); -int xfs_ilock_nowait (xfs_inode_t *,uint ); -void xfs_iunlock (xfs_inode_t *,uint ); -void xfs_ilock_demote (xfs_inode_t *,uint ); -int xfs_isilocked (xfs_inode_t *,uint ); -uint xfs_ilock_map_shared (xfs_inode_t *); -void xfs_iunlock_map_shared (xfs_inode_t *,uint ); -int xfs_ialloc (struct xfs_trans *,xfs_inode_t *,umode_t , -xfs_nlink_t ,xfs_dev_t ,prid_t ,int , -struct xfs_buf **,xfs_inode_t **); - -uint xfs_ip2xflags (struct xfs_inode *); -uint xfs_dic2xflags (struct xfs_dinode *); -int xfs_ifree (struct xfs_trans *,xfs_inode_t *, -struct xfs_bmap_free *); -int xfs_itruncate_extents (struct xfs_trans **,struct xfs_inode *, -int ,xfs_fsize_t ); -int xfs_iunlink (struct xfs_trans *,xfs_inode_t *); - -void xfs_iext_realloc (xfs_inode_t *,int ,int ); -void xfs_iunpin_wait (xfs_inode_t *); -int xfs_iflush (struct xfs_inode *,struct xfs_buf **); -void xfs_lock_inodes (xfs_inode_t **,int ,uint ); -void xfs_lock_two_inodes (xfs_inode_t *,xfs_inode_t *,uint ); - -xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); - -#define IHOLD (ip) \ -do { \ - ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \ - ihold(VFS_I(ip)); \ - trace_xfs_ihold(ip, _THIS_IP_); \ -} while (0) - -#define IRELE (ip) \ -do { \ - trace_xfs_irele(ip, _THIS_IP_); \ - iput(VFS_I(ip)); \ -} while (0) +#include "xfs_inode_ops.h" #endif /* __KERNEL__ */
@@ -584,6 +257,9 @@ 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 *); +void xfs_iflush_fork (struct xfs_inode *,struct xfs_dinode *, +struct xfs_inode_log_item *,int , +struct xfs_buf *);void xfs_idestroy_fork (struct xfs_inode *,int );void xfs_idata_realloc (struct xfs_inode *,int ,int );void xfs_iroot_realloc (struct xfs_inode *,int ,int );
@@ -592,14 +268,13 @@ int xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int);xfs_bmbt_rec_host_t *xfs_iext_get_ext (xfs_ifork_t *,xfs_extnum_t );void xfs_iext_insert (struct xfs_inode *,xfs_extnum_t ,xfs_extnum_t , -xfs_bmbt_irec_t *,int ); +struct xfs_bmbt_irec *,int );void xfs_iext_add (xfs_ifork_t *,xfs_extnum_t ,int );void xfs_iext_add_indirect_multi (xfs_ifork_t *,int ,xfs_extnum_t ,int );void xfs_iext_remove (struct xfs_inode *,xfs_extnum_t ,int ,int );void xfs_iext_remove_inline (xfs_ifork_t *,xfs_extnum_t ,int );void xfs_iext_remove_direct (xfs_ifork_t *,xfs_extnum_t ,int );void xfs_iext_remove_indirect (xfs_ifork_t *,xfs_extnum_t ,int ); -void xfs_iext_realloc_direct (xfs_ifork_t *,int );void xfs_iext_direct_to_inline (xfs_ifork_t *,xfs_extnum_t );void xfs_iext_inline_to_direct (xfs_ifork_t *,int );void xfs_iext_destroy (xfs_ifork_t *);
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_inode.c +91 -79
239 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/50 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
@@ -655,6 +655,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/50 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.h | 14 ++++++-------- include/xfs_bmap_btree.h | 3 +-- include/xfs_btree.h | 3 +-- include/xfs_buf_item.h | 4 +++- include/xfs_dir2.h | 20 ++++++++++---------- include/xfs_dir2_format.h | 22 ++++++++++++++-------- include/xfs_extfree_item.h | 14 +++++++++----- include/xfs_fs.h | 26 +++++++++++++++----------- include/xfs_ialloc_btree.h | 3 +-- include/xfs_icreate_item.h | 1 + include/xfs_log.h | 2 ++ include/xfs_log_priv.h | 1 - include/xfs_quota.h | 2 ++ include/xfs_symlink.h | 20 ++++++++++++++++++++ include/xfs_trans.h | 21 +++++++++++++++------ 19 files changed, 118 insertions(+), 79 deletions(-)
include/libxfs.h +5 -3
@@ -40,7 +40,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>
@@ -233,6 +232,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
@@ -584,8 +588,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.h +6 -8
@@ -18,7 +18,6 @@#ifndef __XFS_BMAP_H__#define __XFS_BMAP_H__ -struct getbmap ;struct xfs_bmbt_irec ;struct xfs_ifork ;struct xfs_inode ;
@@ -135,8 +134,13 @@ typedef struct xfs_bmalloca {char userdata;/* set if is user data */ char aeof;/* allocated space at eof */ char conv;/* overwriting unwritten extents */ +char stack_switch;int flags; -int stack_switch; +#ifdef __KERNEL__ +struct completion *done; +struct work_struct work; +int result; +#endif /* __KERNEL__ */ } xfs_bmalloca_t;/*
@@ -203,19 +207,13 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,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);
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_buf_item.h +3 -1
@@ -120,6 +120,7 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)#define XFS_BLI_INODE_ALLOC_BUF 0x10#define XFS_BLI_STALE_INODE 0x20#define XFS_BLI_INODE_BUF 0x40 +#define XFS_BLI_ORDERED 0x80#define XFS_BLI_FLAGS \ { XFS_BLI_HOLD, "HOLD" }, \
@@ -128,7 +129,8 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf) { XFS_BLI_LOGGED, "LOGGED" }, \ { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \ { XFS_BLI_STALE_INODE, "STALE_INODE" }, \ - { XFS_BLI_INODE_BUF, "INODE_BUF" } + { XFS_BLI_INODE_BUF, "INODE_BUF" }, \ + { XFS_BLI_ORDERED, "ORDERED" } #ifdef __KERNEL__
include/xfs_dir2.h +10 -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,16 @@ 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 +* Direct call on directory open, before entering the readdir code. +*/ +extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, +xfs_dablk_t bno,xfs_daddr_t mapped_bno); +extern int xfs_readdir (struct xfs_inode *dp,void *dirent,size_t bufsize, +xfs_off_t *offset,filldir_t filldir); + + +/* +* 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 +111,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 ;
@@ -264,7 +270,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) ||
@@ -513,7 +519,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_extfree_item.h +9 -5
@@ -114,16 +114,20 @@ typedef struct xfs_efd_log_format_64 {* Define EFI flag bits. Manipulated by set/clear/test_bit operators. */ #define XFS_EFI_RECOVERED 1 -#define XFS_EFI_COMMITTED 2/* -* This is the "extent free intention" log item. It is used -* to log the fact that some extents need to be free. It is -* used in conjunction with the "extent free done" log item -* described below. +* This is the "extent free intention" log item. It is used to log the fact +* that some extents need to be free. It is used in conjunction with the +* "extent free done" log item described below. +* +* The EFI is reference counted so that it is not freed prior to both the EFI +* and EFD being committed and unpinned. This ensures that when the last +* reference goes away the EFI will always be in the AIL as it has been +* unpinned, regardless of whether the EFD is processed before or after the EFI. */ typedef struct xfs_efi_log_item { xfs_log_item_t efi_item; + atomic_t efi_refcount; atomic_t efi_next_extent; unsigned long efi_flags; /* misc flags */ xfs_efi_log_format_t efi_format;
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_icreate_item.h +1 -0
@@ -50,6 +50,7 @@ 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 */
include/xfs_log.h +2 -0
@@ -106,6 +106,8 @@ struct xfs_log_vec {int lv_buf_len;/* size of formatted buffer */ }; +#define XFS_LOG_VEC_ORDERED (-1) +/* * Structure used to pass callback function and the function's argument * to the log manager.
include/xfs_log_priv.h +0 -1
@@ -468,7 +468,6 @@ struct xfs_cil {* threshold, yet give us plenty of space for aggregation on large logs. */ #define XLOG_CIL_SPACE_LIMIT (log) (log->l_logsize >> 3) -#define XLOG_CIL_HARD_SPACE_LIMIT (log) (3 * (log->l_logsize >> 4))/* * ticket grant locks, queues and accounting have their own cachlines
include/xfs_quota.h +2 -0
@@ -87,6 +87,8 @@ typedef struct xfs_dqblk {uuid_t dd_uuid;/* location information */ } xfs_dqblk_t; +#define XFS_DQUOT_CRC_OFF offsetof(struct xfs_dqblk, dd_crc) +/* * flags for q_flags field in the dquot. */
include/xfs_symlink.h +20 -0
@@ -1,9 +1,29 @@/* * Copyright (c) 2012 Red Hat, Inc. 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 */ #ifndef __XFS_SYMLINK_H#define __XFS_SYMLINK_H 1 +struct xfs_mount ; +struct xfs_trans ; +struct xfs_inode ; +struct xfs_buf ; +struct xfs_ifork ; +struct xfs_name ; +#define XFS_SYMLINK_MAGIC 0x58534c4d/* XSLM */ struct xfs_dsymlink_hdr {
include/xfs_trans.h +15 -6
@@ -209,6 +209,9 @@ struct xfs_log_item_desc {#define XFS_TRANS_SB_REXTENTS 0x00001000#define XFS_TRANS_SB_REXTSLOG 0x00002000 +/* +* structure for maintaining pre-calculated transaction reservations. +*/ struct xfs_trans_reservations {uint tr_write;/* extent alloc trans */ uint tr_itruncate;/* truncate trans */
@@ -225,8 +228,8 @@ struct xfs_trans_reservations {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_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 */
@@ -285,14 +288,19 @@ struct xfs_trans_reservations {* as long as SWRITE logs the entire inode core */ #define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_reservations.tr_swrite) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_reservations.tr_swrite) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_reservations.tr_swrite)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_reservations.tr_addafork)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_reservations.tr_attrinval)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetm)#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt)#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_reservations.tr_attrrm)#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_reservations.tr_clearagi) - +#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_qm_sbchange) +#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_reservations.tr_qm_setqlim) +#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_reservations.tr_qm_dqalloc) +#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_reservations.tr_qm_quotaoff) +#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_reservations.tr_qm_equotaoff) +#define XFS_SB_LOG_RES (mp) ((mp)->m_reservations.tr_sb)/* * Various log count values.
@@ -433,7 +441,7 @@ typedef struct xfs_trans {int64_t t_res_fdblocks_delta;/* on-disk only chg */ int64_t t_frextents_delta;/* superblock freextents chg*/ int64_t t_res_frextents_delta;/* on-disk only chg */ -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN )int64_t t_ag_freeblks_delta;/* debugging counter */ int64_t t_ag_flist_delta;/* debugging counter */ int64_t t_ag_btree_delta;/* debugging counter */
@@ -461,7 +469,7 @@ typedef struct xfs_trans {#define xfs_trans_get_block_res (tp) ((tp)->t_blk_res)#define xfs_trans_set_sync (tp) ((tp)->t_flags |= XFS_TRANS_SYNC) -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN )#define xfs_trans_agblocks_delta (tp, d) ((tp)->t_ag_freeblks_delta += (int64_t)d)#define xfs_trans_agflist_delta (tp, d) ((tp)->t_ag_flist_delta += (int64_t)d)#define xfs_trans_agbtree_delta (tp, d) ((tp)->t_ag_btree_delta += (int64_t)d)
@@ -531,6 +539,7 @@ void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);void xfs_trans_binval (xfs_trans_t *,struct xfs_buf *);void xfs_trans_inode_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_stale_inode_buf (xfs_trans_t *,struct xfs_buf *); +void xfs_trans_ordered_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_dquot_buf (xfs_trans_t *,struct xfs_buf *,uint );void xfs_trans_inode_alloc_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_ichgtime (struct xfs_trans *,struct xfs_inode *,int );
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/50 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 | 2 +- include/libxfs.h | 27 +- include/xfs_trans.h | 114 +------- include/xfs_trans_resv.h | 135 +++++++++ libxfs/Makefile | 2 +- libxfs/xfs.h | 2 + libxfs/xfs_trans.c | 576 +-------------------------------------- libxfs/xfs_trans_resv.c | 677 ++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 8 +- 9 files changed, 845 insertions(+), 698 deletions(-) create mode 100644 include/xfs_trans_resv.h create mode 100644 libxfs/xfs_trans_resv.c
include/Makefile +1 -1
@@ -29,7 +29,7 @@ QAHFILES = libxfs.h libxlog.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_quota.h xfs_rtalloc.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.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 +22 -5
@@ -201,7 +201,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_reservations 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 */
@@ -411,6 +411,11 @@ extern int libxfs_ihash_size;extern void libxfs_iomove (xfs_buf_t *,uint ,int ,void *,int ); +#include <xfs/xfs_quota.h> +#include <xfs/xfs_trans_space.h> +#include <xfs/xfs_log.h> +#include <xfs/xfs_log_priv.h> +/* * Transaction interface */
@@ -440,6 +445,19 @@ typedef struct xfs_buf_log_item {xfs_buf_log_format_t bli_format;/* in-log header */ } xfs_buf_log_item_t; +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 */ unsigned int t_log_res; /* amt of log space resvd */
@@ -615,10 +633,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> -#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)
@@ -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_trans.h +2 -112
126 lines not on this page · raw message
include/xfs_trans_resv.h new file +135 -0
135 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -17,7 +17,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.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_sb.c xfs_rtalloc.c xfs_trans.c xfs_attr.c xfs_attr_remote.c \ - crc32.c xfs_symlink.c + crc32.c xfs_symlink.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) +xfs_mount_t *mp) { -uint *p; -int rval; -struct xfs_trans_reservations *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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/50 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
@@ -266,6 +266,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)
@@ -477,7 +478,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 {
@@ -718,7 +719,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/50 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.
--- include/xfs_trans.h | 3 -- libxfs/Makefile | 2 +- libxfs/trans.c | 118 +++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs.h | 6 +++ libxfs/xfs_trans.c | 139 --------------------------------------------------- 5 files changed, 125 insertions(+), 143 deletions(-) delete mode 100644 libxfs/xfs_trans.c
include/xfs_trans.h +0 -3
@@ -459,7 +459,4 @@ extern kmem_zone_t *xfs_log_item_desc_zone;#endif /* __KERNEL__ */ -void xfs_trans_init (struct xfs_mount *); -int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *); -#endif /* __XFS_TRANS_H__ */
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_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_sb.c xfs_rtalloc.c xfs_trans.c xfs_attr.c xfs_attr_remote.c \ + xfs_sb.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ crc32.c xfs_symlink.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
@@ -233,12 +233,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
@@ -246,12 +248,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
@@ -368,6 +372,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/50 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 | 48 ++++++++++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 23 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 +28 -20
102 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/50 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 | 30 ++++++++++++++---------------- 4 files changed, 71 insertions(+), 28 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 +14 -16
@@ -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 ]);
@@ -1795,9 +1793,9 @@ xfs_dir2_node_addname_int(/* * Look at the current free entry. Is it good enough? * -* The bests initialisation should be wher eteh bufer is read in +* The bests initialisation should be where the bufer is read in * the above branch. But gcc is too stupid to realise that bests -* iand the freehdr are actually initialised if they are placed +* and the freehdr are actually initialised if they are placed * there, so we have to do it here to avoid warnings. Blech. */ bests =xfs_dir3_free_bests_p (mp, free);
@@ -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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/50 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_ialloc.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 173 insertions(+), 6 deletions(-)
libxfs/xfs_ialloc.c +173 -6
@@ -314,7 +314,7 @@ xfs_ialloc_ag_alloc(* First try to allocate inodes contiguous with the last-allocated * chunk of inodes. If the filesystem is striped, this will fill * an entire stripe unit with inodes. -*/ +*/ agi =XFS_BUF_TO_AGI (agbp); newino =be32_to_cpu (agi->agi_newino); agno =be32_to_cpu (agi->agi_seqno);
@@ -324,8 +324,6 @@ xfs_ialloc_ag_alloc( (args.agbno < be32_to_cpu(agi->agi_length)))) { args.fsbno =XFS_AGB_TO_FSB (args.mp, agno, args.agbno); args.type =XFS_ALLOCTYPE_THIS_BNO ; - args.mod = args.total = args.wasdel = args.isfl = - args.userdata = args.minalignslop =0 ; args.prod =1 ;/*
@@ -378,8 +376,6 @@ xfs_ialloc_ag_alloc(* Allocate a fixed-size extent of inodes. */ args.type =XFS_ALLOCTYPE_NEAR_BNO ; - args.mod = args.total = args.wasdel = args.isfl = - args.userdata = args.minalignslop =0 ; args.prod =1 ;/* * Allow space for the inode btree to split.
@@ -1074,6 +1070,177 @@ out_error:return XFS_ERROR (error); } +/* +* Free disk inode. Carefully avoids touching the incore inode, all +* manipulations incore are the caller's responsibility. +* The on-disk inode is not changed by this operation, only the +* btree (free inode mask) is changed. +*/ +int +xfs_difree ( +xfs_trans_t *tp,/* transaction pointer */ +xfs_ino_t inode,/* inode to be freed */ +xfs_bmap_free_t *flist,/* extents to free */ +int *delete,/* set if inode cluster was deleted */ +xfs_ino_t *first_ino)/* first inode in deleted cluster */ +{ +/* REFERENCED */ +xfs_agblock_t agbno;/* block number containing inode */ +xfs_buf_t *agbp;/* buffer containing allocation group header */ +xfs_agino_t agino;/* inode number relative to allocation group */ +xfs_agnumber_t agno;/* allocation group number */ +xfs_agi_t *agi;/* allocation group header */ +xfs_btree_cur_t *cur;/* inode btree cursor */ +int error;/* error return value */ +int i;/* result code */ +int ilen;/* inodes in an inode cluster */ +xfs_mount_t *mp;/* mount structure for filesystem */ +int off;/* offset of inode in inode chunk */ +xfs_inobt_rec_incore_t rec;/* btree record */ +struct xfs_perag *pag; + + mp = tp->t_mountp; + +/* +* Break up inode number into its components. +*/ + agno =XFS_INO_TO_AGNO (mp, inode); +if (agno >= mp->m_sb.sb_agcount) { +xfs_warn (mp,"%s: agno >= mp->m_sb.sb_agcount (%d >= %d)." , + __func__, agno, mp->m_sb.sb_agcount); +ASSERT (0 ); +return XFS_ERROR (EINVAL ); + } + agino =XFS_INO_TO_AGINO (mp, inode); +if (inode !=XFS_AGINO_TO_INO (mp, agno, agino)) { +xfs_warn (mp,"%s: inode != XFS_AGINO_TO_INO() (%llu != %llu)." , + __func__, (unsigned long long )inode, + (unsigned long long )XFS_AGINO_TO_INO (mp, agno, agino)); +ASSERT (0 ); +return XFS_ERROR (EINVAL ); + } + agbno =XFS_AGINO_TO_AGBNO (mp, agino); +if (agbno >= mp->m_sb.sb_agblocks) { +xfs_warn (mp,"%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d)." , + __func__, agbno, mp->m_sb.sb_agblocks); +ASSERT (0 ); +return XFS_ERROR (EINVAL ); + } +/* +* Get the allocation group header. +*/ + error =xfs_ialloc_read_agi (mp, tp, agno, &agbp); +if (error) { +xfs_warn (mp,"%s: xfs_ialloc_read_agi() returned error %d." , + __func__, error); +return error; + } + agi =XFS_BUF_TO_AGI (agbp); +ASSERT (agi->agi_magicnum ==cpu_to_be32 (XFS_AGI_MAGIC )); +ASSERT (agbno <be32_to_cpu (agi->agi_length)); +/* +* Initialize the cursor. +*/ + cur =xfs_inobt_init_cursor (mp, tp, agbp, agno); + + error =xfs_check_agi_freecount (cur, agi); +if (error) + goto error0; + +/* +* Look for the entry describing this inode. +*/ +if ((error =xfs_inobt_lookup (cur, agino,XFS_LOOKUP_LE , &i))) { +xfs_warn (mp,"%s: xfs_inobt_lookup() returned error %d." , + __func__, error); + goto error0; + } +XFS_WANT_CORRUPTED_GOTO (i ==1 , error0); + error =xfs_inobt_get_rec (cur, &rec, &i); +if (error) { +xfs_warn (mp,"%s: xfs_inobt_get_rec() returned error %d." , + __func__, error); + goto error0; + } +XFS_WANT_CORRUPTED_GOTO (i ==1 , error0); +/* +* Get the offset in the inode chunk. +*/ + off = agino - rec.ir_startino; +ASSERT (off >=0 && off <XFS_INODES_PER_CHUNK ); +ASSERT (!(rec.ir_free &XFS_INOBT_MASK (off))); +/* +* Mark the inode free & increment the count. +*/ + rec.ir_free |=XFS_INOBT_MASK (off); + rec.ir_freecount++; + +/* +* When an inode cluster is free, it becomes eligible for removal +*/ +if (!(mp->m_flags &XFS_MOUNT_IKEEP ) && + (rec.ir_freecount ==XFS_IALLOC_INODES (mp))) { + + *delete =1 ; + *first_ino =XFS_AGINO_TO_INO (mp, agno, rec.ir_startino); + +/* +* Remove the inode cluster from the AGI B+Tree, adjust the +* AGI and Superblock inode counts, and mark the disk space +* to be freed when the transaction is committed. +*/ + ilen =XFS_IALLOC_INODES (mp); +be32_add_cpu (&agi->agi_count, -ilen); +be32_add_cpu (&agi->agi_freecount, -(ilen -1 )); +xfs_ialloc_log_agi (tp, agbp,XFS_AGI_COUNT |XFS_AGI_FREECOUNT ); + pag =xfs_perag_get (mp, agno); + pag->pagi_freecount -= ilen -1 ; +xfs_perag_put (pag); +xfs_trans_mod_sb (tp,XFS_TRANS_SB_ICOUNT , -ilen); +xfs_trans_mod_sb (tp,XFS_TRANS_SB_IFREE , -(ilen -1 )); + +if ((error =xfs_btree_delete (cur, &i))) { +xfs_warn (mp,"%s: xfs_btree_delete returned error %d." , + __func__, error); + goto error0; + } + +xfs_bmap_add_free (XFS_AGB_TO_FSB (mp, + agno,XFS_INO_TO_AGBNO (mp,rec.ir_startino)), +XFS_IALLOC_BLOCKS (mp), flist, mp); + }else { + *delete =0 ; + + error =xfs_inobt_update (cur, &rec); +if (error) { +xfs_warn (mp,"%s: xfs_inobt_update returned error %d." , + __func__, error); + goto error0; + } + +/* +* Change the inode free counts and log the ag/sb changes. +*/ +be32_add_cpu (&agi->agi_freecount,1 ); +xfs_ialloc_log_agi (tp, agbp,XFS_AGI_FREECOUNT ); + pag =xfs_perag_get (mp, agno); + pag->pagi_freecount++; +xfs_perag_put (pag); +xfs_trans_mod_sb (tp,XFS_TRANS_SB_IFREE ,1 ); + } + + error =xfs_check_agi_freecount (cur, agi); +if (error) + goto error0; + +xfs_btree_del_cursor (cur,XFS_BTREE_NOERROR ); +return 0 ; + +error0: +xfs_btree_del_cursor (cur,XFS_BTREE_ERROR ); +return error; +} + STATIC int xfs_imap_lookup( struct xfs_mount *mp,
@@ -1153,7 +1320,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 */ -xfs_agblock_t offset_agbno;/* blks from chunk start to inode */ +int offset_agbno;/* blks from chunk start to inode */ ASSERT (ino !=NULLFSINO );
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/50 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
@@ -71,7 +71,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
@@ -168,4 +168,9 @@ typedef unsigned long long __psunsigned_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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/50 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
@@ -191,7 +191,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)
@@ -265,7 +267,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
@@ -4426,12 +4426,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
@@ -1320,7 +1320,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/50 xfsprogs: fix make deb
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Commit 48212a30 ("xfsprogs: update 'make deb' to use tarball) fixed a bunch of problems with making the source tarball for releases. However, it broke the debian package builds in a way I hadn't noticed until I rewrote my CI system build script.
I noticed that the CI system wasn't building from a pristine workarea, and instead was just updating the old workarea and running 'make deb'. I added a 'make realclean' to remove all previous state from the workarea, and then 'make deb' started failing with errors building the tarball because po/xfsprogs.pot didn't have a build rule
The above commit removed the pre-build of the translations target, and instead made the translation build target a dependency of building the the tarball. Hence the lack of a build rule of the translations causes the source tarball build to fail.
--- Makefile | 2 ++ 1 file changed, 2 insertions(+)
Makefile +2 -0
@@ -135,6 +135,8 @@ deb: include/builddefs include/platform_defs.h ifeq ($(HAVE_BUILDDEFS), no) $(Q)$(MAKE) $(MAKEOPTS) -C . $@ else + # need to build translations before the source tarball + $(Q)$(MAKE) $(MAKEOPTS) -C po $(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR) $(Q)cd $(SRCDIR) && dpkg-buildpackage endif
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/50 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 | 2 +- include/libxfs.h | 2 +- include/libxlog.h | 2 +- include/xfs_inode.h | 63 +------------ include/xfs_inode_item.h | 170 --------------------------------- include/xfs_inode_item_format.h | 198 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 202 insertions(+), 235 deletions(-) delete mode 100644 include/xfs_inode_item.h create mode 100644 include/xfs_inode_item_format.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_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ + xfs_icreate_item.h xfs_inode.h xfs_inode_item_format.h xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +1 -1
@@ -48,7 +48,7 @@#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_inode_item_format.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
include/libxlog.h +1 -1
@@ -49,7 +49,7 @@ struct xlog {#include <xfs/xfs_log_recover.h> #include <xfs/xfs_buf_item.h> -#include <xfs/xfs_inode_item.h> +#include <xfs/xfs_inode_item_format.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_inode.h +1 -62
75 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_inode_item_format.h new file +198 -0
198 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/50 xfs: split out buf log item format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/Makefile | 2 +- include/libxfs.h | 8 +- include/libxlog.h | 2 +- include/xfs_buf_item.h | 174 ----------------------------------------- include/xfs_buf_item_format.h | 111 ++++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 177 deletions(-) delete mode 100644 include/xfs_buf_item.h create mode 100644 include/xfs_buf_item_format.h
include/Makefile +1 -1
@@ -23,7 +23,7 @@ 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_buf_item_format.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_format.h xfs_inum.h \
include/libxfs.h +7 -1
@@ -47,7 +47,7 @@#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_buf_item_format.h> #include <xfs/xfs_inode_item_format.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h>
@@ -444,6 +444,12 @@ typedef struct xfs_buf_log_item {xfs_buf_log_format_t bli_format;/* in-log header */ } xfs_buf_log_item_t; +/* buf log item flags */ +#define XFS_BLI_HOLD 0x01 +#define XFS_BLI_DIRTY 0x02 +#define XFS_BLI_STALE 0x04 +#define XFS_BLI_INODE_ALLOC_BUF 0x10 + typedef struct xfs_dq_logitem { xfs_log_item_t qli_item; /* common portion */ struct xfs_dquot *qli_dquot; /* dquot ptr */
include/libxlog.h +1 -1
@@ -48,7 +48,7 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_buf_item.h> +#include <xfs/xfs_buf_item_format.h> #include <xfs/xfs_inode_item_format.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_buf_item.h deleted +0 -174
174 lines not on this page · raw message
include/xfs_buf_item_format.h new file +111 -0
111 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/50 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/Makefile | 6 +- include/libxfs.h | 3 +- include/xfs_inode.h | 149 ---- include/xfs_inode_fork.h | 169 +++++ libxfs/Makefile | 5 +- libxfs/xfs_inode.c | 1877 +-------------------------------------------- libxfs/xfs_inode_fork.c | 1893 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 2076 insertions(+), 2026 deletions(-) create mode 100644 include/xfs_inode_fork.h create mode 100644 libxfs/xfs_inode_fork.c
include/Makefile +5 -1
@@ -26,7 +26,11 @@ QAHFILES = libxfs.h libxlog.h \ xfs_btree_trace.h xfs_buf_item_format.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_format.h xfs_inum.h \ + xfs_icreate_item.h \ + xfs_inode.h \ + xfs_inode_fork.h \ + xfs_inode_item_format.h \ + xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +2 -1
@@ -46,9 +46,10 @@#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_item_format.h> #include <xfs/xfs_inode.h> #include <xfs/xfs_buf_item_format.h> -#include <xfs/xfs_inode_item_format.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
include/xfs_inode.h +0 -149
179 lines not on this page · raw message
include/xfs_inode_fork.h new file +169 -0
169 lines not on this page · raw message
libxfs/Makefile +4 -1
@@ -12,7 +12,10 @@ 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_ialloc.c \ + xfs_inode.c \ + xfs_inode_fork.c \ + xfs_btree.c xfs_alloc_btree.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 +3 -1874
1,910 lines not on this page · raw message
libxfs/xfs_inode_fork.c new file +1893 -0
708 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
PATCH 27/50 xfs: move unrealted definitions out of xfs_inode.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/xfs_inode.h | 38 -------------------------------------- include/xfs_trans.h | 7 +++++++ libxfs/xfs.h | 3 +++ 3 files changed, 10 insertions(+), 38 deletions(-)
include/xfs_inode.h +0 -38
@@ -32,50 +32,12 @@ 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__#include "xfs_inode_ops.h" #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_trans.h +7 -0
@@ -227,6 +227,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 */ +#ifdef __KERNEL__struct xfs_buf ;
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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 28/50 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 | 58 ------- include/xfs_inode_buf.h | 52 ++++++ libxfs/Makefile | 2 +- libxfs/init.c | 3 +- libxfs/xfs_inode.c | 434 ----------------------------------------------- libxfs/xfs_inode_buf.c | 430 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 487 insertions(+), 496 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
@@ -27,7 +27,7 @@ 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_buf.h \ xfs_inode_fork.h \ xfs_inode_item_format.h \ xfs_inum.h \
include/libxfs.h +1 -1
@@ -48,7 +48,7 @@#include <xfs/xfs_dinode.h> #include <xfs/xfs_inode_fork.h> #include <xfs/xfs_inode_item_format.h> -#include <xfs/xfs_inode.h> +#include <xfs/xfs_inode_buf.h> #include <xfs/xfs_buf_item_format.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h>
include/xfs_inode.h deleted +0 -58
58 lines not on this page · raw message
include/xfs_inode_buf.h new file +52 -0
52 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -13,7 +13,7 @@ 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_inode_buf.c \ xfs_inode_fork.c \ xfs_btree.c xfs_alloc_btree.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.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 -434
434 lines not on this page · raw message
libxfs/xfs_inode_buf.c new file +430 -0
430 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 29/50 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 | 2 +- include/xfs_dfrag.h | 53 --------------------------------------------------- include/xfs_fs.h | 15 +++++++++++++++ 4 files changed, 16 insertions(+), 55 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 -1
@@ -33,7 +33,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ - xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h xfs_dfrag.h + xfs_trace.h xfs_trans.h xfs_trans_resv.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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/50 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 | 8 +- include/libxlog.h | 2 +- include/xfs_extfree_item.h | 165 ------------------------------------- include/xfs_extfree_item_format.h | 101 +++++++++++++++++++++++ 4 files changed, 108 insertions(+), 168 deletions(-) delete mode 100644 include/xfs_extfree_item.h create mode 100644 include/xfs_extfree_item_format.h
include/Makefile +6 -2
@@ -24,8 +24,12 @@ QAHFILES = libxfs.h libxlog.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_format.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_dinode.h \ + xfs_dir2.h \ + xfs_dir2_format.h \ + xfs_extfree_item_format.h \ + xfs_ialloc.h \ + xfs_ialloc_btree.h \ xfs_icreate_item.h \ xfs_inode_buf.h \ xfs_inode_fork.h \
include/libxlog.h +1 -1
@@ -50,7 +50,7 @@ struct xlog {#include <xfs/xfs_log_recover.h> #include <xfs/xfs_buf_item_format.h> #include <xfs/xfs_inode_item_format.h> -#include <xfs/xfs_extfree_item.h> +#include <xfs/xfs_extfree_item_format.h> #include <xfs/xfs_icreate_item.h> typedef union {
include/xfs_extfree_item.h deleted +0 -165
165 lines not on this page · raw message
include/xfs_extfree_item_format.h new file +101 -0
101 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 31/50 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 | 4 +- include/libxfs.h | 1 + include/xfs_dquot_format.h | 132 ++++++++++++++++++++++++++++++++++++++++++++ include/xfs_quota.h | 112 ------------------------------------- 4 files changed, 136 insertions(+), 113 deletions(-) create mode 100644 include/xfs_dquot_format.h
include/Makefile +3 -1
@@ -36,7 +36,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_inode_item_format.h \ xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ - xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ + xfs_quota.h \ + xfs_dquot_format.h \ + xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h
include/libxfs.h +1 -0
@@ -412,6 +412,7 @@ extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int);#include <xfs/xfs_quota.h> +#include <xfs/xfs_dquot_format.h> #include <xfs/xfs_trans_space.h> #include <xfs/xfs_log.h> #include <xfs/xfs_log_priv.h>
include/xfs_dquot_format.h new file +132 -0
132 lines not on this page · raw message
include/xfs_quota.h +0 -112
133 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 32/50 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 | 2 +- include/libxfs.h | 2 +- include/libxlog.h | 2 +- include/xfs_icreate_item.h | 22 +-------------------- include/xfs_icreate_item_format.h | 39 +++++++++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 include/xfs_icreate_item_format.h
include/Makefile +1 -1
@@ -30,7 +30,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_extfree_item_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ - xfs_icreate_item.h \ + xfs_icreate_item_format.h \ xfs_inode_buf.h \ xfs_inode_fork.h \ xfs_inode_item_format.h \
include/libxfs.h +1 -1
@@ -56,7 +56,7 @@#include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> -#include <xfs/xfs_icreate_item.h> +#include <xfs/xfs_icreate_item_format.h> #include <xfs/xfs_trans.h> #ifndef ARRAY_SIZE
include/libxlog.h +1 -1
@@ -51,7 +51,7 @@ struct xlog {#include <xfs/xfs_buf_item_format.h> #include <xfs/xfs_inode_item_format.h> #include <xfs/xfs_extfree_item_format.h> -#include <xfs/xfs_icreate_item.h> +#include <xfs/xfs_icreate_item_format.h> typedef union { xlog_rec_header_t hic_header;
include/xfs_icreate_item.h +1 -21
@@ -18,25 +18,7 @@#ifndef XFS_ICREATE_ITEM_H #define XFS_ICREATE_ITEM_H 1 -/* -* on disk 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 */ -}; - -#ifdef __KERNEL__ +#include "xfs_icreate_item_format.h" /* in memory log item structure */ struct xfs_icreate_item {
@@ -51,6 +33,4 @@ void xfs_icreate_log(struct xfs_trans *tp, xfs_agnumber_t agno, unsigned int inode_size, xfs_agblock_t length, unsigned int generation); -#endif /* __KERNEL__ */ -#endif /* XFS_ICREATE_ITEM_H */
include/xfs_icreate_item_format.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-2010, Dave Chinner +* 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 +*/ +#ifndef __XFS_ICREATE_ITEM_FORMAT_H__ +#define __XFS_ICREATE_ITEM_FORMAT_H__ 1 + +/* +* on disk 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_ICREATE_ITEM_FORMAT_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 33/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 35/50 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.
Also, remove the duplicate magic number definitions for XFS_TRANS_HEADER_MAGIC...
--- include/Makefile | 5 +- include/libxfs.h | 3 +- include/xfs_trans.h | 469 -------------------------------------------- include/xfs_trans_format.h | 240 +++++++++++++++++++++++ 4 files changed, 246 insertions(+), 471 deletions(-) delete mode 100644 include/xfs_trans.h create mode 100644 include/xfs_trans_format.h
include/Makefile +4 -1
@@ -39,7 +39,10 @@ QAHFILES = libxfs.h libxlog.h \ xfs_quota.h \ xfs_dquot_format.h \ xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ - xfs_trace.h xfs_trans.h xfs_trans_resv.h xfs_trans_space.h + xfs_trace.h \ + xfs_trans_format.h \ + xfs_trans_resv.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/libxfs.h +2 -1
@@ -57,7 +57,8 @@#include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item_format.h> -#include <xfs/xfs_trans.h> +#include <xfs/xfs_trans_resv.h> +#include <xfs/xfs_trans_format.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
include/xfs_trans.h deleted +0 -469
469 lines not on this page · raw message
include/xfs_trans_format.h new file +240 -0
240 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 36/50 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
@@ -163,7 +163,7 @@ typedef struct xfs_bmalloca { { 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 38/50 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 | 3 +- include/libxfs.h | 2 +- include/xfs_symlink.h | 67 --------------- include/xfs_symlink_remote.h | 60 ++++++++++++++ libxfs/Makefile | 4 +- libxfs/xfs_symlink.c | 176 ---------------------------------------- libxfs/xfs_symlink_remote.c | 185 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 251 insertions(+), 246 deletions(-) delete mode 100644 include/xfs_symlink.h create mode 100644 include/xfs_symlink_remote.h delete mode 100644 libxfs/xfs_symlink.c create mode 100644 libxfs/xfs_symlink_remote.c
include/Makefile +2 -1
@@ -38,7 +38,8 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_quota.h \ xfs_dquot_format.h \ - xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ + xfs_rtalloc.h xfs_sb.h \ + xfs_symlink_remote.h \ xfs_trace.h \ xfs_trans_format.h \ xfs_trans_resv.h \
include/libxfs.h +1 -1
@@ -55,7 +55,7 @@#include <xfs/xfs_btree_trace.h> #include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> -#include <xfs/xfs_symlink.h> +#include <xfs/xfs_symlink_remote.h> #include <xfs/xfs_icreate_item_format.h> #include <xfs/xfs_trans_resv.h> #include <xfs/xfs_trans_format.h>
include/xfs_symlink.h deleted +0 -67
67 lines not on this page · raw message
include/xfs_symlink_remote.h new file +60 -0
60 lines not on this page · raw message
libxfs/Makefile +3 -1
@@ -20,7 +20,9 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.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_sb.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ - crc32.c xfs_symlink.c xfs_trans_resv.c + xfs_symlink_remote.c \ + xfs_trans_resv.c \ + crc32.c CFILES += $(PKG_PLATFORM).c PCFILES = darwin.c freebsd.c irix.c linux.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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 39/50 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 | 3 +- include/libxlog.h | 6 - include/xfs_log.h | 192 ------------- include/xfs_log_format.h | 178 ++++++++++++ include/xfs_log_priv.h | 691 --------------------------------------------- libxfs/rdwr.c | 2 - libxlog/xfs_log_recover.c | 2 + 8 files changed, 184 insertions(+), 894 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
@@ -35,7 +35,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_inode_fork.h \ xfs_inode_item_format.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_quota.h \ xfs_dquot_format.h \ xfs_rtalloc.h xfs_sb.h \
include/libxfs.h +1 -2
@@ -415,8 +415,7 @@ extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int);#include <xfs/xfs_quota.h> #include <xfs/xfs_dquot_format.h> #include <xfs/xfs_trans_space.h> -#include <xfs/xfs_log.h> -#include <xfs/xfs_log_priv.h> +#include <xfs/xfs_log_format.h> /* * Transaction interface
include/libxlog.h +0 -6
@@ -53,12 +53,6 @@ struct xlog {#include <xfs/xfs_extfree_item_format.h> #include <xfs/xfs_icreate_item_format.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 -192
192 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 -691
691 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 +2 -0
@@ -27,6 +27,8 @@ }) +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) +/* * Verify the given count of basic blocks is valid number of blocks * to specify for an operation involving the given XFS log buffer.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 40/50 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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 41/50 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
@@ -217,6 +217,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/50 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 | 50 ------------ libxfs/xfs.h | 34 ++++++++ libxfs/xfs_bmap.c | 222 +++------------------------------------------------- 3 files changed, 43 insertions(+), 263 deletions(-)
include/xfs_bmap.h +0 -50
@@ -107,43 +107,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 */ -char stack_switch; -int flags; -#ifdef __KERNEL__ -struct completion *done; -struct work_struct work; -int result; -#endif /* __KERNEL__ */ -}xfs_bmalloca_t ; - -/* * Flags for xfs_bmap_add_extent*. */ #define BMAP_LEFT_CONTIG (1 << 0)
@@ -206,17 +169,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__ - -int xfs_bmap_finish (struct xfs_trans **tp,struct xfs_bmap_free *flist, -int *committed); -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); - -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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 43/50 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 | 283 ---------------------------------------------- include/xfs_quota_defs.h | 143 +++++++++++++++++++++++ 4 files changed, 145 insertions(+), 285 deletions(-) delete mode 100644 include/xfs_quota.h create mode 100644 include/xfs_quota_defs.h
include/Makefile +1 -1
@@ -38,7 +38,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_quota.h \ + xfs_quota_defs.h \ xfs_dquot_format.h \ xfs_rtalloc.h xfs_sb.h \ xfs_symlink_remote.h \
include/libxfs.h +1 -1
@@ -443,7 +443,7 @@ extern int libxfs_ihash_size;extern void libxfs_iomove (xfs_buf_t *,uint ,int ,void *,int ); -#include <xfs/xfs_quota.h> +#include <xfs/xfs_quota_defs.h> #include <xfs/xfs_dquot_format.h> #include <xfs/xfs_trans_space.h> #include <xfs/xfs_log_format.h>
include/xfs_quota.h deleted +0 -283
283 lines not on this page · raw message
include/xfs_quota_defs.h new file +143 -0
143 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 44/50 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 | 3 +- include/libxfs.h | 2 +- include/xfs_rtalloc.h | 166 -------------------------------------------- include/xfs_rtalloc_defs.h | 70 +++++++++++++++++++ 4 files changed, 73 insertions(+), 168 deletions(-) delete mode 100644 include/xfs_rtalloc.h create mode 100644 include/xfs_rtalloc_defs.h
include/Makefile +2 -1
@@ -40,7 +40,8 @@ QAHFILES = libxfs.h libxlog.h \ xfs_metadump.h \ xfs_quota_defs.h \ xfs_dquot_format.h \ - xfs_rtalloc.h xfs_sb.h \ + xfs_rtalloc_defs.h \ + xfs_sb.h \ xfs_symlink_remote.h \ xfs_trace.h \ xfs_trans_format.h \
include/libxfs.h +1 -1
@@ -667,7 +667,7 @@ 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_rtalloc_defs.h> #include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_remote.h>
include/xfs_rtalloc.h deleted +0 -166
166 lines not on this page · raw message
include/xfs_rtalloc_defs.h new file +70 -0
70 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 45/50 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
@@ -202,7 +202,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 (xfs_mount_t *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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 46/50 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
@@ -60,6 +60,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 */ };/*
@@ -107,7 +108,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 47/50 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
@@ -109,7 +109,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 48/50 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
@@ -511,7 +511,8 @@ typedef struct xfs_trans {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
@@ -63,6 +63,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 ; }
@@ -615,13 +617,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,
@@ -658,9 +663,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 ;
@@ -694,9 +701,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);
@@ -731,7 +738,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 49/50 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
@@ -90,42 +90,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.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 50/50 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_log_format.h | 12 ++++- libxfs/Makefile | 1 + libxfs/util.c | 107 ++++++++++++++++++++++++++++++++++++ libxfs/xfs_log_rlimit.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 60 +++++---------------- mkfs/xfs_mkfs.c | 89 +++++++++++++++--------------- mkfs/xfs_mkfs.h | 4 +- 7 files changed, 313 insertions(+), 95 deletions(-) create mode 100644 libxfs/xfs_log_rlimit.c
include/xfs_log_format.h +11 -1
@@ -1,5 +1,6 @@/* * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. +* Copyright (c) 2013 Jie Liu. * All Rights Reserved. * * This program is free software; you can redistribute it and/or
@@ -18,6 +19,9 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +struct xfs_trans_res ; +typedef __uint32_t xlog_tid_t ;#define XLOG_MIN_ICLOGS 2
@@ -39,6 +43,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))
@@ -123,7 +130,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
@@ -175,4 +181,8 @@ typedef struct xfs_log_iovec { uint i_type; /* type of region */ } xfs_log_iovec_t; +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 +1 -0
@@ -19,6 +19,7 @@ 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_log_rlimit.c \ xfs_sb.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ xfs_symlink_remote.c \ xfs_trans_resv.c \
libxfs/util.c +107 -0
113 lines not on this page · raw message
libxfs/xfs_log_rlimit.c new file +135 -0
135 lines not on this page · raw message
mkfs/maxtrres.c +12 -48
88 lines not on this page · raw message
mkfs/xfs_mkfs.c +45 -44
101 lines not on this page · raw message
mkfs/xfs_mkfs.h +2 -2
@@ -54,7 +54,6 @@#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 */ /* with max trans reservation */ #define XFS_MAX_INODE_SIG_BITS 32/* most significant bits in an
@@ -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 dirblocklogi, +int log_sunit);#endif /* __XFS_MKFS_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs