libxfs: sync files with 2.6.38 kernel code
PATCH 1/1 libxfs: sync files with 2.6.38 kernel code
From: Dave Chinner <[email protected]>
Bring the libxfs headers and code into sync with the 2.6.37 kernel code. Update the rest of xfsprogs to work with the new code.
Note: this does not convert xfsprogs to the kernel xfs_trans_ijoin\ijoin_ref interface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work will be needed to change it over to a manner compatible with the current kernel API.
Note: log sector size handling needs to be sorted out. Specifically, initialising l_sectbb_log/l_sectBBsize correctly and removing the hacks in xlog_bread and friends (libxlog/xfs_log_recover.c) to work around the fact they are not initialised correctly. (FWIW, I don't think xfsprogs handles large log sector size correctly as a result, and especially not if the log device sector size is different to the data device sector size).
Testing:
Currently passes xfstests on x86_64 w/ 4k block sizes. On 512 byte block/2k directory block filesystems repair is giving this additional output on test 033:
+cache_purge: shake on cache 0x67a060 left 1 nodes!?
The same test run saw test 104 generating:
+_check_xfs_filesystem: filesystem on /dev/vdb is inconsistent (c) (see 104.full)
which appears to be due to this output:
*** xfs_check output ***
XFS: Invalid block length (0x2000) given for buffer
Which may be a result of the above xlog_bread issues. I haven't confirmed whether this is a regression or not yet.
--- db/attr.c | 16 +- db/attrset.c | 5 +- db/bmap.c | 18 +- db/bmap.h | 4 +- db/check.c | 50 +- db/convert.c | 6 +- db/dir2sf.c | 6 +- db/field.c | 2 +- db/frag.c | 6 +- db/inode.c | 124 ++-- db/metadump.c | 20 +- include/Makefile | 5 +- include/atomic.h | 31 + include/libxfs.h | 44 +- include/libxlog.h | 16 +- include/list.h | 11 + include/radix-tree.h | 76 ++ include/xfs_ag.h | 100 ++- include/xfs_alloc.h | 58 +- include/xfs_arch.h | 32 - include/xfs_attr_leaf.h | 12 - include/xfs_attr_sf.h | 42 +- include/xfs_bit.h | 10 +- include/xfs_bmap.h | 133 ++-- include/xfs_bmap_btree.h | 20 +- include/xfs_btree.h | 31 +- include/xfs_btree_trace.h | 17 - include/xfs_buf_item.h | 51 +- include/xfs_da_btree.h | 21 +- include/xfs_dfrag.h | 5 +- include/xfs_dinode.h | 149 ++--- include/xfs_dir2.h | 4 +- include/xfs_dir2_data.h | 2 +- include/xfs_dir2_node.h | 2 - include/xfs_dir2_sf.h | 7 - include/xfs_extfree_item.h | 17 +- include/xfs_fs.h | 30 +- include/xfs_ialloc.h | 30 +- include/xfs_ialloc_btree.h | 23 +- include/xfs_imap.h | 38 - include/xfs_inode.h | 210 +++--- include/xfs_inode_item.h | 32 +- include/xfs_inum.h | 1 - include/xfs_log.h | 70 +- include/xfs_log_priv.h | 331 +++++++-- include/xfs_log_recover.h | 25 +- include/xfs_mount.h | 259 ++----- include/xfs_quota.h | 160 ++-- include/xfs_rtalloc.h | 19 +- include/xfs_sb.h | 168 +++-- include/xfs_trace.h | 85 +++ include/xfs_trans.h | 648 +++-------------- include/xfs_trans_space.h | 2 +- include/xfs_types.h | 18 +- libxfs/Makefile | 2 +- libxfs/init.c | 133 +++- libxfs/logitem.c | 371 +--------- libxfs/radix-tree.c | 805 ++++++++++++++++++++ libxfs/trans.c | 211 ++---- libxfs/util.c | 75 +- libxfs/xfs.h | 49 +- libxfs/xfs_alloc.c | 599 ++++++++-------- libxfs/xfs_alloc_btree.c | 46 +- libxfs/xfs_attr.c | 138 ++-- libxfs/xfs_attr_leaf.c | 135 ++-- libxfs/xfs_bmap.c | 1773 ++++++++++++++++++++++---------------------- libxfs/xfs_bmap_btree.c | 129 ++-- libxfs/xfs_btree.c | 96 ++- libxfs/xfs_da_btree.c | 48 +- libxfs/xfs_dir2.c | 31 +- libxfs/xfs_dir2_block.c | 28 +- libxfs/xfs_dir2_leaf.c | 21 +- libxfs/xfs_dir2_node.c | 29 +- libxfs/xfs_dir2_sf.c | 24 +- libxfs/xfs_ialloc.c | 1157 +++++++++++++++-------------- libxfs/xfs_ialloc_btree.c | 35 +- libxfs/xfs_inode.c | 277 ++++---- libxfs/xfs_mount.c | 123 +--- libxfs/xfs_trans.c | 492 +++++++++++-- libxlog/xfs_log_recover.c | 606 ++++++++------- logprint/log_misc.c | 2 +- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- mkfs/proto.c | 18 +- mkfs/xfs_mkfs.c | 3 +- repair/attr_repair.c | 14 +- repair/dino_chunks.c | 12 +- repair/dinode.c | 275 ++++---- repair/dir.c | 18 +- repair/dir2.c | 22 +- repair/incore.h | 3 + repair/phase6.c | 76 +- repair/prefetch.c | 29 +- repair/rt.c | 2 +- 94 files changed, 5826 insertions(+), 5400 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/radix-tree.h delete mode 100644 include/xfs_imap.h create mode 100644 include/xfs_trace.h create mode 100644 libxfs/radix-tree.c
db/attr.c +8 -8
@@ -219,7 +219,7 @@ attr_leaf_name_local_name_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i);return l->namelen; }else return 0 ;
@@ -248,7 +248,7 @@ attr_leaf_name_local_value_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i);return be16_to_cpu (l->valuelen); }else return 0 ;
@@ -285,7 +285,7 @@ attr_leaf_name_local_value_offset(if (i >=be16_to_cpu (block->hdr.count))return 0 ; - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i); vp = (char *)&l->nameval[l->namelen];return (int )bitize (vp - (char *)l); }
@@ -333,7 +333,7 @@ attr_leaf_name_remote_name_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (!(e->flags &XFS_ATTR_LOCAL )) { - r =XFS_ATTR_LEAF_NAME_REMOTE (block, i); + r =xfs_attr_leaf_name_remote (block, i);return r->namelen; }else return 0 ;
@@ -360,12 +360,12 @@ attr_leaf_name_size(return 0 ; e = &block->entries[idx];if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, idx); -return (int )bitize (XFS_ATTR_LEAF_ENTSIZE_LOCAL (l->namelen, + l =xfs_attr_leaf_name_local (block, idx); +return (int )bitize (xfs_attr_leaf_entsize_local (l->namelen,be16_to_cpu (l->valuelen))); }else { - r =XFS_ATTR_LEAF_NAME_REMOTE (block, idx); -return (int )bitize (XFS_ATTR_LEAF_ENTSIZE_REMOTE (r->namelen)); + r =xfs_attr_leaf_name_remote (block, idx); +return (int )bitize (xfs_attr_leaf_entsize_remote (r->namelen)); } }
db/attrset.c +3 -2
@@ -158,7 +158,8 @@ attr_set_f( goto out; } -if (libxfs_attr_set (ip, name, value, valuelen, flags)) { +if (libxfs_attr_set (ip, (unsigned char *)name, + (unsigned char *)value, valuelen, flags)) {dbprintf (_ ("failed to set attr %s on inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;
@@ -233,7 +234,7 @@ attr_remove_f( goto out; } -if (libxfs_attr_remove (ip, name, flags)) { +if (libxfs_attr_remove (ip, (unsigned char *)name, flags)) {dbprintf (_ ("failed to remove attr %s from inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;
db/bmap.c +9 -9
@@ -29,7 +29,7 @@#include "init.h" static int bmap_f (int argc,char **argv); -static int bmap_one_extent (xfs_bmbt_rec_64_t *ep, +static int bmap_one_extent (xfs_bmbt_rec_t *ep,xfs_dfiloff_t *offp,xfs_dfiloff_t eoff,int *idxp,bmap_ext_t *bep); static xfs_fsblock_t select_child(xfs_dfiloff_t off, xfs_bmbt_key_t *kp,
@@ -52,7 +52,7 @@ bmap(xfs_dfiloff_t curoffset;xfs_dinode_t *dip;xfs_dfiloff_t eoffset; -xfs_bmbt_rec_64_t *ep; +xfs_bmbt_rec_t *ep;xfs_dinode_fmt_t fmt;int fsize;xfs_bmbt_key_t *kp;
@@ -63,7 +63,7 @@ bmap(xfs_bmbt_ptr_t *pp;xfs_bmdr_block_t *rblock;typnm_t typ; -xfs_bmbt_rec_64_t *xp; +xfs_bmbt_rec_t *xp;push_cur ();set_cur_inode (iocur_top->ino);
@@ -81,7 +81,7 @@ bmap( fmt == XFS_DINODE_FMT_BTREE);if (fmt ==XFS_DINODE_FMT_EXTENTS ) { nextents =XFS_DFORK_NEXTENTS (dip, whichfork); - xp = (xfs_bmbt_rec_64_t *)XFS_DFORK_PTR (dip, whichfork); + xp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR (dip, whichfork);for (ep = xp; ep < &xp[nextents] && n < nex; ep++) {if (!bmap_one_extent (ep, &curoffset, eoffset, &n, bep))break ;
@@ -110,7 +110,7 @@ bmap( for (;;) { nextbno = be64_to_cpu(block->bb_u.l.bb_rightsib); nextents = be16_to_cpu(block->bb_numrecs); - xp = (xfs_bmbt_rec_64_t *) + xp = (xfs_bmbt_rec_t *) XFS_BMBT_REC_ADDR(mp, block, 1); for (ep = xp; ep < &xp[nextents] && n < nex; ep++) { if (!bmap_one_extent(ep, &curoffset, eoffset,
@@ -171,9 +171,9 @@ bmap_f(push_cur ();set_cur_inode (iocur_top->ino); dip = iocur_top->data; -if (be32_to_cpu (dip->di_core.di_nextents)) +if (be32_to_cpu (dip->di_nextents)) dfork =1 ; -if (be16_to_cpu (dip->di_core.di_anextents)) +if (be16_to_cpu (dip->di_anextents)) afork =1 ;pop_cur (); }
@@ -233,7 +233,7 @@ bmap_init(void) static int bmap_one_extent( - xfs_bmbt_rec_64_t *ep, + xfs_bmbt_rec_t *ep, xfs_dfiloff_t *offp, xfs_dfiloff_t eoff, int *idxp,
@@ -271,7 +271,7 @@ bmap_one_extent( void convert_extent( - xfs_bmbt_rec_64_t *rp, + xfs_bmbt_rec_t *rp, xfs_dfiloff_t *op, xfs_dfsbno_t *sp, xfs_dfilblks_t *cp,
db/bmap.h +2 -2
@@ -17,7 +17,7 @@*/ struct bbmap ; -struct xfs_bmbt_rec_64 ; +struct xfs_bmbt_rec ; typedef struct bmap_ext { xfs_dfiloff_t startoff;
@@ -29,6 +29,6 @@ typedef struct bmap_ext {extern void bmap (xfs_dfiloff_t offset,xfs_dfilblks_t len,int whichfork,int *nexp,bmap_ext_t *bep);extern void bmap_init (void ); -extern void convert_extent (struct xfs_bmbt_rec_64 *rp,xfs_dfiloff_t *op, +extern void convert_extent (struct xfs_bmbt_rec *rp,xfs_dfiloff_t *op,xfs_dfsbno_t *sp,xfs_dfilblks_t *cp,int *fp);extern void make_bbmap (struct bbmap *bbmap,int nex,bmap_ext_t *bmp);
db/check.c +25 -25
139 lines not on this page · raw message
db/convert.c +3 -3
@@ -210,14 +210,14 @@ convert_f(int argc, char **argv) }switch (wtype) {case CT_AGBLOCK : - v =XFS_DADDR_TO_AGBNO (mp, v >>BBSHIFT ); + v =xfs_daddr_to_agbno (mp, v >>BBSHIFT );break ;case CT_AGINO : v = (v >> mp->m_sb.sb_inodelog) % (mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog);break ;case CT_AGNUMBER : - v =XFS_DADDR_TO_AGNO (mp, v >>BBSHIFT ); + v =xfs_daddr_to_agno (mp, v >>BBSHIFT );break ;case CT_BBOFF : v &=BBMASK ;
@@ -234,7 +234,7 @@ convert_f(int argc, char **argv) v =XFS_DADDR_TO_FSB (mp, v >>BBSHIFT );break ;case CT_INO : - v =XFS_AGINO_TO_INO (mp,XFS_DADDR_TO_AGNO (mp, v >>BBSHIFT ), + v =XFS_AGINO_TO_INO (mp,xfs_daddr_to_agno (mp, v >>BBSHIFT ), (v >> mp->m_sb.sb_inodelog) % (mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog));break ;
db/dir2sf.c +3 -3
@@ -76,7 +76,7 @@ dir2_inou_i4_count(xfs_dir2_sf_t *sf;ASSERT (bitoffs (startoff) ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return sf->hdr.i8count ==0 ; }
@@ -89,7 +89,7 @@ dir2_inou_i8_count(xfs_dir2_sf_t *sf;ASSERT (bitoffs (startoff) ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return sf->hdr.i8count !=0 ; }
@@ -104,7 +104,7 @@ dir2_inou_size(ASSERT (bitoffs (startoff) ==0 );ASSERT (idx ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return bitize (sf->hdr.i8count ? (uint )sizeof (xfs_dir2_ino8_t) : (uint )sizeof (xfs_dir2_ino4_t));
db/field.c +1 -1
@@ -151,7 +151,7 @@ const ftattr_t ftattrtab[] = { {FLDT_DINODE_A ,"dinode_a" ,NULL , (char *)inode_a_flds, inode_a_size, FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_a_flds }, { FLDT_DINODE_CORE, "dinode_core", NULL, (char *)inode_core_flds, - SI(bitsz(xfs_dinode_core_t)), 0, NULL, inode_core_flds }, + SI(bitsz(xfs_dinode_t)), 0, NULL, inode_core_flds }, { FLDT_DINODE_FMT, "dinode_fmt", fp_dinode_fmt, NULL, SI(bitsz(__int8_t)), 0, NULL, NULL }, { FLDT_DINODE_U, "dinode_u", NULL, (char *)inode_u_flds, inode_u_size,
db/frag.c +2 -4
@@ -307,20 +307,18 @@ process_inode( xfs_dinode_t *dip) {__uint64_t actual; -xfs_dinode_core_t *dic;__uint64_t ideal;xfs_ino_t ino;int skipa;int skipd; - dic = &dip->di_core; ino =XFS_AGINO_TO_INO (mp,be32_to_cpu (agf->agf_seqno), agino); -switch (be16_to_cpu (dic->di_mode) &S_IFMT ) { +switch (be16_to_cpu (dip->di_mode) &S_IFMT ) {case S_IFDIR : skipd = !dflag;break ;case S_IFREG : -if (!rflag && (be16_to_cpu (dic->di_flags) &XFS_DIFLAG_REALTIME )) +if (!rflag && (be16_to_cpu (dip->di_flags) &XFS_DIFLAG_REALTIME )) skipd =1 ; else if (!Rflag && (ino == mp->m_sb.sb_rbmino ||
db/inode.c +70 -54
285 lines not on this page · raw message
db/metadump.c +11 -9
@@ -502,8 +502,8 @@ obfuscate_sf_dir(__uint64_t ino_dir_size;int i; - sfp = &dip->di_u.di_dir2sf; - ino_dir_size =be64_to_cpu (dip->di_core.di_size); + sfp = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (dip); + ino_dir_size =be64_to_cpu (dip->di_size);if (ino_dir_size >XFS_DFORK_DSIZE (dip, mp)) { ino_dir_size =XFS_DFORK_DSIZE (dip, mp);if (show_warnings)
@@ -555,8 +555,9 @@ obfuscate_sf_symlink( xfs_dinode_t *dip) {__uint64_t len; +char *buf; - len =be64_to_cpu (dip->di_core.di_size); + len =be64_to_cpu (dip->di_size);if (len >XFS_DFORK_DSIZE (dip, mp)) {if (show_warnings) print_warning("invalid size (%d) in symlink inode %llu",
@@ -564,8 +565,9 @@ obfuscate_sf_symlink( len =XFS_DFORK_DSIZE (dip, mp); } + buf = (char *)XFS_DFORK_DPTR (dip);while (len >0 ) - dip->di_u.di_symlink[--len] =random () %127 +1 ; + buf[--len] =random () %127 +1 ; } static void
@@ -841,7 +843,7 @@ obfuscate_attr_blocks(break ; }if (entry->flags &XFS_ATTR_LOCAL ) { - local =XFS_ATTR_LEAF_NAME_LOCAL (leaf, i); + local =xfs_attr_leaf_name_local (leaf, i);if (local->namelen ==0 ) {if (show_warnings) print_warning("zero length for "
@@ -854,7 +856,7 @@ obfuscate_attr_blocks(memset (&local->nameval[local->namelen],0 ,be16_to_cpu (local->valuelen)); }else { - remote =XFS_ATTR_LEAF_NAME_REMOTE (leaf, i); + remote =xfs_attr_leaf_name_remote (leaf, i);if (remote->namelen ==0 || remote->valueblk ==0 ) {if (show_warnings)
@@ -1143,7 +1145,7 @@ process_inode_data( xfs_dinode_t *dip, typnm_t itype) { -switch (dip->di_core.di_format) { +switch (dip->di_format) {case XFS_DINODE_FMT_LOCAL :if (!dont_obfuscate)switch (itype) {
@@ -1180,7 +1182,7 @@ process_inode( cur_ino =XFS_AGINO_TO_INO (mp, agno, agino);/* copy appropriate data fork metadata */ -switch (be16_to_cpu (dip->di_core.di_mode) &S_IFMT ) { +switch (be16_to_cpu (dip->di_mode) &S_IFMT ) {case S_IFDIR :memset (&dir_data,0 ,sizeof (dir_data)); success =process_inode_data (dip,TYP_DIR2 );
@@ -1198,7 +1200,7 @@ process_inode(/* copy extended attributes if they exist and forkoff is valid */ if (success &&XFS_DFORK_DSIZE (dip, mp) <XFS_LITINO (mp)) { attr_data.remote_val_count =0 ; -switch (dip->di_core.di_aformat) { +switch (dip->di_aformat) {case XFS_DINODE_FMT_LOCAL :if (!dont_obfuscate)obfuscate_sf_attr (dip);
include/Makefile +3 -2
@@ -19,7 +19,8 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs QAHFILES = libxfs.h libxlog.h \ - bitops.h cache.h kmem.h list.h parent.h swab.h \ + atomic.h bitops.h cache.h kmem.h list.h hlist.h parent.h radix-tree.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_da_btree.h xfs_dinode.h \
@@ -28,7 +29,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_imap.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_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_trace.h \ xfs_trans.h xfs_trans_space.h xfs_types.h xfs_dfrag.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h
include/atomic.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (c) 2011 RedHat, Inc. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef __ATOMIC_H__ +#define __ATOMIC_H__ + +typedef int32_t atomic_t ; +typedef int64_t atomic64_t ; + +#define atomic_inc_return (x) (++(*(x))) +#define atomic_dec_return (x) (--(*(x))) + +#define atomic64_read (x) *(x) +#define atomic64_set (x, v) (*(x) = v) + +#endif /* __ATOMIC_H__ */ +
include/libxfs.h +32 -12
137 lines not on this page · raw message
include/libxlog.h +10 -6
@@ -39,13 +39,12 @@ typedef struct log {int l_iclog_size;/* size of log in bytes */ int l_iclog_size_log;/* log power size of log */ int l_iclog_bufs;/* number of iclog buffers */ -int l_grant_reserve_cycle;/* */ -int l_grant_reserve_bytes;/* */ -int l_grant_write_cycle;/* */ -int l_grant_write_bytes;/* */ +atomic64_t l_grant_reserve_head; +atomic64_t l_grant_write_head;uint l_sectbb_log;/* log2 of sector size in bbs */ uint l_sectbb_mask;/* sector size (in BBs) * alignment mask */ +int l_sectBBsize;/* size of log sector in 512 byte chunks */ } xlog_t;#include <xfs/xfs_log_recover.h>
@@ -91,7 +90,10 @@ extern libxfs_init_t x;extern struct xfs_buf *xlog_get_bp (xlog_t *,int );extern void xlog_put_bp (struct xfs_buf *); -extern int xlog_bread (xlog_t *,xfs_daddr_t ,int ,struct xfs_buf *); +extern int xlog_bread (xlog_t *log,xfs_daddr_t blk_no,int nbblks, +xfs_buf_t *bp,xfs_caddr_t *offset); +extern int xlog_bread_noalign (xlog_t *log,xfs_daddr_t blk_no,int nbblks, +xfs_buf_t *bp);extern int xlog_find_zeroed (xlog_t *log,xfs_daddr_t *blk_no); extern int xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp,
@@ -110,7 +112,7 @@ extern int xlog_print_find_oldest(xlog_t *log, xfs_daddr_t *last_blk);/* for transactional view */ extern void xlog_recover_print_trans_head (xlog_recover_t *tr);extern void xlog_recover_print_trans (xlog_recover_t *trans, -xlog_recover_item_t *itemq,int print); +struct list_head *itemq,int print);extern int xlog_do_recovery_pass (xlog_t *log,xfs_daddr_t head_blk,xfs_daddr_t tail_blk,int pass); extern int xlog_recover_do_trans(xlog_t *log, xlog_recover_t *trans,
@@ -120,4 +122,6 @@ extern int xlog_header_check_recover(xfs_mount_t *mp,extern int xlog_header_check_mount (xfs_mount_t *mp,xlog_rec_header_t *head); +#define xlog_assign_atomic_lsn (l,a,b) ((void) 0) +#define xlog_assign_grant_head (l,a,b) ((void) 0)#endif /* LIBXLOG_H */
include/list.h +11 -0
@@ -27,6 +27,12 @@ struct list_head {struct list_head *prev; }; +#define LIST_HEAD_INIT (name) { &(name), &(name) } + +#define LIST_HEAD (name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD (list) list_head_init(list)static inline void list_head_init (struct list_head *list) { list->next = list->prev = list;
@@ -68,6 +74,11 @@ static inline void list_del_init(struct list_head *entry)list_head_init (entry); } +static inline void list_del (struct list_head *entry) +{ +__list_del (entry->prev, entry->next); +} +static inline void list_move (struct list_head *list,struct list_head *head) {__list_del (list->prev, list->next);
include/radix-tree.h new file +76 -0
76 lines not on this page · raw message
include/xfs_ag.h +74 -26
162 lines not on this page · raw message
include/xfs_alloc.h +27 -31
84 lines not on this page · raw message
include/xfs_arch.h +0 -32
@@ -73,28 +73,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)#endif /* __KERNEL__ */ -/* do we need conversion? */ -#define ARCH_NOCONVERT 1 -#ifdef XFS_NATIVE_HOST -# define ARCH_CONVERT ARCH_NOCONVERT -#else -# define ARCH_CONVERT 0 -#endif - -/* generic swapping macros */ - -#ifndef HAVE_SWABMACROS -#define INT_SWAP16 (type,var) ((typeof(type))(__swab16((__u16)(var)))) -#define INT_SWAP32 (type,var) ((typeof(type))(__swab32((__u32)(var)))) -#define INT_SWAP64 (type,var) ((typeof(type))(__swab64((__u64)(var)))) -#endif - -#define INT_SWAP (type, var) \ - ((sizeof(type) == 8) ? INT_SWAP64(type,var) : \ - ((sizeof(type) == 4) ? INT_SWAP32(type,var) : \ - ((sizeof(type) == 2) ? INT_SWAP16(type,var) : \ - (var)))) -/* * get and set integers from potentially unaligned locations */
@@ -107,16 +85,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b) ((__u8 *)(pointer))[1 ] = (((value) ) &0xff ); \ } -/* does not return a value */ -#define INT_SET (reference,arch,valueref) \ - (__builtin_constant_p(valueref) ? \ - (void)( (reference) = ( ((arch) != ARCH_NOCONVERT) ? (INT_SWAP((reference),(valueref))) : (valueref)) ) : \ - (void)( \ - ((reference) = (valueref)), \ - ( ((arch) != ARCH_NOCONVERT) ? (reference) = INT_SWAP((reference),(reference)) : 0 ) \ - ) \ - ) -/* * In directories inode numbers are stored as unaligned arrays of unsigned * 8bit integers on disk.
include/xfs_attr_leaf.h +0 -12
@@ -151,8 +151,6 @@ typedef struct xfs_attr_leafblock {/* * Cast typed pointers for "local" and "remote" name/value structs. */ -#define XFS_ATTR_LEAF_NAME_REMOTE (leafp,idx) \ - xfs_attr_leaf_name_remote(leafp,idx)static inline xfs_attr_leaf_name_remote_t *xfs_attr_leaf_name_remote (xfs_attr_leafblock_t *leafp,int idx) {
@@ -160,8 +158,6 @@ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)]; } -#define XFS_ATTR_LEAF_NAME_LOCAL (leafp,idx) \ - xfs_attr_leaf_name_local(leafp,idx)static inline xfs_attr_leaf_name_local_t *xfs_attr_leaf_name_local (xfs_attr_leafblock_t *leafp,int idx) {
@@ -169,8 +165,6 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)]; } -#define XFS_ATTR_LEAF_NAME (leafp,idx) \ - xfs_attr_leaf_name(leafp,idx)static inline char *xfs_attr_leaf_name (xfs_attr_leafblock_t *leafp,int idx) {return &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)];
@@ -181,24 +175,18 @@ static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)* a "local" name/value structure, a "remote" name/value structure, and * a pointer which might be either. */ -#define XFS_ATTR_LEAF_ENTSIZE_REMOTE (nlen) \ - xfs_attr_leaf_entsize_remote(nlen)static inline int xfs_attr_leaf_entsize_remote (int nlen) {return ((uint )sizeof (xfs_attr_leaf_name_remote_t) -1 + (nlen) + \XFS_ATTR_LEAF_NAME_ALIGN -1 ) & ~(XFS_ATTR_LEAF_NAME_ALIGN -1 ); } -#define XFS_ATTR_LEAF_ENTSIZE_LOCAL (nlen,vlen) \ - xfs_attr_leaf_entsize_local(nlen,vlen)static inline int xfs_attr_leaf_entsize_local (int nlen,int vlen) {return ((uint )sizeof (xfs_attr_leaf_name_local_t) -1 + (nlen) + (vlen) +XFS_ATTR_LEAF_NAME_ALIGN -1 ) & ~(XFS_ATTR_LEAF_NAME_ALIGN -1 ); } -#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX (bsize) \ - xfs_attr_leaf_entsize_local_max(bsize)static inline int xfs_attr_leaf_entsize_local_max (int bsize) {return (((bsize) >>1 ) + ((bsize) >>2 ));
include/xfs_attr_sf.h +1 -41
58 lines not on this page · raw message
include/xfs_bit.h +1 -9
@@ -23,24 +23,16 @@*/ /* -* masks with n high/low bits set, 32-bit values & 64-bit values +* masks with n high/low bits set, 64-bit values */ -#define XFS_MASK32HI (n) xfs_mask32hi(n) -static inline __uint32_t xfs_mask32hi (int n) -{ -return (__uint32_t)-1 << (32 - (n)); -} -#define XFS_MASK64HI (n) xfs_mask64hi(n)static inline __uint64_t xfs_mask64hi (int n) {return (__uint64_t)-1 << (64 - (n)); } -#define XFS_MASK32LO (n) xfs_mask32lo(n)static inline __uint32_t xfs_mask32lo (int n) {return ((__uint32_t )1 << (n)) -1 ; } -#define XFS_MASK64LO (n) xfs_mask64lo(n)static inline __uint64_t xfs_mask64lo (int n) {return ((__uint64_t )1 << (n)) -1 ;
include/xfs_bmap.h +67 -66
212 lines not on this page · raw message
include/xfs_bmap_btree.h +3 -17
@@ -46,20 +46,12 @@ typedef struct xfs_bmdr_block {#define BMBT_STARTBLOCK_BITLEN 52#define BMBT_BLOCKCOUNT_BITLEN 21 - -#define BMBT_USE_64 1 - -typedef struct xfs_bmbt_rec_32 -{ -__uint32_t l0, l1, l2, l3; -}xfs_bmbt_rec_32_t ; -typedef struct xfs_bmbt_rec_64 -{ +typedef struct xfs_bmbt_rec {__be64 l0, l1; -}xfs_bmbt_rec_64_t ; +}xfs_bmbt_rec_t ;typedef __uint64_t xfs_bmbt_rec_base_t ;/* use this for casts */ -typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t ,xfs_bmdr_rec_t ; +typedef xfs_bmbt_rec_t xfs_bmdr_rec_t ; typedef struct xfs_bmbt_rec_host { __uint64_t l0, l1;
@@ -76,26 +68,22 @@ typedef struct xfs_bmbt_rec_host {#define DSTARTBLOCKMASK \ (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) -#define ISNULLSTARTBLOCK (x) isnullstartblock(x)static inline int isnullstartblock (xfs_fsblock_t x) {return ((x) &STARTBLOCKMASK ) ==STARTBLOCKMASK ; } -#define ISNULLDSTARTBLOCK (x) isnulldstartblock(x)static inline int isnulldstartblock (xfs_dfsbno_t x) {return ((x) &DSTARTBLOCKMASK ) ==DSTARTBLOCKMASK ; } -#define NULLSTARTBLOCK (k) nullstartblock(k)static inline xfs_fsblock_t nullstartblock (int k) {ASSERT (k < (1 <<STARTBLOCKVALBITS ));return STARTBLOCKMASK | (k); } -#define STARTBLOCKVAL (x) startblockval(x)static inline xfs_filblks_t startblockval (xfs_fsblock_t x) {return (xfs_filblks_t)((x) & ~STARTBLOCKMASK );
@@ -224,7 +212,6 @@ extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);extern xfs_fileoff_t xfs_bmbt_get_startoff (xfs_bmbt_rec_host_t *r);extern xfs_exntst_t xfs_bmbt_get_state (xfs_bmbt_rec_host_t *r); -extern void xfs_bmbt_disk_get_all (xfs_bmbt_rec_t *r,xfs_bmbt_irec_t *s);extern xfs_filblks_t xfs_bmbt_disk_get_blockcount (xfs_bmbt_rec_t *r);extern xfs_fileoff_t xfs_bmbt_disk_get_startoff (xfs_bmbt_rec_t *r);
@@ -236,7 +223,6 @@ extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v);extern void xfs_bmbt_set_startoff (xfs_bmbt_rec_host_t *r,xfs_fileoff_t v);extern void xfs_bmbt_set_state (xfs_bmbt_rec_host_t *r,xfs_exntst_t v); -extern void xfs_bmbt_disk_set_all (xfs_bmbt_rec_t *r,xfs_bmbt_irec_t *s);extern void xfs_bmbt_disk_set_allf (xfs_bmbt_rec_t *r,xfs_fileoff_t o,xfs_fsblock_t b,xfs_filblks_t c,xfs_exntst_t v);
include/xfs_btree.h +2 -29
@@ -41,7 +41,7 @@ extern kmem_zone_t *xfs_btree_cur_zone;/* * Generic btree header. * -* This is a comination of the actual format used on disk for short and long +* This is a combination of the actual format used on disk for short and long * format btrees. The first three fields are shared by both format, but * the pointers are different and should be used with care. *
@@ -152,9 +152,7 @@ struct xfs_btree_ops {/* update btree root pointer */ void (*set_root)(struct xfs_btree_cur *cur, -union xfs_btree_ptr *nptr,int level_change); -int (*kill_root)(struct xfs_btree_cur *cur,struct xfs_buf *bp, -int level,union xfs_btree_ptr *newroot); +union xfs_btree_ptr *nptr,int level_change);/* block allocation / freeing */ int (*alloc_block)(struct xfs_btree_cur *cur,
@@ -379,20 +377,6 @@ xfs_btree_read_bufl( int refval);/* ref count value for buffer *//* -* Get a buffer for the block, return it read in. -* Short-form addressing. -*/ -int /* error */ -xfs_btree_read_bufs ( -struct xfs_mount *mp,/* file system mount point */ -struct xfs_trans *tp,/* transaction pointer */ -xfs_agnumber_t agno,/* allocation group number */ -xfs_agblock_t agbno,/* allocation group block number */ -uint lock,/* lock flags for read_buf */ -struct xfs_buf **bpp,/* buffer for agno/agbno */ -int refval);/* ref count value for buffer */ - -/* * Read-ahead the block, don't wait for it, don't return a buffer. * Long-form addressing. */
@@ -413,16 +397,6 @@ xfs_btree_reada_bufs(xfs_agblock_t agbno,/* allocation group block number */ xfs_extlen_t count); /* count of filesystem blocks */ -/* -* Set the buffer for level "lev" in the cursor to bp, releasing -* any previous buffer. -*/ -void -xfs_btree_setbuf ( -xfs_btree_cur_t *cur,/* btree cursor */ -int lev,/* level in btree */ -struct xfs_buf *bp);/* new buffer to set */ -/* * Common btree core entry points.
@@ -432,7 +406,6 @@ int xfs_btree_decrement(struct xfs_btree_cur *, int, int *);int xfs_btree_lookup (struct xfs_btree_cur *,xfs_lookup_t ,int *);int xfs_btree_update (struct xfs_btree_cur *,union xfs_btree_rec *);int xfs_btree_new_iroot (struct xfs_btree_cur *,int *,int *); -int xfs_btree_kill_iroot (struct xfs_btree_cur *);int xfs_btree_insert (struct xfs_btree_cur *,int *);int xfs_btree_delete (struct xfs_btree_cur *,int *);int xfs_btree_get_rec (struct xfs_btree_cur *,union xfs_btree_rec **,int *);
include/xfs_btree_trace.h +0 -17
@@ -58,8 +58,6 @@ void xfs_btree_trace_argbi(const char *, struct xfs_btree_cur *, struct xfs_buf *, int, int);void xfs_btree_trace_argbii (const char *,struct xfs_btree_cur *,struct xfs_buf *,int ,int ,int ); -void xfs_btree_trace_argfffi (const char *,struct xfs_btree_cur *, -xfs_dfiloff_t ,xfs_dfsbno_t ,xfs_dfilblks_t ,int ,int );void xfs_btree_trace_argi (const char *,struct xfs_btree_cur *,int ,int );void xfs_btree_trace_argipk (const char *,struct xfs_btree_cur *,int ,union xfs_btree_ptr ,union xfs_btree_key *,int );
@@ -71,24 +69,10 @@ void xfs_btree_trace_argr(const char *, struct xfs_btree_cur *, union xfs_btree_rec *, int);void xfs_btree_trace_cursor (const char *,struct xfs_btree_cur *,int ,int ); - -#define XFS_ALLOCBT_TRACE_SIZE 4096/* size of global trace buffer */ -extern ktrace_t *xfs_allocbt_trace_buf; - -#define XFS_INOBT_TRACE_SIZE 4096/* size of global trace buffer */ -extern ktrace_t *xfs_inobt_trace_buf; - -#define XFS_BMBT_TRACE_SIZE 4096/* size of global trace buffer */ -#define XFS_BMBT_KTRACE_SIZE 32/* size of per-inode trace buffer */ -extern ktrace_t *xfs_bmbt_trace_buf; - -#define XFS_BTREE_TRACE_ARGBI (c, b, i) \ xfs_btree_trace_argbi(__func__, c, b, i, __LINE__)#define XFS_BTREE_TRACE_ARGBII (c, b, i, j) \ xfs_btree_trace_argbii(__func__, c, b, i, j, __LINE__) -#define XFS_BTREE_TRACE_ARGFFFI (c, o, b, i, j) \ - xfs_btree_trace_argfffi(__func__, c, o, b, i, j, __LINE__)#define XFS_BTREE_TRACE_ARGI (c, i) \ xfs_btree_trace_argi(__func__, c, i, __LINE__)#define XFS_BTREE_TRACE_ARGIPK (c, i, p, k) \
@@ -104,7 +88,6 @@ extern ktrace_t *xfs_bmbt_trace_buf;#else #define XFS_BTREE_TRACE_ARGBI (c, b, i)#define XFS_BTREE_TRACE_ARGBII (c, b, i, j) -#define XFS_BTREE_TRACE_ARGFFFI (c, o, b, i, j)#define XFS_BTREE_TRACE_ARGI (c, i)#define XFS_BTREE_TRACE_ARGIPK (c, i, p, s)#define XFS_BTREE_TRACE_ARGIPR (c, i, p, r)
include/xfs_buf_item.h +19 -32
104 lines not on this page · raw message
include/xfs_da_btree.h +15 -6
@@ -91,9 +91,9 @@ enum xfs_dacmp {* Structure to ease passing around component names. */ typedef struct xfs_da_args { - const uchar_t *name; /* string (maybe not NULL terminated) */ + const __uint8_t *name; /* string (maybe not NULL terminated) */ int namelen; /* length of string (maybe no NULL) */ - uchar_t *value; /* set of bytes (maybe contain NULLs) */ + __uint8_t *value; /* set of bytes (maybe contain NULLs) */ int valuelen; /* length of value */ int flags; /* argument flags (eg: ATTR_NOCREATE) */ xfs_dahash_t hashval; /* hash value of name */
@@ -125,6 +125,13 @@ typedef struct xfs_da_args {#define XFS_DA_OP_OKNOENT 0x0008/* lookup/add op, ENOENT ok, else die */ #define XFS_DA_OP_CILOOKUP 0x0010/* lookup to return CI name if found */ +#define XFS_DA_OP_FLAGS \ + { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ + { XFS_DA_OP_RENAME, "RENAME" }, \ + { XFS_DA_OP_ADDNAME, "ADDNAME" }, \ + { XFS_DA_OP_OKNOENT, "OKNOENT" }, \ + { XFS_DA_OP_CILOOKUP, "CILOOKUP" } +/* * Structure to describe buffer(s) for a block. * This is needed in the directory version 2 format case, when
@@ -185,7 +192,7 @@ typedef struct xfs_da_state {unsigned char inleaf;/* insert into 1->lf, 0->splf */ unsigned char extravalid;/* T/F: extrablk is in use */ unsigned char extraafter;/* T/F: extrablk is after new */ -xfs_da_state_blk_t extrablk;/* for double-splits on leafs */ +xfs_da_state_blk_t extrablk;/* for double-splits on leaves */ /* for dirv2 extrablk is data */ } xfs_da_state_t;
@@ -202,7 +209,8 @@ typedef struct xfs_da_state {*/ struct xfs_nameops {xfs_dahash_t (*hashname)(struct xfs_name *); -enum xfs_dacmp (*compname)(struct xfs_da_args *,const char *,int ); +enum xfs_dacmp (*compname)(struct xfs_da_args *, +const unsigned char *,int ); };
@@ -251,9 +259,9 @@ xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,int xfs_da_shrink_inode (xfs_da_args_t *args,xfs_dablk_t dead_blkno,xfs_dabuf_t *dead_buf); -uint xfs_da_hashname (const uchar_t *name_string,int name_length); +uint xfs_da_hashname (const __uint8_t *name_string,int name_length);enum xfs_dacmp xfs_da_compname (struct xfs_da_args *args, -const char *name,int len); +const unsigned char *name,int len);xfs_da_state_t *xfs_da_state_alloc (void );
@@ -268,5 +276,6 @@ xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);extern struct kmem_zone *xfs_da_state_zone;extern struct kmem_zone *xfs_dabuf_zone; +extern const struct xfs_nameops xfs_default_nameops;#endif /* __XFS_DA_BTREE_H__ */
include/xfs_dfrag.h +1 -4
@@ -46,10 +46,7 @@ typedef struct xfs_swapext/* * Syscall interface for xfs_swapext */ -int xfs_swapext (struct xfs_swapext __user *sx); - -int xfs_swap_extents (struct xfs_inode *ip,struct xfs_inode *tip, -struct xfs_swapext *sxp); +int xfs_swapext (struct xfs_swapext *sx);#endif /* __KERNEL__ */
include/xfs_dinode.h +55 -94
208 lines not on this page · raw message
include/xfs_dir2.h +2 -2
@@ -100,7 +100,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db,struct xfs_dabuf *bp); -extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const char *name, -int len); +extern int xfs_dir_cilookup_result (struct xfs_da_args *args, +const unsigned char *name,int len);#endif /* __XFS_DIR2_H__ */
include/xfs_dir2_data.h +1 -1
@@ -38,7 +38,7 @@ struct xfs_trans;/* * Directory address space divided into sections, -* spaces separated by 32gb. +* spaces separated by 32GB. */ #define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG))#define XFS_DIR2_DATA_SPACE 0
include/xfs_dir2_node.h +0 -2
@@ -75,8 +75,6 @@ xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)return ((db) %XFS_DIR2_MAX_FREE_BESTS (mp)); } -extern void xfs_dir2_free_log_bests (struct xfs_trans *tp,struct xfs_dabuf *bp, -int first,int last);extern int xfs_dir2_leaf_to_node (struct xfs_da_args *args,struct xfs_dabuf *lbp);extern xfs_dahash_t xfs_dir2_leafn_lasthash (struct xfs_dabuf *bp,int *count);
include/xfs_dir2_sf.h +0 -7
@@ -34,13 +34,6 @@ struct xfs_mount;struct xfs_trans ;/* -* Maximum size of a shortform directory. -*/ -#define XFS_DIR2_SF_MAX_SIZE \ - (XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \ - (uint)sizeof(xfs_agino_t)) - -/* * Inode number stored as 8 8-bit values. */ typedef struct {__uint8_t i[8 ]; }xfs_dir2_ino8_t ;
include/xfs_extfree_item.h +5 -12
@@ -33,12 +33,10 @@ typedef struct xfs_extent {* conversion routine. */ -#ifndef HAVE_FORMAT32 typedef struct xfs_extent_32 {__uint64_t ext_start;__uint32_t ext_len; } __attribute__((packed))xfs_extent_32_t ; -#endif typedef struct xfs_extent_64 { __uint64_t ext_start;
@@ -59,7 +57,6 @@ typedef struct xfs_efi_log_format {xfs_extent_t efi_extents[1 ];/* array of extents to free */ } xfs_efi_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_efi_log_format_32 { __uint16_t efi_type; /* efi log item type */ __uint16_t efi_size; /* size of this item */
@@ -67,7 +64,6 @@ typedef struct xfs_efi_log_format_32 {__uint64_t efi_id;/* efi identifier */ xfs_extent_32_t efi_extents[1 ];/* array of extents to free */ } __attribute__((packed)) xfs_efi_log_format_32_t; -#endif typedef struct xfs_efi_log_format_64 { __uint16_t efi_type; /* efi log item type */
@@ -90,7 +86,6 @@ typedef struct xfs_efd_log_format {xfs_extent_t efd_extents[1 ];/* array of extents freed */ } xfs_efd_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_efd_log_format_32 { __uint16_t efd_type; /* efd log item type */ __uint16_t efd_size; /* size of this item */
@@ -98,7 +93,6 @@ typedef struct xfs_efd_log_format_32 {__uint64_t efd_efi_id;/* id of corresponding efi */ xfs_extent_32_t efd_extents[1 ];/* array of extents freed */ } __attribute__((packed)) xfs_efd_log_format_32_t; -#endif typedef struct xfs_efd_log_format_64 { __uint16_t efd_type; /* efd log item type */
@@ -117,11 +111,10 @@ typedef struct xfs_efd_log_format_64 {#define XFS_EFI_MAX_FAST_EXTENTS 16/* -* Define EFI flags. +* Define EFI flag bits. Manipulated by set/clear/test_bit operators. */ -#define XFS_EFI_RECOVERED 0x1 -#define XFS_EFI_COMMITTED 0x2 -#define XFS_EFI_CANCELED 0x4 +#define XFS_EFI_RECOVERED 1 +#define XFS_EFI_COMMITTED 2/* * This is the "extent free intention" log item. It is used
@@ -131,8 +124,8 @@ typedef struct xfs_efd_log_format_64 {*/ typedef struct xfs_efi_log_item {xfs_log_item_t efi_item; -uint efi_flags;/* misc flags */ -uint efi_next_extent; +atomic_t efi_next_extent; +unsigned long efi_flags;/* misc flags */ xfs_efi_log_format_t efi_format; }xfs_efi_log_item_t ;
include/xfs_fs.h +11 -19
@@ -113,22 +113,16 @@ struct getbmapx {#define BMV_IF_ATTRFORK 0x1/* return attr fork rather than data */ #define BMV_IF_NO_DMAPI_READ 0x2/* Do not generate DMAPI read event */ #define BMV_IF_PREALLOC 0x4/* rtn status BMV_OF_PREALLOC if req */ -#define BMV_IF_VALID (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC) -#ifdef __KERNEL__ -#define BMV_IF_EXTENDED 0x40000000/* getpmapx if set */ -#endif +#define BMV_IF_DELALLOC 0x8/* rtn status BMV_OF_DELALLOC if req */ +#define BMV_IF_NO_HOLES 0x10/* Do not return holes */ +#define BMV_IF_VALID \ + (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC| \ + BMV_IF_DELALLOC|BMV_IF_NO_HOLES) -/* bmv_oflags values - returned for for each non-header segment */ +/* bmv_oflags values - returned for each non-header segment */ #define BMV_OF_PREALLOC 0x1/* segment = unwritten pre-allocation */ - -/* Convert getbmap <-> getbmapx - move fields from p1 to p2. */ -#define GETBMAP_CONVERT (p1,p2) { \ - p2.bmv_offset = p1.bmv_offset; \ - p2.bmv_block = p1.bmv_block; \ - p2.bmv_length = p1.bmv_length; \ - p2.bmv_count = p1.bmv_count; \ - p2.bmv_entries = p1.bmv_entries; } - +#define BMV_OF_DELALLOC 0x2/* segment = delayed allocation */ +#define BMV_OF_LAST 0x4/* segment is the last in the file */ /* * Structure for XFS_IOC_FSSETDM.
@@ -300,7 +294,7 @@ typedef struct xfs_bstat {__s32 bs_extents;/* number of extents */ __u32 bs_gen;/* generation count */ __u16 bs_projid_lo;/* lower part of project id */ -#define bs_projid bs_projid_lo +#define bs_projid bs_projid_lo/* (previously just bs_projid) */ __u16 bs_forkoff;/* inode fork offset in bytes */ __u16 bs_projid_hi;/* higher part of project id */ unsigned char bs_pad[10 ];/* pad space, unused */
@@ -432,10 +426,6 @@ typedef struct xfs_handle {#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS#define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS#define XFS_IOC_GETVERSION FS_IOC_GETVERSION -/* 32-bit compat counterparts */ -#define XFS_IOC32_GETXFLAGS FS_IOC32_GETFLAGS -#define XFS_IOC32_SETXFLAGS FS_IOC32_SETFLAGS -#define XFS_IOC32_GETVERSION FS_IOC32_GETVERSION/* * ioctl commands that replace IRIX fcntl()'s
@@ -484,6 +474,8 @@ 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 */ #define XFS_IOC_FREEZE _IOWR('X', 119, int)#define XFS_IOC_THAW _IOWR('X', 120, int)#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
include/xfs_ialloc.h +9 -21
@@ -20,6 +20,7 @@struct xfs_buf ;struct xfs_dinode ; +struct xfs_imap ;struct xfs_mount ;struct xfs_trans ;
@@ -38,7 +39,6 @@ struct xfs_trans;/* * Make an inode pointer out of the buffer/offset. */ -#define XFS_MAKE_IPTR (mp,b,o) xfs_make_iptr(mp,b,o)static inline struct xfs_dinode *xfs_make_iptr (struct xfs_mount *mp,struct xfs_buf *b,int o) {
@@ -49,7 +49,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)/* * Find a free (set) bit in the inode bitmask. */ -#define XFS_IALLOC_FIND_FREE (fp) xfs_ialloc_find_free(fp)static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) {return xfs_lowbit64 (*fp);
@@ -104,17 +103,14 @@ xfs_difree( xfs_ino_t *first_ino); /* first inode in deleted cluster *//* -* Return the location of the inode in bno/len/off, -* for mapping it into a buffer. +* Return the location of the inode in imap, for mapping it into a buffer. */ int -xfs_dilocate ( +xfs_imap (struct xfs_mount *mp,/* file system mount structure */ struct xfs_trans *tp,/* transaction pointer */ xfs_ino_t ino,/* inode to locate */ -xfs_fsblock_t *bno,/* output: block containing inode */ -int *len,/* output: num blocks in cluster*/ -int *off,/* output: index in block of inode */ +struct xfs_imap *imap,/* location map structure */ uint flags);/* flags for inode btree lookup */ /*
@@ -154,23 +150,15 @@ xfs_ialloc_pagi_init( xfs_agnumber_t agno); /* allocation group number *//* -* Lookup the first record greater than or equal to ino -* in the btree given by cur. +* Lookup a record by ino in the btree given by cur. */ -int xfs_inobt_lookup_ge (struct xfs_btree_cur *cur,xfs_agino_t ino, -__int32_t fcnt,xfs_inofree_t free,int *stat); - -/* -* Lookup the first record less than or equal to ino -* in the btree given by cur. -*/ -int xfs_inobt_lookup_le (struct xfs_btree_cur *cur,xfs_agino_t ino, -__int32_t fcnt,xfs_inofree_t free,int *stat); +int xfs_inobt_lookup (struct xfs_btree_cur *cur,xfs_agino_t ino, +xfs_lookup_t dir,int *stat);/* * Get the data from the pointed-to record. */ -extern int xfs_inobt_get_rec (struct xfs_btree_cur *cur,xfs_agino_t *ino, -__int32_t *fcnt,xfs_inofree_t *free,int *stat); +extern int xfs_inobt_get_rec (struct xfs_btree_cur *cur, +xfs_inobt_rec_incore_t *rec,int *stat);#endif /* __XFS_IALLOC_H__ */
include/xfs_ialloc_btree.h +4 -19
@@ -32,15 +32,14 @@ struct xfs_mount;#define XFS_IBT_MAGIC 0x49414254/* 'IABT' */ typedef __uint64_t xfs_inofree_t ; -#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t)) +#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) -#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) +#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) +#define XFS_INOBT_MASK (i) ((xfs_inofree_t)1 << (i)) -#define XFS_INOBT_MASKN (i,n) xfs_inobt_maskn(i,n)static inline xfs_inofree_t xfs_inobt_maskn (int i,int n) { -return (((n) >=XFS_INODES_PER_CHUNK ? \ - (xfs_inofree_t )0 : ((xfs_inofree_t )1 << (n))) -1 ) << (i); +return ((n >=XFS_INODES_PER_CHUNK ?0 :XFS_INOBT_MASK (n)) -1 ) << i; }/*
@@ -70,20 +69,6 @@ typedef struct xfs_inobt_key {typedef __be32 xfs_inobt_ptr_t ;/* -* Bit manipulations for ir_free. -*/ -#define XFS_INOBT_MASK (i) ((xfs_inofree_t)1 << (i)) -#define XFS_INOBT_IS_FREE (rp,i) \ - (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) -#define XFS_INOBT_SET_FREE (rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i)) -#define XFS_INOBT_CLR_FREE (rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) - -/* -* Maximum number of inode btree levels. -*/ -#define XFS_IN_MAXLEVELS (mp) ((mp)->m_in_maxlevels) - -/* * block numbers in the AG. */ #define XFS_IBT_BLOCK (mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
include/xfs_imap.h deleted +0 -38
@@ -1,38 +0,0 @@ -/* -* Copyright (c) 2000,2005 Silicon Graphics, Inc. -* All Rights Reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#ifndef __XFS_IMAP_H__ -#define __XFS_IMAP_H__ - -/* -* This is the structure passed to xfs_imap() to map -* an inode number to its on disk location. -*/ -typedef struct xfs_imap { -xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -uint im_len;/* length in BBs of inode chunk */ -xfs_agblock_t im_agblkno;/* logical block of inode chunk in ag */ -ushort im_ioffset;/* inode offset in block in "inodes" */ -ushort im_boffset;/* inode offset in block in bytes */ -}xfs_imap_t ; - -struct xfs_mount ; -struct xfs_trans ; -int xfs_imap (struct xfs_mount *,struct xfs_trans *,xfs_ino_t , -xfs_imap_t *,uint ); - -#endif /* __XFS_IMAP_H__ */
include/xfs_inode.h +96 -114
370 lines not on this page · raw message
include/xfs_inode_item.h +6 -26
@@ -40,7 +40,6 @@ typedef struct xfs_inode_log_format {__int32_t ilf_boffset;/* off of inode in buffer */ } xfs_inode_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_inode_log_format_32 { __uint16_t ilf_type; /* inode log item type */ __uint16_t ilf_size; /* size of this item */
@@ -56,7 +55,6 @@ typedef struct xfs_inode_log_format_32 {__int32_t ilf_len;/* len of inode buffer */ __int32_t ilf_boffset;/* off of inode in buffer */ } __attribute__((packed)) xfs_inode_log_format_32_t; -#endif typedef struct xfs_inode_log_format_64 { __uint16_t ilf_type; /* inode log item type */
@@ -105,26 +103,16 @@ typedef struct xfs_inode_log_format_64 { XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ XFS_ILOG_ABROOT) -#define XFS_ILI_HOLD 0x1 -#define XFS_ILI_IOLOCKED_EXCL 0x2 -#define XFS_ILI_IOLOCKED_SHARED 0x4 - -#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) - - -#define XFS_ILOG_FBROOT (w) xfs_ilog_fbroot(w)static inline int xfs_ilog_fbroot (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DBROOT :XFS_ILOG_ABROOT ); } -#define XFS_ILOG_FEXT (w) xfs_ilog_fext(w)static inline int xfs_ilog_fext (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DEXT :XFS_ILOG_AEXT ); } -#define XFS_ILOG_FDATA (w) xfs_ilog_fdata(w)static inline int xfs_ilog_fdata (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DDATA :XFS_ILOG_ADATA );
@@ -133,7 +121,7 @@ static inline int xfs_ilog_fdata(int w)#ifdef __KERNEL__struct xfs_buf ; -struct xfs_bmbt_rec_64 ; +struct xfs_bmbt_rec ;struct xfs_inode ;struct xfs_mount ;
@@ -143,21 +131,13 @@ typedef struct xfs_inode_log_item {struct xfs_inode *ili_inode;/* inode ptr */ xfs_lsn_t ili_flush_lsn;/* lsn at last flush */ xfs_lsn_t ili_last_lsn;/* lsn at last transaction */ -unsigned short ili_ilock_recur;/* lock recursion count */ -unsigned short ili_iolock_recur;/* lock recursion count */ -unsigned short ili_flags;/* misc flags */ +unsigned short ili_lock_flags;/* lock flags */ unsigned short ili_logged;/* flushed logged data */ unsigned int ili_last_fields;/* fields when flushed */ -struct xfs_bmbt_rec_64 *ili_extents_buf;/* array of logged +struct xfs_bmbt_rec *ili_extents_buf;/* array of logged data exts */ -struct xfs_bmbt_rec_64 *ili_aextents_buf;/* array of logged +struct xfs_bmbt_rec *ili_aextents_buf;/* array of logged attr exts */ -unsigned int ili_pushbuf_flag;/* one bit used in push_ail */ - -#ifdef DEBUG -uint64_t ili_push_owner;/* one who sets pushbuf_flag -above gets to push the buf */ -#endif #ifdef XFS_TRANS_DEBUG int ili_root_size;char *ili_orig_root;
@@ -175,8 +155,8 @@ static inline int xfs_inode_clean(xfs_inode_t *ip)extern void xfs_inode_item_init (struct xfs_inode *,struct xfs_mount *);extern void xfs_inode_item_destroy (struct xfs_inode *); -extern void xfs_iflush_done (struct xfs_buf *,xfs_inode_log_item_t *); -extern void xfs_istale_done (struct xfs_buf *,xfs_inode_log_item_t *); +extern void xfs_iflush_done (struct xfs_buf *,struct xfs_log_item *); +extern void xfs_istale_done (struct xfs_buf *,struct xfs_log_item *);extern void xfs_iflush_abort (struct xfs_inode *);extern int xfs_inode_item_format_convert (xfs_log_iovec_t *,xfs_inode_log_format_t *);
include/xfs_inum.h +0 -1
@@ -72,7 +72,6 @@ struct xfs_mount;#if XFS_BIG_INUMS #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) -#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))#else #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))#endif
include/xfs_log.h +42 -28
16 lines not on this page · raw message
include/xfs_log_priv.h +253 -78
331 lines not on this page · raw message
include/xfs_mount.h +59 -200
259 lines not on this page · raw message
include/xfs_quota.h +82 -78
160 lines not on this page · raw message
include/xfs_sb.h +87 -81
168 lines not on this page · raw message
include/xfs_trace.h new file +85 -0
85 lines not on this page · raw message
include/xfs_trans.h +84 -564
648 lines not on this page · raw message
libxfs/init.c +118 -15
133 lines not on this page · raw message
libxfs/logitem.c +17 -354
371 lines not on this page · raw message
libxfs/radix-tree.c new file +805 -0
805 lines not on this page · raw message
libxfs/trans.c +64 -147
211 lines not on this page · raw message
libxfs/util.c +41 -34
75 lines not on this page · raw message
libxfs/xfs.h +26 -23
49 lines not on this page · raw message
libxfs/xfs_alloc.c +295 -304
599 lines not on this page · raw message
libxfs/xfs_alloc_btree.c +9 -37
46 lines not on this page · raw message
libxfs/xfs_attr.c +68 -70
138 lines not on this page · raw message
libxfs/xfs_attr_leaf.c +66 -69
135 lines not on this page · raw message
libxfs/xfs_bmap.c +877 -896
1,773 lines not on this page · raw message
libxfs/xfs_bmap_btree.c +61 -68
129 lines not on this page · raw message
libxfs/xfs_btree.c +65 -31
96 lines not on this page · raw message
libxfs/xfs_da_btree.c +23 -25
48 lines not on this page · raw message
libxfs/xfs_ialloc.c +607 -550
1,157 lines not on this page · raw message
libxfs/xfs_inode.c +129 -148
277 lines not on this page · raw message
libxfs/xfs_mount.c +32 -91
123 lines not on this page · raw message
libxfs/xfs_trans.c +446 -46
492 lines not on this page · raw message
libxlog/xfs_log_recover.c +328 -278
606 lines not on this page · raw message
repair/dinode.c +132 -143
275 lines not on this page · raw message
repair/phase6.c +38 -38
76 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.