xfsprogs: patches for crc-dev branch
cover xfsprogs: patches for crc-dev branch
Hi folks,
This series is the matching patch series to my for-3.12 kernel series posted here:
http://oss.sgi.com/pipermail/xfs/2013-July/028207.html
The first 3 patches add icreate transaction support to xfs_logprint.
The next 37 patches update the libxfs code to match the kernel code in the above patch set - many of the transformations are identical, and they bring the code bases mostly into synchronisation.
The next 6 patches introduce jeff Liu's transaciton reservation patchset and integrate it into mkfs to ensure that mkfs.xfs doesn't create logs that are too small. This version has the "default log size larger than the AG size so mkfs fails" problems fixed, so all the xfstests regressions it caused are gone.
THe last 3 patches introduce dirent filetype support into libxfs, mkfs and xfs_db. xfs_repair can handle the new dirent structures just fine, but it doesn't yet have code to validate that the filetype in the dirent matches the inode it points to.
Anyway, this applies to a current crc-dev branch, and should compile cleanly without warnings. If you do get warnings, let me know, because I'm getting ready to a -Werror to the build so that it breaks whenever someone introduces a compile time warning....
Comments, thoughts, flames?
Cheers,
Dave.
$ git diff --stat -C -M --summary --minimal cdc4cb9..
copy/xfs_copy.c | 12 +-
db/bmroot.c | 6 +-
db/check.c | 12 +-
db/dir2.c | 51 +-
db/dir2.h | 1 +
db/dir2sf.c | 61 ++-
db/dir2sf.h | 3 +
db/field.c | 7 +
db/field.h | 3 +
db/inode.c | 23 +-
db/metadump.c | 10 +-
fsr/xfs_fsr.c | 1 -
include/Makefile | 24 +-
include/libxfs.h | 98 +++-
include/libxlog.h | 13 -
include/platform_defs.h.in | 5 +
include/swab.h | 6 +-
include/xfs_ag.h | 55 +-
include/xfs_alloc_btree.h | 3 +-
include/xfs_attr_leaf.h | 1 +
include/xfs_attr_remote.h | 28 +-
include/xfs_bmap.h | 54 +-
include/xfs_bmap_btree.h | 5 +-
include/xfs_btree.h | 3 +-
include/xfs_buf_item.h | 172 ------
include/xfs_da_btree.h | 1 +
include/xfs_dfrag.h | 53 --
include/xfs_dinode.h | 3 -
include/xfs_dir2.h | 20 +-
include/xfs_dir2_format.h | 208 +++++--
include/xfs_extfree_item.h | 161 ------
include/xfs_format.h | 169 ++++++
include/xfs_fs.h | 41 +-
include/xfs_ialloc.h | 8 +
include/xfs_ialloc_btree.h | 3 +-
include/xfs_inode.h | 631 ----------------------
include/xfs_inode_buf.h | 52 ++
include/xfs_inode_fork.h | 171 ++++++
include/xfs_inode_item.h | 170 ------
include/xfs_log.h | 189 -------
include/xfs_log_format.h | 773 +++++++++++++++++++++++++++
include/xfs_log_priv.h | 692 ------------------------
include/xfs_mount.h | 403 --------------
include/xfs_quota.h | 393 --------------
include/xfs_quota_defs.h | 157 ++++++
include/xfs_rtalloc.h | 166 ------
include/xfs_sb.h | 58 +-
include/xfs_symlink.h | 45 --
include/xfs_trace.h | 1 +
include/xfs_trans.h | 224 +-------
include/xfs_trans_resv.h | 116 ++++
include/xfs_types.h | 59 +-
io/init.h | 3 -
libxfs/Makefile | 34 +-
libxfs/init.c | 5 +-
libxfs/rdwr.c | 3 -
libxfs/trans.c | 130 ++++-
libxfs/util.c | 122 ++++-
libxfs/xfs.h | 62 ++-
libxfs/xfs_alloc.c | 37 +-
libxfs/xfs_alloc_btree.c | 23 +-
libxfs/xfs_attr.c | 39 +-
libxfs/xfs_attr_leaf.c | 9 +-
libxfs/xfs_attr_remote.c | 8 +-
libxfs/xfs_bmap.c | 438 ++++-----------
libxfs/xfs_bmap_btree.c | 14 +-
libxfs/xfs_btree.c | 10 +
libxfs/xfs_da_btree.c | 69 +--
libxfs/xfs_dir2.c | 50 +-
libxfs/xfs_dir2_block.c | 44 +-
libxfs/xfs_dir2_data.c | 39 +-
libxfs/xfs_dir2_leaf.c | 17 +-
libxfs/xfs_dir2_node.c | 43 +-
libxfs/xfs_dir2_priv.h | 44 +-
libxfs/xfs_dir2_sf.c | 141 +++--
libxfs/xfs_ialloc.c | 271 ++++++++--
libxfs/xfs_ialloc_btree.c | 16 +-
libxfs/xfs_inode_buf.c | 408 ++++++++++++++
libxfs/{xfs_inode.c => xfs_inode_fork.c} | 425 +--------------
libxfs/xfs_log_rlimit.c | 135 +++++
libxfs/xfs_rtalloc.c | 6 +-
libxfs/{xfs_mount.c => xfs_sb.c} | 118 +++-
libxfs/{xfs_symlink.c => xfs_symlink_remote.c} | 52 +-
libxfs/{xfs_trans.c => xfs_trans_resv.c} | 379 +++++++------
libxlog/xfs_log_recover.c | 3 +
logprint/log_misc.c | 94 +++-
logprint/log_print_all.c | 21 +
mkfs/maxtrres.c | 58 +-
mkfs/proto.c | 24 +-
mkfs/xfs_mkfs.c | 107 ++--
mkfs/xfs_mkfs.h | 4 +-
repair/attr_repair.c | 2 +
repair/dir2.c | 37 +-
repair/dir2.h | 1 +
repair/incore_ino.c | 2 +
repair/phase5.c | 3 +-
repair/phase6.c | 111 ++--
repair/phase7.c | 7 +-
repair/scan.c | 1 +
99 files changed, 4251 insertions(+), 5042 deletions(-)
delete mode 100644 include/xfs_buf_item.h
delete mode 100644 include/xfs_dfrag.h
delete mode 100644 include/xfs_extfree_item.h
create mode 100644 include/xfs_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
delete mode 100644 include/xfs_inode_item.h
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
delete mode 100644 include/xfs_symlink.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} (87%)
rename libxfs/{xfs_symlink.c => xfs_symlink_remote.c} (68%)
rename libxfs/{xfs_trans.c => xfs_trans_resv.c} (67%)_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/49 xfsprogs: introduce xfs_icreate.h
From: Dave Chinner <[email protected]>
Bring the new inode create item definitions across from kernel space for xfs_logprint to be able to parse.
--- include/Makefile | 2 +- include/xfs_icreate_item.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_log.h | 3 ++- include/xfs_trans.h | 7 +++++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 include/xfs_icreate_item.h
include/Makefile +1 -1
@@ -26,7 +26,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ - xfs_inode.h xfs_inode_item.h xfs_inum.h \ + xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/xfs_icreate_item.h new file +52 -0
52 lines not on this page · raw message
include/xfs_log.h +2 -1
@@ -88,7 +88,8 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)#define XLOG_REG_TYPE_UNMOUNT 17#define XLOG_REG_TYPE_COMMIT 18#define XLOG_REG_TYPE_TRANSHDR 19 -#define XLOG_REG_TYPE_MAX 19 +#define XLOG_REG_TYPE_ICREATE 20 +#define XLOG_REG_TYPE_MAX 20 typedef struct xfs_log_iovec { void *i_addr; /* beginning address of region */
include/xfs_trans.h +5 -2
@@ -48,6 +48,7 @@ typedef struct xfs_trans_header {#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ #define XFS_LI_DQUOT 0x123d#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f#define XFS_LI_TYPE_DESC \ { XFS_LI_EFI, "XFS_LI_EFI" }, \
@@ -56,7 +57,8 @@ typedef struct xfs_trans_header { { XFS_LI_INODE, "XFS_LI_INODE" }, \ { XFS_LI_BUF, "XFS_LI_BUF" }, \ { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ - { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" } + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" }/* * Transaction types. Used to distinguish types of buffers.
@@ -107,7 +109,8 @@ typedef struct xfs_trans_header {#define XFS_TRANS_SWAPEXT 40#define XFS_TRANS_SB_COUNT 41#define XFS_TRANS_CHECKPOINT 42 -#define XFS_TRANS_TYPE_MAX 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43/* new transaction types need to be reflected in xfs_logprint(8) */ #define XFS_TRANS_TYPES \
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/49] xfsprogs: introduce xfs_icreate.h
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Bring the new inode create item definitions across from kernel space for
xfs_logprintto be able to parse.Signed-off-by Dave Chinner <[email protected]>---
okay, sync with kernel commit 3ebe7d.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/49 xfsprogs: port inode create transaction changes
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Bring across the relevant parts of the new inode create transaction sufficient to keep kernel/user code in sync and implement the infrastructure needed to make it work in xfsprogs.
--- include/libxfs.h | 1 + include/xfs_ialloc.h | 8 +++ include/xfs_icreate_item.h | 3 ++ libxfs/xfs.h | 5 ++ libxfs/xfs_ialloc.c | 87 +++++++++++++++++++++++++-------- libxfs/xfs_trans.c | 118 +++++++++++++++++++++++++++++---------------- 6 files changed, 160 insertions(+), 62 deletions(-)
include/libxfs.h +1 -0
@@ -57,6 +57,7 @@#include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> +#include <xfs/xfs_icreate_item.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
include/xfs_ialloc.h +8 -0
@@ -150,6 +150,14 @@ int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,int xfs_inobt_get_rec (struct xfs_btree_cur *cur,xfs_inobt_rec_incore_t *rec,int *stat); +/* +* Inode chunk initialisation routine +*/ +int xfs_ialloc_inode_init (struct xfs_mount *mp,struct xfs_trans *tp, +struct list_head *buffer_list, +xfs_agnumber_t agno,xfs_agblock_t agbno, +xfs_agblock_t length,unsigned int gen); +extern const struct xfs_buf_ops xfs_agi_buf_ops;#endif /* __XFS_IALLOC_H__ */
include/xfs_icreate_item.h +3 -0
@@ -36,6 +36,8 @@ struct xfs_icreate_log {__be32 icl_gen;/* inode generation number to use */ }; +#ifdef __KERNEL__ + /* in memory log item structure */ struct xfs_icreate_item { struct xfs_log_item ic_item;
@@ -48,5 +50,6 @@ void xfs_icreate_log(struct xfs_trans *tp, xfs_agnumber_t agno, xfs_agblock_t agbno, unsigned int count, unsigned int inode_size, xfs_agblock_t length, unsigned int generation); +#endif /* __KERNEL__ */ #endif /* XFS_ICREATE_ITEM_H */
libxfs/xfs.h +5 -0
@@ -176,6 +176,7 @@ roundup_pow_of_two(uint v)#define XBF_TRYLOCK XFS_BUF_TRYLOCK#define XBF_DONT_BLOCK 0#define XBF_UNMAPPED 0 +#define XBF_DONE 0#define XFS_BUF_GETERROR (bp) 0#define XFS_BUF_DONE (bp) ((bp)->b_flags |= LIBXFS_B_UPTODATE)#define XFS_BUF_ISDONE (bp) ((bp)->b_flags & LIBXFS_B_UPTODATE)
@@ -194,6 +195,7 @@ roundup_pow_of_two(uint v)#define xfs_buf_relse (bp) libxfs_putbuf(bp)#define xfs_buf_get (devp,blkno,len,f) (libxfs_getbuf((devp), (blkno), (len)))#define xfs_bwrite (bp) libxfs_writebuf((bp), 0) +#define xfs_buf_delwri_queue (bp, bl) libxfs_writebuf((bp), 0)#define XBRW_READ LIBXFS_BREAD#define XBRW_WRITE LIBXFS_BWRITE
@@ -252,6 +254,7 @@ roundup_pow_of_two(uint v)#define xfs_trans_get_block_res (tp) 1#define xfs_trans_set_sync (tp) ((void) 0) +#define xfs_trans_ordered_buf (tp, bp) ((void) 0)#define xfs_trans_agblocks_delta (tp, d)#define xfs_trans_agflist_delta (tp, d)#define xfs_trans_agbtree_delta (tp, d)
@@ -325,6 +328,8 @@ do { \#define uuid_copy (s,d) platform_uuid_copy((s),(d))#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0) +#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +/* * Prototypes for kernel static functions that are aren't in their * associated header files
libxfs/xfs_ialloc.c +66 -21
133 lines not on this page · raw message
libxfs/xfs_trans.c +77 -41
154 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/49] xfsprogs: port inode create transaction changes
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Bring across the relevant parts of the new inode create transaction sufficient to keep kernel/user code in sync and implement the infrastructure needed to make it work in xfsprogs.
Signed-off-by Dave Chinner<[email protected]>---
parts of kernel commits 28c8e41a, ddf6ad01, b8402b47?, and b8402b47.
No illusion to really verifying this patch and just signing off on it.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/49 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.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 03/49] xfsprogs: teach logprint about icreate transaction
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
xfs_logprint can print the icreate log items. good layout of information.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/49 libxfs: fix directory/attribute format issues
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
directory data headers and attr leaf headers need padding for 32 bit systems to correctly align the data sections on 64 bit boundaries.
--- include/xfs_attr_leaf.h | 1 + include/xfs_dir2_format.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
include/xfs_attr_leaf.h +1 -0
@@ -128,6 +128,7 @@ struct xfs_attr3_leaf_hdr {__u8 holes;__u8 pad1;struct xfs_attr_leaf_map freemap[XFS_ATTR_LEAF_MAPSIZE ]; +__be32 pad2;/* 64 bit alignment */ };#define XFS_ATTR3_LEAF_CRC_OFF (offsetof(struct xfs_attr3_leaf_hdr, info.crc))
include/xfs_dir2_format.h +3 -2
@@ -260,6 +260,7 @@ struct xfs_dir3_blk_hdr {struct xfs_dir3_data_hdr {struct xfs_dir3_blk_hdr hdr;xfs_dir2_data_free_t best_free[XFS_DIR2_DATA_FD_COUNT ]; +__be32 pad;/* 64 bit alignment */ };#define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc)
@@ -471,7 +472,7 @@ struct xfs_dir3_leaf_hdr {struct xfs_da3_blkinfo info;/* header for da routines */ __be16 count;/* count of entries */ __be16 stale;/* count of stale entries */ -__be32 pad; +__be32 pad;/* 64 bit alignment */ };struct xfs_dir3_icleaf_hdr {
@@ -712,7 +713,7 @@ struct xfs_dir3_free_hdr {__be32 firstdb;/* db of first entry */ __be32 nvalid;/* count of valid entries */ __be32 nused;/* count of used entries */ -__be32 pad;/* 64 bit alignment. */ +__be32 pad;/* 64 bit alignment */ };struct xfs_dir3_free {
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/49] libxfs: fix directory/attribute format issues
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
directory data headers and attr leaf headers need padding for 32 bit systems to correctly align the data sections on 64 bit boundaries.
Signed-off-by Dave Chinner<[email protected]>---
kernel commit 5170711d
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/49 libxfs: ensure btree root split sets blkno correctly
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
For CRC enabled filesystems, the BMBT is rooted in an inode, so it passes through a difference code path on root splits to the freespace and inode btrees. The inode based btree root has a corruption problem on split - it's the same problem we saw in the directory/attr code where headers are memcpy()d from one block to another without updating the self describing metadata.
Simple fix - when copying the header out of the root block, make sure the block number is updated correctly.
--- libxfs/xfs_btree.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
libxfs/xfs_btree.c +10 -0
@@ -2487,7 +2487,17 @@ xfs_btree_new_iroot(if (error) goto error0; +/* +* we can't just memcpy() the root in for CRC enabled btree blocks. +* In that case have to also ensure the blkno remains correct +*/ memcpy (cblock, block,xfs_btree_block_len (cur)); +if (cur->bc_flags &XFS_BTREE_CRC_BLOCKS ) { +if (cur->bc_flags &XFS_BTREE_LONG_PTRS ) + cblock->bb_u.l.bb_blkno =cpu_to_be64 (cbp->b_bn); +else + cblock->bb_u.s.bb_blkno =cpu_to_be64 (cbp->b_bn); + }be16_add_cpu (&block->bb_level,1 );xfs_btree_set_numrecs (block,1 );
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/49] libxfs: ensure btree root split sets blkno correctly
kernel commit ade1335a
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/49 libxfs: fix byte swapping on constants
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The kernel code uses cpu_to_beXX() on constants in switch() statements for magic numbers in the btree code. Th ebyte swapping infratructure isn't hooked up to the proper byte swap macros to make this work, so fix it and then swap all the generic btree code over to match the kernel code.
--- include/swab.h | 6 +++--- libxfs/xfs_alloc_btree.c | 23 ++++++++++++++--------- libxfs/xfs_bmap_btree.c | 14 ++++++-------- libxfs/xfs_ialloc_btree.c | 16 +++++++++++----- 4 files changed, 34 insertions(+), 25 deletions(-)
include/swab.h +3 -3
@@ -96,15 +96,15 @@*/ # define __swab16 (x) \ (__builtin_constant_p((__u16)(x)) ? \ - ___swab16((x)) : \ + ___constant_swab16((x)) : \ __fswab16((x)))# define __swab32 (x) \ (__builtin_constant_p((__u32)(x)) ? \ - ___swab32((x)) : \ + ___constant_swab32((x)) : \ __fswab32((x)))# define __swab64 (x) \ (__builtin_constant_p((__u64)(x)) ? \ - ___swab64((x)) : \ + ___constant_swab64((x)) : \ __fswab64((x)))
libxfs/xfs_alloc_btree.c +14 -9
@@ -268,10 +268,15 @@ xfs_allocbt_verify(* During growfs operations, we can't verify the exact level or owner as * the perag is not fully initialised and hence not attached to the * buffer. In this case, check against the maximum tree depth. +* +* Similarly, during log recovery we will have a perag structure +* attached, but the agf information will not yet have been initialised +* from the on disk AGF. Again, we can only check against maximum limits +* in this case. */ level =be16_to_cpu (block->bb_level); -switch (cpu_to_be32 (block->bb_magic)) { -case XFS_ABTB_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_ABTB_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -282,14 +287,14 @@ xfs_allocbt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_ABTB_MAGIC : -if (pag) { +case cpu_to_be32 (XFS_ABTB_MAGIC ): +if (pag && pag->pagf_init) {if (level >= pag->pagf_levels[XFS_BTNUM_BNOi])return false; }else if (level >= mp->m_ag_maxlevels)return false;break ; -case XFS_ABTC_CRC_MAGIC : +case cpu_to_be32 (XFS_ABTC_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -300,8 +305,8 @@ xfs_allocbt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_ABTC_MAGIC : -if (pag) { +case cpu_to_be32 (XFS_ABTC_MAGIC ): +if (pag && pag->pagf_init) {if (level >= pag->pagf_levels[XFS_BTNUM_CNTi])return false; }else if (level >= mp->m_ag_maxlevels)
@@ -361,7 +366,7 @@ const struct xfs_buf_ops xfs_allocbt_buf_ops = { }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_allocbt_keys_inorder( struct xfs_btree_cur *cur,
@@ -483,7 +488,7 @@ static const struct xfs_btree_ops xfs_allocbt_ops = { .init_ptr_from_cur = xfs_allocbt_init_ptr_from_cur, .key_diff = xfs_allocbt_key_diff, .buf_ops = &xfs_allocbt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_allocbt_keys_inorder, .recs_inorder = xfs_allocbt_recs_inorder,#endif
libxfs/xfs_bmap_btree.c +6 -8
@@ -708,13 +708,13 @@ xfs_bmbt_verify(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);unsigned int level; -switch (be32_to_cpu (block->bb_magic)) { -case XFS_BMAP_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_BMAP_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.l.bb_uuid, &mp->m_sb.sb_uuid))return false; -if (block->bb_u.l.bb_blkno !=cpu_to_be64 (bp->b_bn)) +if (be64_to_cpu (block->bb_u.l.bb_blkno) != bp->b_bn)return false;/* * XXX: need a better way of verifying the owner here. Right now
@@ -723,7 +723,7 @@ xfs_bmbt_verify(if (be64_to_cpu (block->bb_u.l.bb_owner) ==0 )return false;/* fall through */ -case XFS_BMAP_MAGIC : +case cpu_to_be32 (XFS_BMAP_MAGIC ):break ;default :return false;
@@ -759,7 +759,6 @@ static voidxfs_bmbt_read_verify ( struct xfs_buf *bp) { -xfs_bmbt_verify (bp);if (!(xfs_btree_lblock_verify_crc (bp) &&xfs_bmbt_verify (bp))) {trace_xfs_btree_corrupt (bp, _RET_IP_);
@@ -767,7 +766,6 @@ xfs_bmbt_read_verify( bp->b_target->bt_mount, bp->b_addr);xfs_buf_ioerror (bp,EFSCORRUPTED ); } - } static void
@@ -791,7 +789,7 @@ const struct xfs_buf_ops xfs_bmbt_buf_ops = { }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_bmbt_keys_inorder( struct xfs_btree_cur *cur,
@@ -920,7 +918,7 @@ static const struct xfs_btree_ops xfs_bmbt_ops = { .init_ptr_from_cur = xfs_bmbt_init_ptr_from_cur, .key_diff = xfs_bmbt_key_diff, .buf_ops = &xfs_bmbt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_bmbt_keys_inorder, .recs_inorder = xfs_bmbt_recs_inorder,#endif
libxfs/xfs_ialloc_btree.c +11 -5
@@ -175,9 +175,15 @@ xfs_inobt_verify(/* * During growfs operations, we can't verify the exact owner as the * perag is not fully initialised and hence not attached to the buffer. +* +* Similarly, during log recovery we will have a perag structure +* attached, but the agi information will not yet have been initialised +* from the on disk AGI. We don't currently use any of this information, +* but beware of the landmine (i.e. need to check pag->pagi_init) if we +* ever do. */ -switch (be32_to_cpu (block->bb_magic)) { -case XFS_IBT_CRC_MAGIC : +switch (block->bb_magic) { +case cpu_to_be32 (XFS_IBT_CRC_MAGIC ):if (!xfs_sb_version_hascrc (&mp->m_sb))return false;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
@@ -188,7 +194,7 @@ xfs_inobt_verify( be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)return false;/* fall through */ -case XFS_IBT_MAGIC : +case cpu_to_be32 (XFS_IBT_MAGIC ):break ;default :return 0 ;
@@ -246,7 +252,7 @@ const struct xfs_buf_ops xfs_inobt_buf_ops = { .verify_write = xfs_inobt_write_verify, }; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) STATIC int xfs_inobt_keys_inorder( struct xfs_btree_cur *cur,
@@ -350,7 +356,7 @@ static const struct xfs_btree_ops xfs_inobt_ops = { .init_ptr_from_cur = xfs_inobt_init_ptr_from_cur, .key_diff = xfs_inobt_key_diff, .buf_ops = &xfs_inobt_buf_ops, -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN ) .keys_inorder = xfs_inobt_keys_inorder, .recs_inorder = xfs_inobt_recs_inorder,#endif
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 06/49] libxfs: fix byte swapping on constants
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The kernel code uses
cpu_to_beXX()on constants inswitch()statements for magic numbers in the btree code. Th ebyte swapping infratructure isn't hooked up to the proper byte swap macros to make this work, so fix it and then swap all the generic btree code over to match the kernel code.Signed-off-by Dave Chinner<[email protected]>---
sync to include/uapi/linux/swab.h and (IMO backwards) switch/case statements in xfs_allocbt_verify() like kernel commit ee1a47ab.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
***** SUSPECTED SPAM ***** Re: [PATCH 06/49] libxfs: fix byte swapping on constants
Quoted 9 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The kernel code uses
cpu_to_beXX()on constants inswitch()statements for magic numbers in the btree code. Th ebyte swapping infratructure isn't hooked up to the proper byte swap macros to make this work, so fix it and then swap all the generic btree code over to match the kernel code.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
sync to
include/uapi/linux/swab.hand (IMO backwards) switch/case statements inxfs_allocbt_verify()like kernel commitee1a47ab.
The reason they are done that way is so that the compiler evalutes the byte swap rather than doing it at runtime. i.e runtime only requires a comparisons, instead of a endian swap then a comparison. Hence we end up with smaller, faster code...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/49 libxfs: sync xfs_da_btree.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some variables we renamed in the kernel code, and there are a few other minor differences. Fix them up.
--- libxfs/xfs_da_btree.c | 63 +++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 30 deletions(-)
libxfs/xfs_da_btree.c +33 -30
@@ -480,8 +480,10 @@ xfs_da3_split(* There might be three blocks involved if a double split occurred, * and the original block 0 could be at any position in the list. * -* Note: the info structures being modified here for both v2 and v3 da -* headers, so we can do this linkage just using the v2 structures. +* Note: the magic numbers and sibling pointers are in the same +* physical place for both v2 and v3 headers (by design). Hence it +* doesn't matter which version of the xfs_da_intnode structure we use +* here as the result will be the same using either structure. */ node = oldblk->bp->b_addr;if (node->hdr.info.forw) {
@@ -820,7 +822,7 @@ xfs_da3_node_rebalance(*/ nodehdr2.count += count; tmp = count * (uint )sizeof (xfs_da_node_entry_t); - btree_s = &btree1[nodehdr1.count- count]; + btree_s = &btree1[nodehdr1.count - count]; btree_d = &btree2[0 ];memcpy (btree_d, btree_s, tmp); nodehdr1.count -= count;
@@ -1380,10 +1382,10 @@ xfs_da3_node_unbalance( {struct xfs_da_intnode *drop_node;struct xfs_da_intnode *save_node; -struct xfs_da_node_entry *dbtree; -struct xfs_da_node_entry *sbtree; -struct xfs_da3_icnode_hdr dhdr; -struct xfs_da3_icnode_hdr shdr; +struct xfs_da_node_entry *drop_btree; +struct xfs_da_node_entry *save_btree; +struct xfs_da3_icnode_hdr drop_hdr; +struct xfs_da3_icnode_hdr save_hdr;struct xfs_trans *tp;int sindex;int tmp;
@@ -1392,43 +1394,44 @@ xfs_da3_node_unbalance( drop_node = drop_blk->bp->b_addr; save_node = save_blk->bp->b_addr; -xfs_da3_node_hdr_from_disk (&dhdr, drop_node); -xfs_da3_node_hdr_from_disk (&shdr, save_node); - dbtree =xfs_da3_node_tree_p (drop_node); - sbtree =xfs_da3_node_tree_p (save_node); +xfs_da3_node_hdr_from_disk (&drop_hdr, drop_node); +xfs_da3_node_hdr_from_disk (&save_hdr, save_node); + drop_btree =xfs_da3_node_tree_p (drop_node); + save_btree =xfs_da3_node_tree_p (save_node); tp = state->args->trans;/* * If the dying block has lower hashvals, then move all the * elements in the remaining block up to make a hole. */ -if ((be32_to_cpu (dbtree[0 ].hashval) <be32_to_cpu (sbtree[0 ].hashval)) || - (be32_to_cpu (dbtree[dhdr.count -1 ].hashval) < -be32_to_cpu (sbtree[shdr.count -1 ].hashval))) { +if ((be32_to_cpu (drop_btree[0 ].hashval) < +be32_to_cpu (save_btree[0 ].hashval)) || + (be32_to_cpu (drop_btree[drop_hdr.count -1 ].hashval) < +be32_to_cpu (save_btree[save_hdr.count -1 ].hashval))) {/* XXX: check this - is memmove dst correct? */ - tmp = shdr.count * (uint )sizeof (xfs_da_node_entry_t); -memmove (&sbtree[dhdr.count], &sbtree[0 ], tmp); + tmp = save_hdr.count *sizeof (xfs_da_node_entry_t); +memmove (&save_btree[drop_hdr.count], &save_btree[0 ], tmp); sindex =0 ;xfs_trans_log_buf (tp, save_blk->bp, -XFS_DA_LOGRANGE (save_node, &sbtree[0 ], - (shdr.count + dhdr.count) * +XFS_DA_LOGRANGE (save_node, &save_btree[0 ], + (save_hdr.count + drop_hdr.count) *sizeof (xfs_da_node_entry_t))); }else { - sindex = shdr.count; + sindex = save_hdr.count;xfs_trans_log_buf (tp, save_blk->bp, -XFS_DA_LOGRANGE (save_node, &sbtree[sindex], - dhdr.count *sizeof (xfs_da_node_entry_t))); +XFS_DA_LOGRANGE (save_node, &save_btree[sindex], + drop_hdr.count *sizeof (xfs_da_node_entry_t))); }/* * Move all the B-tree elements from drop_blk to save_blk. */ - tmp = dhdr.count * (uint )sizeof (xfs_da_node_entry_t); -memcpy (&sbtree[sindex], &dbtree[0 ], tmp); - shdr.count += dhdr.count; + tmp = drop_hdr.count * (uint )sizeof (xfs_da_node_entry_t); +memcpy (&save_btree[sindex], &drop_btree[0 ], tmp); + save_hdr.count += drop_hdr.count; -xfs_da3_node_hdr_to_disk (save_node, &shdr); +xfs_da3_node_hdr_to_disk (save_node, &save_hdr);xfs_trans_log_buf (tp, save_blk->bp,XFS_DA_LOGRANGE (save_node, &save_node->hdr,xfs_da3_node_hdr_size (save_node)));
@@ -1436,7 +1439,7 @@ xfs_da3_node_unbalance(/* * Save the last hashval in the remaining block for upward propagation. */ - save_blk->hashval =be32_to_cpu (sbtree[shdr.count -1 ].hashval); + save_blk->hashval =be32_to_cpu (save_btree[save_hdr.count -1 ].hashval); }/*========================================================================
@@ -2201,8 +2204,6 @@ xfs_da3_swap_lastblock( }else {struct xfs_da3_icnode_hdr deadhdr; -ASSERT (dead_info->magic ==cpu_to_be16 (XFS_DA_NODE_MAGIC ) || - dead_info->magic ==cpu_to_be16 (XFS_DA3_NODE_MAGIC )); dead_node = (xfs_da_intnode_t *)dead_info;xfs_da3_node_hdr_from_disk (&deadhdr, dead_node); btree =xfs_da3_node_tree_p (dead_node);
@@ -2441,7 +2442,8 @@ xfs_buf_map_from_irec(ASSERT (nirecs >=1 );if (nirecs >1 ) { - map =kmem_zalloc (nirecs *sizeof (struct xfs_buf_map ),KM_SLEEP ); + map =kmem_zalloc (nirecs *sizeof (struct xfs_buf_map ), +KM_SLEEP |KM_NOFS );if (!map)return ENOMEM ; *mapp = map;
@@ -2497,7 +2499,8 @@ xfs_dabuf_map(* Optimize the one-block case. */ if (nfsb !=1 ) - irecs =kmem_zalloc (sizeof (irec) * nfsb,KM_SLEEP ); + irecs =kmem_zalloc (sizeof (irec) * nfsb, +KM_SLEEP |KM_NOFS ); nirecs = nfsb; error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs,
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/49] libxfs: sync xfs_da_btree.c
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some variables we renamed in the kernel code, and there are a few other minor differences. Fix them up.
Signed-off-by Dave Chinner<[email protected]>---
changed variable names in xfs_da3_node_unbalance(). add directory allocation NOFS per kernel commit b17cb364
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/49 libxfs: update xfs_alloc to current kernel version
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- libxfs/xfs_alloc.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-)
libxfs/xfs_alloc.c +19 -12
@@ -153,6 +153,7 @@ xfs_alloc_compute_diff(xfs_agblock_t wantbno,/* target starting block */ xfs_extlen_t wantlen, /* target length */ xfs_extlen_t alignment, /* target alignment */ + char userdata, /* are we allocating data? */ xfs_agblock_t freebno, /* freespace's starting block */ xfs_extlen_t freelen, /* freespace's length */ xfs_agblock_t *newbnop) /* result: best start block from free */
@@ -167,7 +168,14 @@ xfs_alloc_compute_diff(ASSERT (freelen >= wantlen); freeend = freebno + freelen; wantend = wantbno + wantlen; -if (freebno >= wantbno) { +/* +* We want to allocate from the start of a free extent if it is past +* the desired block or if we are allocating user data and the free +* extent is before desired block. The second case is there to allow +* for contiguous allocation from the remaining free space if the file +* grows in the short term. +*/ +if (freebno >= wantbno || (userdata && freeend < wantend)) {if ((newbno1 =roundup (freebno, alignment)) >= freeend) newbno1 =NULLAGBLOCK ; }else if (freeend >= wantend && alignment >1 ) {
@@ -783,7 +791,8 @@ xfs_alloc_find_best_extent(xfs_alloc_fix_len (args); sdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, *sbnoa, + args->alignment, + args->userdata, *sbnoa, *slena, &new);/*
@@ -954,7 +963,8 @@ restart:if (args->len < blen)continue ; ltdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, ltbnoa, ltlena, <new); + args->alignment, args->userdata, ltbnoa, + ltlena, <new);if (ltnew !=NULLAGBLOCK && (args->len > blen || ltdiff < bdiff)) { bdiff = ltdiff;
@@ -1106,7 +1116,8 @@ restart: args->len =XFS_EXTLEN_MIN (ltlena, args->maxlen);xfs_alloc_fix_len (args); ltdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, ltbnoa, ltlena, <new); + args->alignment, args->userdata, ltbnoa, + ltlena, <new); error = xfs_alloc_find_best_extent(args, &bno_cur_lt, &bno_cur_gt,
@@ -1122,7 +1133,8 @@ restart: args->len =XFS_EXTLEN_MIN (gtlena, args->maxlen);xfs_alloc_fix_len (args); gtdiff =xfs_alloc_compute_diff (args->agbno, args->len, - args->alignment, gtbnoa, gtlena, >new); + args->alignment, args->userdata, gtbnoa, + gtlena, >new); error = xfs_alloc_find_best_extent(args, &bno_cur_gt, &bno_cur_lt,
@@ -1181,7 +1193,7 @@ restart: } rlen = args->len; (void )xfs_alloc_compute_diff (args->agbno, rlen, args->alignment, - ltbnoa, ltlena, <new); + args->userdata, ltbnoa, ltlena, <new);ASSERT (ltnew >= ltbno);ASSERT (ltnew + rlen <= ltbnoa + ltlena);ASSERT (ltnew + rlen <=be32_to_cpu (XFS_BUF_TO_AGF (args->agbp)->agf_length));
@@ -2173,13 +2185,8 @@ xfs_agf_verify(struct xfs_agf *agf =XFS_BUF_TO_AGF (bp);if (xfs_sb_version_hascrc (&mp->m_sb) && - !uuid_equal (&agf->agf_uuid, &mp->m_sb.sb_uuid)) { -char uu[64 ], uu2[64 ]; -platform_uuid_unparse (&agf->agf_uuid, uu); -platform_uuid_unparse (&mp->m_sb.sb_uuid, uu2); - + !uuid_equal (&agf->agf_uuid, &mp->m_sb.sb_uuid))return false; - } if (!(agf->agf_magicnum == cpu_to_be32(XFS_AGF_MAGIC) && XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) &&
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 08/49] libxfs: update xfs_alloc to current kernel version
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
okay, only difference is the initializing of the pagb_tree in xfs_alloc_read_agf(). Don't use the busy extent tree in user space.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/49 libxfs: sync attr code with kernel
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- libxfs/xfs_attr.c | 6 +++--- libxfs/xfs_attr_leaf.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
libxfs/xfs_attr.c +3 -3
@@ -65,7 +65,7 @@ xfs_attr_name_to_xname(return 0 ; } -STATIC int +int xfs_inode_hasattr (struct xfs_inode *ip) {
@@ -268,7 +268,6 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error = xfs_trans_reserve(args.trans, args.total, XFS_ATTRSETM_LOG_RES(mp) + XFS_ATTRSETRT_LOG_RES(mp) * args.total,
@@ -587,6 +586,7 @@ xfs_attr_remove(return xfs_attr_remove_int (dp, &xname, flags); } +/*======================================================================== * External routines when attribute list is inside the inode *========================================================================*/
@@ -854,7 +854,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) error =xfs_attr3_leaf_lookup_int (bp, args);if (error ==ENOATTR ) {xfs_trans_brelse (args->trans, bp); -return (error); +return error; }xfs_attr3_leaf_remove (bp, args);
libxfs/xfs_attr_leaf.c +3 -4
@@ -51,7 +51,6 @@ STATIC int xfs_attr3_leaf_figure_balance(xfs_da_state_t *state,int *number_entries_in_blk1, int *number_usedbytes_in_blk1); -/* * Utility routines. */
@@ -1120,7 +1119,6 @@ xfs_attr3_leaf_add_work(struct xfs_attr_leaf_entry *entry;struct xfs_attr_leaf_name_local *name_loc;struct xfs_attr_leaf_name_remote *name_rmt; -struct xfs_attr_leaf_map *map;struct xfs_mount *mp;int tmp;int i;
@@ -1219,7 +1217,7 @@ xfs_attr3_leaf_add_work( tmp = (ichdr->count -1 ) *sizeof (xfs_attr_leaf_entry_t) +xfs_attr3_leaf_hdr_size (leaf); -for (i =0 ; i <XFS_ATTR_LEAF_MAPSIZE ; map++, i++) { +for (i =0 ; i <XFS_ATTR_LEAF_MAPSIZE ; i++) {if (ichdr->freemap[i].base == tmp) { ichdr->freemap[i].base +=sizeof (xfs_attr_leaf_entry_t); ichdr->freemap[i].size -=sizeof (xfs_attr_leaf_entry_t);
@@ -2337,7 +2335,7 @@ xfs_attr3_leaf_moveents(* Move the remaining entries down to fill the hole, * then zero the entries at the top. */ - tmp = (ichdr_s->count - count) -sizeof (xfs_attr_leaf_entry_t); + tmp = (ichdr_s->count - count) *sizeof (xfs_attr_leaf_entry_t); entry_s = &xfs_attr3_leaf_entryp (leaf_s)[start_s + count]; entry_d = &xfs_attr3_leaf_entryp (leaf_s)[start_s];memmove (entry_d, entry_s, tmp);
@@ -2431,6 +2429,7 @@ xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int *local)return size; } +/*======================================================================== * Manage the INCOMPLETE flag in a leaf entry *========================================================================*/
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 09/49] libxfs: sync attr code with kernel
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>--- libxfs/xfs_attr.c | 6 +++--- libxfs/xfs_attr_leaf.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
syncs the code in libxfs/xfs_attr.c and libxfs/xfs_attr_leaf.c to kernel files with exception of the part in xfs_attr_shortform_to_leaf() that gets updated by patch 14/49.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/49 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.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/49] libxfs: sync dir2 kernel differences
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
syncs the libxfs/xfs_dir2.c, libxfs/xfs_dir2_data.c, libxfs/xfs_dir2_leaf.c, and libxfs/xfs_dir2_node.c to the Linux 3.12 series before kernel patch 31/49.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/49] libxfs: sync dir2 kernel differences
In reply to Dave Chinnerlibxfs/xfs_dir2_node.c
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
libxfs/xfs_dir2_node.c +0
-0
9th chunk in libxfs/xfs_dir2_node.c patch
libxfs/xfs_dir2_node.c xfs_dir2_node_addname_int( · line 1801
Quoted 12 lines
libxfs/xfs_dir2_node.c +2
-2@@ -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);
A clean up in the xfsprogs master branch requires this to be removed.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/49 libxfs: sync xfs_ialloc.c to the kernel code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
include the missing xfs_difree() function. it's not used by userspace, but it makes no sense to have just this one arbitrary difference between the kernel and userspace files.
--- libxfs/xfs.h | 1 + libxfs/xfs_ialloc.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 177 insertions(+), 10 deletions(-)
libxfs/xfs.h +1 -0
@@ -208,6 +208,7 @@ roundup_pow_of_two(uint v)#define XFS_MOUNT_SMALL_INUMS 0/* ignored in userspace */ #define XFS_MOUNT_WSYNC 0/* ignored in userspace */ #define XFS_MOUNT_NOALIGN 0/* ignored in userspace */ +#define XFS_MOUNT_IKEEP 0/* ignored in userspace */ #define xfs_icsb_modify_counters (mp, field, delta, rsvd) \ xfs_mod_incore_sb(mp, field, delta, rsvd)
libxfs/xfs_ialloc.c +176 -10
232 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 11/49] libxfs: sync xfs_ialloc.c to the kernel code
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
include the missing
xfs_difree()function. it's not used by userspace, but it makes no sense to have just this one arbitrary difference between the kernel and userspace files.Signed-off-by Dave Chinner<[email protected]>---
adds xfs_difree(). Adds parts of kernel patches 83a9ba00 and 43df2ee6.
changed variable "offset_agbno" in xfs_imap() from "xfs_agblock_t to "int" so patch 13/49 can move it back to "offset_agbno". good stuff.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/49 xfsprogs: define min/max once and use them everywhere.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/libxfs.h | 1 - include/platform_defs.h.in | 5 +++++ io/init.h | 3 --- libxfs/rdwr.c | 1 - 4 files changed, 5 insertions(+), 5 deletions(-)
include/libxfs.h +0 -1
@@ -72,7 +72,6 @@#define __round_mask (x, y) ((__typeof__(x))((y)-1))#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1)#define round_down (x, y) ((x) & ~__round_mask(x, y)) -#define min (a,b) ((a) < (b) ? (a) : (b))/* * Argument structure for libxfs_init().
include/platform_defs.h.in +5 -0
@@ -173,4 +173,9 @@ typedef unsigned short umode_t; #define __arch_pack #endif +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + #endif /* __XFS_PLATFORM_DEFS_H__ */
io/init.h +0 -3
@@ -26,7 +26,4 @@ extern int expert;extern size_t pagesize;extern struct timeval stopwatch; -#define min (a,b) (((a)<(b))?(a):(b)) -#define max (a,b) (((a)>(b))?(a):(b)) -extern void init_cvtnum (size_t *blocksize,size_t *sectsize);
libxfs/rdwr.c +0 -1
@@ -22,7 +22,6 @@#include "init.h" #define BDSTRAT_SIZE (256 * 1024) -#define min (x, y) ((x) < (y) ? (x) : (y))#define IO_BCOMPARE_CHECK
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 12/49] xfsprogs: define min/max once and use them everywhere.
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
remove private min/max and define it in include/platform_defs.h where it is included in xfs.h and libxfs.h.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/49 libxfs: fix compile warnings
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
--- copy/xfs_copy.c | 12 ++++++++++-- db/bmroot.c | 6 +++--- libxfs/xfs.h | 8 +++++++- libxfs/xfs_attr_remote.c | 8 ++++---- libxfs/xfs_bmap.c | 3 --- libxfs/xfs_da_btree.c | 6 +++--- libxfs/xfs_dir2_node.c | 2 ++ libxfs/xfs_ialloc.c | 2 +- libxfs/xfs_rtalloc.c | 4 ++-- repair/attr_repair.c | 2 ++ repair/incore_ino.c | 2 ++ repair/scan.c | 1 + 12 files changed, 37 insertions(+), 19 deletions(-)
copy/xfs_copy.c +10 -2
@@ -434,6 +434,10 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag, off =XFS_AG_DADDR (mp, agno,XFS_SB_DADDR ); buf->position = (xfs_off_t ) off * (xfs_off_t )BBSIZE ; length = buf->length = first_agbno * blocksize; +if (length ==0 ) { +do_log (_ ("ag header buffer invalid!\n" )); +exit (1 ); + }/* handle alignment stuff */
@@ -449,7 +453,6 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag,if (buf->length % buf->min_io_size !=0 ) buf->length =roundup (buf->length, buf->min_io_size); -ASSERT (length !=0 );read_wbuf (fd, buf, mp);ASSERT (buf->length >= length);
@@ -936,7 +939,12 @@ main(int argc, char **argv)for (;;) {/* none of this touches the w_buf buffer */ -ASSERT (current_level < btree_levels); +if (current_level >= btree_levels) { +do_log ( +_ ("Error: current level %d >= btree levels %d\n" ), + current_level, btree_levels); +exit (1 ); + } current_level++;
db/bmroot.c +3 -3
@@ -91,13 +91,13 @@ bmroota_key_offset( int idx) {xfs_bmdr_block_t *block; -/* REFERENCED */ -xfs_dinode_t *dip; +#ifdef DEBUG +xfs_dinode_t *dip = obj; +#endif xfs_bmdr_key_t *kp;ASSERT (bitoffs (startoff) ==0 );ASSERT (obj == iocur_top->data); - dip = obj; block = (xfs_bmdr_block_t *)((char *)obj +byteize (startoff));ASSERT (XFS_DFORK_Q (dip) && (char *)block ==XFS_DFORK_APTR (dip));ASSERT (be16_to_cpu (block->bb_level) >0 );
libxfs/xfs.h +7 -1
@@ -189,7 +189,9 @@ roundup_pow_of_two(uint v)/* avoid gcc warning */ #define xfs_incore (bt,blkno,len,lockit) ({ \ typeof(blkno) __foo = (blkno); \ + typeof(len) __bar = (len); \ (blkno) = __foo; \ + (len) = __bar;/* no set-but-unused warning */ \NULL ; \ })#define xfs_buf_relse (bp) libxfs_putbuf(bp)
@@ -259,7 +261,11 @@ roundup_pow_of_two(uint v)#define xfs_trans_agblocks_delta (tp, d)#define xfs_trans_agflist_delta (tp, d)#define xfs_trans_agbtree_delta (tp, d) -#define xfs_trans_buf_set_type (tp, bp, t) +#define xfs_trans_buf_set_type(tp, bp, t) ({ \ + int __t = (t); \ + __t = __t; /* no set-but-unused warning */ \ +}) +#define xfs_trans_buf_copy_type (dbp, sbp)#define xfs_buf_readahead (a,b,c,ops) ((void) 0)/* no readahead */
libxfs/xfs_attr_remote.c +4 -4
@@ -214,7 +214,7 @@ xfs_attr_rmtval_copyout(xfs_ino_t ino, int *offset, int *valuelen, - char **dst) + __uint8_t **dst) { char *src = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -261,7 +261,7 @@ xfs_attr_rmtval_copyin(xfs_ino_t ino, int *offset, int *valuelen, - char **src) + __uint8_t **src) { char *dst = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -314,7 +314,7 @@ xfs_attr_rmtval_get(struct xfs_mount *mp = args->dp->i_mount;struct xfs_buf *bp;xfs_dablk_t lblkno = args->rmtblkno; -char *dst = args->value; +__uint8_t *dst = args->value;int valuelen = args->valuelen;int nmap;int error;
@@ -378,7 +378,7 @@ xfs_attr_rmtval_set(struct xfs_bmbt_irec map;xfs_dablk_t lblkno;xfs_fileoff_t lfileoff =0 ; -char *src = args->value; +__uint8_t *src = args->value;int blkcnt;int valuelen;int nmap;
libxfs/xfs_bmap.c +0 -3
@@ -4437,12 +4437,9 @@ xfs_bmapi_allocate(struct xfs_ifork *ifp =XFS_IFORK_PTR (bma->ip, whichfork);int tmp_logflags =0 ;int error; -int rt;ASSERT (bma->length >0 ); - rt = (whichfork ==XFS_DATA_FORK ) &&XFS_IS_REALTIME_INODE (bma->ip); -/* * For the wasdelay case, we could also just allocate the stuff asked * for in this bmap call but that wouldn't be as good.
libxfs/xfs_da_btree.c +3 -3
@@ -376,7 +376,7 @@ xfs_da3_split(struct xfs_da_intnode *node;struct xfs_buf *bp;int max; -int action; +int action =0 ;int error;int i;
@@ -2431,9 +2431,9 @@ static intxfs_buf_map_from_irec ( struct xfs_mount *mp, struct xfs_buf_map **mapp, - unsigned int *nmaps, + int *nmaps, struct xfs_bmbt_irec *irecs, - unsigned int nirecs) + int nirecs) { struct xfs_buf_map *map;int i;
libxfs/xfs_dir2_node.c +2 -0
@@ -295,11 +295,13 @@ xfs_dir2_free_log_header(struct xfs_trans *tp, struct xfs_buf *bp) { +#ifdef DEBUG xfs_dir2_free_t *free; /* freespace structure */ free = bp->b_addr;ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); +#endif xfs_trans_log_buf (tp, bp,0 ,xfs_dir3_free_hdr_size (tp->t_mountp) -1 ); }
libxfs/xfs_ialloc.c +1 -1
@@ -1319,7 +1319,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agblock_t offset_agbno;/* blks from chunk start to inode */ ASSERT (ino !=NULLFSINO );
libxfs/xfs_rtalloc.c +2 -2
@@ -431,8 +431,8 @@ xfs_rtfree_range( {xfs_rtblock_t end;/* end of the freed extent */ int error;/* error value */ -xfs_rtblock_t postblock;/* first block freed > end */ -xfs_rtblock_t preblock;/* first block freed < start */ +xfs_rtblock_t postblock =0 ;/* first block freed > end */ +xfs_rtblock_t preblock =0 ;/* first block freed < start */ end = start + len -1 ;/*
repair/attr_repair.c +2 -0
@@ -1631,9 +1631,11 @@ process_attributes( {int err;__u8 aformat = dip->di_aformat; +#ifdef DEBUG xfs_attr_shortform_t *asf; asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR (dip); +#endif if (aformat ==XFS_DINODE_FMT_LOCAL ) { ASSERT(be16_to_cpu(asf->hdr.totsize) <=
repair/incore_ino.c +2 -0
@@ -167,6 +167,7 @@ __uint32_t num_inode_references(struct ino_tree_node *irec, int ino_offset)default :ASSERT (0 ); } +return 0 ; } void set_inode_disk_nlinks(struct ino_tree_node *irec, int ino_offset,
@@ -207,6 +208,7 @@ __uint32_t get_inode_disk_nlinks(struct ino_tree_node *irec, int ino_offset)default :ASSERT (0 ); } +return 0 ; }/*
repair/scan.c +1 -0
@@ -520,6 +520,7 @@ scan_allocbt( name ="cnt" ;break ;default : + name ="(unknown)" ;assert (0 );break ; }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 13/49] libxfs: fix compile warnings
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
Signed-off-by Dave Chinner<[email protected]>---
convert a couple ASSERT converted to warn/exits, variable sign correction, non-DEBUG unused variable, default string value.
---
Don't see the significance of the initialization of variables in xfs_da3_split() and xfs_rtfree_range().
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/49 xfs: remove local fork format handling from xfs_bmapi_write()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The conversion from local format to extent format requires interpretation of the data in the fork being converted, so it cannot be done in a generic way. It is up to the caller to convert the fork format to extent format before calling into xfs_bmapi_write() so format conversion can be done correctly.
The code in xfs_bmapi_write() to convert the format is used implicitly by the attribute and directory code, but they specifically zero the fork size so that the conversion does not do any allocation or manipulation. Move this conversion into the shortform to leaf functions for the dir/attr code so the conversions are explicitly controlled by all callers.
Now we can remove the conversion code in xfs_bmapi_write.
--- include/xfs_bmap.h | 1 + libxfs/xfs_attr_leaf.c | 2 + libxfs/xfs_bmap.c | 197 ++++++++++++++++++++---------------------------- libxfs/xfs_dir2_block.c | 19 +++-- 4 files changed, 97 insertions(+), 122 deletions(-)
include/xfs_bmap.h +1 -0
@@ -169,6 +169,7 @@ void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,#endif int xfs_bmap_add_attrfork (struct xfs_inode *ip,int size,int rsvd); +void xfs_bmap_local_to_extents_empty (struct xfs_inode *ip,int whichfork);void xfs_bmap_add_free (xfs_fsblock_t bno,xfs_filblks_t len,struct xfs_bmap_free *flist,struct xfs_mount *mp);void xfs_bmap_cancel (struct xfs_bmap_free *flist);
libxfs/xfs_attr_leaf.c +2 -0
@@ -654,6 +654,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) sf = (xfs_attr_shortform_t *)tmpbuffer;xfs_idata_realloc (dp, -size,XFS_ATTR_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_ATTR_FORK ); + bp =NULL ; error =xfs_da_grow_inode (args, &blkno);if (error) {
libxfs/xfs_bmap.c +83 -114
255 lines not on this page · raw message
libxfs/xfs_dir2_block.c +11 -8
@@ -1051,13 +1051,15 @@ xfs_dir2_sf_to_block(__be16 *tagp;/* end of data entry */ xfs_trans_t *tp;/* transaction pointer */ struct xfs_name name; +struct xfs_ifork *ifp;trace_xfs_dir2_sf_to_block (args); dp = args->dp; tp = args->trans; mp = dp->i_mount; -ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); + ifp =XFS_IFORK_PTR (dp,XFS_DATA_FORK ); +ASSERT (ifp->if_flags &XFS_IFINLINE );/* * Bomb out if the shortform directory is way too short. */
@@ -1066,22 +1068,23 @@ xfs_dir2_sf_to_block(return XFS_ERROR (EIO ); } - oldsfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; + oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; -ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); -ASSERT (dp->i_df.if_u1.if_data !=NULL ); +ASSERT (ifp->if_bytes == dp->i_d.di_size); +ASSERT (ifp->if_u1.if_data !=NULL );ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (oldsfp->i8count)); +ASSERT (dp->i_d.di_nextents ==0 );/* * Copy the directory into a temporary buffer. * Then pitch the incore inode data so we can make extents. */ - sfp =kmem_alloc (dp->i_df.if_bytes,KM_SLEEP ); -memcpy (sfp, oldsfp, dp->i_df.if_bytes); + sfp =kmem_alloc (ifp->if_bytes,KM_SLEEP ); +memcpy (sfp, oldsfp, ifp->if_bytes); -xfs_idata_realloc (dp, -dp->i_df.if_bytes,XFS_DATA_FORK ); +xfs_idata_realloc (dp, -ifp->if_bytes,XFS_DATA_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_DATA_FORK ); dp->i_d.di_size =0 ; -xfs_trans_log_inode (tp, dp,XFS_ILOG_CORE );/* * Add block 0 to the inode.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/49] xfs: remove local fork format handling from xfs_bmapi_write()
Quoted 15 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The conversion from local format to extent format requires interpretation of the data in the fork being converted, so it cannot be done in a generic way. It is up to the caller to convert the fork format to extent format before calling into
xfs_bmapi_write()so format conversion can be done correctly.The code in
xfs_bmapi_write()to convert the format is used implicitly by the attribute and directory code, but they specifically zero the fork size so that the conversion does not do any allocation or manipulation. Move this conversion into the shortform to leaf functions for the dir/attr code so the conversions are explicitly controlled by all callers.
Quoted 4 lines
Now we can remove the conversion code in
xfs_bmapi_write.Signed-off-by Dave Chinner<[email protected]>---
same as kernel commit f3508bcd which I reviewed on June 27.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/49 libxfs: local to remote format support of remote symlinks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
This conversion was overlooked earlier on. Now that the differences between userspace and kernel space are getting smaller this bug is obvious. Fix it.
--- include/xfs_symlink.h | 2 ++ libxfs/xfs_bmap.c | 12 ------------ libxfs/xfs_symlink.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-)
include/xfs_symlink.h +2 -0
@@ -31,6 +31,8 @@ struct xfs_dsymlink_hdr {int xfs_symlink_blocks (struct xfs_mount *mp,int pathlen);bool xfs_symlink_hdr_ok (struct xfs_mount *mp,xfs_ino_t ino,uint32_t offset,uint32_t size,struct xfs_buf *bp); +void xfs_symlink_local_to_remote (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_inode *ip,struct xfs_ifork *ifp);extern const struct xfs_buf_ops xfs_symlink_buf_ops;
libxfs/xfs_bmap.c +0 -12
@@ -1221,18 +1221,6 @@ xfs_bmap_add_attrfork_extents(return error; } -STATIC void -xfs_symlink_local_to_remote ( -struct xfs_trans *tp, -struct xfs_buf *bp, -struct xfs_inode *ip, -struct xfs_ifork *ifp) -{ -/* remote symlink blocks are not verifiable until CRCs come along */ - bp->b_ops =NULL ; -memcpy (bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); -} -/* * Called from xfs_bmap_add_attrfork to handle local format files. Each * different data fork content type needs a different callout to do the
libxfs/xfs_symlink.c +29 -0
@@ -145,3 +145,32 @@ const struct xfs_buf_ops xfs_symlink_buf_ops = { .verify_write = xfs_symlink_write_verify, }; +void +xfs_symlink_local_to_remote ( +struct xfs_trans *tp, +struct xfs_buf *bp, +struct xfs_inode *ip, +struct xfs_ifork *ifp) +{ +struct xfs_mount *mp = ip->i_mount; +char *buf; + +if (!xfs_sb_version_hascrc (&mp->m_sb)) { + bp->b_ops =NULL ; +memcpy (bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); +return ; + } + +/* +* As this symlink fits in an inode literal area, it must also fit in +* the smallest buffer the filesystem supports. +*/ +ASSERT (BBTOB (bp->b_length) >= + ifp->if_bytes +sizeof (struct xfs_dsymlink_hdr )); + + bp->b_ops = &xfs_symlink_buf_ops; + + buf = bp->b_addr; + buf +=xfs_symlink_hdr_set (mp, ip->i_ino,0 , ifp->if_bytes, bp); +memcpy (buf, ifp->if_u1.if_data, ifp->if_bytes); +}
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/49] libxfs: local to remote format support of remote symlinks
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
This conversion was overlooked earlier on. Now that the differences between userspace and kernel space are getting smaller this bug is obvious. Fix it.
Signed-off-by Dave Chinner<[email protected]>---
same content for xfs_symlink_local_to_remote() as kernel commit f948dd76 and moved from xfs_bmap.c to xfs_symlink.c
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/49 xfs: separate out log format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace.
--- include/Makefile | 4 +- include/libxfs.h | 4 +- include/libxlog.h | 6 - include/xfs_log.h | 190 ------------- include/xfs_log_format.h | 178 ++++++++++++ include/xfs_log_priv.h | 692 ---------------------------------------------- libxfs/rdwr.c | 2 - libxlog/xfs_log_recover.c | 3 + 8 files changed, 186 insertions(+), 893 deletions(-) delete mode 100644 include/xfs_log.h create mode 100644 include/xfs_log_format.h delete mode 100644 include/xfs_log_priv.h
include/Makefile +3 -1
@@ -27,7 +27,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ - xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ + xfs_log_format.h \ + xfs_log_recover.h \ + xfs_metadump.h \ xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +2 -2
@@ -59,6 +59,8 @@#include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item.h> +#include <xfs/xfs_log_format.h> +#ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif
@@ -613,8 +615,6 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */#include <xfs/xfs_attr_remote.h> #include <xfs/xfs_quota.h> #include <xfs/xfs_trans_space.h> -#include <xfs/xfs_log.h> -#include <xfs/xfs_log_priv.h> #define XFS_INOBT_IS_FREE_DISK (rp,i) \ ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
include/libxlog.h +0 -6
@@ -53,12 +53,6 @@ struct xlog {#include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h> -typedef union { -xlog_rec_header_t hic_header; -xlog_rec_ext_header_t hic_xheader; -char hic_sector[XLOG_HEADER_SIZE ]; -}xlog_in_core_2_t ; -/* * macros mapping kernel code to user code */
include/xfs_log.h deleted +0 -190
190 lines not on this page · raw message
include/xfs_log_format.h new file +178 -0
178 lines not on this page · raw message
include/xfs_log_priv.h deleted +0 -692
692 lines not on this page · raw message
libxfs/rdwr.c +0 -2
@@ -17,8 +17,6 @@*/ #include <xfs/libxfs.h> -#include <xfs/xfs_log.h> -#include <xfs/xfs_log_priv.h> #include "init.h" #define BDSTRAT_SIZE (256 * 1024)
libxlog/xfs_log_recover.c +3 -0
@@ -26,6 +26,7 @@ (0 ); \ }) +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1)/* * Verify the given count of basic blocks is valid number of blocks
@@ -1032,6 +1033,8 @@ xlog_recover_add_item(list_add_tail (&item->ri_list, head); } +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) + STATIC int xlog_recover_add_to_cont_trans( struct xlog *log,
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 16/49] xfs: separate out log format definitions
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that
xfs_log.handxfs_log_priv.hno longer need to be shared with userspace.Signed-off-by Dave Chinner<[email protected]>---
sync the new user/kernel xfs_log_priv.h to patch 01/49 of the for Linux 3.12 kernel patch series which also means remove kernel-only headers.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/49 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
--- include/Makefile | 4 +- include/libxfs.h | 5 +- include/libxlog.h | 1 - include/xfs_inode.h | 70 ------------------ include/xfs_inode_item.h | 170 ------------------------------------------ include/xfs_log_format.h | 189 +++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_types.h | 6 ++ libxfs/trans.c | 2 +- 8 files changed, 202 insertions(+), 245 deletions(-) delete mode 100644 include/xfs_inode_item.h
include/Makefile +3 -1
@@ -26,7 +26,9 @@ QAHFILES = libxfs.h libxlog.h \ xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ - xfs_icreate_item.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ + xfs_icreate_item.h \ + xfs_inode.h \ + xfs_inum.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \
include/libxfs.h +3 -2
@@ -36,6 +36,9 @@#include <xfs/xfs_types.h> #include <xfs/xfs_fs.h> #include <xfs/xfs_arch.h> + +#include <xfs/xfs_log_format.h> +#include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h> #include <xfs/xfs_sb.h>
@@ -50,7 +53,6 @@#include <xfs/xfs_dinode.h> #include <xfs/xfs_inode.h> #include <xfs/xfs_buf_item.h> -#include <xfs/xfs_inode_item.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
@@ -59,7 +61,6 @@#include <xfs/xfs_symlink.h> #include <xfs/xfs_icreate_item.h> -#include <xfs/xfs_log_format.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))
include/libxlog.h +0 -1
@@ -49,7 +49,6 @@ struct xlog {#include <xfs/xfs_log_recover.h> #include <xfs/xfs_buf_item.h> -#include <xfs/xfs_inode_item.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_inode.h +0 -70
88 lines not on this page · raw message
include/xfs_inode_item.h deleted +0 -170
170 lines not on this page · raw message
include/xfs_log_format.h +189 -0
199 lines not on this page · raw message
include/xfs_types.h +6 -0
@@ -147,6 +147,12 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)/* +* Inode fork identifiers. +*/ +#define XFS_DATA_FORK 0 +#define XFS_ATTR_FORK 1 + +/* * Min numbers of data/attr fork btree root pointers. */ #define MINDBTPTRS 3
libxfs/trans.c +1 -1
@@ -226,7 +226,7 @@ libxfs_trans_inode_alloc_buf(* to be logged when the transaction is committed. The inode must * already be associated with the given transaction. * -* The values for fieldmask are defined in xfs_inode_item.h. We always +* The values for fieldmask are defined in xfs_log_format.h. We always * log all of the core inode if any of it has changed, and we always log * all of the inline data/extents/b-tree root if any of them has changed. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 17/49] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner<[email protected]>---
sync the new user/kernel xfs_inode.h and xfs_log_format.h to patch 02/49 of the for Linux 3.12 kernel patch series which also means remove kernel-only headers.
---
Kernel commit 92f8ff73 added "i_pdquot" to the xfs_inode structure. If you want we can refresh this patch on commit rather than rebase the series.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/49 xfs: split out buf log item format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/Makefile | 4 +- include/libxfs.h | 6 +- include/libxlog.h | 1 - include/xfs_buf_item.h | 172 ----------------------------------------------- include/xfs_log_format.h | 97 ++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 175 deletions(-) delete mode 100644 include/xfs_buf_item.h
include/Makefile +3 -1
@@ -23,7 +23,9 @@ QAHFILES = libxfs.h libxlog.h \ swab.h \ xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \ xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \ - xfs_btree_trace.h xfs_buf_item.h xfs_cksum.h xfs_da_btree.h \ + xfs_btree_trace.h \ + xfs_cksum.h \ + xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_icreate_item.h \
include/libxfs.h +5 -1
@@ -52,7 +52,6 @@#include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_inode.h> -#include <xfs/xfs_buf_item.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
@@ -438,6 +437,11 @@ typedef struct xfs_buf_log_item {xfs_buf_log_format_t bli_format;/* in-log header */ } xfs_buf_log_item_t; +#define XFS_BLI_DIRTY (1<<0) +#define XFS_BLI_HOLD (1<<1) +#define XFS_BLI_STALE (1<<2) +#define XFS_BLI_INODE_ALLOC_BUF (1<<3) +#include <xfs/xfs_trans.h> typedef struct xfs_trans {
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_buf_item.h> #include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h>
include/xfs_buf_item.h deleted +0 -172
172 lines not on this page · raw message
include/xfs_log_format.h +97 -0
101 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/49] xfs: split out buf log item format definitions
Quoted 4 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
sync the new user/kernel xfs_buf_log_item to 03/49 of the for Linux 3.12 kernel patch series which also means remove kernel-only in xfs_buf_item.h
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/49 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
--- include/Makefile | 3 +- include/libxlog.h | 1 - include/xfs_extfree_item.h | 161 --------------------------------------------- include/xfs_log_format.h | 83 +++++++++++++++++++++++ 4 files changed, 85 insertions(+), 163 deletions(-) delete mode 100644 include/xfs_extfree_item.h
include/Makefile +2 -1
@@ -27,7 +27,8 @@ QAHFILES = libxfs.h libxlog.h \ xfs_cksum.h \ xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ - xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ + xfs_ialloc.h \ + xfs_ialloc_btree.h \ xfs_icreate_item.h \ xfs_inode.h \ xfs_inum.h \
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_extfree_item.h> #include <xfs/xfs_icreate_item.h> /*
include/xfs_extfree_item.h deleted +0 -161
161 lines not on this page · raw message
include/xfs_log_format.h +83 -0
87 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/49] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner<[email protected]>---
sync the shared user/kernel extent free items to xfs_log_format.h. The kernel only extent free items remain in the header file, xfs_extfree_item.h, which is removed from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/49 xfs: separate dquot on disk format definitions out of xfs_quota.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
--- include/Makefile | 1 + include/libxfs.h | 1 + include/xfs_format.h | 86 +++++++++++++++++++++++++++++++++++ include/xfs_log_format.h | 58 ++++++++++++++++++++++++ include/xfs_quota.h | 114 ----------------------------------------------- include/xfs_types.h | 6 +++ 6 files changed, 152 insertions(+), 114 deletions(-) create mode 100644 include/xfs_format.h
include/Makefile +1 -0
@@ -27,6 +27,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_cksum.h \ xfs_da_btree.h \ xfs_dinode.h xfs_dir2.h xfs_dir2_format.h \ + xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ xfs_icreate_item.h \
include/libxfs.h +1 -0
@@ -37,6 +37,7 @@#include <xfs/xfs_fs.h> #include <xfs/xfs_arch.h> +#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> #include <xfs/xfs_bit.h>
include/xfs_format.h new file +86 -0
86 lines not on this page · raw message
include/xfs_log_format.h +58 -0
62 lines not on this page · raw message
include/xfs_quota.h +0 -114
132 lines not on this page · raw message
include/xfs_types.h +6 -0
@@ -178,4 +178,10 @@ struct xfs_name { int len; }; +/* +* uid_t and gid_t are hard-coded to 32 bits in the inode. +* Hence, an 'id' in a dquot is 32 bits.. +*/ +typedef __uint32_t xfs_dqid_t ; +#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 20/49] xfs: separate dquot on disk format definitions out of xfs_quota.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 05/49.
quota entries moved to new xfs_format.h. quota log entries to xfs_log_format.h and a def to xfs_types.h - all synced to kernel patch 05/49. xfs_quota.h is not synced to kernel 05/49, but in user patch 24/49 is removed.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/49 xfs: separate icreate log format definitions from xfs_icreate_item.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
--- include/Makefile | 1 - include/libxfs.h | 1 - include/libxlog.h | 1 - include/xfs_icreate_item.h | 55 ---------------------------------------------- include/xfs_log_format.h | 18 +++++++++++++++ 5 files changed, 18 insertions(+), 58 deletions(-) delete mode 100644 include/xfs_icreate_item.h
include/Makefile +0 -1
@@ -30,7 +30,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ - xfs_icreate_item.h \ xfs_inode.h \ xfs_inum.h \ xfs_log_format.h \
include/libxfs.h +0 -1
@@ -59,7 +59,6 @@#include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> #include <xfs/xfs_symlink.h> -#include <xfs/xfs_icreate_item.h> #ifndef ARRAY_SIZE
include/libxlog.h +0 -1
@@ -48,7 +48,6 @@ struct xlog { };#include <xfs/xfs_log_recover.h> -#include <xfs/xfs_icreate_item.h> /* * macros mapping kernel code to user code
include/xfs_icreate_item.h deleted +0 -55
55 lines not on this page · raw message
include/xfs_log_format.h +18 -0
@@ -602,4 +602,22 @@ typedef struct xfs_qoff_logformat {#define XFS_ALL_QUOTA_CHKD \ (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD) +/* +* Inode create log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */ +__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */ +__be32 icl_length;/* length of extent to initialise */ +__be32 icl_gen;/* inode generation number to use */ +}; +#endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 21/49] xfs: separate icreate log format definitions from xfs_icreate_item.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 06/49.
move the shared xfs_icreate structure to xfs_log_format.h. xfs_icreate_item.h is now kernel-only, remove from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/49 xfs: split out on-disk transaction definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There's a bunch of definitions in xfs_trans.h that define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains in xfs_trans.h are kernel only definitions.
--- include/xfs_log_format.h | 141 +++++++++++++++++++++++++++++++++++++++++++++++ include/xfs_trans.h | 139 ---------------------------------------------- 2 files changed, 141 insertions(+), 139 deletions(-)
include/xfs_log_format.h +141 -0
@@ -187,6 +187,147 @@ typedef struct xfs_log_iovec {/* +* Transaction Header definitions. +* +* This is the structure written in the log at the head of every transaction. It +* identifies the type and id of the transaction, and contains the number of +* items logged by the transaction so we know how many to expect during +* recovery. +* +* Do not change the below structure without redoing the code in +* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). +*/ +typedef struct xfs_trans_header { +uint th_magic;/* magic number */ +uint th_type;/* transaction type */ +__int32_t th_tid;/* transaction id (unused) */ +uint th_num_items;/* num items logged by trans */ +}xfs_trans_header_t ; + +#define XFS_TRANS_HEADER_MAGIC 0x5452414e/* TRAN */ + +/* +* Log item types. +*/ +#define XFS_LI_EFI 0x1236 +#define XFS_LI_EFD 0x1237 +#define XFS_LI_IUNLINK 0x1238 +#define XFS_LI_INODE 0x123b/* aligned ino chunks, var-size ibufs */ +#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ +#define XFS_LI_DQUOT 0x123d +#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f + +#define XFS_LI_TYPE_DESC \ + { XFS_LI_EFI, "XFS_LI_EFI" }, \ + { XFS_LI_EFD, "XFS_LI_EFD" }, \ + { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ + { XFS_LI_INODE, "XFS_LI_INODE" }, \ + { XFS_LI_BUF, "XFS_LI_BUF" }, \ + { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" } + +/* +* Transaction types. Used to distinguish types of buffers. +*/ +#define XFS_TRANS_SETATTR_NOT_SIZE 1 +#define XFS_TRANS_SETATTR_SIZE 2 +#define XFS_TRANS_INACTIVE 3 +#define XFS_TRANS_CREATE 4 +#define XFS_TRANS_CREATE_TRUNC 5 +#define XFS_TRANS_TRUNCATE_FILE 6 +#define XFS_TRANS_REMOVE 7 +#define XFS_TRANS_LINK 8 +#define XFS_TRANS_RENAME 9 +#define XFS_TRANS_MKDIR 10 +#define XFS_TRANS_RMDIR 11 +#define XFS_TRANS_SYMLINK 12 +#define XFS_TRANS_SET_DMATTRS 13 +#define XFS_TRANS_GROWFS 14 +#define XFS_TRANS_STRAT_WRITE 15 +#define XFS_TRANS_DIOSTRAT 16 +/* 17 was XFS_TRANS_WRITE_SYNC */ +#define XFS_TRANS_WRITEID 18 +#define XFS_TRANS_ADDAFORK 19 +#define XFS_TRANS_ATTRINVAL 20 +#define XFS_TRANS_ATRUNCATE 21 +#define XFS_TRANS_ATTR_SET 22 +#define XFS_TRANS_ATTR_RM 23 +#define XFS_TRANS_ATTR_FLAG 24 +#define XFS_TRANS_CLEAR_AGI_BUCKET 25 +#define XFS_TRANS_QM_SBCHANGE 26 +/* +* Dummy entries since we use the transaction type to index into the +* trans_type[] in xlog_recover_print_trans_head() +*/ +#define XFS_TRANS_DUMMY1 27 +#define XFS_TRANS_DUMMY2 28 +#define XFS_TRANS_QM_QUOTAOFF 29 +#define XFS_TRANS_QM_DQALLOC 30 +#define XFS_TRANS_QM_SETQLIM 31 +#define XFS_TRANS_QM_DQCLUSTER 32 +#define XFS_TRANS_QM_QINOCREATE 33 +#define XFS_TRANS_QM_QUOTAOFF_END 34 +#define XFS_TRANS_SB_UNIT 35 +#define XFS_TRANS_FSYNC_TS 36 +#define XFS_TRANS_GROWFSRT_ALLOC 37 +#define XFS_TRANS_GROWFSRT_ZERO 38 +#define XFS_TRANS_GROWFSRT_FREE 39 +#define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_SB_COUNT 41 +#define XFS_TRANS_CHECKPOINT 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43 +/* new transaction types need to be reflected in xfs_logprint(8) */ + +#define XFS_TRANS_TYPES \ + { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ + { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ + { XFS_TRANS_INACTIVE, "INACTIVE" }, \ + { XFS_TRANS_CREATE, "CREATE" }, \ + { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ + { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ + { XFS_TRANS_REMOVE, "REMOVE" }, \ + { XFS_TRANS_LINK, "LINK" }, \ + { XFS_TRANS_RENAME, "RENAME" }, \ + { XFS_TRANS_MKDIR, "MKDIR" }, \ + { XFS_TRANS_RMDIR, "RMDIR" }, \ + { XFS_TRANS_SYMLINK, "SYMLINK" }, \ + { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ + { XFS_TRANS_GROWFS, "GROWFS" }, \ + { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ + { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ + { XFS_TRANS_WRITEID, "WRITEID" }, \ + { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ + { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ + { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ + { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ + { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ + { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ + { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ + { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ + { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ + { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ + { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ + { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ + { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ + { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ + { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ + { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ + { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ + { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ + { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ + { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ + { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ + { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ + { XFS_TRANS_DUMMY1, "DUMMY1" }, \ + { XFS_TRANS_DUMMY2, "DUMMY2" }, \ + { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } + + + +/* * Inode Log Item Format definitions. * * This is the structure used to lay out an inode log item in the
include/xfs_trans.h +0 -139
157 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 22/49] xfs: split out on-disk transaction definitions
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There's a bunch of definitions in
xfs_trans.hthat define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains inxfs_trans.hare kernel only definitions.Signed-off-by Dave Chinner<[email protected]>---
There are a couple comments that now wrap because of new indentation, but they are fixed in a later patch.
The following entries deviates from kernel patch 07/49 in they are not moved from xfs_trans.h - never are:
/*
* This structure is used to track log items associated with
* a transaction. It points to the log item and keeps some
* flags to track the state of the log item. It also tracks
* the amount of space needed to log the item it describes
* once we get to commit processing (see xfs_trans_commit()).
struct xfs_log_item_desc {
struct xfs_log_item *lid_item;
struct list_head lid_trans;
unsigned char lid_flags;
};#define XFS_LID_DIRTY 0x1
/*
* Values for t_flags.
*/
#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */
#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */
#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */
#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */
#define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */
#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
#define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer
count in superblock */
/*
* Values for call flags parameter.
*/
#define XFS_TRANS_RELEASE_LOG_RES 0x4
#define XFS_TRANS_ABORT 0x8
/*
* Field values for xfs_trans_mod_sb.
*/
#define XFS_TRANS_SB_ICOUNT 0x00000001
#define XFS_TRANS_SB_IFREE 0x00000002
#define XFS_TRANS_SB_FDBLOCKS 0x00000004
#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008
#define XFS_TRANS_SB_FREXTENTS 0x00000010
#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020
#define XFS_TRANS_SB_DBLOCKS 0x00000040
#define XFS_TRANS_SB_AGCOUNT 0x00000080
#define XFS_TRANS_SB_IMAXPCT 0x00000100
#define XFS_TRANS_SB_REXTSIZE 0x00000200
#define XFS_TRANS_SB_RBMBLOCKS 0x00000400
#define XFS_TRANS_SB_RBLOCKS 0x00000800
#define XFS_TRANS_SB_REXTENTS 0x00001000
#define XFS_TRANS_SB_REXTSLOG 0x00002000
/*
* Here we centralize the specification of XFS meta-data buffer
* reference count values. This determine how hard the buffer
* cache tries to hold onto the buffer.
*/
#define XFS_AGF_REF 4
#define XFS_AGI_REF 4
#define XFS_AGFL_REF 3
#define XFS_INO_BTREE_REF 3
#define XFS_ALLOC_BTREE_REF 2
#define XFS_BMAP_BTREE_REF 2
#define XFS_DIR_BTREE_REF 2
#define XFS_INO_REF 2
#define XFS_ATTR_BTREE_REF 1
#define XFS_DQUOT_REF 1
/*
* 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 */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 22/49] xfs: split out on-disk transaction definitions
Quoted 9 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There's a bunch of definitions in
xfs_trans.hthat define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains inxfs_trans.hare kernel only definitions.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
There are a couple comments that now wrap because of new indentation, but they are fixed in a later patch.
my mistake they are removed, not added.
but ...
Quoted 4 lines
The following entries deviates from kernel patch 07/49 in they are not moved from
xfs_trans.h- never are:
...
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/49 xfs: introduce xfs_rtalloc_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h so we don't need to share xfs_rtalloc.h with userspace anymore.
This removes the final __KERNEL__ region from the XFS kernel codebase. Yay!
--- include/Makefile | 5 +- include/libxfs.h | 1 - include/xfs_format.h | 41 +++++++++++++ include/xfs_rtalloc.h | 166 -------------------------------------------------- include/xfs_types.h | 10 +++ 5 files changed, 55 insertions(+), 168 deletions(-) delete mode 100644 include/xfs_rtalloc.h
include/Makefile +4 -1
@@ -35,7 +35,10 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_symlink.h \ + xfs_mount.h \ + xfs_quota.h \ + xfs_sb.h \ + xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h
include/libxfs.h +0 -1
@@ -614,7 +614,6 @@ extern int libxfs_nproc(void);extern unsigned long libxfs_physmem (void );/* in kilobytes */ #include <xfs/xfs_ialloc.h> -#include <xfs/xfs_rtalloc.h> #include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_remote.h>
include/xfs_format.h +41 -0
47 lines not on this page · raw message
include/xfs_rtalloc.h deleted +0 -166
166 lines not on this page · raw message
include/xfs_types.h +10 -0
@@ -184,4 +184,14 @@ struct xfs_name {*/ typedef __uint32_t xfs_dqid_t ; +/* +* Constants for bit manipulations. +*/ +#define XFS_NBBYLOG 3/* log2(NBBY) */ +#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ +#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) +#define XFS_NBWORD (1 << XFS_NBWORDLOG) +#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) + +#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 23/49] xfs: introduce xfs_rtalloc_defs.h
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from
xfs_rtalloc.htoxfs_rt_alloc_defs.hso we don't need to sharexfs_rtalloc.hwith userspace anymore.This removes the final
__KERNEL__region from the XFS kernel codebase. Yay!Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 08/49.
move shared items from xfs_rtalloc.h to xfs_format.h. xfs_rtalloc.h is now kernel-only, remove from xfsprogs.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/49 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 | 279 ----------------------------------------------- include/xfs_quota_defs.h | 157 ++++++++++++++++++++++++++ 4 files changed, 159 insertions(+), 281 deletions(-) delete mode 100644 include/xfs_quota.h create mode 100644 include/xfs_quota_defs.h
include/Makefile +1 -1
@@ -36,7 +36,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_recover.h \ xfs_metadump.h \ xfs_mount.h \ - xfs_quota.h \ + xfs_quota_defs.h \ xfs_sb.h \ xfs_symlink.h \ xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h
include/libxfs.h +1 -1
@@ -39,6 +39,7 @@#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> +#include <xfs/xfs_quota_defs.h> #include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h>
@@ -617,7 +618,6 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */#include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_remote.h> -#include <xfs/xfs_quota.h> #include <xfs/xfs_trans_space.h> #define XFS_INOBT_IS_FREE_DISK (rp,i) \
include/xfs_quota.h deleted +0 -279
279 lines not on this page · raw message
include/xfs_quota_defs.h new file +157 -0
157 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 24/49] xfs: introduce xfs_quota_defs.h
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to
xfs_quota_defs.hso we can unsharexfs_quota.hand remove the__KERNEL__regions from it.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 09/49.
move remaining quota shared entries from xfs_quota.h to xfs_quota_defs.h - as mentioned in patch 20, xfs_quota.h is now kernel-only and removed.
----
should shared files have a common name? - so far the ended in -format.X
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
***** SUSPECTED SPAM ***** Re: [PATCH 24/49] xfs: introduce xfs_quota_defs.h
Quoted 11 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to
xfs_quota_defs.hso we can unsharexfs_quota.hand remove the__KERNEL__regions from it.Signed-off-by Dave Chinner<[email protected]>---
Quoted 8 lines
xfsprogs equivalent of the for 3.12 kernel patch 09/49.
move remaining quota shared entries from
xfs_quota.htoxfs_quota_defs.h- as mentioned in patch 20,xfs_quota.his now kernel-only and removed.----should shared files have a common name? - so far the ended in -format.X
No. The -format.h suffix is used specifically for on-disk format definitions.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/49 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 | 6 +- include/libxfs.h | 20 +- include/xfs_mount.h | 33 +-- include/xfs_trans.h | 75 +----- include/xfs_trans_resv.h | 137 ++++++++++ libxfs/Makefile | 7 +- libxfs/xfs.h | 2 + libxfs/xfs_trans.c | 576 +--------------------------------------- libxfs/xfs_trans_resv.c | 677 +++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 8 +- 10 files changed, 852 insertions(+), 689 deletions(-) create mode 100644 include/xfs_trans_resv.h create mode 100644 libxfs/xfs_trans_resv.c
include/Makefile +5 -1
@@ -39,7 +39,11 @@ QAHFILES = libxfs.h libxlog.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_symlink.h \ - xfs_trace.h xfs_trans.h xfs_trans_space.h xfs_dfrag.h + xfs_trace.h \ + xfs_trans.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 +18 -2
@@ -40,6 +40,7 @@#include <xfs/xfs_format.h> #include <xfs/xfs_log_format.h> #include <xfs/xfs_quota_defs.h> +#include <xfs/xfs_trans_resv.h> #include <xfs/xfs_bit.h> #include <xfs/xfs_inum.h>
@@ -204,7 +205,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_litino;/* size of inode union area */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ -xfs_trans_reservations_t m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ int m_dalign;/* stripe unit */ int m_swidth;/* stripe width */
@@ -408,7 +409,6 @@ extern int libxfs_ihash_size;extern void libxfs_iomove (xfs_buf_t *,uint ,int ,void *,int ); -/* * Transaction interface */
@@ -445,6 +445,19 @@ typedef struct xfs_buf_log_item {#include <xfs/xfs_trans.h> +typedef struct xfs_dq_logitem { +xfs_log_item_t qli_item;/* common portion */ +struct xfs_dquot *qli_dquot;/* dquot ptr */ +xfs_lsn_t qli_flush_lsn;/* lsn at last flush */ +xfs_dq_logformat_t qli_format;/* logged structure */ +}xfs_dq_logitem_t ; + +typedef struct xfs_qoff_logitem { +xfs_log_item_t qql_item;/* common portion */ +struct xfs_qoff_logitem *qql_start_lip;/* qoff-start logitem, if any */ +xfs_qoff_logformat_t qql_format;/* logged structure */ +}xfs_qoff_logitem_t ; + typedef struct xfs_trans { unsigned int t_type; /* transaction type */ unsigned int t_log_res; /* amt of log space resvd */
@@ -700,6 +713,9 @@ void xfs_dinode_from_disk(struct xfs_icdinode *,#define libxfs_symlink_blocks xfs_symlink_blocks#define libxfs_symlink_hdr_ok xfs_symlink_hdr_ok +/* xfs_trans_resv.h */ +#define libxfs_trans_resv_calc xfs_trans_resv_calc +/* xfs_rtalloc.c */ int libxfs_rtfree_extent (struct xfs_trans *,xfs_rtblock_t ,xfs_extlen_t );
include/xfs_mount.h +1 -32
@@ -18,37 +18,6 @@#ifndef __XFS_MOUNT_H__#define __XFS_MOUNT_H__ -typedef struct xfs_trans_reservations { -uint tr_write;/* extent alloc trans */ -uint tr_itruncate;/* truncate trans */ -uint tr_rename;/* rename trans */ -uint tr_link;/* link trans */ -uint tr_remove;/* unlink trans */ -uint tr_symlink;/* symlink trans */ -uint tr_create;/* create trans */ -uint tr_mkdir;/* mkdir trans */ -uint tr_ifree;/* inode free trans */ -uint tr_ichange;/* inode update trans */ -uint tr_growdata;/* fs data section grow trans */ -uint tr_swrite;/* sync write inode trans */ -uint tr_addafork;/* cvt inode to attributed trans */ -uint tr_writeid;/* write setuid/setgid file */ -uint tr_attrinval;/* attr fork buffer invalidation */ -uint tr_attrsetm;/* set/create an attribute at mount time */ -uint tr_attrsetrt;/* set/create an attribute at runtime */ -uint tr_attrrm;/* remove an attribute */ -uint tr_clearagi;/* clear bad agi unlinked ino bucket */ -uint tr_growrtalloc;/* grow realtime allocations */ -uint tr_growrtzero;/* grow realtime zeroing */ -uint tr_growrtfree;/* grow realtime freeing */ -uint tr_qm_sbchange;/* change quota flags */ -uint tr_qm_setqlim;/* adjust quota limits */ -uint tr_qm_dqalloc;/* allocate quota on disk */ -uint tr_qm_quotaoff;/* turn quota off */ -uint tr_qm_equotaoff;/* end of turn quota off */ -uint tr_sb;/* modify superblock */ -}xfs_trans_reservations_t ; -#ifndef __KERNEL__#define xfs_daddr_to_agno (mp,d) \
@@ -174,7 +143,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ uint m_qflags;/* quota status flags */ -xfs_trans_reservations_t m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ __uint64_t m_resblks;/* total reserved blocks */ __uint64_t m_resblks_avail;/* available reserved blocks */
include/xfs_trans.h +2 -73
87 lines not on this page · raw message
include/xfs_trans_resv.h new file +137 -0
137 lines not on this page · raw message
libxfs/Makefile +5 -2
@@ -16,8 +16,11 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_trans.c xfs_attr.c xfs_attr_remote.c \ - crc32.c xfs_symlink.c + xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ + crc32.c \ + xfs_symlink.c \ + xfs_trans.c \ + xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c PCFILES = darwin.c freebsd.c irix.c linux.c
libxfs/xfs.h +2 -0
@@ -100,6 +100,8 @@ typedef __uint32_t inst_t; /* an instruction */#define __return_address __builtin_return_address(0)#endif +#define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 +/* miscellaneous kernel routines not in user space */ #define down_read (a) ((void) 0)#define up_read (a) ((void) 0)
libxfs/xfs_trans.c +1 -575
588 lines not on this page · raw message
libxfs/xfs_trans_resv.c new file +677 -0
677 lines not on this page · raw message
mkfs/maxtrres.c +4 -4
@@ -52,11 +52,11 @@ max_attrsetm_trans_res_adjust(static int max_trans_res_by_mount ( -xfs_mount_t *mp) +struct xfs_mount *mp) { -uint *p; -int rval; -xfs_trans_reservations_t *tr = &mp->m_reservations; +uint *p; +int rval; +struct xfs_trans_resv *tr = &mp->m_reservations;for (rval =0 , p = (uint *)tr; p < (uint *)(tr +1 ); p++) {if ((int )*p > rval)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 25/49] libxfs: introduce xfs_trans_resv.c
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The log space reservation calculation code has been separated from the core transaction code in kernelspace. THi smeans we can add it here in preparation for removing
xfs_trans.cto further reduce the differences between kernel and usrspace files.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 10/49.
move the transaction reservation items from xfs_trans.[ch] to new xfs_trans_resv.[ch] with shortened structure name.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/49 libxfs: move transaction code to trans.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is very little code left in xfs_trans.c. So little it is not worthtrying to share this file with kernel space any more. Move the code to libxfs/trans.c, and remove libxfs/xfs_trans.c.
--- libxfs/Makefile | 1 - libxfs/trans.c | 118 +++++++++++++++++++++++++++++++++++++++++++++ libxfs/xfs.h | 6 +++ libxfs/xfs_trans.c | 139 ----------------------------------------------------- 4 files changed, 124 insertions(+), 140 deletions(-) delete mode 100644 libxfs/xfs_trans.c
libxfs/Makefile +0 -1
@@ -19,7 +19,6 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ crc32.c \ xfs_symlink.c \ - xfs_trans.c \ xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c
libxfs/trans.c +118 -0
129 lines not on this page · raw message
libxfs/xfs.h +6 -0
@@ -235,12 +235,14 @@ roundup_pow_of_two(uint v)#define xfs_mod_incore_sb libxfs_mod_incore_sb#define xfs_trans_alloc libxfs_trans_alloc +#define xfs_trans_add_item libxfs_trans_add_item#define xfs_trans_bhold libxfs_trans_bhold#define xfs_trans_binval libxfs_trans_binval#define xfs_trans_bjoin libxfs_trans_bjoin#define xfs_trans_brelse libxfs_trans_brelse#define xfs_trans_commit libxfs_trans_commit#define xfs_trans_cancel libxfs_trans_cancel +#define xfs_trans_del_item libxfs_trans_del_item#define xfs_trans_dup libxfs_trans_dup#define xfs_trans_get_buf libxfs_trans_get_buf#define xfs_trans_getsb libxfs_trans_getsb
@@ -248,12 +250,14 @@ roundup_pow_of_two(uint v)#define xfs_trans_ihold libxfs_trans_ihold#define xfs_trans_ijoin libxfs_trans_ijoin#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref +#define xfs_trans_init libxfs_trans_init#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf#define xfs_trans_log_buf libxfs_trans_log_buf#define xfs_trans_log_inode libxfs_trans_log_inode#define xfs_trans_mod_sb libxfs_trans_mod_sb#define xfs_trans_read_buf libxfs_trans_read_buf#define xfs_trans_read_buf_map libxfs_trans_read_buf_map +#define xfs_trans_roll libxfs_trans_roll#define xfs_trans_get_buf_map libxfs_trans_get_buf_map#define xfs_trans_reserve libxfs_trans_reserve
@@ -373,6 +377,8 @@ void xfs_mount_common(xfs_mount_t *, xfs_sb_t *);/* * logitem.c and trans.c prototypes */ +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);/* xfs_trans_item.c */ void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *);
libxfs/xfs_trans.c deleted +0 -139
139 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 26/49] libxfs: move transaction code to trans.c
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is very little code left in
xfs_trans.c. So little it is not worthtrying to share this file with kernel space any more. Move the code tolibxfs/trans.c, and removelibxfs/xfs_trans.c.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 11/49.
change zone allocator/zone free to calloc/free, change function names to libxfs_trans_XX.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 27/49 xfs: move inode fork definitions to a new header file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from xfs_inode.h.
Do the same for the all the C code that currently resides in xfs_inode.c for the same reason.
--- include/xfs_bmap_btree.h | 2 + include/xfs_inode.h | 134 +--- include/xfs_inode_fork.h | 171 +++++ libxfs/Makefile | 7 +- libxfs/xfs_inode.c | 1878 +-------------------------------------------- libxfs/xfs_inode_fork.c | 1890 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 2072 insertions(+), 2010 deletions(-) create mode 100644 include/xfs_inode_fork.h create mode 100644 libxfs/xfs_inode_fork.c
include/xfs_bmap_btree.h +2 -0
@@ -197,6 +197,8 @@ typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;#define XFS_BMDR_SPACE_CALC (nrecs) \ (int)(sizeof(xfs_bmdr_block_t) + \ ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))) +#define XFS_BMAP_BMDR_SPACE (bb) \ + (XFS_BMDR_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))/* * Maximum number of bmap btree levels.
include/xfs_inode.h +1 -133
158 lines not on this page · raw message
include/xfs_inode_fork.h new file +171 -0
171 lines not on this page · raw message
libxfs/Makefile +6 -1
@@ -12,7 +12,12 @@ LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ - xfs_alloc.c xfs_ialloc.c xfs_inode.c xfs_btree.c xfs_alloc_btree.c \ + xfs_alloc.c \ + xfs_alloc_btree.c \ + xfs_btree.c \ + xfs_ialloc.c \ + xfs_inode.c \ + xfs_inode_fork.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \
libxfs/xfs_inode.c +2 -1876
1,916 lines not on this page · raw message
libxfs/xfs_inode_fork.c new file +1890 -0
734 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 27/49] xfs: move inode fork definitions to a new header file
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from
xfs_inode.h.
Quoted 5 lines
Do the same for the all the C code that currently resides in
xfs_inode.cfor the same reason.Signed-off-by Dave Chinner<[email protected]>---
xfsprogs equivalent of the for 3.12 kernel patch 12/49.
move remaining shared inode to new xfs_inode_fork.c/h. new function prototypes.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 28/49 xfs: move unrealted definitions out of xfs_inode.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- include/Makefile | 1 + include/libxfs.h | 1 + include/xfs_inode.h | 36 ------------------------------------ include/xfs_trans.h | 7 +++++++ libxfs/xfs.h | 3 +++ 5 files changed, 12 insertions(+), 36 deletions(-)
include/Makefile +1 -0
@@ -31,6 +31,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ xfs_inode.h \ + xfs_inode_fork.h \ xfs_inum.h \ xfs_log_format.h \ xfs_log_recover.h \
include/libxfs.h +1 -0
@@ -54,6 +54,7 @@#include <xfs/xfs_ialloc_btree.h> #include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> +#include <xfs/xfs_inode_fork.h> #include <xfs/xfs_inode.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h>
include/xfs_inode.h +0 -36
@@ -34,35 +34,6 @@ struct xfs_imap {ushort im_boffset;/* inode offset in block in bytes */ }; -/* -* This is the xfs in-core inode structure. -* Most of the on-disk inode is embedded in the i_d field. -* -* The extent pointers/inline file space, however, are managed -* separately. The memory for this information is pointed to by -* the if_u1 unions depending on the type of the data. -* This is used to linearize the array of extents for fast in-core -* access. This is used until the file's number of extents -* surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers -* are accessed through the buffer cache. -* -* Other state kept in the in-core inode is used for identification, -* locking, transactional updating, etc of the inode. -* -* Generally, we do not want to hold the i_rlock while holding the -* i_ilock. Hierarchy is i_iolock followed by i_rlock. -* -* xfs_iptr_t contains all the inode fields up to and including the -* i_mnext and i_mprev fields, it is used as a marker in the inode -* chain off the mount structure by xfs_sync calls. -*/ -/* -* Flags for xfs_ichgtime(). -*/ -#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ -#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ -#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ -#ifdef __KERNEL__
@@ -398,13 +369,6 @@ do { \#endif /* __KERNEL__ */ -/* -* Flags for xfs_iget() -*/ -#define XFS_IGET_CREATE 0x1 -#define XFS_IGET_UNTRUSTED 0x2 -#define XFS_IGET_DONTCACHE 0x4 -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *,struct xfs_imap *,struct xfs_dinode **,struct xfs_buf **,uint ,uint );
include/xfs_trans.h +7 -0
@@ -89,6 +89,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.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/49] xfs: move unrealted definitions out of xfs_inode.h
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
include/xfs_trans.h +0
-0
include/xfs_trans.h struct xfs_log_item_desc { · line 98
Quoted 10 lines
include/xfs_trans.h +7
-0@@ -89,6 +89,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 */ +
in the kernel patch 13/49 these entries go into xfs_log_format.h
Quoted 8 lines
include/xfs_trans.h +0
-0#ifdef __KERNEL__struct xfs_buf ;libxfs/xfs.h +0
-0
libxfs/xfs.h typedef __uint32_t inst_t; /* an instruction */ · line 76
Quoted 9 lines
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); \
in the kernel patch 13/49 these entries go into xfs_icache.h
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
***** SUSPECTED SPAM ***** Re: [PATCH 28/49] xfs: move unrealted definitions out of xfs_inode.h
Quoted 15 lines · Mark Tinguely
Quoted 14 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>---
include/xfs_trans.h +0
-0@@ -89,6 +89,13 @@ struct xfs_log_item_desc {#define XFS_ATTR_BTREE_REF 1#define XFS_DQUOT_REF 1
Quoted 9 lines
include/xfs_trans.h struct xfs_log_item_desc { · line 98
Quoted 7 lines
include/xfs_trans.h +7
-0+/* +* 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 */ +in the kernel patch 13/49 these entries go into
xfs_log_format.h
Right, in the updated kernel series xfs_trans.h is no longer shared with userspace, and this patch series doesn't reflect that. it needs updating.
Quoted 11 lines
Quoted 11 lines
include/xfs_trans.h +0
-0#ifdef __KERNEL__struct xfs_buf ;libxfs/xfs.h +0
-0@@ -68,6 +68,9 @@ typedef __uint32_t inst_t; /* an instruction */#define IHOLD (ip) ((void) 0)
Quoted 8 lines
libxfs/xfs.h typedef __uint32_t inst_t; /* an instruction */ · line 76
Quoted 6 lines
libxfs/xfs.h +3
-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); \in the kernel patch 13/49 these entries go into
xfs_icache.h
Yup, they go into a kernel only header file. Userspace can define them how they want as xfs_iget() has different requirements and a completely different implementation in userspace.
Quoted 3 lines
--Mark.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 29/49 xfs: introduce xfs_inode_buf.c for inode buffer operations
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
--- include/Makefile | 2 +- include/libxfs.h | 2 +- include/xfs_inode.h | 393 --------------------------------------------- include/xfs_inode_buf.h | 53 ++++++ libxfs/Makefile | 2 +- libxfs/init.c | 3 +- libxfs/xfs_inode.c | 419 ------------------------------------------------ libxfs/xfs_inode_buf.c | 408 ++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 466 insertions(+), 816 deletions(-) delete mode 100644 include/xfs_inode.h create mode 100644 include/xfs_inode_buf.h delete mode 100644 libxfs/xfs_inode.c create mode 100644 libxfs/xfs_inode_buf.c
include/Makefile +1 -1
@@ -30,7 +30,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_format.h \ xfs_ialloc.h \ xfs_ialloc_btree.h \ - xfs_inode.h \ + xfs_inode_buf.h \ xfs_inode_fork.h \ xfs_inum.h \ xfs_log_format.h \
include/libxfs.h +1 -1
@@ -55,7 +55,7 @@#include <xfs/xfs_attr_sf.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_inode_fork.h> -#include <xfs/xfs_inode.h> +#include <xfs/xfs_inode_buf.h> #include <xfs/xfs_alloc.h> #include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h>
include/xfs_inode.h deleted +0 -393
393 lines not on this page · raw message
include/xfs_inode_buf.h new file +53 -0
53 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -16,7 +16,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc_btree.c \ xfs_btree.c \ xfs_ialloc.c \ - xfs_inode.c \ + xfs_inode_buf.c \ xfs_inode_fork.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \
libxfs/init.c +2 -1
@@ -32,6 +32,8 @@ int use_xfs_buf_lock; /* global flag: use xfs_buf_t locks for MT */static void manage_zones (int );/* setup global zones */ +kmem_zone_t *xfs_inode_zone; +/* * dev_map - map open devices to fd. */
@@ -369,7 +371,6 @@ manage_zones(int release) {extern kmem_zone_t *xfs_buf_zone;extern kmem_zone_t *xfs_ili_zone; -extern kmem_zone_t *xfs_inode_zone;extern kmem_zone_t *xfs_ifork_zone;extern kmem_zone_t *xfs_buf_item_zone;extern kmem_zone_t *xfs_da_state_zone;
libxfs/xfs_inode.c deleted +0 -419
419 lines not on this page · raw message
libxfs/xfs_inode_buf.c new file +408 -0
408 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/49] xfs: introduce xfs_inode_buf.c for inode buffer operations
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
Signed-off-by Dave Chinner<[email protected]>---
missing commit cca9f93a in xfs_inode_buf.c
This resync series will have to be fixed and reposted. I will look at the remaining patches and mention anything new errors if I can separate them from the old errors.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/49 xfs: split out the remote symlink handling
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
--- include/Makefile | 1 - include/libxfs.h | 1 - include/xfs_format.h | 42 ++++++++++ include/xfs_symlink.h | 47 ----------- libxfs/Makefile | 2 +- libxfs/xfs_symlink.c | 176 ----------------------------------------- libxfs/xfs_symlink_remote.c | 185 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 228 insertions(+), 226 deletions(-) delete mode 100644 include/xfs_symlink.h delete mode 100644 libxfs/xfs_symlink.c create mode 100644 libxfs/xfs_symlink_remote.c
include/Makefile +0 -1
@@ -39,7 +39,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ - xfs_symlink.h \ xfs_trace.h \ xfs_trans.h \ xfs_trans_resv.h \
include/libxfs.h +0 -1
@@ -61,7 +61,6 @@#include <xfs/xfs_btree_trace.h> #include <xfs/xfs_bmap.h> #include <xfs/xfs_trace.h> -#include <xfs/xfs_symlink.h> #ifndef ARRAY_SIZE
include/xfs_format.h +42 -0
53 lines not on this page · raw message
include/xfs_symlink.h deleted +0 -47
47 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -23,7 +23,7 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ crc32.c \ - xfs_symlink.c \ + xfs_symlink_remote.c \ xfs_trans_resv.c CFILES += $(PKG_PLATFORM).c
libxfs/xfs_symlink.c deleted +0 -176
176 lines not on this page · raw message
libxfs/xfs_symlink_remote.c new file +185 -0
185 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 31/49 libxfs: switch over to xfs_sb.c and remove xfs_mount.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that the kernel code has split the superblock specific code out of xfs_mount.c, we don't need xfs_mount.c anymore. Copy in xfs_sb.c and remove xfs_mount.c
--- include/Makefile | 1 - include/libxfs.h | 14 +- include/libxlog.h | 4 - include/xfs_mount.h | 372 --------------------------- include/xfs_sb.h | 26 ++ include/xfs_trace.h | 1 + libxfs/Makefile | 10 +- libxfs/init.c | 2 +- libxfs/xfs.h | 1 + libxfs/xfs_mount.c | 627 --------------------------------------------- libxfs/xfs_sb.c | 721 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 768 insertions(+), 1011 deletions(-) delete mode 100644 include/xfs_mount.h delete mode 100644 libxfs/xfs_mount.c create mode 100644 libxfs/xfs_sb.c
include/Makefile +0 -1
@@ -36,7 +36,6 @@ QAHFILES = libxfs.h libxlog.h \ xfs_log_format.h \ xfs_log_recover.h \ xfs_metadump.h \ - xfs_mount.h \ xfs_quota_defs.h \ xfs_sb.h \ xfs_trace.h \
include/libxfs.h +11 -3
@@ -47,7 +47,6 @@#include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> #include <xfs/xfs_dir2.h> -#include <xfs/xfs_mount.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -323,6 +322,11 @@ enum xfs_buf_flags_t { /* b_flags bits */#define xfs_buf_set_ref (bp,ref) ((void) 0)#define xfs_buf_ioerror (bp,err) (bp)->b_error = (err); +#define xfs_daddr_to_agno (mp,d) \ + ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) +#define xfs_daddr_to_agbno (mp,d) \ + ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) +/* Buffer Cache Interfaces */ extern struct cache *libxfs_bcache;
@@ -476,7 +480,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,
@@ -704,7 +707,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
@@ -729,4 +732,9 @@ extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);#include <xfs/xfs_cksum.h> +#define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args) +#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) +#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) +#define xfs_hex_dump (d,n) ((void) 0) +#endif /* __LIBXFS_H__ */
include/libxlog.h +0 -4
@@ -66,10 +66,6 @@ struct xlog {#define XFS_MOUNT_WAS_CLEAN 0x1#define unlikely (x) (x) -#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args) -#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## args) -#define xfs_hex_dump (d,n) ((void) 0) -extern void xlog_warn (char *fmt,...);extern void xlog_exit (char *fmt,...);extern void xlog_panic (char *fmt,...);
include/xfs_mount.h deleted +0 -372
372 lines not on this page · raw message
include/xfs_sb.h +26 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -625,6 +626,12 @@ xfs_sb_has_incompat_log_feature(return (sbp->sb_features_log_incompat & feature) !=0 ; } +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +/* * end of superblock version macros */
@@ -661,4 +668,23 @@ 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 void xfs_sb_quota_from_disk (struct xfs_sb *sbp); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
include/xfs_trace.h +1 -0
@@ -162,6 +162,7 @@/* set c = c to avoid unused var warnings */ #define trace_xfs_perag_get (a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_get_tag (a,b,c,d) ((c) = (c))#define trace_xfs_perag_put (a,b,c,d) ((c) = (c))#endif /* __TRACE_H__ */
libxfs/Makefile +7 -3
@@ -11,9 +11,13 @@ LT_REVISION = 0 LT_AGE = 0 HFILES = xfs.h init.h xfs_dir2_priv.h crc32defs.h crc32table.h -CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ +CFILES = cache.c \ + crc32.c \ + init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc.c \ xfs_alloc_btree.c \ + xfs_attr.c \ + xfs_attr_remote.c \ xfs_btree.c \ xfs_ialloc.c \ xfs_inode_buf.c \
@@ -21,8 +25,8 @@ CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ - xfs_mount.c xfs_rtalloc.c xfs_attr.c xfs_attr_remote.c \ - crc32.c \ + xfs_rtalloc.c \ + xfs_sb.c \ xfs_symlink_remote.c \ xfs_trans_resv.c
libxfs/init.c +1 -1
@@ -692,7 +692,7 @@ libxfs_mount(INIT_RADIX_TREE (&mp->m_perag_tree,GFP_KERNEL ); sbp = &(mp->m_sb); -xfs_mount_common (mp, sb); +xfs_sb_mount_common (mp, sb);xfs_alloc_compute_maxlevels (mp);xfs_bmap_compute_maxlevels (mp,XFS_DATA_FORK );
libxfs/xfs.h +1 -0
@@ -345,6 +345,7 @@ do { \#define uuid_equal (s,d) (platform_uuid_compare((s),(d)) == 0)#define xfs_icreate_log (tp, agno, agbno, cnt, isize, len, gen) ((void) 0) +#define xfs_sb_validate_fsb_count (sbp, nblks) (0)/* * Prototypes for kernel static functions that are aren't in their
libxfs/xfs_mount.c deleted +0 -627
627 lines not on this page · raw message
libxfs/xfs_sb.c new file +721 -0
721 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 32/49 xfs: create xfs_bmap_util.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is a bunch of code in xfs_bmap.c that is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code to xfs_bmap_util.c, and the declarations to xfs_bmap_util.h.
The biggest issue here is xfs_bmap_finish() - userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to include xfs_bmap_util.c as well.
It also introduces and interesting dance for the stack switching code in xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved to xfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.
--- include/xfs_bmap.h | 51 ------------ libxfs/xfs.h | 34 ++++++++ libxfs/xfs_bmap.c | 222 +++-------------------------------------------------- 3 files changed, 43 insertions(+), 264 deletions(-)
include/xfs_bmap.h +0 -51
@@ -108,38 +108,6 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) }/* -* Argument structure for xfs_bmap_alloc. -*/ -typedef struct xfs_bmalloca { -xfs_fsblock_t *firstblock;/* i/o first block allocated */ -struct xfs_bmap_free *flist;/* bmap freelist */ -struct xfs_trans *tp;/* transaction pointer */ -struct xfs_inode *ip;/* incore inode pointer */ -struct xfs_bmbt_irec prev;/* extent before the new one */ -struct xfs_bmbt_irec got;/* extent after, or delayed */ - -xfs_fileoff_t offset;/* offset in file filling in */ -xfs_extlen_t length;/* i/o length asked/allocated */ -xfs_fsblock_t blkno;/* starting block of new extent */ - -struct xfs_btree_cur *cur;/* btree cursor */ -xfs_extnum_t idx;/* current extent index */ -int nallocs;/* number of extents alloc'd */ -int logflags;/* flags for transaction logging */ - -xfs_extlen_t total;/* total blocks needed for xaction */ -xfs_extlen_t minlen;/* minimum allocation size (blocks) */ -xfs_extlen_t minleft;/* amount must be left after alloc */ -char eof;/* set if allocating past last extent */ -char wasdel;/* replacing a delayed allocation */ -char userdata;/* set if is user data */ -char aeof;/* allocated space at eof */ -char conv;/* overwriting unwritten extents */ -int flags; -int stack_switch; -}xfs_bmalloca_t ; - -/* * Flags for xfs_bmap_add_extent*. */ #define BMAP_LEFT_CONTIG (1 << 0)
@@ -202,23 +170,4 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx, xfs_extnum_t num);uint xfs_default_attroffset (struct xfs_inode *ip); -#ifdef __KERNEL__ -/* bmap to userspace formatter - copy to user & advance pointer */ -typedef int (*xfs_bmap_format_t )(void **,struct getbmapx *,int *); - -int xfs_bmap_finish (struct xfs_trans **tp,struct xfs_bmap_free *flist, -int *committed); -int xfs_getbmap (struct xfs_inode *ip,struct getbmapx *bmv, -xfs_bmap_format_t formatter,void *arg); -int xfs_bmap_eof (struct xfs_inode *ip,xfs_fileoff_t endoff, -int whichfork,int *eof); -int xfs_bmap_count_blocks (struct xfs_trans *tp,struct xfs_inode *ip, -int whichfork,int *count); -int xfs_bmap_punch_delalloc_range (struct xfs_inode *ip, -xfs_fileoff_t start_fsb,xfs_fileoff_t length); - -xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb); - -#endif /* __KERNEL__ */ -#endif /* __XFS_BMAP_H__ */
libxfs/xfs.h +34 -0
@@ -51,6 +51,40 @@typedef __uint32_t uint_t ;typedef __uint32_t inst_t ;/* an instruction */ +/* +* Argument structure for xfs_bmap_alloc. +*/ +typedef struct xfs_bmalloca { +xfs_fsblock_t *firstblock;/* i/o first block allocated */ +struct xfs_bmap_free *flist;/* bmap freelist */ +struct xfs_trans *tp;/* transaction pointer */ +struct xfs_inode *ip;/* incore inode pointer */ +struct xfs_bmbt_irec prev;/* extent before the new one */ +struct xfs_bmbt_irec got;/* extent after, or delayed */ + +xfs_fileoff_t offset;/* offset in file filling in */ +xfs_extlen_t length;/* i/o length asked/allocated */ +xfs_fsblock_t blkno;/* starting block of new extent */ + +struct xfs_btree_cur *cur;/* btree cursor */ +xfs_extnum_t idx;/* current extent index */ +int nallocs;/* number of extents alloc'd */ +int logflags;/* flags for transaction logging */ + +xfs_extlen_t total;/* total blocks needed for xaction */ +xfs_extlen_t minlen;/* minimum allocation size (blocks) */ +xfs_extlen_t minleft;/* amount must be left after alloc */ +char eof;/* set if allocating past last extent */ +char wasdel;/* replacing a delayed allocation */ +char userdata;/* set if is user data */ +char aeof;/* allocated space at eof */ +char conv;/* overwriting unwritten extents */ +char stack_switch; +int flags; +}xfs_bmalloca_t ; + +#define xfs_bmapi_allocate __xfs_bmapi_allocate +#ifndef EWRONGFS #define EWRONGFS EINVAL#endif
libxfs/xfs_bmap.c +9 -213
290 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 32/49] xfs: create xfs_bmap_util.[ch]
Quoted 432 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is a bunch of code in
xfs_bmap.cthat is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code toxfs_bmap_util.c, and the declarations toxfs_bmap_util.h.The biggest issue here is
xfs_bmap_finish()- userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to includexfs_bmap_util.cas well.It also introduces and interesting dance for the stack switching code in
xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved toxfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.Signed-off-by Dave Chinner<[email protected]>--- include/xfs_bmap.h | 51 ------------ libxfs/xfs.h | 34 ++++++++ libxfs/xfs_bmap.c | 222 +++-------------------------------------------------- 3 files changed, 43 insertions(+), 264 deletions(-)include/xfs_bmap.h +0
-51@@ -108,38 +108,6 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) }/* -* Argument structure for xfs_bmap_alloc. -*/ -typedef struct xfs_bmalloca { -xfs_fsblock_t *firstblock;/* i/o first block allocated */ -struct xfs_bmap_free *flist;/* bmap freelist */ -struct xfs_trans *tp;/* transaction pointer */ -struct xfs_inode *ip;/* incore inode pointer */ -struct xfs_bmbt_irec prev;/* extent before the new one */ -struct xfs_bmbt_irec got;/* extent after, or delayed */ - -xfs_fileoff_t offset;/* offset in file filling in */ -xfs_extlen_t length;/* i/o length asked/allocated */ -xfs_fsblock_t blkno;/* starting block of new extent */ - -struct xfs_btree_cur *cur;/* btree cursor */ -xfs_extnum_t idx;/* current extent index */ -int nallocs;/* number of extents alloc'd */ -int logflags;/* flags for transaction logging */ - -xfs_extlen_t total;/* total blocks needed for xaction */ -xfs_extlen_t minlen;/* minimum allocation size (blocks) */ -xfs_extlen_t minleft;/* amount must be left after alloc */ -char eof;/* set if allocating past last extent */ -char wasdel;/* replacing a delayed allocation */ -char userdata;/* set if is user data */ -char aeof;/* allocated space at eof */ -char conv;/* overwriting unwritten extents */ -int flags; -int stack_switch; -}xfs_bmalloca_t ; - -/* * Flags for xfs_bmap_add_extent*. */ #define BMAP_LEFT_CONTIG (1<< 0)@@ -202,23 +170,4 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx, xfs_extnum_t num);uint xfs_default_attroffset (struct xfs_inode *ip); -#ifdef __KERNEL__ -/* bmap to userspace formatter - copy to user& advance pointer */ -typedef int (*xfs_bmap_format_t )(void **,struct getbmapx *,int *); - -int xfs_bmap_finish (struct xfs_trans **tp,struct xfs_bmap_free *flist, -int *committed); -int xfs_getbmap (struct xfs_inode *ip,struct getbmapx *bmv, -xfs_bmap_format_t formatter,void *arg); -int xfs_bmap_eof (struct xfs_inode *ip,xfs_fileoff_t endoff, -int whichfork,int *eof); -int xfs_bmap_count_blocks (struct xfs_trans *tp,struct xfs_inode *ip, -int whichfork,int *count); -int xfs_bmap_punch_delalloc_range (struct xfs_inode *ip, -xfs_fileoff_t start_fsb,xfs_fileoff_t length); - -xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb); - -#endif /* __KERNEL__ */ -#endif /* __XFS_BMAP_H__ */ libxfs/xfs.h +34
-0@@ -51,6 +51,40 @@typedef __uint32_t uint_t ;typedef __uint32_t inst_t ;/* an instruction */ +/* +* Argument structure for xfs_bmap_alloc. +*/ +typedef struct xfs_bmalloca { +xfs_fsblock_t *firstblock;/* i/o first block allocated */ +struct xfs_bmap_free *flist;/* bmap freelist */ +struct xfs_trans *tp;/* transaction pointer */ +struct xfs_inode *ip;/* incore inode pointer */ +struct xfs_bmbt_irec prev;/* extent before the new one */ +struct xfs_bmbt_irec got;/* extent after, or delayed */ + +xfs_fileoff_t offset;/* offset in file filling in */ +xfs_extlen_t length;/* i/o length asked/allocated */ +xfs_fsblock_t blkno;/* starting block of new extent */ + +struct xfs_btree_cur *cur;/* btree cursor */ +xfs_extnum_t idx;/* current extent index */ +int nallocs;/* number of extents alloc'd */ +int logflags;/* flags for transaction logging */ + +xfs_extlen_t total;/* total blocks needed for xaction */ +xfs_extlen_t minlen;/* minimum allocation size (blocks) */ +xfs_extlen_t minleft;/* amount must be left after alloc */ +char eof;/* set if allocating past last extent */ +char wasdel;/* replacing a delayed allocation */ +char userdata;/* set if is user data */ +char aeof;/* allocated space at eof */ +char conv;/* overwriting unwritten extents */ +char stack_switch; +int flags; +}xfs_bmalloca_t ; + +#define xfs_bmapi_allocate __xfs_bmapi_allocate +#ifndef EWRONGFS #define EWRONGFS EINVAL#endif libxfs/xfs_bmap.c +7
-211@@ -74,19 +74,6 @@ xfs_bmap_compute_maxlevels( mp->m_bm_maxlevels[whichfork] = level; } -/* -* Convert the given file system block to a disk block. We have to treat it -* differently based on whether the file is a real time file or not, because the -* bmap code does. -*/ -xfs_daddr_t -xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb) -{ -return (XFS_IS_REALTIME_INODE (ip) ? \ - (xfs_daddr_t )XFS_FSB_TO_BB ((ip)->i_mount, (fsb)) : \ -XFS_FSB_TO_DADDR ((ip)->i_mount, (fsb))); -} - STATIC int /* error */ xfs_bmbt_lookup_eq( struct xfs_btree_cur *cur,@@ -229,173 +216,6 @@ xfs_bmap_forkoff_reset( }/* -* Extent tree block counting routines. -*/ - -/* -* Count leaf blocks given a range of extent records. -*/ -STATIC void -xfs_bmap_count_leaves ( -xfs_ifork_t *ifp, -xfs_extnum_t idx, -int numrecs, -int *count) -{ -int b; - -for (b =0 ; b< numrecs; b++) { -xfs_bmbt_rec_host_t *frp =xfs_iext_get_ext (ifp, idx + b); - *count +=xfs_bmbt_get_blockcount (frp); - } -} - -/* -* Count leaf blocks given a range of extent records originally -* in btree format. -*/ -STATIC void -xfs_bmap_disk_count_leaves ( -struct xfs_mount *mp, -struct xfs_btree_block *block, -int numrecs, -int *count) -{ -int b; -xfs_bmbt_rec_t *frp; - -for (b =1 ; b<= numrecs; b++) { - frp =XFS_BMBT_REC_ADDR (mp, block, b); - *count +=xfs_bmbt_disk_get_blockcount (frp); - } -} - -/* -* Recursively walks each level of a btree -* to count total fsblocks is use. -*/ -STATIC int /* error */ -xfs_bmap_count_tree ( -xfs_mount_t *mp,/* file system mount point */ -xfs_trans_t *tp,/* transaction pointer */ -xfs_ifork_t *ifp,/* inode fork pointer */ -xfs_fsblock_t blockno,/* file system block number */ -int levelin,/* level in btree */ -int *count)/* Count of blocks */ -{ -int error; -xfs_buf_t *bp, *nbp; -int level = levelin; -__be64 *pp; -xfs_fsblock_t bno = blockno; -xfs_fsblock_t nextbno; -struct xfs_btree_block *block, *nextblock; -int numrecs; - - error =xfs_btree_read_bufl (mp, tp, bno,0 ,&bp,XFS_BMAP_BTREE_REF , - &xfs_bmbt_buf_ops); -if (error) -return error; - *count +=1 ; - block =XFS_BUF_TO_BLOCK (bp); - -if (--level) { -/* Not at node above leaves, count this level of nodes */ - nextbno =be64_to_cpu (block->bb_u.l.bb_rightsib); -while (nextbno !=NULLFSBLOCK ) { - error =xfs_btree_read_bufl (mp, tp, nextbno,0 ,&nbp, -XFS_BMAP_BTREE_REF , - &xfs_bmbt_buf_ops); -if (error) -return error; - *count +=1 ; - nextblock =XFS_BUF_TO_BLOCK (nbp); - nextbno =be64_to_cpu (nextblock->bb_u.l.bb_rightsib); -xfs_trans_brelse (tp, nbp); - } - -/* Dive to the next level */ - pp =XFS_BMBT_PTR_ADDR (mp, block,1 , mp->m_bmap_dmxr[1 ]); - bno =be64_to_cpu (*pp); -if (unlikely ((error = -xfs_bmap_count_tree (mp, tp, ifp, bno, level, count))<0 )) { -xfs_trans_brelse (tp, bp); -XFS_ERROR_REPORT ("xfs_bmap_count_tree(1)" , -XFS_ERRLEVEL_LOW , mp); -return XFS_ERROR (EFSCORRUPTED ); - } -xfs_trans_brelse (tp, bp); - }else { -/* count all level 1 nodes and their leaves */ -for (;;) { - nextbno =be64_to_cpu (block->bb_u.l.bb_rightsib); - numrecs =be16_to_cpu (block->bb_numrecs); -xfs_bmap_disk_count_leaves (mp, block, numrecs, count); -xfs_trans_brelse (tp, bp); -if (nextbno ==NULLFSBLOCK ) -break ; - bno = nextbno; - error =xfs_btree_read_bufl (mp, tp, bno,0 ,&bp, -XFS_BMAP_BTREE_REF , - &xfs_bmbt_buf_ops); -if (error) -return error; - *count +=1 ; - block =XFS_BUF_TO_BLOCK (bp); - } - } -return 0 ; -} - -/* -* Count fsblocks of the given fork. -*/ -int /* error */ -xfs_bmap_count_blocks ( -xfs_trans_t *tp,/* transaction pointer */ -xfs_inode_t *ip,/* incore inode */ -int whichfork,/* data or attr fork */ -int *count)/* out: count of blocks */ -{ -struct xfs_btree_block *block;/* current btree block */ -xfs_fsblock_t bno;/* block # of "block" */ -xfs_ifork_t *ifp;/* fork structure */ -int level;/* btree level, for checking */ -xfs_mount_t *mp;/* file system mount structure */ -__be64 *pp;/* pointer to block address */ - - bno =NULLFSBLOCK ; - mp = ip->i_mount; - ifp =XFS_IFORK_PTR (ip, whichfork); -if (XFS_IFORK_FORMAT (ip, whichfork) ==XFS_DINODE_FMT_EXTENTS ) { -xfs_bmap_count_leaves (ifp,0 , - ifp->if_bytes / (uint )sizeof (xfs_bmbt_rec_t), - count); -return 0 ; - } - -/* -* Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out. -*/ - block = ifp->if_broot; - level =be16_to_cpu (block->bb_level); -ASSERT (level>0 ); - pp =XFS_BMAP_BROOT_PTR_ADDR (mp, block,1 , ifp->if_broot_bytes); - bno =be64_to_cpu (*pp); -ASSERT (bno !=NULLDFSBNO ); -ASSERT (XFS_FSB_TO_AGNO (mp, bno)< mp->m_sb.sb_agcount); -ASSERT (XFS_FSB_TO_AGBNO (mp, bno)< mp->m_sb.sb_agblocks); - -if (unlikely (xfs_bmap_count_tree (mp, tp, ifp, bno, level, count)<0 )) { -XFS_ERROR_REPORT ("xfs_bmap_count_blocks(2)" ,XFS_ERRLEVEL_LOW , - mp); -return XFS_ERROR (EFSCORRUPTED ); - } - -return 0 ; -} - -/* * Debug/sanity checking code */ @@ -803,7 +623,6 @@ xfs_bmap_del_free(kmem_zone_free (xfs_bmap_free_item_zone, free); } -/* * Free up any items left in the list. */ @@ -1028,8 +847,8 @@ xfs_bmap_extents_to_btree(* Do all this logging at the end so that * the root is at the right level. */ -xfs_btree_log_recs (cur, abp,1 ,be16_to_cpu (ablock->bb_numrecs));xfs_btree_log_block (cur, abp,XFS_BB_ALL_BITS ); +xfs_btree_log_recs (cur, abp,1 ,be16_to_cpu (ablock->bb_numrecs));ASSERT (*curp ==NULL ); *curp = cur; *logflagsp =XFS_ILOG_CORE |xfs_ilog_fbroot (whichfork);@@ -1744,7 +1563,7 @@ xfs_bmap_last_before(return 0 ; } -STATIC int +int xfs_bmap_last_extent( struct xfs_trans *tp, struct xfs_inode *ip,@@ -1808,29 +1627,6 @@ xfs_bmap_isaeof( }/* -* Check if the endoff is outside the last extent. If so the caller will grow -* the allocation to a stripe unit boundary. All offsets are considered outside -* the end of file for an empty fork, so 1 is returned in *eof in that case. -*/ -int -xfs_bmap_eof ( -struct xfs_inode *ip, -xfs_fileoff_t endoff, -int whichfork, -int *eof) -{ -struct xfs_bmbt_irec rec; -int error; - - error =xfs_bmap_last_extent (NULL , ip, whichfork,&rec, eof); -if (error || *eof) -return error; - - *eof = endoff>= rec.br_startoff + rec.br_blockcount; -return 0 ; -} - -/* * Returns the file-relative block number of the first block past eof in * the file. This is not based on i_size, it is based on the extent records. * Returns 0 for local files, as they do not have extent records. @@ -3369,7 +3165,7 @@ done:/* * Adjust the size of the new extent based on di_extsize and rt extsize. */ -STATIC int +int xfs_bmap_extsize_align( xfs_mount_t *mp, xfs_bmbt_irec_t *gotp, /* next extent pointer */@@ -3531,9 +3327,9 @@ xfs_bmap_extsize_align(#define XFS_ALLOC_GAP_UNITS 4 -STATIC void +void xfs_bmap_adjacent ( -xfs_bmalloca_t *ap)/* bmap alloc argument struct */ +struct xfs_bmalloca *ap)/* bmap alloc argument struct */ {xfs_fsblock_t adjust;/* adjustment to block numbers */ xfs_agnumber_t fb_agno;/* ag number of ap->firstblock */ @@ -3796,7 +3592,7 @@ xfs_bmap_btalloc_nullfb( STATIC intxfs_bmap_btalloc ( -xfs_bmalloca_t *ap)/* bmap alloc argument struct */ +struct xfs_bmalloca *ap)/* bmap alloc argument struct */ {xfs_mount_t *mp;/* mount point structure */ xfs_alloctype_t atype =0 ;/* type for allocation routines */ @@ -4028,7 +3824,7 @@ xfs_bmap_btalloc(*/ STATIC intxfs_bmap_alloc ( -xfs_bmalloca_t *ap)/* bmap alloc argument struct */ +struct xfs_bmalloca *ap)/* bmap alloc argument struct */ {if (XFS_IS_REALTIME_INODE (ap->ip)&& ap->userdata)return xfs_bmap_rtalloc (ap);
libxfs/xfs_bmap.c xfs_bmapi_delay( · line 4219
Quoted 10 lines
libxfs/xfs_bmap.c +2
-2@@ -4416,8 +4212,8 @@ xfs_bmapi_delay( } -STATIC int -xfs_bmapi_allocate ( +int +__xfs_bmapi_allocate (struct xfs_bmalloca *bma) {struct xfs_mount *mp = bma->ip->i_mount;
matches kernel patch 21/49.
__xfs_bmapi_allocate() in xfs_bmap.c has an extra rt variable in the kernel file that is not in the user file. variable is not used adn should be removed in the kernel too.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 33/49 xfsprogs: sync minor kernel header differences
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are lots of little differences between kernel and userspace headers noticable now that the files are largely the same. Clean up all the formatting, whitespace and other minor differences in the userspace headers.
--- include/libxfs.h | 8 +++++--- include/xfs_ag.h | 2 +- include/xfs_alloc_btree.h | 3 +-- include/xfs_attr_remote.h | 28 +++++++++++----------------- include/xfs_bmap_btree.h | 3 +-- include/xfs_btree.h | 3 +-- include/xfs_dinode.h | 3 --- include/xfs_dir2.h | 11 +---------- include/xfs_dir2_format.h | 22 ++++++++++++++-------- include/xfs_fs.h | 26 +++++++++++++++----------- include/xfs_ialloc_btree.h | 3 +-- include/xfs_inode_buf.h | 1 - include/xfs_trans.h | 8 +++----- libxfs/xfs.h | 2 ++ 14 files changed, 56 insertions(+), 67 deletions(-)
include/libxfs.h +5 -3
@@ -46,7 +46,6 @@#include <xfs/xfs_inum.h> #include <xfs/xfs_sb.h> #include <xfs/xfs_ag.h> -#include <xfs/xfs_dir2.h> #include <xfs/xfs_da_btree.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_alloc_btree.h>
@@ -235,6 +234,11 @@ extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *,extern void libxfs_umount (xfs_mount_t *);extern void libxfs_rtmount_destroy (xfs_mount_t *); +/* +* xfs/xfs_dir2_format.h needs struct xfs_mount to be defined +*/ +#include <xfs/xfs_dir2_format.h> +#include <xfs/xfs_dir2.h> /* * Simple I/O interface
@@ -610,8 +614,6 @@ extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, uint, xfs_inode_t **, xfs_daddr_t);extern void libxfs_iput (xfs_inode_t *,uint ); -#include <xfs/xfs_dir2_format.h> -/* Shared utility routines */ extern unsigned int libxfs_log2_roundup (unsigned int i);
include/xfs_ag.h +1 -1
@@ -102,7 +102,7 @@ typedef struct xfs_agf {#define XFS_AGF_LONGEST 0x00000400#define XFS_AGF_BTREEBLKS 0x00000800#define XFS_AGF_UUID 0x00001000 -#define XFS_AGF_NUM_BITS 12 +#define XFS_AGF_NUM_BITS 13#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)#define XFS_AGF_FLAGS \
include/xfs_alloc_btree.h +1 -2
@@ -64,8 +64,7 @@ typedef __be32 xfs_alloc_ptr_t;*/ #define XFS_ALLOC_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_SBLOCK_CRC_LEN : \ - XFS_BTREE_SBLOCK_LEN) + XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)/* * Record, key, and pointer address macros for btree blocks.
include/xfs_attr_remote.h +11 -17
@@ -1,25 +1,19 @@/* * Copyright (c) 2013 Red Hat, Inc. +* All Rights Reserved. * -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2.1 of the GNU Lesser General Public License -* as published by the Free Software Foundation. +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. * -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. * -* Further, this software is distributed without any warranty that it is -* free of the rightful claim of any third person regarding infringement -* or the like. Any license provided herein, whether implied or -* otherwise, applies only to this software file. Patent licenses, if -* any, provided herein do not apply to combinations of this program with -* other software, or any other product whatsoever. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, -* USA. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_ATTR_REMOTE_H__#define __XFS_ATTR_REMOTE_H__
include/xfs_bmap_btree.h +1 -2
@@ -140,8 +140,7 @@ typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;*/ #define XFS_BMBT_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_LBLOCK_CRC_LEN : \ - XFS_BTREE_LBLOCK_LEN) + XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN)#define XFS_BMBT_REC_ADDR (mp, block, index) \ ((xfs_bmbt_rec_t *) \
include/xfs_btree.h +1 -2
@@ -93,7 +93,6 @@ struct xfs_btree_block {#define XFS_BTREE_LBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.l.bb_crc) -/* * Generic key, ptr and record wrapper structures. *
@@ -214,7 +213,7 @@ struct xfs_btree_ops {const struct xfs_buf_ops *buf_ops; -#ifdef DEBUG +#if defined(DEBUG ) || defined(XFS_WARN )/* check that k1 is lower than k2 */ int (*keys_inorder)(struct xfs_btree_cur *cur, union xfs_btree_key *k1,
include/xfs_dinode.h +0 -3
@@ -132,9 +132,6 @@ typedef enum xfs_dinode_fmt {#define XFS_LITINO (mp, version) \ ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version))) -#define XFS_BROOT_SIZE_ADJ (ip) \ - (XFS_BMBT_BLOCK_LEN((ip)->i_mount) - sizeof(xfs_bmdr_block_t)) -/* * Inode data & attribute fork sizes, per inode. */
include/xfs_dir2.h +1 -10
@@ -28,14 +28,6 @@ struct xfs_dir2_sf_entry;struct xfs_dir2_data_hdr ;struct xfs_dir2_data_entry ;struct xfs_dir2_data_unused ; -struct xfs_dir2_data_free ; - -typedef uint xfs_dir2_data_aoff_t ;/* argument form */ - -/* -* Directory block number (logical dirblk in file) -*/ -typedef __uint32_t xfs_dir2_db_t ;extern struct xfs_name xfs_name_dotdot;
@@ -71,7 +63,7 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_sf_to_block (struct xfs_da_args *args);/* -* used by db +* Interface routines used by userspace utilities */ extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
@@ -110,5 +102,4 @@ extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; -#endif /* __XFS_DIR2_H__ */
include/xfs_dir2_format.h +14 -8
@@ -73,6 +73,7 @@*/ typedef __uint16_t xfs_dir2_data_off_t ;#define NULLDATAOFF 0xffffU +typedef uint xfs_dir2_data_aoff_t ;/* argument form */ /* * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
@@ -93,6 +94,11 @@ typedef __uint32_t xfs_dir2_dataptr_t;typedef xfs_off_t xfs_dir2_off_t ;/* +* Directory block number (logical dirblk in file) +*/ +typedef __uint32_t xfs_dir2_db_t ; + +/* * Inode number stored as 8 8-bit values. */ typedef struct {__uint8_t i[8 ]; }xfs_dir2_ino8_t ;
@@ -144,19 +150,19 @@ static inline int xfs_dir2_sf_hdr_size(int i8count) (sizeof (xfs_dir2_ino8_t) -sizeof (xfs_dir2_ino4_t)); } -static inline xfs_dir2_data_aoff_t +static inline xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset (xfs_dir2_sf_entry_t *sfep) {return get_unaligned_be16 (&sfep->offset.i); } -static inline void +static inline void xfs_dir2_sf_put_offset (xfs_dir2_sf_entry_t *sfep,xfs_dir2_data_aoff_t off) {put_unaligned_be16 (off, &sfep->offset.i); } -static inline int +static inline int xfs_dir2_sf_entsize (struct xfs_dir2_sf_hdr *hdr,int len) { return sizeof(struct xfs_dir2_sf_entry) + /* namelen + offset */
@@ -166,14 +172,14 @@ xfs_dir2_sf_entsize(struct xfs_dir2_sf_hdr *hdr, int len) sizeof(xfs_dir2_ino4_t)); } -static inline struct xfs_dir2_sf_entry * +static inline struct xfs_dir2_sf_entry *xfs_dir2_sf_firstentry (struct xfs_dir2_sf_hdr *hdr) {return (struct xfs_dir2_sf_entry *) ((char *)hdr +xfs_dir2_sf_hdr_size (hdr->i8count)); } -static inline struct xfs_dir2_sf_entry * +static inline struct xfs_dir2_sf_entry *xfs_dir2_sf_nextentry (struct xfs_dir2_sf_hdr *hdr,struct xfs_dir2_sf_entry *sfep) {
@@ -238,7 +244,7 @@ typedef struct xfs_dir2_data_free {*/ typedef struct xfs_dir2_data_hdr {__be32 magic;/* XFS_DIR2_DATA_MAGIC or */ -/* XFS_DIR2_BLOCK_MAGIC */ +/* XFS_DIR2_BLOCK_MAGIC */ xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT ]; }xfs_dir2_data_hdr_t ;
@@ -265,7 +271,7 @@ struct xfs_dir3_data_hdr {#define XFS_DIR3_DATA_CRC_OFF offsetof(struct xfs_dir3_data_hdr, hdr.crc) -static inline struct xfs_dir2_data_free * +static inline struct xfs_dir2_data_free *xfs_dir3_data_bestfree_p (struct xfs_dir2_data_hdr *hdr) { if (hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -514,7 +520,7 @@ struct xfs_dir3_leaf {#define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc)extern void xfs_dir3_leaf_hdr_from_disk (struct xfs_dir3_icleaf_hdr *to, -struct xfs_dir2_leaf *from); +struct xfs_dir2_leaf *from);static inline int xfs_dir3_leaf_hdr_size (struct xfs_dir2_leaf *lp)
include/xfs_fs.h +15 -11
@@ -311,6 +311,17 @@ typedef struct xfs_bstat { } xfs_bstat_t;/* +* Project quota id helpers (previously projid was 16bit only +* and using two 16bit values to hold new 32bit projid was choosen +* to retain compatibility with "old" filesystems). +*/ +static inline __uint32_t +bstat_get_projid (struct xfs_bstat *bs) +{ +return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; +} + +/* * The user-level BulkStat Request interface structure. */ typedef struct xfs_fsop_bulkreq {
@@ -511,10 +522,14 @@ typedef struct xfs_handle {#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ +/* XFS_IOC_FREEZE -- FIFREEZE 119 */ /* XFS_IOC_THAW -- FITHAW 120 */ +#ifndef FIFREEZE #define XFS_IOC_FREEZE _IOWR('X', 119, int)#define XFS_IOC_THAW _IOWR('X', 120, int) +#endif +#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
@@ -537,15 +552,4 @@ typedef struct xfs_handle {#define BBTOB (bbs) ((bbs) << BBSHIFT)#endif -/* -* Project quota id helpers (previously projid was 16bit only -* and using two 16bit values to hold new 32bit projid was choosen -* to retain compatibility with "old" filesystems). -*/ -static inline __uint32_t -bstat_get_projid (struct xfs_bstat *bs) -{ -return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; -} -#endif /* __XFS_FS_H__ */
include/xfs_ialloc_btree.h +1 -2
@@ -80,8 +80,7 @@ typedef __be32 xfs_inobt_ptr_t;*/ #define XFS_INOBT_BLOCK_LEN (mp) \ (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ - XFS_BTREE_SBLOCK_CRC_LEN : \ - XFS_BTREE_SBLOCK_LEN) + XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)/* * Record, key, and pointer address macros for btree blocks.
include/xfs_inode_buf.h +0 -1
@@ -40,7 +40,6 @@ int xfs_iread(struct xfs_mount *, struct xfs_trans *,void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *);void xfs_dinode_to_disk (struct xfs_dinode *,struct xfs_icdinode *); -bool xfs_can_free_eofblocks (struct xfs_inode *,bool );#if defined(DEBUG )void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *);
include/xfs_trans.h +3 -5
@@ -200,7 +200,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 */
@@ -228,7 +228,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)
@@ -298,6 +298,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 );
@@ -327,7 +328,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/xfs.h +2 -0
@@ -437,3 +437,5 @@ xfs_buf_t *xfs_trans_buf_item_match(xfs_trans_t *, struct xfs_buftarg *,/* local source files */ int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );void xfs_trans_mod_sb (xfs_trans_t *,uint ,long ); +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/49] xfsprogs: sync minor kernel header differences
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are lots of little differences between kernel and userspace headers noticable now that the files are largely the same. Clean up all the formatting, whitespace and other minor differences in the userspace headers.
Signed-off-by Dave Chinner<[email protected]>---
This patch is the user equivalent of the for Linux 3.12 kernel patch
22/49.
xfs_dir2.h kernel file has entry not in user:
extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mapped_bno);
xfs_inode_buf.h kernel file has entry not in user:
bool xfs_can_free_eofblocks(struct xfs_inode *, bool);
xfs_trans.h user has several entries mentioned in previous patches.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/49 xfs: don't special case shared superblock mounts
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
--- include/xfs_sb.h | 7 ------- 1 file changed, 7 deletions(-)
include/xfs_sb.h +0 -7
@@ -355,15 +355,8 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp) (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))return 0 ; -#ifdef __KERNEL__if (sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN )return 0 ; -#else -if ((sbp->sb_versionnum &XFS_SB_VERSION_SHAREDBIT ) && - sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN ) -return 0 ; -#endif -return 1 ; }if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 )
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/49] xfs: don't special case shared superblock mounts
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
Signed-off-by Dave Chinner<[email protected]>---
matches kernel patch 28/49.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 35/49 xfs: move swap extent code to xfs_extent_ops
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Swapping extents is clearly an extent operaiton, and it is not shared with userspace. Move the code to xfs_extent_ops.[ch], and the userspace ioctl structure definition to xfs_fs.h where most of the other ioctl structure definitions are. The means xfs_dfrag.h is no longer needed in userspace.
--- fsr/xfs_fsr.c | 1 - include/Makefile | 3 +-- include/xfs_dfrag.h | 53 ----------------------------------------------------- include/xfs_fs.h | 15 +++++++++++++++ 4 files changed, 16 insertions(+), 56 deletions(-) delete mode 100644 include/xfs_dfrag.h
fsr/xfs_fsr.c +0 -1
@@ -20,7 +20,6 @@#include <xfs/xfs.h> #include <xfs/xfs_types.h> #include <xfs/jdm.h> -#include <xfs/xfs_dfrag.h> #include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_dinode.h> #include <xfs/xfs_attr_sf.h>
include/Makefile +1 -2
@@ -41,8 +41,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_trace.h \ xfs_trans.h \ xfs_trans_resv.h \ - xfs_trans_space.h \ - xfs_dfrag.h + xfs_trans_space.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h xfs_types.h HFILES += $(PKG_PLATFORM).h
include/xfs_dfrag.h deleted +0 -53
53 lines not on this page · raw message
include/xfs_fs.h +15 -0
@@ -461,6 +461,21 @@ typedef struct xfs_handle { + (handle).ha_fid.fid_len)/* +* Structure passed to XFS_IOC_SWAPEXT +*/ +typedef struct xfs_swapext +{ +__int64_t sx_version;/* version */ +#define XFS_SX_VERSION 0 +__int64_t sx_fdtarget;/* fd of target file */ +__int64_t sx_fdtmp;/* fd of tmp file */ +xfs_off_t sx_offset;/* offset into file */ +xfs_off_t sx_length;/* leng from offset */ +char sx_pad[16 ];/* pad space, unused */ +xfs_bstat_t sx_stat;/* stat of target b4 copy */ +}xfs_swapext_t ; + +/* * Flags for going down operation */ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0/* going down */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 35/49] xfs: move swap extent code to xfs_extent_ops
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Swapping extents is clearly an extent operaiton, and it is not shared with userspace. Move the code to xfs_extent_ops.[ch], and the userspace ioctl structure definition to
xfs_fs.hwhere most of the other ioctl structure definitions are. The meansxfs_dfrag.his no longer needed in userspace.Signed-off-by Dave Chinner<[email protected]>---
Equivalent to patch kernel patch 27/49.
It is out of sequence but the files are the same.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 36/49 xfs: kill __KERNEL__ check for debug code in allocation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of __KERNEL__ users.
--- libxfs/xfs_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libxfs/xfs_alloc.c +3 -3
@@ -856,7 +856,7 @@ xfs_alloc_ag_vextent_near(xfs_agblock_t ltnew;/* useful start bno of left side */ xfs_extlen_t rlen;/* length of returned extent */ int forced =0 ; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Randomly don't execute the first algorithm. */
@@ -916,8 +916,8 @@ restart:xfs_extlen_t blen=0 ;xfs_agblock_t bnew=0 ; -#if defined(DEBUG ) && defined(__KERNEL__) -if (!dofirst) +#ifdef DEBUG +if (dofirst)break ;#endif /*
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 36/49] xfs: kill __KERNEL__ check for debug code in allocation code
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of
__KERNEL__users.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 29/49.
This patch is same as kernel - there are differences in xfs_alloc.c from other patches.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/49 xfs: remove __KERNEL__ from debug code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the __KERNEL__ part of the defines, and let userspace handle the debug code appropriately.
--- include/xfs_bmap.h | 2 +- libxfs/xfs_dir2_data.c | 4 ++-- libxfs/xfs_rtalloc.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
include/xfs_bmap.h +1 -1
@@ -127,7 +127,7 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) { BMAP_RIGHT_FILLING, "RF" }, \ { BMAP_ATTRFORK, "ATTR" } -#if defined(__KERNEL) && defined(DEBUG ) +#ifdef DEBUG void xfs_bmap_trace_exlist (struct xfs_inode *ip,xfs_extnum_t cnt,int whichfork,unsigned long caller_ip);#define XFS_BMAP_TRACE_EXLIST (ip,c,w) \
libxfs/xfs_dir2_data.c +2 -2
@@ -315,7 +315,7 @@ xfs_dir2_data_freefind(xfs_dir2_data_free_t *dfp;/* bestfree entry */ xfs_dir2_data_aoff_t off;/* offset value needed */ struct xfs_dir2_data_free *bf; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG int matched;/* matched the value */ int seenzero;/* saw a 0 bestfree entry */ #endif
@@ -323,7 +323,7 @@ xfs_dir2_data_freefind( off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); bf =xfs_dir3_data_bestfree_p (hdr); -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Validate some consistency in the bestfree table. * Check order, non-overlapping entries, and if we find the
libxfs/xfs_rtalloc.c +1 -1
@@ -735,7 +735,7 @@ xfs_rtfree_extent(ASSERT (mp->m_rbmip->i_itemp !=NULL );ASSERT (xfs_isilocked (mp->m_rbmip,XFS_ILOCK_EXCL )); -#if defined(__KERNEL__) && defined(DEBUG ) +#ifdef DEBUG /* * Check to see that this whole range is currently allocated. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/49] xfs: remove __KERNEL__ from debug code
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the
__KERNEL__part of the defines, and let userspace handle the debug code appropriately.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 30/49.
patches are the same, but at this point, the kernel and user xfs_rtalloc.c files are out of sync - doesn't appear they ever become synced.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 38/49 xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
--- libxfs/xfs_dir2_leaf.c | 4 ---- 1 file changed, 4 deletions(-)
libxfs/xfs_dir2_leaf.c +0 -4
@@ -1568,10 +1568,6 @@ xfs_dir2_leaf_search_hash( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); -#ifndef __KERNEL__ -if (!leafhdr.count) -return 0 ; -#endif /* * Note, the table cannot be empty, so we have to go through the loop. * Binary search the leaf entries looking for our hash value.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 38/49] xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 31/49. compares okay to the kernel patch.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 39/49 xfs: move kernel specific type definitions to xfs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_types.h is shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines to xfs_linux.h so we can remove the __KERNEL__ guards from xfs_types.h
--- include/xfs_types.h | 36 ------------------------------------ 1 file changed, 36 deletions(-)
include/xfs_types.h +0 -36
@@ -18,42 +18,6 @@#ifndef __XFS_TYPES_H__#define __XFS_TYPES_H__ -#ifdef __KERNEL__ - -/* -* Additional type declarations for XFS -*/ -typedef signed char __int8_t ; -typedef unsigned char __uint8_t ; -typedef signed short int __int16_t ; -typedef unsigned short int __uint16_t ; -typedef signed int __int32_t ; -typedef unsigned int __uint32_t ; -typedef signed long long int __int64_t ; -typedef unsigned long long int __uint64_t ; - -typedef __uint32_t inst_t ;/* an instruction */ - -typedef __s64 xfs_off_t ;/* <file offset> type */ -typedef unsigned long long xfs_ino_t ;/* <inode> type */ -typedef __s64 xfs_daddr_t ;/* <disk address> type */ -typedef char *xfs_caddr_t ;/* <core address> type */ -typedef __u32 xfs_dev_t ; -typedef __u32 xfs_nlink_t ; - -/* __psint_t is the same size as a pointer */ -#if (BITS_PER_LONG ==32 ) -typedef __int32_t __psint_t ; -typedef __uint32_t __psunsigned_t ; -#elif (BITS_PER_LONG ==64 ) -typedef __int64_t __psint_t ; -typedef __uint64_t __psunsigned_t ; -#else -#error BITS_PER_LONG must be 32 or 64 -#endif - -#endif /* __KERNEL__ */ -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 39/49] xfs: move kernel specific type definitions to xfs.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs_types.his shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines toxfs_linux.hso we can remove the__KERNEL__guards fromxfs_types.hSigned-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 33/49.
patches are the same,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 40/49 xfs: make struct xfs_perag kernel only
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The struct xfs_perag has many kernel-only definitions in it, requiring a __KERNEL__ guard so userspace can use it to. Move it to xfs_mount.h so that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another __KERNEL__ check in the XFS header files.
--- include/libxfs.h | 31 +++++++++++++++++++++++++++++++ include/xfs_ag.h | 53 ----------------------------------------------------- 2 files changed, 31 insertions(+), 53 deletions(-)
include/libxfs.h +31 -0
@@ -218,6 +218,37 @@ typedef struct xfs_mount {xfs_dablk_t m_dirfreeblk;/* blockno of dirfreeindex v2 */ } xfs_mount_t; +/* +* Per-ag incore structure, copies of information in agf and agi, +* to improve the performance of allocation group selection. +*/ +typedef struct xfs_perag { +struct xfs_mount *pag_mount;/* owner filesystem */ +xfs_agnumber_t pag_agno;/* AG this structure belongs to */ +atomic_t pag_ref;/* perag reference count */ +char pagf_init;/* this agf's entry is initialized */ +char pagi_init;/* this agi's entry is initialized */ +char pagf_metadata;/* the agf is preferred to be metadata */ +char pagi_inodeok;/* The agi is ok for inodes */ +__uint8_t pagf_levels[XFS_BTNUM_AGF ]; +/* # of levels in bno & cnt btree */ +__uint32_t pagf_flcount;/* count of blocks in freelist */ +xfs_extlen_t pagf_freeblks;/* total free blocks */ +xfs_extlen_t pagf_longest;/* longest free space */ +__uint32_t pagf_btreeblks;/* # of blocks held in AGF btrees */ +xfs_agino_t pagi_freecount;/* number of free inodes */ +xfs_agino_t pagi_count;/* number of allocated inodes */ + +/* +* Inode allocation search lookup optimisation. +* If the pagino matches, the search for new inodes +* doesn't need to search the near ones again straight away +*/ +xfs_agino_t pagl_pagino; +xfs_agino_t pagl_leftrec; +xfs_agino_t pagl_rightrec; +int pagb_count;/* pagb slots in use */ +}xfs_perag_t ;#define LIBXFS_MOUNT_ROOTINOS 0x0001#define LIBXFS_MOUNT_DEBUGGER 0x0002
include/xfs_ag.h +0 -53
59 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 40/49] xfs: make struct xfs_perag kernel only
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The struct
xfs_peraghas many kernel-only definitions in it, requiring a__KERNEL__guard so userspace can use it to. Move it toxfs_mount.hso that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another__KERNEL__check in the XFS header files.Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 34/49
looks okay.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 41/49 xfs: Introduce a new structure to hold transaction reservation items
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Introduce a new structure xfs_trans_res to hold transaction reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the log count as well as log flags for permanent log reservation.
--- include/libxfs.h | 2 +- include/xfs_trans_resv.h | 125 ++++++++++++++++++++++++++--------------------- libxfs/trans.c | 2 +- libxfs/xfs_trans_resv.c | 121 ++++++++++++++++++++++++++++++++++----------- mkfs/maxtrres.c | 17 ++++--- 5 files changed, 172 insertions(+), 95 deletions(-)
include/libxfs.h +1 -1
@@ -203,7 +203,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_litino;/* size of inode union area */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ -struct xfs_trans_resv m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_resv;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ int m_dalign;/* stripe unit */ int m_swidth;/* stripe width */
include/xfs_trans_resv.h +68 -57
142 lines not on this page · raw message
libxfs/trans.c +1 -1
@@ -33,7 +33,7 @@ voidlibxfs_trans_init ( struct xfs_mount *mp) { -xfs_trans_resv_calc (mp, &mp->m_reservations); +xfs_trans_resv_calc (mp, &mp->m_resv); }/*
libxfs/xfs_trans_resv.c +93 -28
125 lines not on this page · raw message
mkfs/maxtrres.c +9 -8
@@ -47,22 +47,23 @@ max_attrsetm_trans_res_adjust( nblks +=XFS_B_TO_FSB (mp, size); nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); res =XFS_ATTRSETM_LOG_RES (mp) +XFS_ATTRSETRT_LOG_RES (mp) * nblks; - mp->m_reservations.tr_attrsetm = res; + mp->m_resv.tr_attrsetm.tr_logres = res; }static int max_trans_res_by_mount (struct xfs_mount *mp) { -uint *p; -int rval; -struct xfs_trans_resv *tr = &mp->m_reservations; +struct xfs_trans_resv *tr = &mp->m_resv; +struct xfs_trans_res *p; +struct xfs_trans_res rval = {0 }; -for (rval =0 , p = (uint *)tr; p < (uint *)(tr +1 ); p++) { -if ((int )*p > rval) - rval = (int )*p; +for (p = (struct xfs_trans_res *)tr; + p < (struct xfs_trans_res *)(tr +1 ); p++) { +if (p->tr_logres > rval.tr_logres) + rval = *p; } -return rval; +return rval.tr_logres; }int
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 41/49] xfs: Introduce a new structure to hold transaction reservation items
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
Introduce a new structure
xfs_trans_resto hold transaction reservation item info per log ticket.We also need to improve
xfs_trans_resv_calc()by initializing the log count as well as log flags for permanent log reservation.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 35/49 plus find max log reservation for mkfs.
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/49 xfs: Introduce tr_fsyncts to m_reservation
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
A preparation step.
For now fsync_ts transaction use the pre-calculated log reservation size of tr_swrite.
This patch introduce a new item tr_fsyncts to mp->m_reservations structure so that we can fetch the log reservation value for it in a same manner to others.
--- include/xfs_trans_resv.h | 3 ++- libxfs/xfs_trans_resv.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
include/xfs_trans_resv.h +2 -1
@@ -62,6 +62,7 @@ struct xfs_trans_resv {struct xfs_trans_res tr_qm_quotaoff;/* turn quota off */ struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */ struct xfs_trans_res tr_sb;/* modify superblock */ +struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ };/*
@@ -109,7 +110,7 @@ struct xfs_trans_resv {* Logging the inode timestamps on an fsync -- same as SWRITE * as long as SWRITE logs the entire inode core */ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres)#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
libxfs/xfs_trans_resv.c +1 -0
@@ -734,6 +734,7 @@ xfs_trans_resv_calc( resp->tr_ichange.tr_logres =xfs_calc_ichange_reservation (mp); resp->tr_growdata.tr_logres =xfs_calc_growdata_reservation (mp); resp->tr_swrite.tr_logres =xfs_calc_swrite_reservation (mp); + resp->tr_fsyncts.tr_logres =xfs_calc_swrite_reservation (mp); resp->tr_writeid.tr_logres =xfs_calc_writeid_reservation (mp); resp->tr_attrsetrt.tr_logres =xfs_calc_attrsetrt_reservation (mp); resp->tr_clearagi.tr_logres =xfs_calc_clear_agi_bucket_reservation (mp);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 42/49] xfs: Introduce tr_fsyncts to m_reservation
Quoted 4 lines · Dave Chinner
From: Jie Liu<[email protected]>
A preparation step.
Quoted 8 lines
For now
fsync_tstransaction use the pre-calculated log reservation size oftr_swrite.
This patch introduce a new itemtr_fsynctstomp->m_reservationsstructure so that we can fetch the log reservation value for it in a same manner to others.Signed-off-by Jie Liu<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 36/49. tr_fsyncts get it's own reservation function.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 43/49 xfs: Make writeid transaction use tr_writeid
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
tr_writeid is defined at mp->m_resv structure, however, it does not really being used when it should be..
This patch changes it to tr_writeid to fetch the correct log reservation size.
--- include/xfs_trans_resv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/xfs_trans_resv.h +1 -1
@@ -111,7 +111,7 @@ struct xfs_trans_resv {* as long as SWRITE logs the entire inode core */ #define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 43/49] xfs: Make writeid transaction use tr_writeid
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
tr_writeidis defined atmp->m_resvstructure, however, it does not really being used when it should be..This patch changes it to
tr_writeidto fetch the correct log reservation size.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 37/49. now tr_writeid gets it's own reservation function.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 44/49 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
@@ -512,7 +512,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
@@ -65,6 +65,9 @@ struct xfs_trans_resv {struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ }; +/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv) +/* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent.
libxfs/trans.c +9 -11
@@ -91,7 +91,7 @@ libxfs_trans_roll( struct xfs_inode *dp) {struct xfs_trans *trans; -unsigned int logres, count; +struct xfs_trans_res tres;int error;/*
@@ -103,8 +103,8 @@ libxfs_trans_roll(/* * Copy the critical parameters from one trans to the next. */ - logres = trans->t_log_res; - count = trans->t_log_count; + tres.tr_logres = trans->t_log_res; + tres.tr_logcount = trans->t_log_count; *tpp =xfs_trans_dup (trans);/*
@@ -128,8 +128,8 @@ libxfs_trans_roll(* across this call, or that anything that is locked be logged in * the prior and the next transactions. */ - error =xfs_trans_reserve (trans,0 , logres,0 , -XFS_TRANS_PERM_LOG_RES , count); + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (trans, &tres,0 ,0 );/* * Ensure that the inode is in the new transaction and locked. */
@@ -176,12 +176,10 @@ libxfs_trans_dup(int libxfs_trans_reserve ( -xfs_trans_t *tp, -uint blocks, -uint logspace, -uint rtextents, -uint flags, -uint logcount) +struct xfs_trans *tp, +struct xfs_trans_res *resp, +uint blocks, +uint rtextents) {xfs_sb_t *mpsb = &tp->t_mountp->m_sb;
libxfs/util.c +11 -4
@@ -473,7 +473,8 @@ libxfs_alloc_file_space( tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); resblks = (uint )XFS_DIOSTRAT_SPACE_RES (mp, datablocks); - error =xfs_trans_reserve (tp, resblks,0 ,0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks,0 );if (error)break ;xfs_trans_ijoin (tp, ip,0 );
@@ -536,7 +537,6 @@ libxfs_inode_alloc(struct fsxattr *fsx, xfs_inode_t **ipp) { - int i; xfs_buf_t *ialloc_context;xfs_inode_t *ip;xfs_trans_t *ntp;
@@ -555,13 +555,20 @@ libxfs_inode_alloc( }if (ialloc_context) { +struct xfs_trans_res tres; +xfs_trans_bhold (*tp, ialloc_context); + tres.tr_logres = (*tp)->t_log_res; + tres.tr_logcount = (*tp)->t_log_count; + ntp =xfs_trans_dup (*tp);xfs_trans_commit (*tp,0 ); *tp = ntp; -if ((i =xfs_trans_reserve (*tp,0 ,0 ,0 ,0 ,0 ))) { + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (*tp, &tres,0 ,0 ); +if (error) {fprintf (stderr,_ ("%s: cannot reserve space: %s\n" ), - progname,strerror (i)); + progname,strerror (error));exit (1 ); }xfs_trans_bjoin (*tp, ialloc_context);
libxfs/xfs_attr.c +16 -17
@@ -202,13 +202,14 @@ xfs_attr_set_int( int valuelen, int flags) { -xfs_da_args_t args; -xfs_fsblock_t firstblock; -xfs_bmap_free_t flist; -int error, err2, committed; -xfs_mount_t *mp = dp->i_mount; -int rsvd = (flags &ATTR_ROOT ) !=0 ; -int local; +xfs_da_args_t args; +xfs_fsblock_t firstblock; +xfs_bmap_free_t flist; +int error, err2, committed; +struct xfs_mount *mp = dp->i_mount; +struct xfs_trans_res tres; +int rsvd = (flags &ATTR_ROOT ) !=0 ; +int local;/* * Attach the dquots to the inode.
@@ -268,11 +269,11 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error =xfs_trans_reserve (args.trans, args.total, -XFS_ATTRSETM_LOG_RES (mp) + -XFS_ATTRSETRT_LOG_RES (mp) * args.total, -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRSET_LOG_COUNT ); + tres.tr_logres =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * args.total; + tres.tr_logcount =XFS_ATTRSET_LOG_COUNT ; + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (args.trans, &tres, args.total,0 );if (error) {xfs_trans_cancel (args.trans,0 );return (error);
@@ -492,11 +493,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)if (flags &ATTR_ROOT ) args.trans->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (args.trans, -XFS_ATTRRM_SPACE_RES (mp), -XFS_ATTRRM_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRRM_LOG_COUNT ))) { + error =xfs_trans_reserve (args.trans, &M_RES (mp)->tr_attrrm, +XFS_ATTRRM_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (args.trans,0 );return (error); }
libxfs/xfs_bmap.c +2 -2
@@ -1113,8 +1113,8 @@ xfs_bmap_add_attrfork( blks =XFS_ADDAFORK_SPACE_RES (mp);if (rsvd) tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp, blks,XFS_ADDAFORK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ADDAFORK_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_addafork, blks,0 ); +if (error) goto error0;xfs_ilock (ip,XFS_ILOCK_EXCL ); error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
libxfs/xfs_trans_resv.c +4 -3
@@ -522,7 +522,8 @@ xfs_calc_attrsetm_reservation(* Since the runtime attribute transaction space is dependent on the total * blocks needed for the 1st bmap, here we calculate out the space unit for * one block so that the caller could figure out the total space according -* to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp). +* to the attibute extent length in blocks by: +* ext * M_RES(mp)->tr_attrsetrt.tr_logres */ STATIC uint xfs_calc_attrsetrt_reservation(
@@ -594,14 +595,14 @@ xfs_calc_qm_setqlim_reservation(/* * Allocating quota on disk if needed. -* the write transaction log space: XFS_WRITE_LOG_RES(mp) +* the write transaction log space: M_RES(mp)->tr_write.tr_logres * the unit of quota allocation: one system block size */ STATIC uintxfs_calc_qm_dqalloc_reservation (struct xfs_mount *mp) { -return XFS_WRITE_LOG_RES (mp) + +return M_RES (mp)->tr_write.tr_logres +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ) -1 ); }
mkfs/proto.c +16 -8
@@ -119,7 +119,9 @@ getres( mp = tp->t_mountp;for (i =0 , r =MKFS_BLOCKRES (blocks); r >= blocks; r--) { - i =libxfs_trans_reserve (tp, r,0 ,0 ,0 ,0 ); +struct xfs_trans_res tres = {0 }; + + i =libxfs_trans_reserve (tp, &tres, r,0 );if (i ==0 )return ; }
@@ -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.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 44/49] xfs: refactor xfs_trans_reserve() interface
Quoted 7 lines · Dave Chinner
From: Jie Liu<[email protected]>
With the new
xfs_trans_resstructure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refinexfs_trans_reserve()interface to be more neat.
Quoted 6 lines
Also, introduce a new helper
M_RES()to return a pointer to themp->m_resvstructure to simplify the input.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 38/49 plus modifying the calls to libxfs_trans_reserve() in xfsprogs.
Still think you should remove the M_RES(mp) define.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 45/49 xfs: Get rid of all XFS_XXX_LOG_RES() macro
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Get rid of all XFS_XXX_LOG_RES() macros since they are obsoleted now.
--- include/xfs_trans_resv.h | 36 ------------------------------------ mkfs/maxtrres.c | 5 +++-- 2 files changed, 3 insertions(+), 38 deletions(-)
include/xfs_trans_resv.h +0 -36
@@ -92,42 +92,6 @@ struct xfs_trans_resv { (XFS_DAENTER_BLOCKS (mp,XFS_DATA_FORK ) + \XFS_DAENTER_BMAPS (mp,XFS_DATA_FORK ) +1 ) - -#define XFS_WRITE_LOG_RES (mp) ((mp)->m_resv.tr_write.tr_logres) -#define XFS_RENAME_LOG_RES (mp) ((mp)->m_resv.tr_rename.tr_logres) -#define XFS_LINK_LOG_RES (mp) ((mp)->m_resv.tr_link.tr_logres) -#define XFS_REMOVE_LOG_RES (mp) ((mp)->m_resv.tr_remove.tr_logres) -#define XFS_SYMLINK_LOG_RES (mp) ((mp)->m_resv.tr_symlink.tr_logres) -#define XFS_CREATE_LOG_RES (mp) ((mp)->m_resv.tr_create.tr_logres) -#define XFS_MKDIR_LOG_RES (mp) ((mp)->m_resv.tr_mkdir.tr_logres) -#define XFS_IFREE_LOG_RES (mp) ((mp)->m_resv.tr_ifree.tr_logres) -#define XFS_SWRITE_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) -#define XFS_ICHANGE_LOG_RES (mp) ((mp)->m_resv.tr_ichange.tr_logres) -#define XFS_GROWDATA_LOG_RES (mp) ((mp)->m_resv.tr_growdata.tr_logres) -#define XFS_ITRUNCATE_LOG_RES (mp) ((mp)->m_resv.tr_itruncate.tr_logres) -#define XFS_GROWRTZERO_LOG_RES (mp) ((mp)->m_resv.tr_growrtzero.tr_logres) -#define XFS_GROWRTFREE_LOG_RES (mp) ((mp)->m_resv.tr_growrtfree.tr_logres) -#define XFS_GROWRTALLOC_LOG_RES (mp) ((mp)->m_resv.tr_growrtalloc.tr_logres) - -/* -* Logging the inode timestamps on an fsync -- same as SWRITE -* as long as SWRITE logs the entire inode core -*/ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres) -#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres) -#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres) -#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_resv.tr_attrsetrt.tr_logres) -#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_resv.tr_attrrm.tr_logres) -#define XFS_SB_LOG_RES (mp) ((mp)->m_resv.tr_sb.tr_logres) -#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres) -#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres) -#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres) -#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres) -#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres) -#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_resv.tr_clearagi.tr_logres) -/* * Various log count values. */
mkfs/maxtrres.c +3 -2
@@ -46,8 +46,9 @@ max_attrsetm_trans_res_adjust( nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); nblks +=XFS_B_TO_FSB (mp, size); nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); - res =XFS_ATTRSETM_LOG_RES (mp) +XFS_ATTRSETRT_LOG_RES (mp) * nblks; - mp->m_resv.tr_attrsetm.tr_logres = res; + res =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * nblks; +M_RES (mp)->tr_attrsetm.tr_logres = res; } static int
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 45/49] xfs: Get rid of all XFS_XXX_LOG_RES() macro
Quoted 7 lines · Dave Chinner
From: Jie Liu<[email protected]>
Get rid of all
XFS_XXX_LOG_RES()macros since they are obsoleted now.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 39/49. also changes a reservation max_attrsetm_trans_res_adjust to use the xfs_trans_res information.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 46/49 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 | 11 +++- libxfs/Makefile | 15 ++++-- libxfs/util.c | 107 +++++++++++++++++++++++++++++++++++++ libxfs/xfs_log_rlimit.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++ mkfs/maxtrres.c | 60 +++++---------------- mkfs/xfs_mkfs.c | 95 +++++++++++++++++---------------- mkfs/xfs_mkfs.h | 4 +- 7 files changed, 328 insertions(+), 99 deletions(-) create mode 100644 libxfs/xfs_log_rlimit.c
include/xfs_log_format.h +10 -1
@@ -18,6 +18,9 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +struct xfs_trans_res ; +/* * On-disk Log Format definitions. *
@@ -49,6 +52,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
@@ -133,7 +139,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1
@@ -761,4 +766,8 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); + +#endif /* __XFS_LOG_FORMAT_H__ */
libxfs/Makefile +12 -3
@@ -17,14 +17,23 @@ CFILES = cache.c \ xfs_alloc.c \ xfs_alloc_btree.c \ xfs_attr.c \ + xfs_attr_leaf.c \ xfs_attr_remote.c \ + xfs_bmap.c \ + xfs_bmap_btree.c \ xfs_btree.c \ + xfs_da_btree.c \ + xfs_dir2.c \ + xfs_dir2_block.c \ + xfs_dir2_data.c \ + xfs_dir2_leaf.c \ + xfs_dir2_node.c \ + xfs_dir2_sf.c \ xfs_ialloc.c \ xfs_inode_buf.c \ xfs_inode_fork.c \ - xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ - xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \ - xfs_dir2_node.c xfs_dir2_data.c xfs_dir2_sf.c xfs_bmap.c \ + xfs_ialloc_btree.c \ + xfs_log_rlimit.c \ xfs_rtalloc.c \ xfs_sb.c \ xfs_symlink_remote.c \
libxfs/util.c +107 -0
113 lines not on this page · raw message
libxfs/xfs_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 +50 -45
131 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 dirblocklog, +int log_sunit);#endif /* __XFS_MKFS_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 46/49] xfs: Add xfs_log_rlimit.c
Quoted 8 lines · Dave Chinner
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ]
Quoted 8 lines
[dchinner: rework loop in
xfs_log_get_max_trans_res()][dchinner: implement
xfs_log_calc_unit_res()inutil.cto give mkfs a worse case calculation of the log size needed. ]Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
user equivalent of the for Linux 3.12 kernel patch 41/49 plus a lot of additional mkfs support.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 47/49 xfs: Add read-only support for dirent filetype field
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the xfs_name structures passed around is added, but the directory code does not use this field yet. That will be in the next patch.
--- db/check.c | 12 +-- db/dir2.c | 10 +-- db/dir2sf.c | 9 ++- db/metadump.c | 10 +-- include/xfs_da_btree.h | 1 + include/xfs_dir2.h | 9 ++- include/xfs_dir2_format.h | 183 ++++++++++++++++++++++++++++++++++++++++------ include/xfs_sb.h | 28 ++++--- include/xfs_types.h | 1 + libxfs/xfs_dir2.c | 5 +- libxfs/xfs_dir2_block.c | 18 ++--- libxfs/xfs_dir2_data.c | 13 ++-- libxfs/xfs_dir2_leaf.c | 6 +- libxfs/xfs_dir2_node.c | 8 +- libxfs/xfs_dir2_priv.h | 44 +++++------ libxfs/xfs_dir2_sf.c | 122 ++++++++++++++++++------------- logprint/log_misc.c | 58 ++++++++------- repair/dir2.c | 37 +++++----- repair/dir2.h | 1 + repair/phase6.c | 22 +++--- 20 files changed, 384 insertions(+), 213 deletions(-)
db/check.c +6 -6
@@ -2309,7 +2309,7 @@ process_data_dir_v2( (int)((char *)dep - (char *)data)); error++; } - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep);if ((char *)tagp >= endptr) {if (!sflag || v) dbprintf(_("dir %lld block %d bad entry at %d\n"),
@@ -2324,7 +2324,7 @@ process_data_dir_v2( xname.name = dep->name; xname.len = dep->namelen;dir_hash_add (mp->m_dirnameops->hashname (&xname), addr); - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); count++; lastfree =0 ; lino =be64_to_cpu (dep->inumber);
@@ -3434,7 +3434,7 @@ process_sf_dir_v2( sfe =xfs_dir2_sf_firstentry (sf); offset =XFS_DIR3_DATA_FIRST_OFFSET (mp);for (i = sf->count -1 , i8 =0 ; i >=0 ; i--) { -if ((__psint_t )sfe +xfs_dir2_sf_entsize (sf, sfe->namelen) - +if ((__psint_t )sfe +xfs_dir3_sf_entsize (mp, sf, sfe->namelen) - (__psint_t )sf >be64_to_cpu (dip->di_size)) {if (!sflag) dbprintf(_("dir %llu bad size in entry at %d\n"),
@@ -3443,7 +3443,7 @@ process_sf_dir_v2( error++;break ; } - lino =xfs_dir2_sfe_get_ino (sf, sfe); + lino =xfs_dir3_sfe_get_ino (mp, sf, sfe);if (lino >XFS_DIR2_MAX_SHORT_INUM ) i8++; cid =find_inode (lino,1 );
@@ -3473,8 +3473,8 @@ process_sf_dir_v2( } offset =xfs_dir2_sf_get_offset (sfe) + -xfs_dir2_sf_entsize (sf, sfe->namelen); - sfe =xfs_dir2_sf_nextentry (sf, sfe); +xfs_dir3_sf_entsize (mp, sf, sfe->namelen); + sfe =xfs_dir3_sf_nextentry (mp, sf, sfe); }if (i <0 && (__psint_t )sfe - (__psint_t )sf !=be64_to_cpu (dip->di_size)) {
db/dir2.c +5 -5
@@ -222,7 +222,7 @@ __dir2_data_entries_count( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return i;
@@ -246,7 +246,7 @@ __dir2_data_entry_offset( ptr +=be16_to_cpu (dup->length); else { dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); } }return ptr;
@@ -495,7 +495,7 @@ dir2_data_union_tag_count( end = (char *)&dep->namelen +sizeof (dep->namelen);if (end > (char *)obj + mp->m_dirblksize)return 0 ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); } end = (char *)tagp +sizeof (*tagp);return end <= (char *)obj + mp->m_dirblksize;
@@ -517,7 +517,7 @@ dir2_data_union_tag_offset(return bitize ((int )((char *)xfs_dir2_data_unused_tag_p (dup) - (char *)dup)); dep = (xfs_dir2_data_entry_t *)dup; -return bitize ((int )((char *)xfs_dir2_data_entry_tag_p (dep) - +return bitize ((int )((char *)xfs_dir3_data_entry_tag_p (mp, dep) - (char *)dep)); }
@@ -592,7 +592,7 @@ dir2_data_union_size(return bitize (be16_to_cpu (dup->length)); else { dep = (xfs_dir2_data_entry_t *)dup; -return bitize (xfs_dir2_data_entsize (dep->namelen)); +return bitize (xfs_dir3_data_entsize (mp, dep->namelen)); } }
db/dir2sf.c +5 -4
@@ -24,6 +24,7 @@#include "bit.h" #include "dir2.h" #include "dir2sf.h" +#include "init.h" static int dir2_inou_i4_count (void *obj,int startoff);static int dir2_inou_i8_count (void *obj,int startoff);
@@ -155,8 +156,8 @@ dir2_sf_entry_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); -return bitize ((int )xfs_dir2_sf_entsize (sf, e->namelen)); + e =xfs_dir3_sf_nextentry (mp, sf, e); +return bitize ((int )xfs_dir3_sf_entsize (mp, sf, e->namelen)); }/*ARGSUSED*/
@@ -200,7 +201,7 @@ dir2_sf_list_offset( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < idx; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
@@ -220,6 +221,6 @@ dir2sf_size( sf = (struct xfs_dir2_sf_hdr *)((char *)obj +byteize (startoff)); e =xfs_dir2_sf_firstentry (sf);for (i =0 ; i < sf->count; i++) - e =xfs_dir2_sf_nextentry (sf, e); + e =xfs_dir3_sf_nextentry (mp, sf, e);return bitize ((int )((char *)e - (char *)sf)); }
db/metadump.c +5 -5
@@ -939,7 +939,7 @@ obfuscate_sf_dir( namelen = ino_dir_size - ((char *)&sfep->name[0 ] - (char *)sfp); }else if ((char *)sfep - (char *)sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) > +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) {if (show_warnings) print_warning("entry length in dir inode %llu "
@@ -950,11 +950,11 @@ obfuscate_sf_dir( (char *)sfp); } -generate_obfuscated_name (xfs_dir2_sfe_get_ino (sfp, sfep), +generate_obfuscated_name (xfs_dir3_sfe_get_ino (mp, sfp, sfep), namelen, &sfep->name[0 ]); sfep = (xfs_dir2_sf_entry_t *)((char *)sfep + -xfs_dir2_sf_entsize (sfp, namelen)); +xfs_dir3_sf_entsize (mp, sfp, namelen)); } }
@@ -1184,7 +1184,7 @@ obfuscate_dir_data_blocks( } dep = (xfs_dir2_data_entry_t *)ptr; - length =xfs_dir2_data_entsize (dep->namelen); + length =xfs_dir3_data_entsize (mp, dep->namelen);if (dir_offset + length > dir_data.end_of_data || ptr + length > endptr) {
@@ -1194,7 +1194,7 @@ obfuscate_dir_data_blocks( (long long)cur_ino);break ; } -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != dir_offset) { dir_data.bad_block =1 ;break ;
include/xfs_da_btree.h +1 -0
@@ -176,6 +176,7 @@ enum xfs_dacmp { typedef struct xfs_da_args { const __uint8_t *name; /* string (maybe not NULL terminated) */ int namelen; /* length of string (maybe no NULL) */ + __uint8_t filetype; /* filetype of inode for directories */ __uint8_t *value; /* set of bytes (maybe contain NULLs) */ int valuelen; /* length of value */ int flags; /* argument flags (eg: ATTR_NOCREATE) */
include/xfs_dir2.h +5 -4
@@ -68,10 +68,11 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp);extern void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *sfp,xfs_ino_t ino); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep); -extern void xfs_dir2_sfe_put_ino (struct xfs_dir2_sf_hdr *, -struct xfs_dir2_sf_entry *sfep,xfs_ino_t ino); +extern xfs_ino_t xfs_dir3_sfe_get_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *sfp,struct xfs_dir2_sf_entry *sfep); +extern void xfs_dir3_sfe_put_ino (struct xfs_mount *mp, +struct xfs_dir2_sf_hdr *hdr,struct xfs_dir2_sf_entry *sfep, +xfs_ino_t ino);extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);
include/xfs_dir2_format.h +160 -23
260 lines not on this page · raw message
include/xfs_sb.h +19 -9
@@ -555,12 +555,6 @@ static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; } -static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -} - -/* * Extended v5 superblock feature masks. These are to be used for new v5 * superblock features only.
@@ -599,7 +593,9 @@ xfs_sb_has_ro_compat_feature(return (sbp->sb_features_ro_compat & feature) !=0 ; } +#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0)/* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALLstatic inline bool xfs_sb_has_incompat_feature(
@@ -619,16 +615,30 @@ xfs_sb_has_incompat_log_feature(return (sbp->sb_features_log_incompat & feature) !=0 ; } -static inline bool -xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +/* +* V5 superblock specific feature checks +*/ +static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) { -return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; +} + +static inline int xfs_sb_version_hasftype (struct xfs_sb *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && +xfs_sb_has_incompat_feature (sbp,XFS_SB_FEAT_INCOMPAT_FTYPE ); }/* * end of superblock version macros */ +static inline bool +xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) +{ +return (ino == sbp->sb_uquotino || ino == sbp->sb_gquotino); +} +#define XFS_SB_DADDR ((xfs_daddr_t)0)/* daddr in filesystem/ag */ #define XFS_SB_BLOCK (mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)#define XFS_BUF_TO_SBP (bp) ((xfs_dsb_t *)((bp)->b_addr))
include/xfs_types.h +1 -0
@@ -140,6 +140,7 @@ typedef enum {struct xfs_name {const unsigned char *name;int len; +int type; };/*
libxfs/xfs_dir2.c +4 -1
@@ -18,7 +18,8 @@#include <xfs.h> -struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 }; +struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 ,XFS_DIR3_FT_DIR }; +/* * ASCII case-insensitive (ie. A-Z) support for directories that was
@@ -367,6 +368,7 @@ xfs_dir_replace(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.inumber = inum; args.dp = dp;
@@ -414,6 +416,7 @@ xfs_dir_canenter(memset (&args,0 ,sizeof (xfs_da_args_t)); args.name = name->name; args.namelen = name->len; + args.filetype = name->type; args.hashval = dp->i_mount->m_dirnameops->hashname (name); args.dp = dp; args.whichfork =XFS_DATA_FORK ;
libxfs/xfs_dir2_block.c +9 -9
@@ -107,7 +107,7 @@ const struct xfs_buf_ops xfs_dir3_block_buf_ops = { .verify_write = xfs_dir3_block_write_verify, }; -static int +int xfs_dir3_block_read( struct xfs_trans *tp, struct xfs_inode *dp,
@@ -350,7 +350,7 @@ xfs_dir2_block_addname(if (error)return error; - len =xfs_dir2_data_entsize (args->namelen); + len =xfs_dir3_data_entsize (mp, args->namelen);/* * Set up pointers to parts of the block.
@@ -530,7 +530,7 @@ xfs_dir2_block_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, args->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Clean up the bestfree array and log the header, tail, and entry.
@@ -780,7 +780,7 @@ xfs_dir2_block_removename( needlog = needscan =0 ;xfs_dir2_data_make_free (tp, bp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Fix up the block tail. */
@@ -1140,7 +1140,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (dp->i_ino); dep->namelen =1 ; dep->name[0 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[0 ].hashval =cpu_to_be32 (xfs_dir_hash_dot);
@@ -1153,7 +1153,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (xfs_dir2_sf_get_parent_ino (sfp)); dep->namelen =2 ; dep->name[0 ] = dep->name[1 ] ='.' ; - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); blp[1 ].hashval =cpu_to_be32 (xfs_dir_hash_dotdot);
@@ -1198,10 +1198,10 @@ xfs_dir2_sf_to_block(* Copy a real entry. */ dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); - dep->inumber =cpu_to_be64 (xfs_dir2_sfe_get_ino (sfp, sfep)); + dep->inumber =cpu_to_be64 (xfs_dir3_sfe_get_ino (mp, sfp, sfep)); dep->namelen = sfep->namelen;memcpy (dep->name, sfep->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep); name.name = sfep->name;
@@ -1214,7 +1214,7 @@ xfs_dir2_sf_to_block(if (++i == sfp->count) sfep =NULL ;else - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); }/* Done with the temporary buffer */ kmem_free (sfp);
libxfs/xfs_dir2_data.c +7 -6
@@ -131,7 +131,7 @@ __xfs_dir3_data_check(XFS_WANT_CORRUPTED_RETURN ( !xfs_dir_ino_validate (mp,be64_to_cpu (dep->inumber)));XFS_WANT_CORRUPTED_RETURN ( -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) == +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) == (char *)dep - (char *)hdr); count++; lastfree =0 ;
@@ -150,7 +150,7 @@ __xfs_dir3_data_check( }XFS_WANT_CORRUPTED_RETURN (i <be32_to_cpu (btp->count)); } - p +=xfs_dir2_data_entsize (dep->namelen); + p +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Need to have seen all the entries and all the bestfree slots.
@@ -520,8 +520,8 @@ xfs_dir2_data_freescan(else { dep = (xfs_dir2_data_entry_t *)p;ASSERT ((char *)dep - (char *)hdr == -be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep))); - p +=xfs_dir2_data_entsize (dep->namelen); +be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep))); + p +=xfs_dir3_data_entsize (mp, dep->namelen); } } }
@@ -611,7 +611,8 @@ xfs_dir2_data_log_entry(struct xfs_buf *bp, xfs_dir2_data_entry_t *dep) /* data entry pointer */ { - xfs_dir2_data_hdr_t *hdr = bp->b_addr; + struct xfs_dir2_data_hdr *hdr = bp->b_addr; +struct xfs_mount *mp = tp->t_mountp; ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -619,7 +620,7 @@ xfs_dir2_data_log_entry( hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));xfs_trans_log_buf (tp, bp, (uint)((char *)dep - (char *)hdr), - (uint)((char *)(xfs_dir2_data_entry_tag_p (dep) +1 ) - + (uint)((char *)(xfs_dir3_data_entry_tag_p (mp, dep) +1 ) - (char *)hdr -1 )); }
libxfs/xfs_dir2_leaf.c +3 -3
@@ -677,7 +677,7 @@ xfs_dir2_leaf_addname( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); bestsp =xfs_dir2_leaf_bests_p (ltp); - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * See if there are any entries with the same hash value
@@ -878,7 +878,7 @@ xfs_dir2_leaf_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/* * Need to scan fix up the bestfree table.
@@ -1409,7 +1409,7 @@ xfs_dir2_leaf_removename(*/ xfs_dir2_data_make_free (tp, dbp, (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * We just mark the leaf entry stale by putting a null in it. */
libxfs/xfs_dir2_node.c +4 -4
@@ -587,7 +587,7 @@ xfs_dir2_leafn_lookup_for_addname(ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); } - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * Loop over leaf entries with the right hash value. */
@@ -1241,7 +1241,7 @@ xfs_dir2_leafn_remove( longest =be16_to_cpu (bf[0 ].length); needlog = needscan =0 ;xfs_dir2_data_make_free (tp, dbp, off, -xfs_dir2_data_entsize (dep->namelen), &needlog, &needscan); +xfs_dir3_data_entsize (mp, dep->namelen), &needlog, &needscan);/* * Rescan the data block freespaces for bestfree. * Log the data block header if needed.
@@ -1693,7 +1693,7 @@ xfs_dir2_node_addname_int( dp = args->dp; mp = dp->i_mount; tp = args->trans; - length =xfs_dir2_data_entsize (args->namelen); + length =xfs_dir3_data_entsize (mp, args->namelen);/* * If we came in with a freespace block that means that lookup * found an entry with our hash value. This is the freespace
@@ -1989,7 +1989,7 @@ xfs_dir2_node_addname_int( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); - tagp =xfs_dir2_data_entry_tag_p (dep); + tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, dbp, dep);/*
libxfs/xfs_dir2_priv.h +17 -27
93 lines not on this page · raw message
libxfs/xfs_dir2_sf.c +72 -50
319 lines not on this page · raw message
logprint/log_misc.c +30 -28
114 lines not on this page · raw message
repair/dir2.c +19 -18
@@ -651,6 +651,7 @@ _("would correct bad hashval in interior dir block\n"*/ void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep) {
@@ -680,10 +681,10 @@ process_sf_dir2_fixi8(xfs_dir2_sf_put_offset (newsfep,xfs_dir2_sf_get_offset (oldsfep));memmove (newsfep->name, oldsfep->name, newsfep->namelen); - ino =xfs_dir2_sfe_get_ino (oldsfp, oldsfep); -xfs_dir2_sfe_put_ino (newsfp, newsfep, ino); - oldsfep =xfs_dir2_sf_nextentry (oldsfp, oldsfep); - newsfep =xfs_dir2_sf_nextentry (newsfp, newsfep); + ino =xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep); +xfs_dir3_sfe_put_ino (mp, newsfp, newsfep, ino); + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep); + newsfep =xfs_dir3_sf_nextentry (mp, newsfp, newsfep); } *next_sfep = newsfep;free (oldsfp);
@@ -708,8 +709,8 @@ process_sf_dir2_fixoff(for (i =0 ; i < sfp->count; i++) {xfs_dir2_sf_put_offset (sfep, offset); - offset +=xfs_dir2_data_entsize (sfep->namelen); - sfep =xfs_dir2_sf_nextentry (sfp, sfep); + offset +=xfs_dir3_data_entsize (mp, sfep->namelen); + sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); } }
@@ -771,7 +772,7 @@ process_sf_dir2(/* * check for bad entry count */ -if (num_entries *xfs_dir2_sf_entsize (sfp,1 ) + +if (num_entries *xfs_dir3_sf_entsize (mp, sfp,1 ) +xfs_dir2_sf_hdr_size (0 ) > max_size || num_entries ==0 ) num_entries =0xFF ;
@@ -787,7 +788,7 @@ process_sf_dir2( sfep = next_sfep; junkit =0 ; bad_sfnamelen =0 ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep);/* * if entry points to self, junk it since only '.' or '..' * should do that and shortform dirs don't contain either
@@ -901,7 +902,7 @@ _("zero length entry in shortform dir %" PRIu64 ""),break ; } }else if ((__psint_t ) sfep - (__psint_t ) sfp + -xfs_dir2_sf_entsize (sfp, sfep->namelen) +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ino_dir_size) { bad_sfnamelen =1 ;
@@ -972,7 +973,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), bad_offset =1 ; } offset =xfs_dir2_sf_get_offset (sfep) + -xfs_dir2_data_entsize (namelen); +xfs_dir3_data_entsize (mp, namelen);/* * junk the entry by copying up the rest of the
@@ -989,7 +990,7 @@ _("entry contains offset out of order in shortform dir %" PRIu64 "\n"), name[namelen] ='\0' ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen);be64_add_cpu (&dip->di_size, -tmp_elen); ino_dir_size -= tmp_elen;
@@ -1043,8 +1044,8 @@ _("would have junked entry \"%s\" in directory inode %" PRIu64 "\n"), next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -1075,7 +1076,7 @@ _("would have corrected i8 count in directory %" PRIu64 " from %d to %d\n"),_ ("corrected i8 count in directory %" PRIu64", was %d, now %d\n" ), ino, sfp->i8count, i8);if (i8 ==0 ) -process_sf_dir2_fixi8 (sfp, &next_sfep); +process_sf_dir2_fixi8 (mp, sfp, &next_sfep);else sfp->i8count = i8; *dino_dirty =1 ;
@@ -1268,12 +1269,12 @@ process_dir2_data(continue ; } dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); lastfree =0 ; }/*
@@ -1528,7 +1529,7 @@ _("entry \"%*.*s\" in directory inode %" PRIu64 " points to self: "),/* * Advance to the next entry. */ - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* * Check the bestfree table.
repair/dir2.h +1 -0
@@ -72,6 +72,7 @@ process_dir2(void process_sf_dir2_fixi8 ( +struct xfs_mount *mp,struct xfs_dir2_sf_hdr *sfp,xfs_dir2_sf_entry_t **next_sfep);
repair/phase6.c +11 -11
@@ -1500,12 +1500,12 @@ longform_dir2_entry_check_data(/* validate data entry size */ dep = (xfs_dir2_data_entry_t *)ptr; -if (ptr +xfs_dir2_data_entsize (dep->namelen) > endptr) +if (ptr +xfs_dir3_data_entsize (mp, dep->namelen) > endptr)break ; -if (be16_to_cpu (*xfs_dir2_data_entry_tag_p (dep)) != +if (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) != (char *)dep - (char *)d)break ; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); }/* did we find an empty or corrupt block? */
@@ -1594,7 +1594,7 @@ longform_dir2_entry_check_data( } addr =xfs_dir2_db_off_to_dataptr (mp, db, ptr - (char *)d); dep = (xfs_dir2_data_entry_t *)ptr; - ptr +=xfs_dir2_data_entsize (dep->namelen); + ptr +=xfs_dir3_data_entsize (mp, dep->namelen); inum =be64_to_cpu (dep->inumber); lastfree =0 ;/*
@@ -2226,7 +2226,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, bad_sfnamelen =0 ; tmp_sfep =NULL ; - lino =xfs_dir2_sfe_get_ino (sfp, sfep); + lino =xfs_dir3_sfe_get_ino (mp, sfp, sfep); namelen = sfep->namelen;
@@ -2255,7 +2255,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,break ; } }else if (no_modify && (__psint_t ) sfep - (__psint_t ) sfp + - +xfs_dir2_sf_entsize (sfp, sfep->namelen) + +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) > ip->i_d.di_size) { bad_sfnamelen =1 ;
@@ -2285,7 +2285,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp,if (no_modify &&verify_inum (mp, lino)) { next_sfep = (xfs_dir2_sf_entry_t *)((__psint_t )sfep + -xfs_dir2_sf_entsize (sfp, sfep->namelen)); +xfs_dir3_sf_entsize (mp, sfp, sfep->namelen));continue ; }
@@ -2393,7 +2393,7 @@ do_junkit:if (lino == orphanage_ino) orphanage_ino =0 ;if (!no_modify) { - tmp_elen =xfs_dir2_sf_entsize (sfp, + tmp_elen =xfs_dir3_sf_entsize (mp, sfp, sfep->namelen); tmp_sfep = (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + tmp_elen);
@@ -2446,8 +2446,8 @@ do_junkit: next_sfep = (tmp_sfep ==NULL ) ? (xfs_dir2_sf_entry_t *) ((__psint_t ) sfep + ((!bad_sfnamelen) - ?xfs_dir2_sf_entsize (sfp, sfep->namelen) - :xfs_dir2_sf_entsize (sfp, namelen))) + ?xfs_dir3_sf_entsize (mp, sfp, sfep->namelen) + :xfs_dir3_sf_entsize (mp, sfp, namelen))) : tmp_sfep; }
@@ -2458,7 +2458,7 @@ do_junkit: }else {if (i8 ==0 ) { tmp_sfep = next_sfep; -process_sf_dir2_fixi8 (sfp, &tmp_sfep); +process_sf_dir2_fixi8 (mp, sfp, &tmp_sfep); bytes_deleted += (__psint_t )next_sfep - (__psint_t )tmp_sfep;
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 47/49] xfs: Add read-only support for dirent filetype field
Quoted 26 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Quoted 7 lines
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the
xfs_namestructures passed around is added, but the directory code does not use this field yet. That will be in the next patch.Signed-off-by Dave Chinner<[email protected]>---
Same as kernel patch (48/49) - written to support only v3 inodes. This should support v2 and v3 inodes.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
***** SUSPECTED SPAM ***** Re: [PATCH 47/49] xfs: Add read-only support for dirent filetype field
Quoted 32 lines · Mark Tinguely
Quoted 31 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Add support for the file type field in directory entries so that readdir can return the type of the inode the dirent points to to userspace without first having to read the inode off disk.
The encoding of the type field is a single byte that is added to the end of the directory entry name length. For all intents and purposes, it appends a "hidden" byte to the name field which contains the type information. As the directory entry is already of dynamic size, helpers are already required to access and decode the direct entry structures.
Hence the relevent extraction and iteration helpers are updated to understand the hidden byte. Helpers for reading and writing the filetype field from the directory entries are also added. Only the read helpers are used by this patch. It also adds all the code necessary to read the type information out of the dirents on disk.
Further we add the superblock feature bit and helpers to indicate that we understand the on-disk format change. This is not a compatible change - existing kernels cannot read the new format successfully - so an incompatible feature flag is added. We don't yet allow filesystems to mount with this flag yet - that will be added once write support is added.
Finally, the code to take the type from the VFS, convert it to an XFS on-disk type and put it into the
xfs_namestructures passed around is added, but the directory code does not use this field yet. That will be in the next patch.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
Same as kernel patch (48/49) - written to support only v3 inodes. This should support v2 and v3 inodes.
It's a directory entry format change - it has nothing to do with the version of the inode.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 48/49 xfs: Add write support for dirent filetype field
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Add support to propagate and add filetype values into the on-disk directs. This involves passing the filetype into the xfs_da_args structure along with the name and namelength for direct operations, and encoding it into the dirent at the same time we write the inode number into the dirent.
--- include/xfs_sb.h | 3 ++- libxfs/xfs_dir2_block.c | 7 +++++++ libxfs/xfs_dir2_data.c | 2 ++ libxfs/xfs_dir2_leaf.c | 3 +++ libxfs/xfs_dir2_node.c | 3 +++ libxfs/xfs_dir2_sf.c | 35 +++++++++++++++++++++++++++-------- 6 files changed, 44 insertions(+), 9 deletions(-)
include/xfs_sb.h +2 -1
@@ -594,7 +594,8 @@ xfs_sb_has_ro_compat_feature( }#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0)/* filetype in dirent */ -#define XFS_SB_FEAT_INCOMPAT_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_ALL \ + (XFS_SB_FEAT_INCOMPAT_FTYPE)#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL static inline bool
libxfs/xfs_dir2_block.c +7 -0
@@ -530,6 +530,7 @@ xfs_dir2_block_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, args->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/*
@@ -622,6 +623,7 @@ xfs_dir2_block_lookup(* Fill in inode number, CI name if appropriate, release the block. */ args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (mp, dep); error =xfs_dir_cilookup_result (args, dep->name, dep->namelen);xfs_trans_brelse (args->trans, bp);return XFS_ERROR (error);
@@ -854,6 +856,7 @@ xfs_dir2_block_replace(* Change the inode number to the new value. */ dep->inumber =cpu_to_be64 (args->inumber); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype);xfs_dir2_data_log_entry (args->trans, bp, dep);xfs_dir3_data_check (dp, bp);return 0 ;
@@ -1140,6 +1143,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (dp->i_ino); dep->namelen =1 ; dep->name[0 ] ='.' ; +xfs_dir3_dirent_put_ftype (mp, dep,XFS_DIR3_FT_DIR ); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep);
@@ -1153,6 +1157,7 @@ xfs_dir2_sf_to_block( dep->inumber =cpu_to_be64 (xfs_dir2_sf_get_parent_ino (sfp)); dep->namelen =2 ; dep->name[0 ] = dep->name[1 ] ='.' ; +xfs_dir3_dirent_put_ftype (mp, dep,XFS_DIR3_FT_DIR ); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, bp, dep);
@@ -1200,6 +1205,8 @@ xfs_dir2_sf_to_block( dep = (xfs_dir2_data_entry_t *)((char *)hdr + newoffset); dep->inumber =cpu_to_be64 (xfs_dir3_sfe_get_ino (mp, sfp, sfep)); dep->namelen = sfep->namelen; +xfs_dir3_dirent_put_ftype (mp, dep, +xfs_dir3_sfe_get_ftype (mp, sfp, sfep));memcpy (dep->name, sfep->name, dep->namelen); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);
libxfs/xfs_dir2_data.c +2 -0
@@ -133,6 +133,8 @@ __xfs_dir3_data_check(XFS_WANT_CORRUPTED_RETURN (be16_to_cpu (*xfs_dir3_data_entry_tag_p (mp, dep)) == (char *)dep - (char *)hdr); +XFS_WANT_CORRUPTED_RETURN ( +xfs_dir3_dirent_get_ftype (mp, dep) <XFS_DIR3_FT_MAX ); count++; lastfree =0 ; if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
libxfs/xfs_dir2_leaf.c +3 -0
@@ -878,6 +878,7 @@ xfs_dir2_leaf_addname( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);/*
@@ -1207,6 +1208,7 @@ xfs_dir2_leaf_lookup(* Return the found inode number & CI name if appropriate */ args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (dp->i_mount, dep); error =xfs_dir_cilookup_result (args, dep->name, dep->namelen);xfs_trans_brelse (tp, dbp);xfs_trans_brelse (tp, lbp);
@@ -1537,6 +1539,7 @@ xfs_dir2_leaf_replace(* Put the new inode number in, log it. */ dep->inumber =cpu_to_be64 (args->inumber); +xfs_dir3_dirent_put_ftype (dp->i_mount, dep, args->filetype); tp = args->trans;xfs_dir2_data_log_entry (tp, dbp, dep);xfs_dir3_leaf_check (dp->i_mount, lbp);
libxfs/xfs_dir2_node.c +3 -0
@@ -798,6 +798,7 @@ xfs_dir2_leafn_lookup_for_entry(xfs_trans_brelse (tp, state->extrablk.bp); args->cmpresult = cmp; args->inumber =be64_to_cpu (dep->inumber); + args->filetype =xfs_dir3_dirent_get_ftype (mp, dep); *indexp = index; state->extravalid =1 ; state->extrablk.bp = curbp;
@@ -1989,6 +1990,7 @@ xfs_dir2_node_addname_int( dep->inumber =cpu_to_be64 (args->inumber); dep->namelen = args->namelen;memcpy (dep->name, args->name, dep->namelen); +xfs_dir3_dirent_put_ftype (mp, dep, args->filetype); tagp =xfs_dir3_data_entry_tag_p (mp, dep); *tagp =cpu_to_be16 ((char *)dep - (char *)hdr);xfs_dir2_data_log_entry (tp, dbp, dep);
@@ -2209,6 +2211,7 @@ xfs_dir2_node_replace(* Fill in the new inode number and log the entry. */ dep->inumber =cpu_to_be64 (inum); +xfs_dir3_dirent_put_ftype (state->mp, dep, args->filetype);xfs_dir2_data_log_entry (args->trans, state->extrablk.bp, dep); rval =0 ; }
libxfs/xfs_dir2_sf.c +27 -8
@@ -316,6 +316,8 @@ xfs_dir2_block_to_sf(memcpy (sfep->name, dep->name, dep->namelen);xfs_dir3_sfe_put_ino (mp, sfp, sfep,be64_to_cpu (dep->inumber)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_dirent_get_ftype (mp, dep)); sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep); }
@@ -479,6 +481,8 @@ xfs_dir2_sf_addname_easy(xfs_dir2_sf_put_offset (sfep, offset);memcpy (sfep->name, args->name, sfep->namelen);xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (dp->i_mount, sfp, sfep, args->filetype); +/* * Update the header and inode. */
@@ -572,6 +576,7 @@ xfs_dir2_sf_addname_hard(xfs_dir2_sf_put_offset (sfep, offset);memcpy (sfep->name, args->name, sfep->namelen);xfs_dir3_sfe_put_ino (mp, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, args->filetype); sfp->count++;#if XFS_BIG_INUMS if (args->inumber >XFS_DIR2_MAX_SHORT_INUM && !objchange)
@@ -808,6 +813,7 @@ xfs_dir2_sf_lookup(if (args->namelen ==1 && args->name[0 ] =='.' ) { args->inumber = dp->i_ino; args->cmpresult =XFS_CMP_EXACT ; + args->filetype =XFS_DIR3_FT_DIR ;return XFS_ERROR (EEXIST ); }/*
@@ -817,6 +823,7 @@ xfs_dir2_sf_lookup( args->name[0] == '.' && args->name[1] == '.') { args->inumber =xfs_dir2_sf_get_parent_ino (sfp); args->cmpresult =XFS_CMP_EXACT ; + args->filetype =XFS_DIR3_FT_DIR ;return XFS_ERROR (EEXIST ); }/*
@@ -836,6 +843,8 @@ xfs_dir2_sf_lookup( args->cmpresult = cmp; args->inumber =xfs_dir3_sfe_get_ino (dp->i_mount, sfp, sfep); + args->filetype =xfs_dir3_sfe_get_ftype (dp->i_mount, + sfp, sfep);if (cmp ==XFS_CMP_EXACT )return XFS_ERROR (EEXIST ); ci_sfep = sfep;
@@ -1035,6 +1044,8 @@ xfs_dir2_sf_replace(#endif xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, args->inumber); +xfs_dir3_sfe_put_ftype (dp->i_mount, sfp, sfep, + args->filetype);break ; } }
@@ -1101,10 +1112,12 @@ xfs_dir2_sf_toino4(int oldsize;/* old inode size */ xfs_dir2_sf_entry_t *sfep;/* new sf entry */ xfs_dir2_sf_hdr_t *sfp;/* new sf directory */ +struct xfs_mount *mp;trace_xfs_dir2_sf_toino4 (args); dp = args->dp; + mp = dp->i_mount;/* * Copy the old directory to the buffer.
@@ -1142,13 +1155,15 @@ xfs_dir2_sf_toino4(for (i =0 , sfep =xfs_dir2_sf_firstentry (sfp), oldsfep =xfs_dir2_sf_firstentry (oldsfp); i < sfp->count; - i++, sfep =xfs_dir3_sf_nextentry (dp->i_mount, sfp, sfep), - oldsfep =xfs_dir3_sf_nextentry (dp->i_mount, oldsfp, oldsfep)) { + i++, sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep), + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset;memcpy (sfep->name, oldsfep->name, sfep->namelen); -xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, -xfs_dir3_sfe_get_ino (dp->i_mount, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ino (mp, sfp, sfep, +xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_sfe_get_ftype (mp, oldsfp, oldsfep)); }/* * Clean up the inode.
@@ -1176,10 +1191,12 @@ xfs_dir2_sf_toino8(int oldsize;/* old inode size */ xfs_dir2_sf_entry_t *sfep;/* new sf entry */ xfs_dir2_sf_hdr_t *sfp;/* new sf directory */ +struct xfs_mount *mp;trace_xfs_dir2_sf_toino8 (args); dp = args->dp; + mp = dp->i_mount;/* * Copy the old directory to the buffer.
@@ -1217,13 +1234,15 @@ xfs_dir2_sf_toino8(for (i =0 , sfep =xfs_dir2_sf_firstentry (sfp), oldsfep =xfs_dir2_sf_firstentry (oldsfp); i < sfp->count; - i++, sfep =xfs_dir3_sf_nextentry (dp->i_mount, sfp, sfep), - oldsfep =xfs_dir3_sf_nextentry (dp->i_mount, oldsfp, oldsfep)) { + i++, sfep =xfs_dir3_sf_nextentry (mp, sfp, sfep), + oldsfep =xfs_dir3_sf_nextentry (mp, oldsfp, oldsfep)) { sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset;memcpy (sfep->name, oldsfep->name, sfep->namelen); -xfs_dir3_sfe_put_ino (dp->i_mount, sfp, sfep, -xfs_dir3_sfe_get_ino (dp->i_mount, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ino (mp, sfp, sfep, +xfs_dir3_sfe_get_ino (mp, oldsfp, oldsfep)); +xfs_dir3_sfe_put_ftype (mp, sfp, sfep, +xfs_dir3_sfe_get_ftype (mp, oldsfp, oldsfep)); }/* * Clean up the inode.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 49/49 xfsprogs: add dtype support to mkfs and db
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that we have an extra field in the dirent, add support into xfs_db to be able to view it when looking at directory structures.
Add support to mkfs to create filesystems with filetype - we'll always set it on CRC enabled filesystems so all new v5 filesystems will have this functionality enabled.
--- db/dir2.c | 41 ++++++++++++++++++++++++++++++++++++++++- db/dir2.h | 1 + db/dir2sf.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- db/dir2sf.h | 3 +++ db/field.c | 7 +++++++ db/field.h | 3 +++ db/inode.c | 23 +++++++++++++++++++++-- mkfs/xfs_mkfs.c | 7 +++++++ 8 files changed, 133 insertions(+), 4 deletions(-)
db/dir2.c +40 -1
@@ -596,6 +596,25 @@ dir2_data_union_size( } } +static int +dir3_data_union_ftype_offset ( +void *obj, +int startoff, +int idx) +{ +xfs_dir2_data_entry_t *dep; +xfs_dir2_data_unused_t *dup; + +ASSERT (bitoffs (startoff) ==0 ); +ASSERT (idx ==0 ); + dup = (xfs_dir2_data_unused_t *)((char *)obj +byteize (startoff)); +if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) +return bitize ((int )((char *)xfs_dir2_data_unused_tag_p (dup) - + (char *)dup)); + dep = (xfs_dir2_data_entry_t *)dup; +return bitize ((int )((char *)&dep->name[dep->namelen] - (char *)dep)); +} +/* * Free block functions */
@@ -859,7 +878,7 @@ const field_t dir3_flds[] = { dir3_block_tail_count, FLD_OFFSET|FLD_COUNT, TYP_NONE }, {"dhdr" ,FLDT_DIR3_DATA_HDR ,OI (D3OFF (hdr)), dir3_data_hdr_count, FLD_COUNT, TYP_NONE }, - { "du", FLDT_DIR2_DATA_UNION, dir2_data_u_offset, dir2_data_u_count, + { "du", FLDT_DIR3_DATA_UNION, dir2_data_u_offset, dir2_data_u_count, FLD_ARRAY|FLD_OFFSET|FLD_COUNT, TYP_NONE }, { "lhdr", FLDT_DIR3_LEAF_HDR, OI(L3OFF(hdr)), dir3_leaf_hdr_count, FLD_COUNT, TYP_NONE },
@@ -880,6 +899,26 @@ const field_t dir3_flds[] = { { NULL } }; +#define D3EOFF (f) bitize(offsetof(xfs_dir2_data_entry_t, f)) +#define D3UOFF (f) bitize(offsetof(xfs_dir2_data_unused_t, f)) +const field_t dir3_data_union_flds[] = { + {"freetag" ,FLDT_UINT16X ,OI (D3UOFF (freetag)), + dir2_data_union_freetag_count,FLD_COUNT ,TYP_NONE }, + {"inumber" ,FLDT_INO ,OI (D3EOFF (inumber)), + dir2_data_union_inumber_count,FLD_COUNT ,TYP_INODE }, + {"length" ,FLDT_DIR2_DATA_OFF ,OI (D3UOFF (length)), + dir2_data_union_length_count,FLD_COUNT ,TYP_NONE }, + {"namelen" ,FLDT_UINT8D ,OI (D3EOFF (namelen)), + dir2_data_union_namelen_count,FLD_COUNT ,TYP_NONE }, + {"name" ,FLDT_CHARNS ,OI (D3EOFF (name)), dir2_data_union_name_count, +FLD_COUNT ,TYP_NONE }, + {"filetype" ,FLDT_UINT8D , dir3_data_union_ftype_offset,C1 , +FLD_OFFSET ,TYP_NONE }, + {"tag" ,FLDT_DIR2_DATA_OFF , dir2_data_union_tag_offset, + dir2_data_union_tag_count,FLD_OFFSET |FLD_COUNT ,TYP_NONE }, + {NULL } +}; +#define DBH3OFF (f) bitize(offsetof(struct xfs_dir3_blk_hdr, f))const field_t dir3_blkhdr_flds[] = { {"magic" ,FLDT_UINT32X ,OI (DBH3OFF (magic)),C1 ,0 ,TYP_NONE },
db/dir2.h +1 -0
@@ -48,6 +48,7 @@ extern const field_t dir3_blkhdr_flds[];extern const field_t dir3_data_hdr_flds[];extern const field_t dir3_free_hdr_flds[];extern const field_t dir3_leaf_hdr_flds[]; +extern const field_t dir3_data_union_flds[];extern const field_t da3_blkinfo_flds[];extern const field_t da3_node_hdr_flds[];
db/dir2sf.c +51 -1
67 lines not on this page · raw message
db/dir2sf.h +3 -0
@@ -21,6 +21,9 @@ extern const field_t dir2_inou_flds[];extern const field_t dir2_sf_hdr_flds[];extern const field_t dir2_sf_entry_flds[]; +extern const field_t dir3sf_flds[]; +extern const field_t dir3_sf_entry_flds[]; +extern int dir2sf_size (void *obj,int startoff,int idx);extern int dir2_inou_size (void *obj,int startoff,int idx);extern int dir2_sf_entry_size (void *obj,int startoff,int idx);
db/field.c +7 -0
@@ -235,6 +235,13 @@ const ftattr_t ftattrtab[] = { SI(bitsz(struct xfs_dir3_free_hdr)), 0, NULL, dir3_free_hdr_flds }, { FLDT_DIR3_LEAF_HDR, "dir3_leaf_hdr", NULL, (char *)dir3_leaf_hdr_flds, SI(bitsz(struct xfs_dir3_leaf_hdr)), 0, NULL, dir3_leaf_hdr_flds }, + { FLDT_DIR3_DATA_UNION, "dir3_data_union", NULL, + (char *)dir3_data_union_flds, dir2_data_union_size,FTARG_SIZE ,NULL , + dir3_data_union_flds }, + { FLDT_DIR3_SF_ENTRY, "dir3_sf_entry", NULL, (char *)dir3_sf_entry_flds, + dir2_sf_entry_size, FTARG_SIZE, NULL, dir3_sf_entry_flds }, + { FLDT_DIR3SF, "dir3sf", NULL, (char *)dir3sf_flds, dir2sf_size, + FTARG_SIZE, NULL, dir3sf_flds },/* dir v2/3 node fields */ { FLDT_DA_BLKINFO, "dir_blkinfo", NULL, (char *)da_blkinfo_flds,
db/field.h +3 -0
@@ -116,6 +116,9 @@ typedef enum fldt {FLDT_DIR3_DATA_HDR ,FLDT_DIR3_FREE_HDR ,FLDT_DIR3_LEAF_HDR , +FLDT_DIR3_DATA_UNION , +FLDT_DIR3_SF_ENTRY , +FLDT_DIR3SF ,/* dir v2/3 node fields */ FLDT_DA_BLKINFO,
db/inode.c +21 -2
@@ -47,6 +47,7 @@ static int inode_u_c_count(void *obj, int startoff);static int inode_u_dev_count (void *obj,int startoff);static int inode_u_muuid_count (void *obj,int startoff);static int inode_u_sfdir2_count (void *obj,int startoff); +static int inode_u_sfdir3_count (void *obj,int startoff);static int inode_u_symlink_count (void *obj,int startoff); static const cmdinfo_t inode_cmd =
@@ -78,7 +79,7 @@ const field_t inode_crc_flds[] = { {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 , TYP_INODE }, { "v3", FLDT_DINODE_V3, OI(OFF(magic)), C1, 0, TYP_NONE }, - { "u", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE }, + { "u3", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE }, { "a", FLDT_DINODE_A, inode_a_offset, inode_a_count, FLD_COUNT|FLD_OFFSET, TYP_NONE }, { NULL }
@@ -193,6 +194,7 @@ const field_t inode_u_flds[] = { { "dev", FLDT_DEV, NULL, inode_u_dev_count, FLD_COUNT, TYP_NONE }, { "muuid", FLDT_UUID, NULL, inode_u_muuid_count, FLD_COUNT, TYP_NONE }, { "sfdir2", FLDT_DIR2SF, NULL, inode_u_sfdir2_count, FLD_COUNT, TYP_NONE }, + { "sfdir3", FLDT_DIR3SF, NULL, inode_u_sfdir3_count, FLD_COUNT, TYP_NONE }, { "symlink", FLDT_CHARNS, NULL, inode_u_symlink_count, FLD_COUNT, TYP_NONE }, { NULL }
@@ -556,7 +558,24 @@ inode_u_sfdir2_count(ASSERT ((char *)XFS_DFORK_DPTR (dip) - (char *)dip ==byteize (startoff));return dip->di_format ==XFS_DINODE_FMT_LOCAL && (be16_to_cpu (dip->di_mode) &S_IFMT ) ==S_IFDIR && -xfs_sb_version_hasdirv2 (&mp->m_sb); +xfs_sb_version_hasdirv2 (&mp->m_sb) && + !xfs_sb_version_hasftype (&mp->m_sb); +} + +static int +inode_u_sfdir3_count ( +void *obj, +int startoff) +{ +xfs_dinode_t *dip; + +ASSERT (bitoffs (startoff) ==0 ); +ASSERT (obj == iocur_top->data); + dip = obj; +ASSERT ((char *)XFS_DFORK_DPTR (dip) - (char *)dip ==byteize (startoff)); +return dip->di_format ==XFS_DINODE_FMT_LOCAL && + (be16_to_cpu (dip->di_mode) &S_IFMT ) ==S_IFDIR && +xfs_sb_version_hasftype (&mp->m_sb); }int
mkfs/xfs_mkfs.c +7 -0
@@ -2513,6 +2513,13 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"), lsectorsize != BBSIZE), nci, sbp->sb_features2 != 0);/* +* dirent filetype field always enabled on v5 superblocks +*/ +if (crcs_enabled) { + sbp->sb_features_incompat =XFS_SB_FEAT_INCOMPAT_FTYPE ; + } + +/* * Due to a structure alignment issue, sb_features2 ended up in one * of two locations, the second "incorrect" location represented by * the sb_bad_features2 field. To avoid older kernels mounting
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way. The combination of 3.12 XFS code and 3.12 xfsprogs seems to be working well. xfs_repair, mkfs.xfs, and xfs_logprint still seem to work either way.
The following patches had issues during the git am session:
# Patch 11
Applying: libxfs: sync xfs_ialloc.c to the kernel code /usr/src/xfs/xfsprogs/.git/rebase-apply/patch:226: trailing whitespace.
/*
warning: 1 line adds whitespace errors.
# Patch 20
Applying: xfs: separate dquot on disk format definitions out of xfs_quota.h /usr/src/xfs/xfsprogs/.git/rebase-apply/patch:64: trailing whitespace.
* This header file defines all the on-disk format definitions for
warning: 1 line adds whitespace errors.
# Patch 27
Applying: xfs: move inode fork definitions to a new header file
fatal: corrupt patch at line 2313
Patch failed at 0001 xfs: move inode fork definitions to a new header file The copy of the patch that failed is found in:
/usr/src/xfs/xfsprogs/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
# Deleted the blank line from the patch (Thunderbird save error?). # Patch 27 (Take 2)
Applying: xfs: move inode fork definitions to a new header file
# Patch 49
Applying: xfsprogs: add dtype support to mkfs and db /usr/src/xfs/xfsprogs/.git/rebase-apply/patch:163: new blank line at EOF. +
warning: 1 line adds whitespace errors.
In other words, everything works so far. Again, on one PC, the xfstests results are awful, with many xfs/* tests failing. The results have yet to be reviwed closely, though. There's a chance that something in xfstests didn't build against xfsprogs...unless all the hole punch and dmapi tests really are having issues...not enough info yet...
Thanks!
Michael
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Michael L. Semon
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way.
We'll, if you don't have all the filtering patches that I posted a while back it'll make quite a mess with all the experimental warnings mkfs and repair emit, and the xfs_db tests that modify filesystem structures will all also fail...
I'll repost them later today...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Michael L. Semon
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
Quoted 7 lines
Quoted 2 lines
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way.
We'll, if you don't have all the filtering patches that I posted a while back it'll make quite a mess with all the experimental warnings mkfs and repair emit, and the
xfs_dbtests that modify filesystem structures will all also fail...
I've been slacking on xfstests updates. The problem may exist between keyboard and chair, though: I was trying to copy a merged xfsprogs from one PC to another, then build everything from make distclean after deleting /usr/include/xfs. Something must have gone wrong...won't be the first time...
Quoted 1 line
I'll repost them later today...
I'll take this patchset home and see if any of them were not committed to the xfsprogs git:
http://oss.sgi.com/archives/xfs/2013-06/msg00217.html
Is this the correct patchset?
Thanks!
Michael
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 20 lines · Michael L. Semon
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Michael L. Semon
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
Quoted 7 lines
Quoted 2 lines
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way.
We'll, if you don't have all the filtering patches that I posted a while back it'll make quite a mess with all the experimental warnings mkfs and repair emit, and the
xfs_dbtests that modify filesystem structures will all also fail...I've been slacking on xfstests updates. The problem may exist between keyboard and chair, though: I was trying to copy a merged xfsprogs from one PC to another, then build everything from
make distcleanafter deleting/usr/include/xfs. Something must have gone wrong...won't be the first time...
Quoted 8 lines
Quoted 1 line
I'll repost them later today...
I'll take this patchset home and see if any of them were not committed to the xfsprogs git:
http://oss.sgi.com/archives/xfs/2013-06/msg00217.html
Is this the correct patchset?
Yeah, that's it, thugh I have a more recent version of it locally...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 28 lines · Dave Chinner
Quoted 27 lines · Michael L. Semon
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Michael L. Semon
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
Quoted 7 lines
Quoted 2 lines
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way.
We'll, if you don't have all the filtering patches that I posted a while back it'll make quite a mess with all the experimental warnings mkfs and repair emit, and the
xfs_dbtests that modify filesystem structures will all also fail...I've been slacking on xfstests updates. The problem may exist between keyboard and chair, though: I was trying to copy a merged xfsprogs from one PC to another, then build everything from
make distcleanafter deleting/usr/include/xfs. Something must have gone wrong...won't be the first time...Quoted 1 line
I'll repost them later today...
I'll take this patchset home and see if any of them were not committed to the xfsprogs git:
Quoted 7 lines
Quoted 1 line
Is this the correct patchset?
Yeah, that's it, thugh I have a more recent version of it locally...
Cheers,
Dave.
Thanks. After applying this patchset and compiling dmapi, xfsprogs, xfsdump, and xfstests around in circles several times, it looks rather sane now. Two issues remain, one reproduced on another PC:
1) The earlier worries about dmapi and hole punching comes from the results of xfs/145 being run. It hasn't been that long, but I've forgotten the last time xfstests gave messages like "[not run] DMAPI modules not loaded." dmapi is installed as a prerequisite; I have precisely zero knowledge of what happens when it is enabled.
2) There are two PCs: the one being discussed here, and the all-3.12 setup that is in mid-bisect. For CRC filesystems made by the new mkfs.xfs for the 3.11.0-rc and 3.10.0+ mid-bisect kernels, attempts to mount them fail with a dmesg like this (by memory)...
XFS(sdb6): ... unknown incompatible features (0x1) detected ... Filesystem can not be safely mounted by this kernel.
Is there an extra flag that can be passed to mkfs.xfs for the sake of older CRC-capable kernels? FWIW, both PCs could still mount CRC-enabled XFS filesystems made during the kernel 3.10-rc cycle.
Thanks again!
Michael
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 42 lines · Michael L. Semon
Quoted 28 lines · Dave Chinner
Quoted 27 lines · Michael L. Semon
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Michael L. Semon
Quoted 1 line · Dave Chinner
Comments, thoughts, flames?
Quoted 7 lines
Quoted 2 lines
I was hoping that I could use this 3.12 patchset with a 3.11.0-rc kernel, but the xfstests look like a disaster by going that way.
We'll, if you don't have all the filtering patches that I posted a while back it'll make quite a mess with all the experimental warnings mkfs and repair emit, and the
xfs_dbtests that modify filesystem structures will all also fail...I've been slacking on xfstests updates. The problem may exist between keyboard and chair, though: I was trying to copy a merged xfsprogs from one PC to another, then build everything from
make distcleanafter deleting/usr/include/xfs. Something must have gone wrong...won't be the first time...Quoted 1 line
I'll repost them later today...
I'll take this patchset home and see if any of them were not committed to the xfsprogs git:
Quoted 7 lines
Quoted 1 line
Is this the correct patchset?
Yeah, that's it, thugh I have a more recent version of it locally...
Cheers,
Dave.
Thanks. After applying this patchset and compiling dmapi, xfsprogs, xfsdump, and xfstests around in circles several times, it looks rather sane now. Two issues remain, one reproduced on another PC:
Quoted 5 lines
1) The earlier worries about dmapi and hole punching comes from the results of xfs/145 being run. It hasn't been that long, but I've forgotten the last time xfstests gave messages like "[not run] DMAPI modules not loaded." dmapi is installed as a prerequisite; I have precisely zero knowledge of what happens when it is enabled.
All the tests using dmapi should be detecting that your kernel does not support dmapi and therefore should not be run....
Quoted 7 lines
2) There are two PCs: the one being discussed here, and the all-3.12 setup that is in mid-bisect. For CRC filesystems made by the new mkfs.xfs for the 3.11.0-rc and 3.10.0+ mid-bisect kernels, attempts to mount them fail with a dmesg like this (by memory)...
XFS(sdb6): ... unknown incompatible features (
0x1) detected ... Filesystem can not be safely mounted by this kernel.
Yes, that's because the new mkfs sets the dirent filetype field feature bit, and older kernels don't know anything about that.
Quoted 2 lines
Is there an extra flag that can be passed to mkfs.xfs for the sake of older CRC-capable kernels?
No, I didn't add one because this is all still under the "experimental" umbrella and still under active development hence changes in flags and features are expected and there's no real reason to provide options for features will always be turned on once non-experimental releases are made.
Quoted 2 lines
FWIW, both PCs could still mount
CRC-enabled XFS filesystems made during the kernel 3.10-rc cycle.
Sure - mkfs doesn't enable this flag until patch 49 of this series.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs