]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: update to match 3.19-rc1 kernel code
authorDave Chinner <dchinner@redhat.com>
Thu, 30 Jul 2015 22:54:23 +0000 (08:54 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 22:54:23 +0000 (08:54 +1000)
Signed-off-by: Dave Chinner <dchinner@redhat.com>
70 files changed:
db/block.c
db/bmap.c
db/bmap.h
db/check.c
db/faddr.c
db/field.c
db/frag.c
db/io.c
db/metadump.c
fsr/xfs_fsr.c
include/libxfs.h
include/xfs_arch.h
libxfs/Makefile
libxfs/xfs.h
libxfs/xfs_ag.h [deleted file]
libxfs/xfs_alloc.c
libxfs/xfs_alloc.h
libxfs/xfs_attr_leaf.h
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h
libxfs/xfs_bmap_btree.c
libxfs/xfs_btree.c
libxfs/xfs_btree.h
libxfs/xfs_da_btree.c
libxfs/xfs_da_format.c
libxfs/xfs_dinode.h [deleted file]
libxfs/xfs_dir2.c
libxfs/xfs_dir2.h
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c
libxfs/xfs_dir2_priv.h
libxfs/xfs_dir2_sf.c
libxfs/xfs_format.h
libxfs/xfs_fs.h
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h
libxfs/xfs_inode_fork.c
libxfs/xfs_inum.h [deleted file]
libxfs/xfs_log_format.h
libxfs/xfs_quota_defs.h
libxfs/xfs_rtbitmap.c
libxfs/xfs_sb.c
libxfs/xfs_sb.h
libxfs/xfs_types.h
mkfs/proto.c
mkfs/xfs_mkfs.c
po/de.po
po/pl.po
repair/agheader.c
repair/agheader.h
repair/attr_repair.c
repair/attr_repair.h
repair/bmap.c
repair/bmap.h
repair/dino_chunks.c
repair/dinode.c
repair/dinode.h
repair/dir2.c
repair/incore.c
repair/incore.h
repair/incore_bmc.c
repair/incore_ext.c
repair/phase4.c
repair/phase5.c
repair/phase6.c
repair/prefetch.c
repair/rt.c
repair/scan.c
repair/scan.h

index c561654f8de91f80c0d3fc7b44d47691cb095cf1..59a626504163c0223f9548a7ed467ba2a868a617 100644 (file)
@@ -71,13 +71,13 @@ ablock_f(
        char            **argv)
 {
        bmap_ext_t      bm;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             haveattr;
        int             nex;
        char            *p;
 
-       bno = (xfs_dfiloff_t)strtoull(argv[1], &p, 0);
+       bno = (xfs_fileoff_t)strtoull(argv[1], &p, 0);
        if (*p != '\0') {
                dbprintf(_("bad block number %s\n"), argv[1]);
                return 0;
@@ -165,14 +165,14 @@ dblock_f(
 {
        bbmap_t         bbmap;
        bmap_ext_t      *bmp;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             nb;
        int             nex;
        char            *p;
        typnm_t         type;
 
-       bno = (xfs_dfiloff_t)strtoull(argv[1], &p, 0);
+       bno = (xfs_fileoff_t)strtoull(argv[1], &p, 0);
        if (*p != '\0') {
                dbprintf(_("bad block number %s\n"), argv[1]);
                return 0;
@@ -222,7 +222,7 @@ fsblock_f(
 {
        xfs_agblock_t   agbno;
        xfs_agnumber_t  agno;
-       xfs_dfsbno_t    d;
+       xfs_fsblock_t   d;
        char            *p;
 
        if (argc == 1) {
index fafa8931b4e28ac8e385677c9b06faefc0b6ef7e..2a49380447954fbf97e07877386e32cba9c274b2 100644 (file)
--- a/db/bmap.c
+++ b/db/bmap.c
@@ -30,9 +30,9 @@
 
 static int             bmap_f(int argc, char **argv);
 static int             bmap_one_extent(xfs_bmbt_rec_t *ep,
-                                       xfs_dfiloff_t *offp, xfs_dfiloff_t eoff,
+                                       xfs_fileoff_t *offp, xfs_fileoff_t eoff,
                                        int *idxp, bmap_ext_t *bep);
-static xfs_fsblock_t   select_child(xfs_dfiloff_t off, xfs_bmbt_key_t *kp,
+static xfs_fsblock_t   select_child(xfs_fileoff_t off, xfs_bmbt_key_t *kp,
                                     xfs_bmbt_ptr_t *pp, int nrecs);
 
 static const cmdinfo_t bmap_cmd =
@@ -41,17 +41,17 @@ static const cmdinfo_t      bmap_cmd =
 
 void
 bmap(
-       xfs_dfiloff_t           offset,
-       xfs_dfilblks_t          len,
+       xfs_fileoff_t           offset,
+       xfs_filblks_t           len,
        int                     whichfork,
        int                     *nexp,
        bmap_ext_t              *bep)
 {
        struct xfs_btree_block  *block;
        xfs_fsblock_t           bno;
-       xfs_dfiloff_t           curoffset;
+       xfs_fileoff_t           curoffset;
        xfs_dinode_t            *dip;
-       xfs_dfiloff_t           eoffset;
+       xfs_fileoff_t           eoffset;
        xfs_bmbt_rec_t          *ep;
        xfs_dinode_fmt_t        fmt;
        int                     fsize;
@@ -139,11 +139,11 @@ bmap_f(
        int             afork = 0;
        bmap_ext_t      be;
        int             c;
-       xfs_dfiloff_t   co, cosave;
+       xfs_fileoff_t   co, cosave;
        int             dfork = 0;
        xfs_dinode_t    *dip;
-       xfs_dfiloff_t   eo;
-       xfs_dfilblks_t  len;
+       xfs_fileoff_t   eo;
+       xfs_filblks_t   len;
        int             nex;
        char            *p;
        int             whichfork;
@@ -177,7 +177,7 @@ bmap_f(
                pop_cur();
        }
        if (optind < argc) {
-               co = (xfs_dfiloff_t)strtoull(argv[optind], &p, 0);
+               co = (xfs_fileoff_t)strtoull(argv[optind], &p, 0);
                if (*p != '\0') {
                        dbprintf(_("bad block number for bmap %s\n"),
                                argv[optind]);
@@ -185,7 +185,7 @@ bmap_f(
                }
                optind++;
                if (optind < argc) {
-                       len = (xfs_dfilblks_t)strtoull(argv[optind], &p, 0);
+                       len = (xfs_filblks_t)strtoull(argv[optind], &p, 0);
                        if (*p != '\0') {
                                dbprintf(_("bad len for bmap %s\n"), argv[optind]);
                                return 0;
@@ -233,17 +233,17 @@ bmap_init(void)
 static int
 bmap_one_extent(
        xfs_bmbt_rec_t          *ep,
-       xfs_dfiloff_t           *offp,
-       xfs_dfiloff_t           eoff,
+       xfs_fileoff_t           *offp,
+       xfs_fileoff_t           eoff,
        int                     *idxp,
        bmap_ext_t              *bep)
 {
-       xfs_dfilblks_t          c;
-       xfs_dfiloff_t           curoffset;
+       xfs_filblks_t           c;
+       xfs_fileoff_t           curoffset;
        int                     f;
        int                     idx;
-       xfs_dfiloff_t           o;
-       xfs_dfsbno_t            s;
+       xfs_fileoff_t           o;
+       xfs_fsblock_t           s;
 
        convert_extent(ep, &o, &s, &c, &f);
        curoffset = *offp;
@@ -271,9 +271,9 @@ bmap_one_extent(
 void
 convert_extent(
        xfs_bmbt_rec_t          *rp,
-       xfs_dfiloff_t           *op,
-       xfs_dfsbno_t            *sp,
-       xfs_dfilblks_t          *cp,
+       xfs_fileoff_t           *op,
+       xfs_fsblock_t           *sp,
+       xfs_filblks_t           *cp,
        int                     *fp)
 {
        struct xfs_bmbt_irec    irec;
@@ -302,7 +302,7 @@ make_bbmap(
 
 static xfs_fsblock_t
 select_child(
-       xfs_dfiloff_t   off,
+       xfs_fileoff_t   off,
        xfs_bmbt_key_t  *kp,
        xfs_bmbt_ptr_t  *pp,
        int             nrecs)
index 289528729ffce0fc535bbd7a9b07e6633324944f..fef1d28f56922664ade854b1984781b69f42c616 100644 (file)
--- a/db/bmap.h
+++ b/db/bmap.h
@@ -20,15 +20,15 @@ struct      bbmap;
 struct xfs_bmbt_rec;
 
 typedef struct bmap_ext {
-       xfs_dfiloff_t   startoff;
-       xfs_dfsbno_t    startblock;
-       xfs_dfilblks_t  blockcount;
+       xfs_fileoff_t   startoff;
+       xfs_fsblock_t   startblock;
+       xfs_filblks_t   blockcount;
        int             flag;
 } bmap_ext_t;
 
-extern void    bmap(xfs_dfiloff_t offset, xfs_dfilblks_t len, int whichfork,
+extern void    bmap(xfs_fileoff_t offset, xfs_filblks_t len, int whichfork,
                     int *nexp, bmap_ext_t *bep);
 extern void    bmap_init(void);
-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    convert_extent(struct xfs_bmbt_rec *rp, xfs_fileoff_t *op,
+                              xfs_fsblock_t *sp, xfs_filblks_t *cp, int *fp);
 extern void    make_bbmap(struct bbmap *bbmap, int nex, bmap_ext_t *bmp);
index 0e6762371cd55e5c0b00018b90915ba79efbab07..01f5b6e4d0fe71888143a10abd0d88c2f001ed2d 100644 (file)
@@ -183,8 +183,8 @@ typedef void        (*scan_lbtree_f_t)(struct xfs_btree_block *block,
                                   dbm_t                type,
                                   xfs_fsblock_t        bno,
                                   inodata_t            *id,
-                                  xfs_drfsbno_t        *totd,
-                                  xfs_drfsbno_t        *toti,
+                                  xfs_rfsblock_t       *totd,
+                                  xfs_rfsblock_t       *toti,
                                   xfs_extnum_t         *nex,
                                   blkmap_t             **blkmapp,
                                   int                  isroot,
@@ -233,23 +233,23 @@ static int                check_inomap(xfs_agnumber_t agno, xfs_agblock_t agbno,
 static void            check_linkcounts(xfs_agnumber_t agno);
 static int             check_range(xfs_agnumber_t agno, xfs_agblock_t agbno,
                                    xfs_extlen_t len);
-static void            check_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void            check_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                     dbm_t type);
-static int             check_rinomap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static int             check_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                      xfs_ino_t c_ino);
 static void            check_rootdir(void);
-static int             check_rrange(xfs_drfsbno_t bno, xfs_extlen_t len);
+static int             check_rrange(xfs_rfsblock_t bno, xfs_extlen_t len);
 static void            check_set_dbmap(xfs_agnumber_t agno,
                                        xfs_agblock_t agbno, xfs_extlen_t len,
                                        dbm_t type1, dbm_t type2,
                                        xfs_agnumber_t c_agno,
                                        xfs_agblock_t c_agbno);
-static void            check_set_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void            check_set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                         dbm_t type1, dbm_t type2);
 static void            check_summary(void);
 static void            checknot_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
                                       xfs_extlen_t len, int typemask);
-static void            checknot_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void            checknot_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                        int typemask);
 static void            dir_hash_add(xfs_dahash_t hash,
                                     xfs_dir2_dataptr_t addr);
@@ -268,11 +268,11 @@ static xfs_ino_t  process_block_dir_v2(blkmap_t *blkmap, int *dot,
                                             int *dotdot, inodata_t *id);
 static void            process_bmbt_reclist(xfs_bmbt_rec_t *rp, int numrecs,
                                             dbm_t type, inodata_t *id,
-                                            xfs_drfsbno_t *tot,
+                                            xfs_rfsblock_t *tot,
                                             blkmap_t **blkmapp);
 static void            process_btinode(inodata_t *id, xfs_dinode_t *dip,
-                                       dbm_t type, xfs_drfsbno_t *totd,
-                                       xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+                                       dbm_t type, xfs_rfsblock_t *totd,
+                                       xfs_rfsblock_t *toti, xfs_extnum_t *nex,
                                        blkmap_t **blkmapp, int whichfork);
 static xfs_ino_t       process_data_dir_v2(int *dot, int *dotdot,
                                            inodata_t *id, int v,
@@ -287,14 +287,14 @@ static int                process_dir_v2(xfs_dinode_t *dip, blkmap_t *blkmap,
                                       int *dot, int *dotdot, inodata_t *id,
                                       xfs_ino_t *parent);
 static void            process_exinode(inodata_t *id, xfs_dinode_t *dip,
-                                       dbm_t type, xfs_drfsbno_t *totd,
-                                       xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+                                       dbm_t type, xfs_rfsblock_t *totd,
+                                       xfs_rfsblock_t *toti, xfs_extnum_t *nex,
                                        blkmap_t **blkmapp, int whichfork);
 static void            process_inode(xfs_agf_t *agf, xfs_agino_t agino,
                                      xfs_dinode_t *dip, int isfree);
 static void            process_lclinode(inodata_t *id, xfs_dinode_t *dip,
-                                        dbm_t type, xfs_drfsbno_t *totd,
-                                        xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+                                        dbm_t type, xfs_rfsblock_t *totd,
+                                        xfs_rfsblock_t *toti, xfs_extnum_t *nex,
                                         blkmap_t **blkmapp, int whichfork);
 static xfs_ino_t       process_leaf_node_dir_v2(blkmap_t *blkmap, int *dot,
                                                 int *dotdot, inodata_t *id,
@@ -323,8 +323,8 @@ static void         scan_ag(xfs_agnumber_t agno);
 static void            scan_freelist(xfs_agf_t *agf);
 static void            scan_lbtree(xfs_fsblock_t root, int nlevels,
                                    scan_lbtree_f_t func, dbm_t type,
-                                   inodata_t *id, xfs_drfsbno_t *totd,
-                                   xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+                                   inodata_t *id, xfs_rfsblock_t *totd,
+                                   xfs_rfsblock_t *toti, xfs_extnum_t *nex,
                                    blkmap_t **blkmapp, int isroot,
                                    typnm_t btype);
 static void            scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root,
@@ -332,8 +332,8 @@ static void         scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root,
                                    scan_sbtree_f_t func, typnm_t btype);
 static void            scanfunc_bmap(struct xfs_btree_block *block,
                                      int level, dbm_t type, xfs_fsblock_t bno,
-                                     inodata_t *id, xfs_drfsbno_t *totd,
-                                     xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+                                     inodata_t *id, xfs_rfsblock_t *totd,
+                                     xfs_rfsblock_t *toti, xfs_extnum_t *nex,
                                      blkmap_t **blkmapp, int isroot,
                                      typnm_t btype);
 static void            scanfunc_bno(struct xfs_btree_block *block, int level,
@@ -350,9 +350,9 @@ static void         set_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
                                  xfs_agnumber_t c_agno, xfs_agblock_t c_agbno);
 static void            set_inomap(xfs_agnumber_t agno, xfs_agblock_t agbno,
                                   xfs_extlen_t len, inodata_t *id);
-static void            set_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void            set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                   dbm_t type);
-static void            set_rinomap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void            set_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
                                    inodata_t *id);
 static void            setlink_inode(inodata_t *id, nlink_t nlink, int isdir,
                                       int security);
@@ -997,8 +997,8 @@ blocktrash_f(
 {
        xfs_agblock_t   agbno;
        xfs_agnumber_t  agno;
-       xfs_drfsbno_t   bi;
-       xfs_drfsbno_t   blocks;
+       xfs_rfsblock_t  bi;
+       xfs_rfsblock_t  blocks;
        int             c;
        int             count;
        int             done;
@@ -1011,7 +1011,7 @@ blocktrash_f(
        int             mode;
        struct timeval  now;
        char            *p;
-       xfs_drfsbno_t   randb;
+       xfs_rfsblock_t  randb;
        uint            seed;
        int             sopt;
        int             tmask;
@@ -1135,7 +1135,7 @@ blocktrash_f(
                dbprintf(_("blocktrash: seed %u\n"), seed);
        srandom(seed);
        for (i = 0; i < count; i++) {
-               randb = (xfs_drfsbno_t)((((__int64_t)random() << 32) |
+               randb = (xfs_rfsblock_t)((((__int64_t)random() << 32) |
                                         random()) % blocks);
                for (bi = 0, agno = 0, done = 0;
                     !done && agno < mp->m_sb.sb_agcount;
@@ -1210,7 +1210,7 @@ blockuse_f(
                p = &dbmap[agno][agbno];
                i = inomap[agno][agbno];
                dbprintf(_("block %llu (%u/%u) type %s"),
-                       (xfs_dfsbno_t)XFS_AGB_TO_FSB(mp, agno, agbno),
+                       (xfs_fsblock_t)XFS_AGB_TO_FSB(mp, agno, agbno),
                        agno, agbno, typename[(dbm_t)*p]);
                if (i) {
                        dbprintf(_(" inode %lld"), i->ino);
@@ -1407,7 +1407,7 @@ check_range(
 
 static void
 check_rdbmap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        dbm_t           type)
 {
@@ -1428,7 +1428,7 @@ check_rdbmap(
 
 static int
 check_rinomap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        xfs_ino_t       c_ino)
 {
@@ -1477,7 +1477,7 @@ check_rootdir(void)
 
 static int
 check_rrange(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len)
 {
        xfs_extlen_t    i;
@@ -1525,7 +1525,7 @@ check_set_dbmap(
 
 static void
 check_set_rdbmap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        dbm_t           type1,
        dbm_t           type2)
@@ -1549,7 +1549,7 @@ check_set_rdbmap(
 static void
 check_summary(void)
 {
-       xfs_drfsbno_t   bno;
+       xfs_rfsblock_t  bno;
        xfs_suminfo_t   *csp;
        xfs_suminfo_t   *fsp;
        int             log;
@@ -1596,7 +1596,7 @@ checknot_dbmap(
 
 static void
 checknot_rdbmap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        int             typemask)
 {
@@ -2021,21 +2021,21 @@ process_bmbt_reclist(
        int                     numrecs,
        dbm_t                   type,
        inodata_t               *id,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        blkmap_t                **blkmapp)
 {
        xfs_agblock_t           agbno;
        xfs_agnumber_t          agno;
        xfs_fsblock_t           b;
-       xfs_dfilblks_t          c;
-       xfs_dfilblks_t          cp;
+       xfs_filblks_t           c;
+       xfs_filblks_t           cp;
        int                     f;
        int                     i;
        xfs_agblock_t           iagbno;
        xfs_agnumber_t          iagno;
-       xfs_dfiloff_t           o;
-       xfs_dfiloff_t           op;
-       xfs_dfsbno_t            s;
+       xfs_fileoff_t           o;
+       xfs_fileoff_t           op;
+       xfs_fsblock_t           s;
        int                     v;
 
        cp = op = 0;
@@ -2090,7 +2090,7 @@ process_bmbt_reclist(
                                if (CHECK_BLIST(b))
                                        dbprintf(_("inode %lld block %lld at "
                                                 "offset %lld\n"),
-                                               id->ino, (xfs_dfsbno_t)b, o);
+                                               id->ino, (xfs_fsblock_t)b, o);
                        }
                } else {
                        agno = XFS_FSB_TO_AGNO(mp, (xfs_fsblock_t)s);
@@ -2104,7 +2104,7 @@ process_bmbt_reclist(
                                if (CHECK_BLIST(b))
                                        dbprintf(_("inode %lld block %lld at "
                                                 "offset %lld\n"),
-                                               id->ino, (xfs_dfsbno_t)b, o);
+                                               id->ino, (xfs_fsblock_t)b, o);
                        }
                }
                *tot += c;
@@ -2116,8 +2116,8 @@ process_btinode(
        inodata_t               *id,
        xfs_dinode_t            *dip,
        dbm_t                   type,
-       xfs_drfsbno_t           *totd,
-       xfs_drfsbno_t           *toti,
+       xfs_rfsblock_t          *totd,
+       xfs_rfsblock_t          *toti,
        xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     whichfork)
@@ -2540,8 +2540,8 @@ process_exinode(
        inodata_t               *id,
        xfs_dinode_t            *dip,
        dbm_t                   type,
-       xfs_drfsbno_t           *totd,
-       xfs_drfsbno_t           *toti,
+       xfs_rfsblock_t          *totd,
+       xfs_rfsblock_t          *toti,
        xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     whichfork)
@@ -2576,13 +2576,13 @@ process_inode(
        xfs_extnum_t            nextents = 0;
        int                     nlink;
        int                     security;
-       xfs_drfsbno_t           totblocks;
-       xfs_drfsbno_t           totdblocks = 0;
-       xfs_drfsbno_t           totiblocks = 0;
+       xfs_rfsblock_t          totblocks;
+       xfs_rfsblock_t          totdblocks = 0;
+       xfs_rfsblock_t          totiblocks = 0;
        dbm_t                   type;
        xfs_extnum_t            anextents = 0;
-       xfs_drfsbno_t           atotdblocks = 0;
-       xfs_drfsbno_t           atotiblocks = 0;
+       xfs_rfsblock_t          atotdblocks = 0;
+       xfs_rfsblock_t          atotiblocks = 0;
        xfs_qcnt_t              bc = 0;
        xfs_qcnt_t              ic = 0;
        xfs_qcnt_t              rc = 0;
@@ -2870,8 +2870,8 @@ process_lclinode(
        inodata_t               *id,
        xfs_dinode_t            *dip,
        dbm_t                   type,
-       xfs_drfsbno_t           *totd,
-       xfs_drfsbno_t           *toti,
+       xfs_rfsblock_t          *totd,
+       xfs_rfsblock_t          *toti,
        xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     whichfork)
@@ -2943,7 +2943,7 @@ process_leaf_node_dir_v2(
                if (v)
                        dbprintf(_("dir inode %lld block %u=%llu\n"), id->ino,
                                (__uint32_t)dbno,
-                               (xfs_dfsbno_t)bmp->startblock);
+                               (xfs_fsblock_t)bmp->startblock);
                push_cur();
                if (nex > 1)
                        make_bbmap(&bbmap, nex, bmp);
@@ -3230,8 +3230,8 @@ process_quota(
                        if (scicb)
                                dbprintf(_("can't read block %lld for %s quota "
                                         "inode (fsblock %lld)\n"),
-                                       (xfs_dfiloff_t)qbno, s,
-                                       (xfs_dfsbno_t)bno);
+                                       (xfs_fileoff_t)qbno, s,
+                                       (xfs_fsblock_t)bno);
                        error++;
                        pop_cur();
                        continue;
@@ -3240,7 +3240,7 @@ process_quota(
                        if (verbose || id->ilist || cb)
                                dbprintf(_("%s dqblk %lld entry %d id %u bc "
                                         "%lld ic %lld rc %lld\n"),
-                                       s, (xfs_dfiloff_t)qbno, i, dqid,
+                                       s, (xfs_fileoff_t)qbno, i, dqid,
                                        be64_to_cpu(dqb->dd_diskdq.d_bcount),
                                        be64_to_cpu(dqb->dd_diskdq.d_icount),
                                        be64_to_cpu(dqb->dd_diskdq.d_rtbcount));
@@ -3249,7 +3249,7 @@ process_quota(
                                        dbprintf(_("bad magic number %#x for %s "
                                                 "dqblk %lld entry %d id %u\n"),
                                                be16_to_cpu(dqb->dd_diskdq.d_magic), s,
-                                               (xfs_dfiloff_t)qbno, i, dqid);
+                                               (xfs_fileoff_t)qbno, i, dqid);
                                error++;
                                continue;
                        }
@@ -3259,7 +3259,7 @@ process_quota(
                                                 "%s dqblk %lld entry %d id "
                                                 "%u\n"),
                                                dqb->dd_diskdq.d_version, s,
-                                               (xfs_dfiloff_t)qbno, i, dqid);
+                                               (xfs_fileoff_t)qbno, i, dqid);
                                error++;
                                continue;
                        }
@@ -3268,7 +3268,7 @@ process_quota(
                                        dbprintf(_("bad flags %#x for %s dqblk "
                                                 "%lld entry %d id %u\n"),
                                                dqb->dd_diskdq.d_flags, s,
-                                               (xfs_dfiloff_t)qbno, i, dqid);
+                                               (xfs_fileoff_t)qbno, i, dqid);
                                error++;
                                continue;
                        }
@@ -3277,7 +3277,7 @@ process_quota(
                                        dbprintf(_("bad id %u for %s dqblk %lld "
                                                 "entry %d id %u\n"),
                                                be32_to_cpu(dqb->dd_diskdq.d_id), s,
-                                               (xfs_dfiloff_t)qbno, i, dqid);
+                                               (xfs_fileoff_t)qbno, i, dqid);
                                error++;
                                continue;
                        }
@@ -3301,12 +3301,12 @@ process_rtbitmap(
        int             bitsperblock;
        xfs_fileoff_t   bmbno;
        xfs_fsblock_t   bno;
-       xfs_drtbno_t    extno;
+       xfs_rtblock_t   extno;
        int             len;
        int             log;
        int             offs;
        int             prevbit;
-       xfs_drfsbno_t   rtbno;
+       xfs_rfsblock_t  rtbno;
        int             start_bmbno;
        int             start_bit;
        int             t;
@@ -3322,7 +3322,7 @@ process_rtbitmap(
                        if (!sflag)
                                dbprintf(_("block %lld for rtbitmap inode is "
                                         "missing\n"),
-                                       (xfs_dfiloff_t)bmbno);
+                                       (xfs_fileoff_t)bmbno);
                        error++;
                        continue;
                }
@@ -3333,7 +3333,7 @@ process_rtbitmap(
                        if (!sflag)
                                dbprintf(_("can't read block %lld for rtbitmap "
                                         "inode\n"),
-                                       (xfs_dfiloff_t)bmbno);
+                                       (xfs_fileoff_t)bmbno);
                        error++;
                        pop_cur();
                        continue;
@@ -3389,7 +3389,7 @@ process_rtsummary(
                        if (!sflag)
                                dbprintf(_("block %lld for rtsummary inode is "
                                         "missing\n"),
-                                       (xfs_dfiloff_t)sumbno);
+                                       (xfs_fileoff_t)sumbno);
                        error++;
                        continue;
                }
@@ -3400,7 +3400,7 @@ process_rtsummary(
                        if (!sflag)
                                dbprintf(_("can't read block %lld for rtsummary "
                                         "inode\n"),
-                                       (xfs_dfiloff_t)sumbno);
+                                       (xfs_fileoff_t)sumbno);
                        error++;
                        pop_cur();
                        continue;
@@ -3885,8 +3885,8 @@ scan_lbtree(
        scan_lbtree_f_t func,
        dbm_t           type,
        inodata_t       *id,
-       xfs_drfsbno_t   *totd,
-       xfs_drfsbno_t   *toti,
+       xfs_rfsblock_t  *totd,
+       xfs_rfsblock_t  *toti,
        xfs_extnum_t    *nex,
        blkmap_t        **blkmapp,
        int             isroot,
@@ -3941,8 +3941,8 @@ scanfunc_bmap(
        dbm_t                   type,
        xfs_fsblock_t           bno,
        inodata_t               *id,
-       xfs_drfsbno_t           *totd,
-       xfs_drfsbno_t           *toti,
+       xfs_rfsblock_t          *totd,
+       xfs_rfsblock_t          *toti,
        xfs_extnum_t            *nex,
        blkmap_t                **blkmapp,
        int                     isroot,
@@ -3981,7 +3981,7 @@ scanfunc_bmap(
                                         "in inode %lld bmap block %lld\n"),
                                        be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[0],
                                        mp->m_bmap_dmxr[0], id->ino,
-                                       (xfs_dfsbno_t)bno);
+                                       (xfs_fsblock_t)bno);
                        error++;
                        return;
                }
@@ -3997,7 +3997,7 @@ scanfunc_bmap(
                        dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
                                 "inode %lld bmap block %lld\n"),
                                be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[1],
-                               mp->m_bmap_dmxr[1], id->ino, (xfs_dfsbno_t)bno);
+                               mp->m_bmap_dmxr[1], id->ino, (xfs_fsblock_t)bno);
                error++;
                return;
        }
@@ -4306,7 +4306,7 @@ set_inomap(
 
 static void
 set_rdbmap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        dbm_t           type)
 {
@@ -4315,7 +4315,7 @@ set_rdbmap(
 
 static void
 set_rinomap(
-       xfs_drfsbno_t   bno,
+       xfs_rfsblock_t  bno,
        xfs_extlen_t    len,
        inodata_t       *id)
 {
index 437324109c1addbb6391d8659431f3a813b8df91..d40717da8bd2f231621abfffa4f61c62e4952b1f 100644 (file)
@@ -80,7 +80,7 @@ fa_attrblock(
 {
        bmap_ext_t      bm;
        __uint32_t      bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fsblock_t   dfsbno;
        int             nex;
 
        bno = (__uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
@@ -107,13 +107,13 @@ fa_cfileoffa(
        typnm_t         next)
 {
        bmap_ext_t      bm;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             nex;
 
-       bno = (xfs_dfiloff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
+       bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
                BVUNSIGNED);
-       if (bno == NULLDFILOFF) {
+       if (bno == NULLFILEOFF) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -137,14 +137,14 @@ fa_cfileoffd(
 {
        bbmap_t         bbmap;
        bmap_ext_t      *bmp;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             nb;
        int             nex;
 
-       bno = (xfs_dfiloff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
+       bno = (xfs_fileoff_t)getbitval(obj, bit, BMBT_STARTOFF_BITLEN,
                BVUNSIGNED);
-       if (bno == NULLDFILOFF) {
+       if (bno == NULLFILEOFF) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -171,12 +171,12 @@ fa_cfsblock(
        int             bit,
        typnm_t         next)
 {
-       xfs_dfsbno_t    bno;
+       xfs_fsblock_t   bno;
        int             nb;
 
-       bno = (xfs_dfsbno_t)getbitval(obj, bit, BMBT_STARTBLOCK_BITLEN,
+       bno = (xfs_fsblock_t)getbitval(obj, bit, BMBT_STARTBLOCK_BITLEN,
                BVUNSIGNED);
-       if (bno == NULLDFSBNO) {
+       if (bno == NULLFSBLOCK) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -193,12 +193,12 @@ fa_dfiloffa(
        typnm_t         next)
 {
        bmap_ext_t      bm;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             nex;
 
-       bno = (xfs_dfiloff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
-       if (bno == NULLDFILOFF) {
+       bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
+       if (bno == NULLFILEOFF) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -222,13 +222,13 @@ fa_dfiloffd(
 {
        bbmap_t         bbmap;
        bmap_ext_t      *bmp;
-       xfs_dfiloff_t   bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fileoff_t   bno;
+       xfs_fsblock_t   dfsbno;
        int             nb;
        int             nex;
 
-       bno = (xfs_dfiloff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
-       if (bno == NULLDFILOFF) {
+       bno = (xfs_fileoff_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
+       if (bno == NULLFILEOFF) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -255,10 +255,10 @@ fa_dfsbno(
        int             bit,
        typnm_t         next)
 {
-       xfs_dfsbno_t    bno;
+       xfs_fsblock_t   bno;
 
-       bno = (xfs_dfsbno_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
-       if (bno == NULLDFSBNO) {
+       bno = (xfs_fsblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
+       if (bno == NULLFSBLOCK) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -277,7 +277,7 @@ fa_dirblock(
        bbmap_t         bbmap;
        bmap_ext_t      *bmp;
        __uint32_t      bno;
-       xfs_dfsbno_t    dfsbno;
+       xfs_fsblock_t   dfsbno;
        int             nex;
 
        bno = (__uint32_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
@@ -309,10 +309,10 @@ fa_drfsbno(
        int             bit,
        typnm_t         next)
 {
-       xfs_drfsbno_t   bno;
+       xfs_rfsblock_t  bno;
 
-       bno = (xfs_drfsbno_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
-       if (bno == NULLDRFSBNO) {
+       bno = (xfs_rfsblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
+       if (bno == NULLRFSBLOCK) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
@@ -328,10 +328,10 @@ fa_drtbno(
        int     bit,
        typnm_t next)
 {
-       xfs_drtbno_t    bno;
+       xfs_rtblock_t   bno;
 
-       bno = (xfs_drtbno_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
-       if (bno == NULLDRTBNO) {
+       bno = (xfs_rtblock_t)getbitval(obj, bit, bitsz(bno), BVUNSIGNED);
+       if (bno == NULLRTBLOCK) {
                dbprintf(_("null block number, cannot set new addr\n"));
                return;
        }
index 4582097647678f897314d194cde13cfc0344a238..816065e7471d8cf5d513fa629ddb663665a14d2e 100644 (file)
@@ -169,11 +169,11 @@ const ftattr_t    ftattrtab[] = {
          0, NULL, NULL },
 
        { FLDT_DEV, "dev", fp_num, "%#x", SI(bitsz(xfs_dev_t)), 0, NULL, NULL },
-       { FLDT_DFILOFFA, "dfiloffa", fp_num, "%llu", SI(bitsz(xfs_dfiloff_t)),
+       { FLDT_DFILOFFA, "dfiloffa", fp_num, "%llu", SI(bitsz(xfs_fileoff_t)),
          0, fa_dfiloffa, NULL },
-       { FLDT_DFILOFFD, "dfiloffd", fp_num, "%llu", SI(bitsz(xfs_dfiloff_t)),
+       { FLDT_DFILOFFD, "dfiloffd", fp_num, "%llu", SI(bitsz(xfs_fileoff_t)),
          0, fa_dfiloffd, NULL },
-       { FLDT_DFSBNO, "dfsbno", fp_num, "%llu", SI(bitsz(xfs_dfsbno_t)),
+       { FLDT_DFSBNO, "dfsbno", fp_num, "%llu", SI(bitsz(xfs_fsblock_t)),
          FTARG_DONULL, fa_dfsbno, NULL },
        { FLDT_DINODE_A, "dinode_a", NULL, (char *)inode_a_flds, inode_a_size,
          FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_a_flds },
@@ -269,9 +269,9 @@ const ftattr_t      ftattrtab[] = {
          0, NULL, dqblk_flds },
        { FLDT_DQID, "dqid", fp_num, "%d", SI(bitsz(xfs_dqid_t)), 0, NULL,
          NULL },
-       { FLDT_DRFSBNO, "drfsbno", fp_num, "%llu", SI(bitsz(xfs_drfsbno_t)),
+       { FLDT_DRFSBNO, "drfsbno", fp_num, "%llu", SI(bitsz(xfs_rfsblock_t)),
          FTARG_DONULL, fa_drfsbno, NULL },
-       { FLDT_DRTBNO, "drtbno", fp_num, "%llu", SI(bitsz(xfs_drtbno_t)),
+       { FLDT_DRTBNO, "drtbno", fp_num, "%llu", SI(bitsz(xfs_rtblock_t)),
          FTARG_DONULL, fa_drtbno, NULL },
        { FLDT_EXTLEN, "extlen", fp_num, "%u", SI(bitsz(xfs_extlen_t)), 0, NULL,
          NULL },
index ed401e83481d0d5255e19521eb2e493e95ff3afe..d8ad25eb2ccbe7e446655b960e6248b50b69af23 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -227,11 +227,11 @@ process_bmbt_reclist(
        int                     numrecs,
        extmap_t                **extmapp)
 {
-       xfs_dfilblks_t          c;
+       xfs_filblks_t           c;
        int                     f;
        int                     i;
-       xfs_dfiloff_t           o;
-       xfs_dfsbno_t            s;
+       xfs_fileoff_t           o;
+       xfs_fsblock_t           s;
 
        for (i = 0; i < numrecs; i++, rp++) {
                convert_extent(rp, &o, &s, &c, &f);
diff --git a/db/io.c b/db/io.c
index 0a9f756d5db6a4fd92b6b04c5097e3814f380a42..b55a5fb60d239f61da4fffed70153e56130fc114 100644 (file)
--- a/db/io.c
+++ b/db/io.c
@@ -151,7 +151,7 @@ print_iocur(
        dbprintf("%s\n", tag);
        dbprintf(_("\tbyte offset %lld, length %d\n"), ioc->off, ioc->len);
        dbprintf(_("\tbuffer block %lld (fsbno %lld), %d bb%s\n"), ioc->bb,
-               (xfs_dfsbno_t)XFS_DADDR_TO_FSB(mp, ioc->bb), ioc->blen,
+               (xfs_fsblock_t)XFS_DADDR_TO_FSB(mp, ioc->bb), ioc->blen,
                ioc->blen == 1 ? "" : "s");
        if (ioc->bbmap) {
                dbprintf(_("\tblock map"));
@@ -189,7 +189,7 @@ print_ring(void)
                         ioc->typ == NULL ? "none" : ioc->typ->name,
                         ioc->bb,
                         ioc->blen,
-                        (xfs_dfsbno_t)XFS_DADDR_TO_FSB(mp, ioc->bb),
+                        (xfs_fsblock_t)XFS_DADDR_TO_FSB(mp, ioc->bb),
                         ioc->ino
                        );
 
index 7a7cf2e47593babae8faa478477ef13d45c02fa7..edd4363d13af63a84d0e857aff3ffd713b0bc869 100644 (file)
@@ -418,7 +418,7 @@ valid_bno(
                return 1;
        if (agno == (mp->m_sb.sb_agcount - 1) && agbno > 0 &&
                        agbno <= (mp->m_sb.sb_dblocks -
-                        (xfs_drfsbno_t)(mp->m_sb.sb_agcount - 1) *
+                        (xfs_rfsblock_t)(mp->m_sb.sb_agcount - 1) *
                         mp->m_sb.sb_agblocks))
                return 1;
 
@@ -1279,7 +1279,7 @@ process_sf_attr(
 static void
 process_dir_data_block(
        char            *block,
-       xfs_dfiloff_t   offset,
+       xfs_fileoff_t   offset,
        int             is_block_format)
 {
        /*
@@ -1577,11 +1577,11 @@ process_attr_block(
 /* Processes symlinks, attrs, directories ... */
 static int
 process_single_fsb_objects(
-       xfs_dfiloff_t   o,
-       xfs_dfsbno_t    s,
-       xfs_dfilblks_t  c,
+       xfs_fileoff_t   o,
+       xfs_fsblock_t   s,
+       xfs_filblks_t   c,
        typnm_t         btype,
-       xfs_dfiloff_t   last)
+       xfs_fileoff_t   last)
 {
        char            *dp;
        int             ret = 0;
@@ -1675,11 +1675,11 @@ static int mfsb_length;
 
 static int
 process_multi_fsb_objects(
-       xfs_dfiloff_t   o,
-       xfs_dfsbno_t    s,
-       xfs_dfilblks_t  c,
+       xfs_fileoff_t   o,
+       xfs_fsblock_t   s,
+       xfs_filblks_t   c,
        typnm_t         btype,
-       xfs_dfiloff_t   last)
+       xfs_fileoff_t   last)
 {
        int             ret = 0;
 
@@ -1752,11 +1752,11 @@ process_bmbt_reclist(
        typnm_t                 btype)
 {
        int                     i;
-       xfs_dfiloff_t           o, op = NULLDFILOFF;
-       xfs_dfsbno_t            s;
-       xfs_dfilblks_t          c, cp = NULLDFILOFF;
+       xfs_fileoff_t           o, op = NULLFILEOFF;
+       xfs_fsblock_t           s;
+       xfs_filblks_t           c, cp = NULLFILEOFF;
        int                     f;
-       xfs_dfiloff_t           last;
+       xfs_fileoff_t           last;
        xfs_agnumber_t          agno;
        xfs_agblock_t           agbno;
        int                     error;
index 580604cbad75cab8c311ea9f847355fccc85004f..2fc94c78425ca1b2e5c9fc87278dc23142c3d607 100644 (file)
@@ -21,7 +21,6 @@
 #include <xfs/xfs_types.h>
 #include <xfs/jdm.h>
 #include <xfs/xfs_bmap_btree.h>
-#include <xfs/xfs_dinode.h>
 #include <xfs/xfs_attr_sf.h>
 
 #include <fcntl.h>
index 5629f28d5ece329420c4da1202cf9615801f70e9..9398e1182f7ac59f85ecff90f22ee91353b465fc 100644 (file)
@@ -19,9 +19,6 @@
 #ifndef __LIBXFS_H__
 #define __LIBXFS_H__
 
-#define XFS_BIG_INUMS  1
-#define XFS_BIG_BLKNOS 1
-
 #include <xfs/platform_defs.h>
 
 #include <xfs/list.h>
@@ -44,9 +41,7 @@
 #include <xfs/xfs_trans_resv.h>
 
 #include <xfs/xfs_bit.h>
-#include <xfs/xfs_inum.h>
 #include <xfs/xfs_sb.h>
-#include <xfs/xfs_ag.h>
 #include <xfs/xfs_da_format.h>
 #include <xfs/xfs_da_btree.h>
 #include <xfs/xfs_dir2.h>
@@ -54,7 +49,6 @@
 #include <xfs/xfs_alloc_btree.h>
 #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_buf.h>
 #include <xfs/xfs_alloc.h>
index d5e591a8a4307ce728e8bf66527b4b10f5dbdd15..07026c097f16c1fc48b0ed0e5d2305468ab8946f 100644 (file)
 #ifndef __XFS_ARCH_H__
 #define __XFS_ARCH_H__
 
-#ifndef XFS_BIG_INUMS
-# error XFS_BIG_INUMS must be defined true or false
-#endif
-
-#ifdef __KERNEL__
-
-#include <asm/byteorder.h>
-
-#ifdef __BIG_ENDIAN
-#define        XFS_NATIVE_HOST 1
-#else
-#undef XFS_NATIVE_HOST
-#endif
-
-#else /* __KERNEL__ */
-
 #if __BYTE_ORDER == __BIG_ENDIAN
 #define        XFS_NATIVE_HOST 1
 #else
@@ -87,8 +71,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)
        *a = cpu_to_be64(be64_to_cpu(*a) + b);
 }
 
-#endif /* __KERNEL__ */
-
 /*
  * get and set integers from potentially unaligned locations
  */
index 801282389ccabc9d66ad78ece13ac28b51b6bc3d..0b67ea008c1e2d871194ffe88ab21f939926ff44 100644 (file)
@@ -22,8 +22,7 @@ HFILES = xfs.h \
        xfs_dir2_priv.h \
 
 # headers installed in QA targets
-QAHFILES = xfs_ag.h \
-       xfs_alloc.h \
+QAHFILES = xfs_alloc.h \
        xfs_alloc_btree.h \
        xfs_attr_leaf.h \
        xfs_attr_sf.h \
@@ -35,14 +34,12 @@ QAHFILES = xfs_ag.h \
        xfs_cksum.h \
        xfs_da_btree.h \
        xfs_da_format.h \
-       xfs_dinode.h \
        xfs_dir2.h \
        xfs_format.h \
        xfs_ialloc.h \
        xfs_ialloc_btree.h \
        xfs_inode_buf.h \
        xfs_inode_fork.h \
-       xfs_inum.h \
        xfs_log_format.h \
        xfs_quota_defs.h \
        xfs_sb.h \
index 8f3842611cd1eec0628b338741018d2e2471928e..18a443afba47a126d2dc1c995c36e4d70e9d1945 100644 (file)
@@ -493,6 +493,7 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
                return ip->i_size;
        return ip->i_d.di_size;
 }
+#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
 
 /* xfs_mount.c */
 int xfs_initialize_perag_data(xfs_mount_t *, xfs_agnumber_t);
diff --git a/libxfs/xfs_ag.h b/libxfs/xfs_ag.h
deleted file mode 100644 (file)
index 6e247a9..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2000-2003,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_AG_H__
-#define        __XFS_AG_H__
-
-/*
- * Allocation group header
- * This is divided into three structures, placed in sequential 512-byte
- * buffers after a copy of the superblock (also in a 512-byte buffer).
- */
-
-struct xfs_buf;
-struct xfs_mount;
-struct xfs_trans;
-
-#define        XFS_AGF_MAGIC   0x58414746      /* 'XAGF' */
-#define        XFS_AGI_MAGIC   0x58414749      /* 'XAGI' */
-#define        XFS_AGFL_MAGIC  0x5841464c      /* 'XAFL' */
-#define        XFS_AGF_VERSION 1
-#define        XFS_AGI_VERSION 1
-
-#define        XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
-#define        XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
-
-/*
- * Btree number 0 is bno, 1 is cnt.  This value gives the size of the
- * arrays below.
- */
-#define        XFS_BTNUM_AGF   ((int)XFS_BTNUM_CNTi + 1)
-
-/*
- * The second word of agf_levels in the first a.g. overlaps the EFS
- * superblock's magic number.  Since the magic numbers valid for EFS
- * are > 64k, our value cannot be confused for an EFS superblock's.
- */
-
-typedef struct xfs_agf {
-       /*
-        * Common allocation group header information
-        */
-       __be32          agf_magicnum;   /* magic number == XFS_AGF_MAGIC */
-       __be32          agf_versionnum; /* header version == XFS_AGF_VERSION */
-       __be32          agf_seqno;      /* sequence # starting from 0 */
-       __be32          agf_length;     /* size in blocks of a.g. */
-       /*
-        * Freespace information
-        */
-       __be32          agf_roots[XFS_BTNUM_AGF];       /* root blocks */
-       __be32          agf_spare0;     /* spare field */
-       __be32          agf_levels[XFS_BTNUM_AGF];      /* btree levels */
-       __be32          agf_spare1;     /* spare field */
-
-       __be32          agf_flfirst;    /* first freelist block's index */
-       __be32          agf_fllast;     /* last freelist block's index */
-       __be32          agf_flcount;    /* count of blocks in freelist */
-       __be32          agf_freeblks;   /* total free blocks */
-
-       __be32          agf_longest;    /* longest free space */
-       __be32          agf_btreeblks;  /* # of blocks held in AGF btrees */
-       uuid_t          agf_uuid;       /* uuid of filesystem */
-
-       /*
-        * reserve some contiguous space for future logged fields before we add
-        * the unlogged fields. This makes the range logging via flags and
-        * structure offsets much simpler.
-        */
-       __be64          agf_spare64[16];
-
-       /* unlogged fields, written during buffer writeback. */
-       __be64          agf_lsn;        /* last write sequence */
-       __be32          agf_crc;        /* crc of agf sector */
-       __be32          agf_spare2;
-
-       /* structure must be padded to 64 bit alignment */
-} xfs_agf_t;
-
-#define XFS_AGF_CRC_OFF                offsetof(struct xfs_agf, agf_crc)
-
-#define        XFS_AGF_MAGICNUM        0x00000001
-#define        XFS_AGF_VERSIONNUM      0x00000002
-#define        XFS_AGF_SEQNO           0x00000004
-#define        XFS_AGF_LENGTH          0x00000008
-#define        XFS_AGF_ROOTS           0x00000010
-#define        XFS_AGF_LEVELS          0x00000020
-#define        XFS_AGF_FLFIRST         0x00000040
-#define        XFS_AGF_FLLAST          0x00000080
-#define        XFS_AGF_FLCOUNT         0x00000100
-#define        XFS_AGF_FREEBLKS        0x00000200
-#define        XFS_AGF_LONGEST         0x00000400
-#define        XFS_AGF_BTREEBLKS       0x00000800
-#define        XFS_AGF_UUID            0x00001000
-#define        XFS_AGF_NUM_BITS        13
-#define        XFS_AGF_ALL_BITS        ((1 << XFS_AGF_NUM_BITS) - 1)
-
-#define XFS_AGF_FLAGS \
-       { XFS_AGF_MAGICNUM,     "MAGICNUM" }, \
-       { XFS_AGF_VERSIONNUM,   "VERSIONNUM" }, \
-       { XFS_AGF_SEQNO,        "SEQNO" }, \
-       { XFS_AGF_LENGTH,       "LENGTH" }, \
-       { XFS_AGF_ROOTS,        "ROOTS" }, \
-       { XFS_AGF_LEVELS,       "LEVELS" }, \
-       { XFS_AGF_FLFIRST,      "FLFIRST" }, \
-       { XFS_AGF_FLLAST,       "FLLAST" }, \
-       { XFS_AGF_FLCOUNT,      "FLCOUNT" }, \
-       { XFS_AGF_FREEBLKS,     "FREEBLKS" }, \
-       { XFS_AGF_LONGEST,      "LONGEST" }, \
-       { XFS_AGF_BTREEBLKS,    "BTREEBLKS" }, \
-       { XFS_AGF_UUID,         "UUID" }
-
-/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGF_DADDR(mp)      ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
-#define        XFS_AGF_BLOCK(mp)       XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
-#define        XFS_BUF_TO_AGF(bp)      ((xfs_agf_t *)((bp)->b_addr))
-
-extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
-                       xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
-
-/*
- * Size of the unlinked inode hash table in the agi.
- */
-#define        XFS_AGI_UNLINKED_BUCKETS        64
-
-typedef struct xfs_agi {
-       /*
-        * Common allocation group header information
-        */
-       __be32          agi_magicnum;   /* magic number == XFS_AGI_MAGIC */
-       __be32          agi_versionnum; /* header version == XFS_AGI_VERSION */
-       __be32          agi_seqno;      /* sequence # starting from 0 */
-       __be32          agi_length;     /* size in blocks of a.g. */
-       /*
-        * Inode information
-        * Inodes are mapped by interpreting the inode number, so no
-        * mapping data is needed here.
-        */
-       __be32          agi_count;      /* count of allocated inodes */
-       __be32          agi_root;       /* root of inode btree */
-       __be32          agi_level;      /* levels in inode btree */
-       __be32          agi_freecount;  /* number of free inodes */
-
-       __be32          agi_newino;     /* new inode just allocated */
-       __be32          agi_dirino;     /* last directory inode chunk */
-       /*
-        * Hash table of inodes which have been unlinked but are
-        * still being referenced.
-        */
-       __be32          agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
-       /*
-        * This marks the end of logging region 1 and start of logging region 2.
-        */
-       uuid_t          agi_uuid;       /* uuid of filesystem */
-       __be32          agi_crc;        /* crc of agi sector */
-       __be32          agi_pad32;
-       __be64          agi_lsn;        /* last write sequence */
-
-       __be32          agi_free_root; /* root of the free inode btree */
-       __be32          agi_free_level;/* levels in free inode btree */
-
-       /* structure must be padded to 64 bit alignment */
-} xfs_agi_t;
-
-#define XFS_AGI_CRC_OFF                offsetof(struct xfs_agi, agi_crc)
-
-#define        XFS_AGI_MAGICNUM        (1 << 0)
-#define        XFS_AGI_VERSIONNUM      (1 << 1)
-#define        XFS_AGI_SEQNO           (1 << 2)
-#define        XFS_AGI_LENGTH          (1 << 3)
-#define        XFS_AGI_COUNT           (1 << 4)
-#define        XFS_AGI_ROOT            (1 << 5)
-#define        XFS_AGI_LEVEL           (1 << 6)
-#define        XFS_AGI_FREECOUNT       (1 << 7)
-#define        XFS_AGI_NEWINO          (1 << 8)
-#define        XFS_AGI_DIRINO          (1 << 9)
-#define        XFS_AGI_UNLINKED        (1 << 10)
-#define        XFS_AGI_NUM_BITS_R1     11      /* end of the 1st agi logging region */
-#define        XFS_AGI_ALL_BITS_R1     ((1 << XFS_AGI_NUM_BITS_R1) - 1)
-#define        XFS_AGI_FREE_ROOT       (1 << 11)
-#define        XFS_AGI_FREE_LEVEL      (1 << 12)
-#define        XFS_AGI_NUM_BITS_R2     13
-
-/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGI_DADDR(mp)      ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
-#define        XFS_AGI_BLOCK(mp)       XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
-#define        XFS_BUF_TO_AGI(bp)      ((xfs_agi_t *)((bp)->b_addr))
-
-extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
-                               xfs_agnumber_t agno, struct xfs_buf **bpp);
-
-/*
- * The third a.g. block contains the a.g. freelist, an array
- * of block pointers to blocks owned by the allocation btree code.
- */
-#define XFS_AGFL_DADDR(mp)     ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
-#define        XFS_AGFL_BLOCK(mp)      XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
-#define        XFS_BUF_TO_AGFL(bp)     ((xfs_agfl_t *)((bp)->b_addr))
-
-#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
-       (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
-               &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
-               (__be32 *)(bp)->b_addr)
-
-/*
- * Size of the AGFL.  For CRC-enabled filesystes we steal a couple of
- * slots in the beginning of the block for a proper header with the
- * location information and CRC.
- */
-#define XFS_AGFL_SIZE(mp) \
-       (((mp)->m_sb.sb_sectsize - \
-        (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
-               sizeof(struct xfs_agfl) : 0)) / \
-         sizeof(xfs_agblock_t))
-
-typedef struct xfs_agfl {
-       __be32          agfl_magicnum;
-       __be32          agfl_seqno;
-       uuid_t          agfl_uuid;
-       __be64          agfl_lsn;
-       __be32          agfl_crc;
-       __be32          agfl_bno[];     /* actually XFS_AGFL_SIZE(mp) */
-} xfs_agfl_t;
-
-#define XFS_AGFL_CRC_OFF       offsetof(struct xfs_agfl, agfl_crc)
-
-/*
- * tags for inode radix tree
- */
-#define XFS_ICI_NO_TAG         (-1)    /* special flag for an untagged lookup
-                                          in xfs_inode_ag_iterator */
-#define XFS_ICI_RECLAIM_TAG    0       /* inode is to be reclaimed */
-#define XFS_ICI_EOFBLOCKS_TAG  1       /* inode has blocks beyond EOF */
-
-#define        XFS_AG_MAXLEVELS(mp)            ((mp)->m_ag_maxlevels)
-#define        XFS_MIN_FREELIST_RAW(bl,cl,mp)  \
-       (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
-#define        XFS_MIN_FREELIST(a,mp)          \
-       (XFS_MIN_FREELIST_RAW(          \
-               be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
-               be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
-#define        XFS_MIN_FREELIST_PAG(pag,mp)    \
-       (XFS_MIN_FREELIST_RAW(          \
-               (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
-               (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
-
-#define XFS_AGB_TO_FSB(mp,agno,agbno)  \
-       (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
-#define        XFS_FSB_TO_AGNO(mp,fsbno)       \
-       ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
-#define        XFS_FSB_TO_AGBNO(mp,fsbno)      \
-       ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
-#define        XFS_AGB_TO_DADDR(mp,agno,agbno) \
-       ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
-               (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
-#define        XFS_AG_DADDR(mp,agno,d)         (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
-
-/*
- * For checking for bad ranges of xfs_daddr_t's, covering multiple
- * allocation groups or a single xfs_daddr_t that's a superblock copy.
- */
-#define        XFS_AG_CHECK_DADDR(mp,d,len)    \
-       ((len) == 1 ? \
-           ASSERT((d) == XFS_SB_DADDR || \
-                  xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
-           ASSERT(xfs_daddr_to_agno(mp, d) == \
-                  xfs_daddr_to_agno(mp, (d) + (len) - 1)))
-
-#endif /* __XFS_AG_H__ */
index b795bd3ae94143aa511184c47a75641a20e23b8b..d33b4c53f285fab59c180e7fde9cdf430fa5da94 100644 (file)
@@ -2189,6 +2189,10 @@ xfs_agf_verify(
              be32_to_cpu(agf->agf_flcount) <= XFS_AGFL_SIZE(mp)))
                return false;
 
+       if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > XFS_BTREE_MAXLEVELS ||
+           be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > XFS_BTREE_MAXLEVELS)
+               return false;
+
        /*
         * during growfs operations, the perag is not fully initialised,
         * so we can't use it for any useful checking. growfs ensures we can't
index feacb061bab78bb3492ee0ff37eed5cc0fb95894..d1b4b6a5c8947ee038392ac877f58aeb6063e024 100644 (file)
@@ -231,4 +231,7 @@ xfs_alloc_get_rec(
        xfs_extlen_t            *len,   /* output: length of extent */
        int                     *stat); /* output: success/failure */
 
+int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
+                       xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
+
 #endif /* __XFS_ALLOC_H__ */
index fcfa1814b9bcc3353411f03c3878470d31f382e8..e2929da7c3ba40c1156bfcfe762f2f076389e64f 100644 (file)
@@ -56,7 +56,7 @@ int   xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
 
 
 /*
- * Internal routines when attribute fork size == mp->m_sb.sb_blocksize 
+ * Internal routines when attribute fork size == XFS_LBSIZE(mp).
  */
 int    xfs_attr3_leaf_to_node(struct xfs_da_args *args);
 int    xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
index c50546747b10c8d9d39e327a5815038a7d2535f3..991584775aec4ff195757df3e17344edbe0a26b4 100644 (file)
@@ -359,7 +359,7 @@ xfs_bmap_check_leaf_extents(
        pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
        bno = be64_to_cpu(*pp);
 
-       ASSERT(bno != NULLDFSBNO);
+       ASSERT(bno != NULLFSBLOCK);
        ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
        ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
 
@@ -1266,7 +1266,7 @@ xfs_bmap_read_extents(
        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(bno != NULLFSBLOCK);
        ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
        ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
        /*
@@ -1396,11 +1396,7 @@ xfs_bmap_search_multi_extents(
        gotp->br_startoff = 0xffa5a5a5a5a5a5a5LL;
        gotp->br_blockcount = 0xa55a5a5a5a5a5a5aLL;
        gotp->br_state = XFS_EXT_INVALID;
-#if XFS_BIG_BLKNOS
        gotp->br_startblock = 0xffffa5a5a5a5a5a5LL;
-#else
-       gotp->br_startblock = 0xffffa5a5;
-#endif
        prevp->br_startoff = NULLFILEOFF;
 
        ep = xfs_iext_bno_to_ext(ifp, bno, &lastx);
@@ -5374,40 +5370,216 @@ error0:
        return error;
 }
 
+/*
+ * Determine whether an extent shift can be accomplished by a merge with the
+ * extent that precedes the target hole of the shift.
+ */
+STATIC bool
+xfs_bmse_can_merge(
+       struct xfs_bmbt_irec    *left,  /* preceding extent */
+       struct xfs_bmbt_irec    *got,   /* current extent to shift */
+       xfs_fileoff_t           shift)  /* shift fsb */
+{
+       xfs_fileoff_t           startoff;
+
+       startoff = got->br_startoff - shift;
+
+       /*
+        * The extent, once shifted, must be adjacent in-file and on-disk with
+        * the preceding extent.
+        */
+       if ((left->br_startoff + left->br_blockcount != startoff) ||
+           (left->br_startblock + left->br_blockcount != got->br_startblock) ||
+           (left->br_state != got->br_state) ||
+           (left->br_blockcount + got->br_blockcount > MAXEXTLEN))
+               return false;
+
+       return true;
+}
+
+/*
+ * A bmap extent shift adjusts the file offset of an extent to fill a preceding
+ * hole in the file. If an extent shift would result in the extent being fully
+ * adjacent to the extent that currently precedes the hole, we can merge with
+ * the preceding extent rather than do the shift.
+ *
+ * This function assumes the caller has verified a shift-by-merge is possible
+ * with the provided extents via xfs_bmse_can_merge().
+ */
+STATIC int
+xfs_bmse_merge(
+       struct xfs_inode                *ip,
+       int                             whichfork,
+       xfs_fileoff_t                   shift,          /* shift fsb */
+       int                             current_ext,    /* idx of gotp */
+       struct xfs_bmbt_rec_host        *gotp,          /* extent to shift */
+       struct xfs_bmbt_rec_host        *leftp,         /* preceding extent */
+       struct xfs_btree_cur            *cur,
+       int                             *logflags)      /* output */
+{
+       struct xfs_bmbt_irec            got;
+       struct xfs_bmbt_irec            left;
+       xfs_filblks_t                   blockcount;
+       int                             error, i;
+
+       xfs_bmbt_get_all(gotp, &got);
+       xfs_bmbt_get_all(leftp, &left);
+       blockcount = left.br_blockcount + got.br_blockcount;
+
+       ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
+       ASSERT(xfs_bmse_can_merge(&left, &got, shift));
+
+       /*
+        * Merge the in-core extents. Note that the host record pointers and
+        * current_ext index are invalid once the extent has been removed via
+        * xfs_iext_remove().
+        */
+       xfs_bmbt_set_blockcount(leftp, blockcount);
+       xfs_iext_remove(ip, current_ext, 1, 0);
+
+       /*
+        * Update the on-disk extent count, the btree if necessary and log the
+        * inode.
+        */
+       XFS_IFORK_NEXT_SET(ip, whichfork,
+                          XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
+       *logflags |= XFS_ILOG_CORE;
+       if (!cur) {
+               *logflags |= XFS_ILOG_DEXT;
+               return 0;
+       }
+
+       /* lookup and remove the extent to merge */
+       error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock,
+                                  got.br_blockcount, &i);
+       if (error)
+               return error;
+       XFS_WANT_CORRUPTED_RETURN(i == 1);
+
+       error = xfs_btree_delete(cur, &i);
+       if (error)
+               return error;
+       XFS_WANT_CORRUPTED_RETURN(i == 1);
+
+       /* lookup and update size of the previous extent */
+       error = xfs_bmbt_lookup_eq(cur, left.br_startoff, left.br_startblock,
+                                  left.br_blockcount, &i);
+       if (error)
+               return error;
+       XFS_WANT_CORRUPTED_RETURN(i == 1);
+
+       left.br_blockcount = blockcount;
+
+       return xfs_bmbt_update(cur, left.br_startoff, left.br_startblock,
+                              left.br_blockcount, left.br_state);
+}
+
+/*
+ * Shift a single extent.
+ */
+STATIC int
+xfs_bmse_shift_one(
+       struct xfs_inode                *ip,
+       int                             whichfork,
+       xfs_fileoff_t                   offset_shift_fsb,
+       int                             *current_ext,
+       struct xfs_bmbt_rec_host        *gotp,
+       struct xfs_btree_cur            *cur,
+       int                             *logflags)
+{
+       struct xfs_ifork                *ifp;
+       xfs_fileoff_t                   startoff;
+       struct xfs_bmbt_rec_host        *leftp;
+       struct xfs_bmbt_irec            got;
+       struct xfs_bmbt_irec            left;
+       int                             error;
+       int                             i;
+
+       ifp = XFS_IFORK_PTR(ip, whichfork);
+
+       xfs_bmbt_get_all(gotp, &got);
+       startoff = got.br_startoff - offset_shift_fsb;
+
+       /* delalloc extents should be prevented by caller */
+       XFS_WANT_CORRUPTED_RETURN(!isnullstartblock(got.br_startblock));
+
+       /*
+        * Check for merge if we've got an extent to the left, otherwise make
+        * sure there's enough room at the start of the file for the shift.
+        */
+       if (*current_ext) {
+               /* grab the left extent and check for a large enough hole */
+               leftp = xfs_iext_get_ext(ifp, *current_ext - 1);
+               xfs_bmbt_get_all(leftp, &left);
+
+               if (startoff < left.br_startoff + left.br_blockcount)
+                       return -EINVAL;
+
+               /* check whether to merge the extent or shift it down */
+               if (xfs_bmse_can_merge(&left, &got, offset_shift_fsb)) {
+                       return xfs_bmse_merge(ip, whichfork, offset_shift_fsb,
+                                             *current_ext, gotp, leftp, cur,
+                                             logflags);
+               }
+       } else if (got.br_startoff < offset_shift_fsb)
+               return -EINVAL;
+
+       /*
+        * Increment the extent index for the next iteration, update the start
+        * offset of the in-core extent and update the btree if applicable.
+        */
+       (*current_ext)++;
+       xfs_bmbt_set_startoff(gotp, startoff);
+       *logflags |= XFS_ILOG_CORE;
+       if (!cur) {
+               *logflags |= XFS_ILOG_DEXT;
+               return 0;
+       }
+
+       error = xfs_bmbt_lookup_eq(cur, got.br_startoff, got.br_startblock,
+                                  got.br_blockcount, &i);
+       if (error)
+               return error;
+       XFS_WANT_CORRUPTED_RETURN(i == 1);
+
+       got.br_startoff = startoff;
+       return xfs_bmbt_update(cur, got.br_startoff, got.br_startblock,
+                               got.br_blockcount, got.br_state);
+}
+
 /*
  * Shift extent records to the left to cover a hole.
  *
- * The maximum number of extents to be shifted in a single operation
- * is @num_exts, and @current_ext keeps track of the current extent
- * index we have shifted. @offset_shift_fsb is the length by which each
- * extent is shifted. If there is no hole to shift the extents
- * into, this will be considered invalid operation and we abort immediately.
+ * The maximum number of extents to be shifted in a single operation is
+ * @num_exts. @start_fsb specifies the file offset to start the shift and the
+ * file offset where we've left off is returned in @next_fsb. @offset_shift_fsb
+ * is the length by which each extent is shifted. If there is no hole to shift
+ * the extents into, this will be considered invalid operation and we abort
+ * immediately.
  */
 int
 xfs_bmap_shift_extents(
        struct xfs_trans        *tp,
        struct xfs_inode        *ip,
-       int                     *done,
        xfs_fileoff_t           start_fsb,
        xfs_fileoff_t           offset_shift_fsb,
-       xfs_extnum_t            *current_ext,
+       int                     *done,
+       xfs_fileoff_t           *next_fsb,
        xfs_fsblock_t           *firstblock,
        struct xfs_bmap_free    *flist,
        int                     num_exts)
 {
-       struct xfs_btree_cur            *cur;
+       struct xfs_btree_cur            *cur = NULL;
        struct xfs_bmbt_rec_host        *gotp;
        struct xfs_bmbt_irec            got;
-       struct xfs_bmbt_irec            left;
        struct xfs_mount                *mp = ip->i_mount;
        struct xfs_ifork                *ifp;
        xfs_extnum_t                    nexts = 0;
-       xfs_fileoff_t                   startoff;
+       xfs_extnum_t                    current_ext;
        int                             error = 0;
-       int                             i;
        int                             whichfork = XFS_DATA_FORK;
-       int                             logflags;
-       xfs_filblks_t                   blockcount = 0;
+       int                             logflags = 0;
        int                             total_extents;
 
        if (unlikely(XFS_TEST_ERROR(
@@ -5422,7 +5594,8 @@ xfs_bmap_shift_extents(
        if (XFS_FORCED_SHUTDOWN(mp))
                return -EIO;
 
-       ASSERT(current_ext != NULL);
+       ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
        ifp = XFS_IFORK_PTR(ip, whichfork);
        if (!(ifp->if_flags & XFS_IFEXTENTS)) {
@@ -5432,142 +5605,62 @@ xfs_bmap_shift_extents(
                        return error;
        }
 
-       /*
-        * If *current_ext is 0, we would need to lookup the extent
-        * from where we would start shifting and store it in gotp.
-        */
-       if (!*current_ext) {
-               gotp = xfs_iext_bno_to_ext(ifp, start_fsb, current_ext);
-               /*
-                * gotp can be null in 2 cases: 1) if there are no extents
-                * or 2) start_fsb lies in a hole beyond which there are
-                * no extents. Either way, we are done.
-                */
-               if (!gotp) {
-                       *done = 1;
-                       return 0;
-               }
-       }
-
-       /* We are going to change core inode */
-       logflags = XFS_ILOG_CORE;
        if (ifp->if_flags & XFS_IFBROOT) {
                cur = xfs_bmbt_init_cursor(mp, tp, ip, whichfork);
                cur->bc_private.b.firstblock = *firstblock;
                cur->bc_private.b.flist = flist;
                cur->bc_private.b.flags = 0;
-       } else {
-               cur = NULL;
-               logflags |= XFS_ILOG_DEXT;
+       }
+
+       /*
+        * Look up the extent index for the fsb where we start shifting. We can
+        * henceforth iterate with current_ext as extent list changes are locked
+        * out via ilock.
+        *
+        * gotp can be null in 2 cases: 1) if there are no extents or 2)
+        * start_fsb lies in a hole beyond which there are no extents. Either
+        * way, we are done.
+        */
+       gotp = xfs_iext_bno_to_ext(ifp, start_fsb, &current_ext);
+       if (!gotp) {
+               *done = 1;
+               goto del_cursor;
        }
 
        /*
         * There may be delalloc extents in the data fork before the range we
-        * are collapsing out, so we cannot
-        * use the count of real extents here. Instead we have to calculate it
-        * from the incore fork.
+        * are collapsing out, so we cannot use the count of real extents here.
+        * Instead we have to calculate it from the incore fork.
         */
        total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
-       while (nexts++ < num_exts && *current_ext < total_extents) {
-
-               gotp = xfs_iext_get_ext(ifp, *current_ext);
-               xfs_bmbt_get_all(gotp, &got);
-               startoff = got.br_startoff - offset_shift_fsb;
-
-               /*
-                * Before shifting extent into hole, make sure that the hole
-                * is large enough to accomodate the shift.
-                */
-               if (*current_ext) {
-                       xfs_bmbt_get_all(xfs_iext_get_ext(ifp,
-                                               *current_ext - 1), &left);
-
-                       if (startoff < left.br_startoff + left.br_blockcount)
-                               error = -EINVAL;
-               } else if (offset_shift_fsb > got.br_startoff) {
-                       /*
-                        * When first extent is shifted, offset_shift_fsb
-                        * should be less than the stating offset of
-                        * the first extent.
-                        */
-                       error = -EINVAL;
-               }
-
+       while (nexts++ < num_exts && current_ext < total_extents) {
+               error = xfs_bmse_shift_one(ip, whichfork, offset_shift_fsb,
+                                       &current_ext, gotp, cur, &logflags);
                if (error)
                        goto del_cursor;
 
-               if (cur) {
-                       error = xfs_bmbt_lookup_eq(cur, got.br_startoff,
-                                                  got.br_startblock,
-                                                  got.br_blockcount,
-                                                  &i);
-                       if (error)
-                               goto del_cursor;
-                       XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor);
-               }
-
-               /* Check if we can merge 2 adjacent extents */
-               if (*current_ext &&
-                   left.br_startoff + left.br_blockcount == startoff &&
-                   left.br_startblock + left.br_blockcount ==
-                               got.br_startblock &&
-                   left.br_state == got.br_state &&
-                   left.br_blockcount + got.br_blockcount <= MAXEXTLEN) {
-                       blockcount = left.br_blockcount +
-                               got.br_blockcount;
-                       xfs_iext_remove(ip, *current_ext, 1, 0);
-                       if (cur) {
-                               error = xfs_btree_delete(cur, &i);
-                               if (error)
-                                       goto del_cursor;
-                               XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor);
-                       }
-                       XFS_IFORK_NEXT_SET(ip, whichfork,
-                               XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
-                       gotp = xfs_iext_get_ext(ifp, --*current_ext);
-                       xfs_bmbt_get_all(gotp, &got);
-
-                       /* Make cursor point to the extent we will update */
-                       if (cur) {
-                               error = xfs_bmbt_lookup_eq(cur, got.br_startoff,
-                                                          got.br_startblock,
-                                                          got.br_blockcount,
-                                                          &i);
-                               if (error)
-                                       goto del_cursor;
-                               XFS_WANT_CORRUPTED_GOTO(i == 1, del_cursor);
-                       }
-
-                       xfs_bmbt_set_blockcount(gotp, blockcount);
-                       got.br_blockcount = blockcount;
-               } else {
-                       /* We have to update the startoff */
-                       xfs_bmbt_set_startoff(gotp, startoff);
-                       got.br_startoff = startoff;
-               }
-
-               if (cur) {
-                       error = xfs_bmbt_update(cur, got.br_startoff,
-                                               got.br_startblock,
-                                               got.br_blockcount,
-                                               got.br_state);
-                       if (error)
-                               goto del_cursor;
-               }
-
-               (*current_ext)++;
+               /* update total extent count and grab the next record */
                total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
+               if (current_ext >= total_extents)
+                       break;
+               gotp = xfs_iext_get_ext(ifp, current_ext);
        }
 
        /* Check if we are done */
-       if (*current_ext == total_extents)
+       if (current_ext == total_extents) {
                *done = 1;
+       } else if (next_fsb) {
+               xfs_bmbt_get_all(gotp, &got);
+               *next_fsb = got.br_startoff;
+       }
 
 del_cursor:
        if (cur)
                xfs_btree_del_cursor(cur,
                        error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
 
-       xfs_trans_log_inode(tp, ip, logflags);
+       if (logflags)
+               xfs_trans_log_inode(tp, ip, logflags);
+
        return error;
 }
index b879ca56a64ccfab5b2a42502a5b50f68b85f1df..44db6db8640241c063a88641d5e10d61fe046c54 100644 (file)
@@ -178,9 +178,8 @@ 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);
 int    xfs_bmap_shift_extents(struct xfs_trans *tp, struct xfs_inode *ip,
-               int *done, xfs_fileoff_t start_fsb,
-               xfs_fileoff_t offset_shift_fsb, xfs_extnum_t *current_ext,
-               xfs_fsblock_t *firstblock, struct xfs_bmap_free *flist,
-               int num_exts);
+               xfs_fileoff_t start_fsb, xfs_fileoff_t offset_shift_fsb,
+               int *done, xfs_fileoff_t *next_fsb, xfs_fsblock_t *firstblock,
+               struct xfs_bmap_free *flist, int num_exts);
 
 #endif /* __XFS_BMAP_H__ */
index 37eee503068ce369e72afa7e68a13798761ff903..7b8b307f79b776bdd9d6f625811ceb474ad0797d 100644 (file)
@@ -90,23 +90,8 @@ __xfs_bmbt_get_all(
        ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
        s->br_startoff = ((xfs_fileoff_t)l0 &
                           xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
-#if XFS_BIG_BLKNOS
        s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) |
                           (((xfs_fsblock_t)l1) >> 21);
-#else
-#ifdef DEBUG
-       {
-               xfs_dfsbno_t    b;
-
-               b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
-                   (((xfs_dfsbno_t)l1) >> 21);
-               ASSERT((b >> 32) == 0 || isnulldstartblock(b));
-               s->br_startblock = (xfs_fsblock_t)b;
-       }
-#else  /* !DEBUG */
-       s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
-#endif /* DEBUG */
-#endif /* XFS_BIG_BLKNOS */
        s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21));
        /* This is xfs_extent_state() in-line */
        if (ext_flag) {
@@ -142,21 +127,8 @@ xfs_fsblock_t
 xfs_bmbt_get_startblock(
        xfs_bmbt_rec_host_t     *r)
 {
-#if XFS_BIG_BLKNOS
        return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) |
               (((xfs_fsblock_t)r->l1) >> 21);
-#else
-#ifdef DEBUG
-       xfs_dfsbno_t    b;
-
-       b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
-           (((xfs_dfsbno_t)r->l1) >> 21);
-       ASSERT((b >> 32) == 0 || isnulldstartblock(b));
-       return (xfs_fsblock_t)b;
-#else  /* !DEBUG */
-       return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
-#endif /* DEBUG */
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -220,7 +192,6 @@ xfs_bmbt_set_allf(
        ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
        ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
 
-#if XFS_BIG_BLKNOS
        ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
 
        r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -229,23 +200,6 @@ xfs_bmbt_set_allf(
        r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
                ((xfs_bmbt_rec_base_t)blockcount &
                (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(startblock)) {
-               r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                       ((xfs_bmbt_rec_base_t)startoff << 9) |
-                        (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)startblock << 21) |
-                         ((xfs_bmbt_rec_base_t)blockcount &
-                          (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       } else {
-               r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                       ((xfs_bmbt_rec_base_t)startoff << 9);
-               r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
-                        ((xfs_bmbt_rec_base_t)blockcount &
-                        (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -277,8 +231,6 @@ xfs_bmbt_disk_set_allf(
        ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
        ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
        ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
-
-#if XFS_BIG_BLKNOS
        ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
 
        r->l0 = cpu_to_be64(
@@ -289,26 +241,6 @@ xfs_bmbt_disk_set_allf(
                ((xfs_bmbt_rec_base_t)startblock << 21) |
                 ((xfs_bmbt_rec_base_t)blockcount &
                  (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(startblock)) {
-               r->l0 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                        ((xfs_bmbt_rec_base_t)startoff << 9) |
-                         (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
-               r->l1 = cpu_to_be64(xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)startblock << 21) |
-                         ((xfs_bmbt_rec_base_t)blockcount &
-                          (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-       } else {
-               r->l0 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                        ((xfs_bmbt_rec_base_t)startoff << 9));
-               r->l1 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)startblock << 21) |
-                        ((xfs_bmbt_rec_base_t)blockcount &
-                         (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -344,24 +276,11 @@ xfs_bmbt_set_startblock(
        xfs_bmbt_rec_host_t *r,
        xfs_fsblock_t   v)
 {
-#if XFS_BIG_BLKNOS
        ASSERT((v & xfs_mask64hi(12)) == 0);
        r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) |
                  (xfs_bmbt_rec_base_t)(v >> 43);
        r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
                  (xfs_bmbt_rec_base_t)(v << 21);
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(v)) {
-               r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)v << 21) |
-                         (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       } else {
-               r->l0 &= ~(xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
-                         (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -417,8 +336,8 @@ xfs_bmbt_to_bmdr(
                       cpu_to_be64(XFS_BUF_DADDR_NULL));
        } else
                ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_MAGIC));
-       ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO));
-       ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO));
+       ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK));
+       ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK));
        ASSERT(rblock->bb_level != 0);
        dblock->bb_level = rblock->bb_level;
        dblock->bb_numrecs = rblock->bb_numrecs;
@@ -742,11 +661,11 @@ xfs_bmbt_verify(
 
        /* sibling pointer verification */
        if (!block->bb_u.l.bb_leftsib ||
-           (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLDFSBNO) &&
+           (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLFSBLOCK) &&
             !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_leftsib))))
                return false;
        if (!block->bb_u.l.bb_rightsib ||
-           (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLDFSBNO) &&
+           (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLFSBLOCK) &&
             !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_rightsib))))
                return false;
 
index 0605560c7586b986c1967ebe26838f95d3a52d3b..c0896c942a4bfdb5223defedecd8e66bcbe1083a 100644 (file)
@@ -61,11 +61,11 @@ xfs_btree_check_lblock(
                be16_to_cpu(block->bb_numrecs) <=
                        cur->bc_ops->get_maxrecs(cur, level) &&
                block->bb_u.l.bb_leftsib &&
-               (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO) ||
+               (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK) ||
                 XFS_FSB_SANITY_CHECK(mp,
                        be64_to_cpu(block->bb_u.l.bb_leftsib))) &&
                block->bb_u.l.bb_rightsib &&
-               (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO) ||
+               (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK) ||
                 XFS_FSB_SANITY_CHECK(mp,
                        be64_to_cpu(block->bb_u.l.bb_rightsib)));
 
@@ -150,12 +150,12 @@ xfs_btree_check_block(
 int                                    /* error (0 or EFSCORRUPTED) */
 xfs_btree_check_lptr(
        struct xfs_btree_cur    *cur,   /* btree cursor */
-       xfs_dfsbno_t            bno,    /* btree block disk address */
+       xfs_fsblock_t           bno,    /* btree block disk address */
        int                     level)  /* btree block level */
 {
        XFS_WANT_CORRUPTED_RETURN(
                level > 0 &&
-               bno != NULLDFSBNO &&
+               bno != NULLFSBLOCK &&
                XFS_FSB_SANITY_CHECK(cur->bc_mp, bno));
        return 0;
 }
@@ -578,7 +578,7 @@ xfs_btree_islastblock(
        block = xfs_btree_get_block(cur, level, &bp);
        xfs_btree_check_block(cur, block, level, bp);
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO);
+               return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK);
        else
                return block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK);
 }
@@ -754,16 +754,16 @@ xfs_btree_readahead_lblock(
        struct xfs_btree_block  *block)
 {
        int                     rval = 0;
-       xfs_dfsbno_t            left = be64_to_cpu(block->bb_u.l.bb_leftsib);
-       xfs_dfsbno_t            right = be64_to_cpu(block->bb_u.l.bb_rightsib);
+       xfs_fsblock_t           left = be64_to_cpu(block->bb_u.l.bb_leftsib);
+       xfs_fsblock_t           right = be64_to_cpu(block->bb_u.l.bb_rightsib);
 
-       if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
+       if ((lr & XFS_BTCUR_LEFTRA) && left != NULLFSBLOCK) {
                xfs_btree_reada_bufl(cur->bc_mp, left, 1,
                                     cur->bc_ops->buf_ops);
                rval++;
        }
 
-       if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLDFSBNO) {
+       if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLFSBLOCK) {
                xfs_btree_reada_bufl(cur->bc_mp, right, 1,
                                     cur->bc_ops->buf_ops);
                rval++;
@@ -835,7 +835,7 @@ xfs_btree_ptr_to_daddr(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
-               ASSERT(ptr->l != cpu_to_be64(NULLDFSBNO));
+               ASSERT(ptr->l != cpu_to_be64(NULLFSBLOCK));
 
                return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
        } else {
@@ -883,9 +883,9 @@ xfs_btree_setbuf(
 
        b = XFS_BUF_TO_BLOCK(bp);
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
-               if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO))
+               if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK))
                        cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
-               if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO))
+               if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK))
                        cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
        } else {
                if (b->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK))
@@ -901,7 +901,7 @@ xfs_btree_ptr_is_null(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               return ptr->l == cpu_to_be64(NULLDFSBNO);
+               return ptr->l == cpu_to_be64(NULLFSBLOCK);
        else
                return ptr->s == cpu_to_be32(NULLAGBLOCK);
 }
@@ -912,7 +912,7 @@ xfs_btree_set_ptr_null(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               ptr->l = cpu_to_be64(NULLDFSBNO);
+               ptr->l = cpu_to_be64(NULLFSBLOCK);
        else
                ptr->s = cpu_to_be32(NULLAGBLOCK);
 }
@@ -980,8 +980,8 @@ xfs_btree_init_block_int(
        buf->bb_numrecs = cpu_to_be16(numrecs);
 
        if (flags & XFS_BTREE_LONG_PTRS) {
-               buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO);
-               buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO);
+               buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK);
+               buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK);
                if (flags & XFS_BTREE_CRC_BLOCKS) {
                        buf->bb_u.l.bb_blkno = cpu_to_be64(blkno);
                        buf->bb_u.l.bb_owner = cpu_to_be64(owner);
index a04b69422f676c990dafa22da49288b1db279071..8f18bab73ea535d8de8cd20a78b14d68b35f079f 100644 (file)
@@ -258,7 +258,7 @@ xfs_btree_check_block(
 int                                    /* error (0 or EFSCORRUPTED) */
 xfs_btree_check_lptr(
        struct xfs_btree_cur    *cur,   /* btree cursor */
-       xfs_dfsbno_t            ptr,    /* btree block disk address */
+       xfs_fsblock_t           ptr,    /* btree block disk address */
        int                     level); /* btree block level */
 
 /*
index fae2fd85917348d129a56229fefcdd73e314588c..33dc333c6bc67ccdc41fc547489032220348dd73 100644 (file)
@@ -491,7 +491,6 @@ xfs_da3_root_split(
        struct xfs_buf          *bp;
        struct xfs_inode        *dp;
        struct xfs_trans        *tp;
-       struct xfs_mount        *mp;
        struct xfs_dir2_leaf    *leaf;
        xfs_dablk_t             blkno;
        int                     level;
@@ -511,7 +510,6 @@ xfs_da3_root_split(
 
        dp = args->dp;
        tp = args->trans;
-       mp = state->mp;
        error = xfs_da_get_buf(tp, dp, blkno, -1, &bp, args->whichfork);
        if (error)
                return error;
@@ -1981,7 +1979,7 @@ xfs_da_grow_inode_int(
        struct xfs_trans        *tp = args->trans;
        struct xfs_inode        *dp = args->dp;
        int                     w = args->whichfork;
-       xfs_drfsbno_t           nblks = dp->i_d.di_nblocks;
+       xfs_rfsblock_t          nblks = dp->i_d.di_nblocks;
        struct xfs_bmbt_irec    map, *mapp;
        int                     nmap, error, got, i, mapi;
 
@@ -2319,14 +2317,12 @@ xfs_da_shrink_inode(
        xfs_inode_t *dp;
        int done, error, w, count;
        xfs_trans_t *tp;
-       xfs_mount_t *mp;
 
        trace_xfs_da_shrink_inode(args);
 
        dp = args->dp;
        w = args->whichfork;
        tp = args->trans;
-       mp = dp->i_mount;
        count = args->geo->fsbcount;
        for (;;) {
                /*
@@ -2540,7 +2536,8 @@ xfs_da_get_buf(
                                    mapp, nmap, 0);
        error = bp ? bp->b_error : -EIO;
        if (error) {
-               xfs_trans_brelse(trans, bp);
+               if (bp)
+                       xfs_trans_brelse(trans, bp);
                goto out_free;
        }
 
index c5e36d95517f73842b81c021e8ebad9c25375071..fe20fff6644521b31df8096b1ac68689b9c3bf2f 100644 (file)
@@ -257,7 +257,6 @@ xfs_dir3_data_get_ftype(
 {
        __uint8_t       ftype = dep->name[dep->namelen];
 
-       ASSERT(ftype < XFS_DIR3_FT_MAX);
        if (ftype >= XFS_DIR3_FT_MAX)
                return XFS_DIR3_FT_UNKNOWN;
        return ftype;
diff --git a/libxfs/xfs_dinode.h b/libxfs/xfs_dinode.h
deleted file mode 100644 (file)
index 623bbe8..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2000,2002,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_DINODE_H__
-#define        __XFS_DINODE_H__
-
-#define        XFS_DINODE_MAGIC                0x494e  /* 'IN' */
-#define XFS_DINODE_GOOD_VERSION(v)     ((v) >= 1 && (v) <= 3)
-
-typedef struct xfs_timestamp {
-       __be32          t_sec;          /* timestamp seconds */
-       __be32          t_nsec;         /* timestamp nanoseconds */
-} xfs_timestamp_t;
-
-/*
- * On-disk inode structure.
- *
- * This is just the header or "dinode core", the inode is expanded to fill a
- * variable size the leftover area split into a data and an attribute fork.
- * The format of the data and attribute fork depends on the format of the
- * inode as indicated by di_format and di_aformat.  To access the data and
- * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros
- * below.
- *
- * There is a very similar struct icdinode in xfs_inode which matches the
- * layout of the first 96 bytes of this structure, but is kept in native
- * format instead of big endian.
- *
- * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed
- * padding field for v3 inodes.
- */
-typedef struct xfs_dinode {
-       __be16          di_magic;       /* inode magic # = XFS_DINODE_MAGIC */
-       __be16          di_mode;        /* mode and type of file */
-       __u8            di_version;     /* inode version */
-       __u8            di_format;      /* format of di_c data */
-       __be16          di_onlink;      /* old number of links to file */
-       __be32          di_uid;         /* owner's user id */
-       __be32          di_gid;         /* owner's group id */
-       __be32          di_nlink;       /* number of links to file */
-       __be16          di_projid_lo;   /* lower part of owner's project id */
-       __be16          di_projid_hi;   /* higher part owner's project id */
-       __u8            di_pad[6];      /* unused, zeroed space */
-       __be16          di_flushiter;   /* incremented on flush */
-       xfs_timestamp_t di_atime;       /* time last accessed */
-       xfs_timestamp_t di_mtime;       /* time last modified */
-       xfs_timestamp_t di_ctime;       /* time created/inode modified */
-       __be64          di_size;        /* number of bytes in file */
-       __be64          di_nblocks;     /* # of direct & btree blocks used */
-       __be32          di_extsize;     /* basic/minimum extent size for file */
-       __be32          di_nextents;    /* number of extents in data fork */
-       __be16          di_anextents;   /* number of extents in attribute fork*/
-       __u8            di_forkoff;     /* attr fork offs, <<3 for 64b align */
-       __s8            di_aformat;     /* format of attr fork's data */
-       __be32          di_dmevmask;    /* DMIG event mask */
-       __be16          di_dmstate;     /* DMIG state info */
-       __be16          di_flags;       /* random flags, XFS_DIFLAG_... */
-       __be32          di_gen;         /* generation number */
-
-       /* di_next_unlinked is the only non-core field in the old dinode */
-       __be32          di_next_unlinked;/* agi unlinked list ptr */
-
-       /* start of the extended dinode, writable fields */
-       __le32          di_crc;         /* CRC of the inode */
-       __be64          di_changecount; /* number of attribute changes */
-       __be64          di_lsn;         /* flush sequence */
-       __be64          di_flags2;      /* more random flags */
-       __u8            di_pad2[16];    /* more padding for future expansion */
-
-       /* fields only written to during inode creation */
-       xfs_timestamp_t di_crtime;      /* time created */
-       __be64          di_ino;         /* inode number */
-       uuid_t          di_uuid;        /* UUID of the filesystem */
-
-       /* structure must be padded to 64 bit alignment */
-} xfs_dinode_t;
-
-#define XFS_DINODE_CRC_OFF     offsetof(struct xfs_dinode, di_crc)
-
-#define DI_MAX_FLUSH 0xffff
-
-/*
- * Size of the core inode on disk.  Version 1 and 2 inodes have
- * the same size, but version 3 has grown a few additional fields.
- */
-static inline uint xfs_dinode_size(int version)
-{
-       if (version == 3)
-               return sizeof(struct xfs_dinode);
-       return offsetof(struct xfs_dinode, di_crc);
-}
-
-/*
- * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
- * Since the pathconf interface is signed, we use 2^31 - 1 instead.
- * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
- */
-#define        XFS_MAXLINK             ((1U << 31) - 1U)
-#define        XFS_MAXLINK_1           65535U
-
-/*
- * Values for di_format
- */
-typedef enum xfs_dinode_fmt {
-       XFS_DINODE_FMT_DEV,             /* xfs_dev_t */
-       XFS_DINODE_FMT_LOCAL,           /* bulk data */
-       XFS_DINODE_FMT_EXTENTS,         /* struct xfs_bmbt_rec */
-       XFS_DINODE_FMT_BTREE,           /* struct xfs_bmdr_block */
-       XFS_DINODE_FMT_UUID             /* uuid_t */
-} xfs_dinode_fmt_t;
-
-/*
- * Inode minimum and maximum sizes.
- */
-#define        XFS_DINODE_MIN_LOG      8
-#define        XFS_DINODE_MAX_LOG      11
-#define        XFS_DINODE_MIN_SIZE     (1 << XFS_DINODE_MIN_LOG)
-#define        XFS_DINODE_MAX_SIZE     (1 << XFS_DINODE_MAX_LOG)
-
-/*
- * Inode size for given fs.
- */
-#define XFS_LITINO(mp, version) \
-       ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))
-
-/*
- * Inode data & attribute fork sizes, per inode.
- */
-#define XFS_DFORK_Q(dip)               ((dip)->di_forkoff != 0)
-#define XFS_DFORK_BOFF(dip)            ((int)((dip)->di_forkoff << 3))
-
-#define XFS_DFORK_DSIZE(dip,mp) \
-       (XFS_DFORK_Q(dip) ? \
-               XFS_DFORK_BOFF(dip) : \
-               XFS_LITINO(mp, (dip)->di_version))
-#define XFS_DFORK_ASIZE(dip,mp) \
-       (XFS_DFORK_Q(dip) ? \
-               XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
-               0)
-#define XFS_DFORK_SIZE(dip,mp,w) \
-       ((w) == XFS_DATA_FORK ? \
-               XFS_DFORK_DSIZE(dip, mp) : \
-               XFS_DFORK_ASIZE(dip, mp))
-
-/*
- * Return pointers to the data or attribute forks.
- */
-#define XFS_DFORK_DPTR(dip) \
-       ((char *)dip + xfs_dinode_size(dip->di_version))
-#define XFS_DFORK_APTR(dip)    \
-       (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))
-#define XFS_DFORK_PTR(dip,w)   \
-       ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
-
-#define XFS_DFORK_FORMAT(dip,w) \
-       ((w) == XFS_DATA_FORK ? \
-               (dip)->di_format : \
-               (dip)->di_aformat)
-#define XFS_DFORK_NEXTENTS(dip,w) \
-       ((w) == XFS_DATA_FORK ? \
-               be32_to_cpu((dip)->di_nextents) : \
-               be16_to_cpu((dip)->di_anextents))
-
-#define        XFS_BUF_TO_DINODE(bp)   ((xfs_dinode_t *)((bp)->b_addr))
-
-/*
- * For block and character special files the 32bit dev_t is stored at the
- * beginning of the data fork.
- */
-static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
-{
-       return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
-}
-
-static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
-{
-       *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);
-}
-
-/*
- * Values for di_flags
- * There should be a one-to-one correspondence between these flags and the
- * XFS_XFLAG_s.
- */
-#define XFS_DIFLAG_REALTIME_BIT  0     /* file's blocks come from rt area */
-#define XFS_DIFLAG_PREALLOC_BIT  1     /* file space has been preallocated */
-#define XFS_DIFLAG_NEWRTBM_BIT   2     /* for rtbitmap inode, new format */
-#define XFS_DIFLAG_IMMUTABLE_BIT 3     /* inode is immutable */
-#define XFS_DIFLAG_APPEND_BIT    4     /* inode is append-only */
-#define XFS_DIFLAG_SYNC_BIT      5     /* inode is written synchronously */
-#define XFS_DIFLAG_NOATIME_BIT   6     /* do not update atime */
-#define XFS_DIFLAG_NODUMP_BIT    7     /* do not dump */
-#define XFS_DIFLAG_RTINHERIT_BIT 8     /* create with realtime bit set */
-#define XFS_DIFLAG_PROJINHERIT_BIT   9 /* create with parents projid */
-#define XFS_DIFLAG_NOSYMLINKS_BIT   10 /* disallow symlink creation */
-#define XFS_DIFLAG_EXTSIZE_BIT      11 /* inode extent size allocator hint */
-#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
-#define XFS_DIFLAG_NODEFRAG_BIT     13 /* do not reorganize/defragment */
-#define XFS_DIFLAG_FILESTREAM_BIT   14  /* use filestream allocator */
-#define XFS_DIFLAG_REALTIME      (1 << XFS_DIFLAG_REALTIME_BIT)
-#define XFS_DIFLAG_PREALLOC      (1 << XFS_DIFLAG_PREALLOC_BIT)
-#define XFS_DIFLAG_NEWRTBM       (1 << XFS_DIFLAG_NEWRTBM_BIT)
-#define XFS_DIFLAG_IMMUTABLE     (1 << XFS_DIFLAG_IMMUTABLE_BIT)
-#define XFS_DIFLAG_APPEND        (1 << XFS_DIFLAG_APPEND_BIT)
-#define XFS_DIFLAG_SYNC          (1 << XFS_DIFLAG_SYNC_BIT)
-#define XFS_DIFLAG_NOATIME       (1 << XFS_DIFLAG_NOATIME_BIT)
-#define XFS_DIFLAG_NODUMP        (1 << XFS_DIFLAG_NODUMP_BIT)
-#define XFS_DIFLAG_RTINHERIT     (1 << XFS_DIFLAG_RTINHERIT_BIT)
-#define XFS_DIFLAG_PROJINHERIT   (1 << XFS_DIFLAG_PROJINHERIT_BIT)
-#define XFS_DIFLAG_NOSYMLINKS    (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
-#define XFS_DIFLAG_EXTSIZE       (1 << XFS_DIFLAG_EXTSIZE_BIT)
-#define XFS_DIFLAG_EXTSZINHERIT  (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
-#define XFS_DIFLAG_NODEFRAG      (1 << XFS_DIFLAG_NODEFRAG_BIT)
-#define XFS_DIFLAG_FILESTREAM    (1 << XFS_DIFLAG_FILESTREAM_BIT)
-
-#ifdef CONFIG_XFS_RT
-#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
-#else
-#define XFS_IS_REALTIME_INODE(ip) (0)
-#endif
-
-#define XFS_DIFLAG_ANY \
-       (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
-        XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
-        XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
-        XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
-        XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
-
-#endif /* __XFS_DINODE_H__ */
index e2d3ce7dd02a25af41d770d2951e7e748e7f7491..0be516f27498b6ac0a8ec13de4f61f1935f4e736 100644 (file)
@@ -27,17 +27,16 @@ struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR };
  * structure if appropriate for the given operation and filesystem config.
  */
 const unsigned char xfs_mode_to_ftype[S_IFMT >> S_SHIFT] = {
-       [0]                     = XFS_DIR3_FT_UNKNOWN,
-       [S_IFREG >> S_SHIFT]    = XFS_DIR3_FT_REG_FILE,
-       [S_IFDIR >> S_SHIFT]    = XFS_DIR3_FT_DIR,
-       [S_IFCHR >> S_SHIFT]    = XFS_DIR3_FT_CHRDEV,
-       [S_IFBLK >> S_SHIFT]    = XFS_DIR3_FT_BLKDEV,
-       [S_IFIFO >> S_SHIFT]    = XFS_DIR3_FT_FIFO,
-       [S_IFSOCK >> S_SHIFT]   = XFS_DIR3_FT_SOCK,
-       [S_IFLNK >> S_SHIFT]    = XFS_DIR3_FT_SYMLINK,
+       [0]                     = XFS_DIR3_FT_UNKNOWN,
+       [S_IFREG >> S_SHIFT]    = XFS_DIR3_FT_REG_FILE,
+       [S_IFDIR >> S_SHIFT]    = XFS_DIR3_FT_DIR,
+       [S_IFCHR >> S_SHIFT]    = XFS_DIR3_FT_CHRDEV,
+       [S_IFBLK >> S_SHIFT]    = XFS_DIR3_FT_BLKDEV,
+       [S_IFIFO >> S_SHIFT]    = XFS_DIR3_FT_FIFO,
+       [S_IFSOCK >> S_SHIFT]   = XFS_DIR3_FT_SOCK,
+       [S_IFLNK >> S_SHIFT]    = XFS_DIR3_FT_SYMLINK,
 };
 
-
 /*
  * ASCII case-insensitive (ie. A-Z) support for directories that was
  * used in IRIX.
@@ -236,7 +235,8 @@ xfs_dir_init(
 }
 
 /*
-  Enter a name in a directory.
+ * Enter a name in a directory, or check for available space.
+ * If inum is 0, only the available space test is performed.
  */
 int
 xfs_dir_createname(
@@ -253,10 +253,12 @@ xfs_dir_createname(
        int                     v;              /* type-checking value */
 
        ASSERT(S_ISDIR(dp->i_d.di_mode));
-       rval = xfs_dir_ino_validate(tp->t_mountp, inum);
-       if (rval)
-               return rval;
-       XFS_STATS_INC(xs_dir_create);
+       if (inum) {
+               rval = xfs_dir_ino_validate(tp->t_mountp, inum);
+               if (rval)
+                       return rval;
+               XFS_STATS_INC(xs_dir_create);
+       }
 
        args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
        if (!args)
@@ -275,6 +277,8 @@ xfs_dir_createname(
        args->whichfork = XFS_DATA_FORK;
        args->trans = tp;
        args->op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
+       if (!inum)
+               args->op_flags |= XFS_DA_OP_JUSTCHECK;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
                rval = xfs_dir2_sf_addname(args);
@@ -534,62 +538,14 @@ out_free:
 
 /*
  * 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)
+       struct xfs_name *name)          /* name of entry to add */
 {
-       struct xfs_da_args *args;
-       int             rval;
-       int             v;              /* type-checking value */
-
-       if (resblks)
-               return 0;
-
-       ASSERT(S_ISDIR(dp->i_d.di_mode));
-
-       args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
-       if (!args)
-               return -ENOMEM;
-
-       args->geo = dp->i_mount->m_dir_geo;
-       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;
-       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);
-               goto out_free;
-       }
-
-       rval = xfs_dir2_isblock(args, &v);
-       if (rval)
-               goto out_free;
-       if (v) {
-               rval = xfs_dir2_block_addname(args);
-               goto out_free;
-       }
-
-       rval = xfs_dir2_isleaf(args, &v);
-       if (rval)
-               goto out_free;
-       if (v)
-               rval = xfs_dir2_leaf_addname(args);
-       else
-               rval = xfs_dir2_node_addname(args);
-out_free:
-       kmem_free(args);
-       return rval;
+       return xfs_dir_createname(tp, dp, name, 0, NULL, NULL, 0);
 }
 
 /*
index c9121b569e560e5423f9e69dddc061e87472b469..b7f8835a200c31fbff9608b0f7da53209bbb8bd4 100644 (file)
@@ -142,7 +142,7 @@ extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
                                xfs_fsblock_t *first,
                                struct xfs_bmap_free *flist, xfs_extlen_t tot);
 extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
-                               struct xfs_name *name, uint resblks);
+                               struct xfs_name *name);
 
 /*
  * Direct call from the bmap code, bypassing the generic directory layer.
index d6da2dba702178720ab5635c3374942f8c4e254b..40d7851a75ce1fa566df25665d2c077ba7b9d334 100644 (file)
@@ -334,7 +334,6 @@ xfs_dir2_block_addname(
        int                     low;            /* low index for binary srch */
        int                     lowstale;       /* low stale index */
        int                     mid=0;          /* midpoint for binary srch */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needlog;        /* need to log header */
        int                     needscan;       /* need to rescan freespace */
        __be16                  *tagp;          /* pointer to tag value */
@@ -344,7 +343,6 @@ xfs_dir2_block_addname(
 
        dp = args->dp;
        tp = args->trans;
-       mp = dp->i_mount;
 
        /* Read the (one and only) directory block into bp. */
        error = xfs_dir3_block_read(tp, dp, &bp);
@@ -600,7 +598,6 @@ xfs_dir2_block_lookup(
        xfs_inode_t             *dp;            /* incore inode */
        int                     ent;            /* entry index */
        int                     error;          /* error return value */
-       xfs_mount_t             *mp;            /* filesystem mount point */
 
        trace_xfs_dir2_block_lookup(args);
 
@@ -611,7 +608,6 @@ xfs_dir2_block_lookup(
        if ((error = xfs_dir2_block_lookup_int(args, &bp, &ent)))
                return error;
        dp = args->dp;
-       mp = dp->i_mount;
        hdr = bp->b_addr;
        xfs_dir3_data_check(dp, bp);
        btp = xfs_dir2_block_tail_p(args->geo, hdr);
@@ -752,7 +748,6 @@ xfs_dir2_block_removename(
        xfs_inode_t             *dp;            /* incore inode */
        int                     ent;            /* block leaf entry index */
        int                     error;          /* error return value */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needlog;        /* need to log block header */
        int                     needscan;       /* need to fixup bestfree */
        xfs_dir2_sf_hdr_t       sfh;            /* shortform header */
@@ -770,7 +765,6 @@ xfs_dir2_block_removename(
        }
        dp = args->dp;
        tp = args->trans;
-       mp = dp->i_mount;
        hdr = bp->b_addr;
        btp = xfs_dir2_block_tail_p(args->geo, hdr);
        blp = xfs_dir2_block_leaf_p(btp);
@@ -834,7 +828,6 @@ xfs_dir2_block_replace(
        xfs_inode_t             *dp;            /* incore inode */
        int                     ent;            /* leaf entry index */
        int                     error;          /* error return value */
-       xfs_mount_t             *mp;            /* filesystem mount point */
 
        trace_xfs_dir2_block_replace(args);
 
@@ -846,7 +839,6 @@ xfs_dir2_block_replace(
                return error;
        }
        dp = args->dp;
-       mp = dp->i_mount;
        hdr = bp->b_addr;
        btp = xfs_dir2_block_tail_p(args->geo, hdr);
        blp = xfs_dir2_block_leaf_p(btp);
index a998bef0d9298ddfb537a8adb2308ac35367ab53..adc43b48afa06afefde1d99a58aa740f5abec76d 100644 (file)
@@ -367,7 +367,6 @@ xfs_dir2_block_to_leaf(
        xfs_dir2_db_t           ldb;            /* leaf block's bno */
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf's tail */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needlog;        /* need to log block header */
        int                     needscan;       /* need to rescan bestfree */
        xfs_trans_t             *tp;            /* transaction pointer */
@@ -378,7 +377,6 @@ xfs_dir2_block_to_leaf(
        trace_xfs_dir2_block_to_leaf(args);
 
        dp = args->dp;
-       mp = dp->i_mount;
        tp = args->trans;
        /*
         * Add the leaf block to the inode.
@@ -609,7 +607,6 @@ xfs_dir2_leaf_addname(
        int                     lfloghigh;      /* high leaf logging index */
        int                     lowstale;       /* index of prev stale leaf */
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf tail pointer */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needbytes;      /* leaf block bytes needed */
        int                     needlog;        /* need to log data header */
        int                     needscan;       /* need to rescan data free */
@@ -624,7 +621,6 @@ xfs_dir2_leaf_addname(
 
        dp = args->dp;
        tp = args->trans;
-       mp = dp->i_mount;
 
        error = xfs_dir3_leaf_read(tp, dp, args->geo->leafblk, -1, &lbp);
        if (error)
@@ -1339,11 +1335,9 @@ xfs_dir2_leaf_removename(
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
        xfs_dir2_leaf_entry_t   *lep;           /* leaf entry */
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf tail structure */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needlog;        /* need to log data header */
        int                     needscan;       /* need to rescan data frees */
        xfs_dir2_data_off_t     oldbest;        /* old value of best free */
-       xfs_trans_t             *tp;            /* transaction pointer */
        struct xfs_dir2_data_free *bf;          /* bestfree table */
        struct xfs_dir2_leaf_entry *ents;
        struct xfs_dir3_icleaf_hdr leafhdr;
@@ -1357,8 +1351,6 @@ xfs_dir2_leaf_removename(
                return error;
        }
        dp = args->dp;
-       tp = args->trans;
-       mp = dp->i_mount;
        leaf = lbp->b_addr;
        hdr = dbp->b_addr;
        xfs_dir3_data_check(dp, dbp);
@@ -1590,11 +1582,9 @@ xfs_dir2_leaf_trim_data(
        int                     error;          /* error return value */
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf tail structure */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_trans_t             *tp;            /* transaction pointer */
 
        dp = args->dp;
-       mp = dp->i_mount;
        tp = args->trans;
        /*
         * Read the offending data block.  We need its buffer.
index 3dc3d4c9234f597405ebf8d1e7b9255ac1d01114..cdd06dc8aef176cdc50c26c99e92bcdf234e7d0a 100644 (file)
@@ -280,7 +280,6 @@ xfs_dir2_leaf_to_node(
        int                     i;              /* leaf freespace index */
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf tail structure */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     n;              /* count of live freespc ents */
        xfs_dir2_data_off_t     off;            /* freespace entry value */
        __be16                  *to;            /* pointer to freespace entry */
@@ -290,7 +289,6 @@ xfs_dir2_leaf_to_node(
        trace_xfs_dir2_leaf_to_node(args);
 
        dp = args->dp;
-       mp = dp->i_mount;
        tp = args->trans;
        /*
         * Add a freespace block to the directory.
@@ -370,16 +368,12 @@ xfs_dir2_leafn_add(
        int                     lfloghigh;      /* high leaf entry logging */
        int                     lfloglow;       /* low leaf entry logging */
        int                     lowstale;       /* previous stale entry */
-       xfs_mount_t             *mp;            /* filesystem mount point */
-       xfs_trans_t             *tp;            /* transaction pointer */
        struct xfs_dir3_icleaf_hdr leafhdr;
        struct xfs_dir2_leaf_entry *ents;
 
        trace_xfs_dir2_leafn_add(args, index);
 
        dp = args->dp;
-       mp = dp->i_mount;
-       tp = args->trans;
        leaf = bp->b_addr;
        dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
        ents = dp->d_ops->leaf_ents_p(leaf);
@@ -1153,7 +1147,6 @@ xfs_dir2_leafn_remove(
        xfs_dir2_leaf_entry_t   *lep;           /* leaf entry */
        int                     longest;        /* longest data free entry */
        int                     off;            /* data block entry offset */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        int                     needlog;        /* need to log data header */
        int                     needscan;       /* need to rescan data frees */
        xfs_trans_t             *tp;            /* transaction pointer */
@@ -1165,7 +1158,6 @@ xfs_dir2_leafn_remove(
 
        dp = args->dp;
        tp = args->trans;
-       mp = dp->i_mount;
        leaf = bp->b_addr;
        dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf);
        ents = dp->d_ops->leaf_ents_p(leaf);
@@ -1306,7 +1298,6 @@ xfs_dir2_leafn_split(
        xfs_da_args_t           *args;          /* operation arguments */
        xfs_dablk_t             blkno;          /* new leaf block number */
        int                     error;          /* error return value */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        struct xfs_inode        *dp;
 
        /*
@@ -1314,7 +1305,6 @@ xfs_dir2_leafn_split(
         */
        args = state->args;
        dp = args->dp;
-       mp = dp->i_mount;
        ASSERT(oldblk->magic == XFS_DIR2_LEAFN_MAGIC);
        error = xfs_da_grow_inode(args, &blkno);
        if (error) {
@@ -2214,12 +2204,10 @@ xfs_dir2_node_trim_free(
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     error;          /* error return code */
        xfs_dir2_free_t         *free;          /* freespace structure */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_trans_t             *tp;            /* transaction pointer */
        struct xfs_dir3_icfree_hdr freehdr;
 
        dp = args->dp;
-       mp = dp->i_mount;
        tp = args->trans;
        /*
         * Read the freespace block.
index 4a8df72cab001d294acf86c34e3bb9c265492624..d04547fcf274af0eaee18096c94b22652551b9f7 100644 (file)
 
 struct dir_context;
 
-
 /* xfs_dir2.c */
 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
                                xfs_dir2_db_t *dbp);
 extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
                                const unsigned char *name, int len);
 
-#define S_SHIFT 12
-extern const unsigned char xfs_mode_to_ftype[];
-
-extern unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp,
-                                       __uint8_t filetype);
-
 
 /* xfs_dir2_block.c */
 extern int xfs_dir3_block_read(struct xfs_trans *tp, struct xfs_inode *dp,
index 61a0be1b11a1c424ba6c7ad936b9d6fac1e52aac..020856b9e181a92c584c79f7a818bfabc015d712 100644 (file)
@@ -34,10 +34,9 @@ static void xfs_dir2_sf_check(xfs_da_args_t *args);
 #else
 #define        xfs_dir2_sf_check(args)
 #endif /* DEBUG */
-#if XFS_BIG_INUMS
+
 static void xfs_dir2_sf_toino4(xfs_da_args_t *args);
 static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
-#endif /* XFS_BIG_INUMS */
 
 /*
  * Given a block directory (dp/block), calculate its size as a shortform (sf)
@@ -100,10 +99,10 @@ xfs_dir2_block_sfsize(
                isdotdot =
                        dep->namelen == 2 &&
                        dep->name[0] == '.' && dep->name[1] == '.';
-#if XFS_BIG_INUMS
+
                if (!isdot)
                        i8count += be64_to_cpu(dep->inumber) > XFS_DIR2_MAX_SHORT_INUM;
-#endif
+
                /* take into account the file type field */
                if (!isdot && !isdotdot) {
                        count++;
@@ -301,7 +300,7 @@ xfs_dir2_sf_addname(
         */
        incr_isize = dp->d_ops->sf_entsize(sfp, args->namelen);
        objchange = 0;
-#if XFS_BIG_INUMS
+
        /*
         * Do we have to change to 8 byte inodes?
         */
@@ -315,7 +314,7 @@ xfs_dir2_sf_addname(
                         (uint)sizeof(xfs_dir2_ino4_t));
                objchange = 1;
        }
-#endif
+
        new_isize = (int)dp->i_d.di_size + incr_isize;
        /*
         * Won't fit as shortform any more (due to size),
@@ -353,10 +352,8 @@ xfs_dir2_sf_addname(
         */
        else {
                ASSERT(pick == 2);
-#if XFS_BIG_INUMS
                if (objchange)
                        xfs_dir2_sf_toino8(args);
-#endif
                xfs_dir2_sf_addname_hard(args, objchange, new_isize);
        }
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
@@ -408,10 +405,8 @@ xfs_dir2_sf_addname_easy(
         * Update the header and inode.
         */
        sfp->count++;
-#if XFS_BIG_INUMS
        if (args->inumber > XFS_DIR2_MAX_SHORT_INUM)
                sfp->i8count++;
-#endif
        dp->i_d.di_size = new_isize;
        xfs_dir2_sf_check(args);
 }
@@ -443,13 +438,11 @@ xfs_dir2_sf_addname_hard(
        xfs_dir2_sf_hdr_t       *oldsfp;        /* original shortform dir */
        xfs_dir2_sf_entry_t     *sfep;          /* entry in new dir */
        xfs_dir2_sf_hdr_t       *sfp;           /* new shortform dir */
-       struct xfs_mount        *mp;
 
        /*
         * Copy the old directory to the stack buffer.
         */
        dp = args->dp;
-       mp = dp->i_mount;
 
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        old_isize = (int)dp->i_d.di_size;
@@ -499,10 +492,8 @@ xfs_dir2_sf_addname_hard(
        dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
        dp->d_ops->sf_put_ftype(sfep, args->filetype);
        sfp->count++;
-#if XFS_BIG_INUMS
        if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
                sfp->i8count++;
-#endif
        /*
         * If there's more left to copy, do that.
         */
@@ -532,7 +523,6 @@ xfs_dir2_sf_addname_pick(
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     holefit;        /* found hole it will fit in */
        int                     i;              /* entry number */
-       xfs_mount_t             *mp;            /* filesystem mount point */
        xfs_dir2_data_aoff_t    offset;         /* data block offset */
        xfs_dir2_sf_entry_t     *sfep;          /* shortform entry */
        xfs_dir2_sf_hdr_t       *sfp;           /* shortform structure */
@@ -540,7 +530,6 @@ xfs_dir2_sf_addname_pick(
        int                     used;           /* data bytes used */
 
        dp = args->dp;
-       mp = dp->i_mount;
 
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        size = dp->d_ops->data_entsize(args->namelen);
@@ -576,13 +565,8 @@ xfs_dir2_sf_addname_pick(
        /*
         * If changing the inode number size, do it the hard way.
         */
-#if XFS_BIG_INUMS
-       if (objchange) {
+       if (objchange)
                return 2;
-       }
-#else
-       ASSERT(objchange == 0);
-#endif
        /*
         * If it won't fit at the end then do it the hard way (use the hole).
         */
@@ -611,10 +595,8 @@ xfs_dir2_sf_check(
        int                     offset;         /* data offset */
        xfs_dir2_sf_entry_t     *sfep;          /* shortform dir entry */
        xfs_dir2_sf_hdr_t       *sfp;           /* shortform structure */
-       struct xfs_mount        *mp;
 
        dp = args->dp;
-       mp = dp->i_mount;
 
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        offset = dp->d_ops->data_first_offset;
@@ -633,7 +615,6 @@ xfs_dir2_sf_check(
                ASSERT(dp->d_ops->sf_get_ftype(sfep) < XFS_DIR3_FT_MAX);
        }
        ASSERT(i8count == sfp->i8count);
-       ASSERT(XFS_BIG_INUMS || i8count == 0);
        ASSERT((char *)sfep - (char *)sfp == dp->i_d.di_size);
        ASSERT(offset +
               (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) +
@@ -853,7 +834,6 @@ xfs_dir2_sf_removename(
         */
        xfs_idata_realloc(dp, newsize - oldsize, XFS_DATA_FORK);
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
-#if XFS_BIG_INUMS
        /*
         * Are we changing inode number size?
         */
@@ -863,7 +843,6 @@ xfs_dir2_sf_removename(
                else
                        sfp->i8count--;
        }
-#endif
        xfs_dir2_sf_check(args);
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
        return 0;
@@ -878,12 +857,8 @@ xfs_dir2_sf_replace(
 {
        xfs_inode_t             *dp;            /* incore directory inode */
        int                     i;              /* entry index */
-#if XFS_BIG_INUMS || defined(DEBUG)
        xfs_ino_t               ino=0;          /* entry old inode number */
-#endif
-#if XFS_BIG_INUMS
        int                     i8elevated;     /* sf_toino8 set i8count=1 */
-#endif
        xfs_dir2_sf_entry_t     *sfep;          /* shortform directory entry */
        xfs_dir2_sf_hdr_t       *sfp;           /* shortform structure */
 
@@ -903,7 +878,7 @@ xfs_dir2_sf_replace(
        ASSERT(dp->i_df.if_u1.if_data != NULL);
        sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->i8count));
-#if XFS_BIG_INUMS
+
        /*
         * New inode number is large, and need to convert to 8-byte inodes.
         */
@@ -934,17 +909,15 @@ xfs_dir2_sf_replace(
                sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
        } else
                i8elevated = 0;
-#endif
+
        ASSERT(args->namelen != 1 || args->name[0] != '.');
        /*
         * Replace ..'s entry.
         */
        if (args->namelen == 2 &&
            args->name[0] == '.' && args->name[1] == '.') {
-#if XFS_BIG_INUMS || defined(DEBUG)
                ino = dp->d_ops->sf_get_parent_ino(sfp);
                ASSERT(args->inumber != ino);
-#endif
                dp->d_ops->sf_put_parent_ino(sfp, args->inumber);
        }
        /*
@@ -955,10 +928,8 @@ xfs_dir2_sf_replace(
                     i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) {
                        if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
                                                                XFS_CMP_EXACT) {
-#if XFS_BIG_INUMS || defined(DEBUG)
                                ino = dp->d_ops->sf_get_ino(sfp, sfep);
                                ASSERT(args->inumber != ino);
-#endif
                                dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
                                dp->d_ops->sf_put_ftype(sfep, args->filetype);
                                break;
@@ -969,14 +940,11 @@ xfs_dir2_sf_replace(
                 */
                if (i == sfp->count) {
                        ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
-#if XFS_BIG_INUMS
                        if (i8elevated)
                                xfs_dir2_sf_toino4(args);
-#endif
                        return -ENOENT;
                }
        }
-#if XFS_BIG_INUMS
        /*
         * See if the old number was large, the new number is small.
         */
@@ -1003,13 +971,11 @@ xfs_dir2_sf_replace(
                if (!i8elevated)
                        sfp->i8count++;
        }
-#endif
        xfs_dir2_sf_check(args);
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA);
        return 0;
 }
 
-#if XFS_BIG_INUMS
 /*
  * Convert from 8-byte inode numbers to 4-byte inode numbers.
  * The last 8-byte inode number is gone, but the count is still 1.
@@ -1027,12 +993,10 @@ 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.
@@ -1105,12 +1069,10 @@ 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.
@@ -1164,4 +1126,3 @@ xfs_dir2_sf_toino8(
        dp->i_d.di_size = newsize;
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
 }
-#endif /* XFS_BIG_INUMS */
index 34d85aca305801ea3b1e982bab49305099dac465..8baa9264b8ab849579cb5df1b5ac15e6e06d5499 100644 (file)
@@ -33,6 +33,1077 @@ struct xfs_inode;
 struct xfs_buf;
 struct xfs_ifork;
 
+/*
+ * Super block
+ * Fits into a sector-sized buffer at address 0 of each allocation group.
+ * Only the first of these is ever updated except during growfs.
+ */
+#define        XFS_SB_MAGIC            0x58465342      /* 'XFSB' */
+#define        XFS_SB_VERSION_1        1               /* 5.3, 6.0.1, 6.1 */
+#define        XFS_SB_VERSION_2        2               /* 6.2 - attributes */
+#define        XFS_SB_VERSION_3        3               /* 6.2 - new inode version */
+#define        XFS_SB_VERSION_4        4               /* 6.2+ - bitmask version */
+#define        XFS_SB_VERSION_5        5               /* CRC enabled filesystem */
+#define        XFS_SB_VERSION_NUMBITS          0x000f
+#define        XFS_SB_VERSION_ALLFBITS         0xfff0
+#define        XFS_SB_VERSION_ATTRBIT          0x0010
+#define        XFS_SB_VERSION_NLINKBIT         0x0020
+#define        XFS_SB_VERSION_QUOTABIT         0x0040
+#define        XFS_SB_VERSION_ALIGNBIT         0x0080
+#define        XFS_SB_VERSION_DALIGNBIT        0x0100
+#define        XFS_SB_VERSION_SHAREDBIT        0x0200
+#define XFS_SB_VERSION_LOGV2BIT                0x0400
+#define XFS_SB_VERSION_SECTORBIT       0x0800
+#define        XFS_SB_VERSION_EXTFLGBIT        0x1000
+#define        XFS_SB_VERSION_DIRV2BIT         0x2000
+#define        XFS_SB_VERSION_BORGBIT          0x4000  /* ASCII only case-insens. */
+#define        XFS_SB_VERSION_MOREBITSBIT      0x8000
+
+/*
+ * Supported feature bit list is just all bits in the versionnum field because
+ * we've used them all up and understand them all. Except, of course, for the
+ * shared superblock bit, which nobody knows what it does and so is unsupported.
+ */
+#define        XFS_SB_VERSION_OKBITS           \
+       ((XFS_SB_VERSION_NUMBITS | XFS_SB_VERSION_ALLFBITS) & \
+               ~XFS_SB_VERSION_SHAREDBIT)
+
+/*
+ * There are two words to hold XFS "feature" bits: the original
+ * word, sb_versionnum, and sb_features2.  Whenever a bit is set in
+ * sb_features2, the feature bit XFS_SB_VERSION_MOREBITSBIT must be set.
+ *
+ * These defines represent bits in sb_features2.
+ */
+#define XFS_SB_VERSION2_RESERVED1BIT   0x00000001
+#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002      /* Superblk counters */
+#define XFS_SB_VERSION2_RESERVED4BIT   0x00000004
+#define XFS_SB_VERSION2_ATTR2BIT       0x00000008      /* Inline attr rework */
+#define XFS_SB_VERSION2_PARENTBIT      0x00000010      /* parent pointers */
+#define XFS_SB_VERSION2_PROJID32BIT    0x00000080      /* 32 bit project id */
+#define XFS_SB_VERSION2_CRCBIT         0x00000100      /* metadata CRCs */
+#define XFS_SB_VERSION2_FTYPE          0x00000200      /* inode type in dir */
+
+#define        XFS_SB_VERSION2_OKBITS          \
+       (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
+        XFS_SB_VERSION2_ATTR2BIT       | \
+        XFS_SB_VERSION2_PROJID32BIT    | \
+        XFS_SB_VERSION2_FTYPE)
+
+/*
+ * Superblock - in core version.  Must match the ondisk version below.
+ * Must be padded to 64 bit alignment.
+ */
+typedef struct xfs_sb {
+       __uint32_t      sb_magicnum;    /* magic number == XFS_SB_MAGIC */
+       __uint32_t      sb_blocksize;   /* logical block size, bytes */
+       xfs_rfsblock_t  sb_dblocks;     /* number of data blocks */
+       xfs_rfsblock_t  sb_rblocks;     /* number of realtime blocks */
+       xfs_rtblock_t   sb_rextents;    /* number of realtime extents */
+       uuid_t          sb_uuid;        /* file system unique id */
+       xfs_fsblock_t   sb_logstart;    /* starting block of log if internal */
+       xfs_ino_t       sb_rootino;     /* root inode number */
+       xfs_ino_t       sb_rbmino;      /* bitmap inode for realtime extents */
+       xfs_ino_t       sb_rsumino;     /* summary inode for rt bitmap */
+       xfs_agblock_t   sb_rextsize;    /* realtime extent size, blocks */
+       xfs_agblock_t   sb_agblocks;    /* size of an allocation group */
+       xfs_agnumber_t  sb_agcount;     /* number of allocation groups */
+       xfs_extlen_t    sb_rbmblocks;   /* number of rt bitmap blocks */
+       xfs_extlen_t    sb_logblocks;   /* number of log blocks */
+       __uint16_t      sb_versionnum;  /* header version == XFS_SB_VERSION */
+       __uint16_t      sb_sectsize;    /* volume sector size, bytes */
+       __uint16_t      sb_inodesize;   /* inode size, bytes */
+       __uint16_t      sb_inopblock;   /* inodes per block */
+       char            sb_fname[12];   /* file system name */
+       __uint8_t       sb_blocklog;    /* log2 of sb_blocksize */
+       __uint8_t       sb_sectlog;     /* log2 of sb_sectsize */
+       __uint8_t       sb_inodelog;    /* log2 of sb_inodesize */
+       __uint8_t       sb_inopblog;    /* log2 of sb_inopblock */
+       __uint8_t       sb_agblklog;    /* log2 of sb_agblocks (rounded up) */
+       __uint8_t       sb_rextslog;    /* log2 of sb_rextents */
+       __uint8_t       sb_inprogress;  /* mkfs is in progress, don't mount */
+       __uint8_t       sb_imax_pct;    /* max % of fs for inode space */
+                                       /* statistics */
+       /*
+        * These fields must remain contiguous.  If you really
+        * want to change their layout, make sure you fix the
+        * code in xfs_trans_apply_sb_deltas().
+        */
+       __uint64_t      sb_icount;      /* allocated inodes */
+       __uint64_t      sb_ifree;       /* free inodes */
+       __uint64_t      sb_fdblocks;    /* free data blocks */
+       __uint64_t      sb_frextents;   /* free realtime extents */
+       /*
+        * End contiguous fields.
+        */
+       xfs_ino_t       sb_uquotino;    /* user quota inode */
+       xfs_ino_t       sb_gquotino;    /* group quota inode */
+       __uint16_t      sb_qflags;      /* quota flags */
+       __uint8_t       sb_flags;       /* misc. flags */
+       __uint8_t       sb_shared_vn;   /* shared version number */
+       xfs_extlen_t    sb_inoalignmt;  /* inode chunk alignment, fsblocks */
+       __uint32_t      sb_unit;        /* stripe or raid unit */
+       __uint32_t      sb_width;       /* stripe or raid width */
+       __uint8_t       sb_dirblklog;   /* log2 of dir block size (fsbs) */
+       __uint8_t       sb_logsectlog;  /* log2 of the log sector size */
+       __uint16_t      sb_logsectsize; /* sector size for the log, bytes */
+       __uint32_t      sb_logsunit;    /* stripe unit size for the log */
+       __uint32_t      sb_features2;   /* additional feature bits */
+
+       /*
+        * bad features2 field as a result of failing to pad the sb
+        * structure to 64 bits. Some machines will be using this field
+        * for features2 bits. Easiest just to mark it bad and not use
+        * it for anything else.
+        */
+       __uint32_t      sb_bad_features2;
+
+       /* version 5 superblock fields start here */
+
+       /* feature masks */
+       __uint32_t      sb_features_compat;
+       __uint32_t      sb_features_ro_compat;
+       __uint32_t      sb_features_incompat;
+       __uint32_t      sb_features_log_incompat;
+
+       __uint32_t      sb_crc;         /* superblock crc */
+       __uint32_t      sb_pad;
+
+       xfs_ino_t       sb_pquotino;    /* project quota inode */
+       xfs_lsn_t       sb_lsn;         /* last write sequence */
+
+       /* must be padded to 64 bit alignment */
+} xfs_sb_t;
+
+#define XFS_SB_CRC_OFF         offsetof(struct xfs_sb, sb_crc)
+
+/*
+ * Superblock - on disk version.  Must match the in core version above.
+ * Must be padded to 64 bit alignment.
+ */
+typedef struct xfs_dsb {
+       __be32          sb_magicnum;    /* magic number == XFS_SB_MAGIC */
+       __be32          sb_blocksize;   /* logical block size, bytes */
+       __be64          sb_dblocks;     /* number of data blocks */
+       __be64          sb_rblocks;     /* number of realtime blocks */
+       __be64          sb_rextents;    /* number of realtime extents */
+       uuid_t          sb_uuid;        /* file system unique id */
+       __be64          sb_logstart;    /* starting block of log if internal */
+       __be64          sb_rootino;     /* root inode number */
+       __be64          sb_rbmino;      /* bitmap inode for realtime extents */
+       __be64          sb_rsumino;     /* summary inode for rt bitmap */
+       __be32          sb_rextsize;    /* realtime extent size, blocks */
+       __be32          sb_agblocks;    /* size of an allocation group */
+       __be32          sb_agcount;     /* number of allocation groups */
+       __be32          sb_rbmblocks;   /* number of rt bitmap blocks */
+       __be32          sb_logblocks;   /* number of log blocks */
+       __be16          sb_versionnum;  /* header version == XFS_SB_VERSION */
+       __be16          sb_sectsize;    /* volume sector size, bytes */
+       __be16          sb_inodesize;   /* inode size, bytes */
+       __be16          sb_inopblock;   /* inodes per block */
+       char            sb_fname[12];   /* file system name */
+       __u8            sb_blocklog;    /* log2 of sb_blocksize */
+       __u8            sb_sectlog;     /* log2 of sb_sectsize */
+       __u8            sb_inodelog;    /* log2 of sb_inodesize */
+       __u8            sb_inopblog;    /* log2 of sb_inopblock */
+       __u8            sb_agblklog;    /* log2 of sb_agblocks (rounded up) */
+       __u8            sb_rextslog;    /* log2 of sb_rextents */
+       __u8            sb_inprogress;  /* mkfs is in progress, don't mount */
+       __u8            sb_imax_pct;    /* max % of fs for inode space */
+                                       /* statistics */
+       /*
+        * These fields must remain contiguous.  If you really
+        * want to change their layout, make sure you fix the
+        * code in xfs_trans_apply_sb_deltas().
+        */
+       __be64          sb_icount;      /* allocated inodes */
+       __be64          sb_ifree;       /* free inodes */
+       __be64          sb_fdblocks;    /* free data blocks */
+       __be64          sb_frextents;   /* free realtime extents */
+       /*
+        * End contiguous fields.
+        */
+       __be64          sb_uquotino;    /* user quota inode */
+       __be64          sb_gquotino;    /* group quota inode */
+       __be16          sb_qflags;      /* quota flags */
+       __u8            sb_flags;       /* misc. flags */
+       __u8            sb_shared_vn;   /* shared version number */
+       __be32          sb_inoalignmt;  /* inode chunk alignment, fsblocks */
+       __be32          sb_unit;        /* stripe or raid unit */
+       __be32          sb_width;       /* stripe or raid width */
+       __u8            sb_dirblklog;   /* log2 of dir block size (fsbs) */
+       __u8            sb_logsectlog;  /* log2 of the log sector size */
+       __be16          sb_logsectsize; /* sector size for the log, bytes */
+       __be32          sb_logsunit;    /* stripe unit size for the log */
+       __be32          sb_features2;   /* additional feature bits */
+       /*
+        * bad features2 field as a result of failing to pad the sb
+        * structure to 64 bits. Some machines will be using this field
+        * for features2 bits. Easiest just to mark it bad and not use
+        * it for anything else.
+        */
+       __be32          sb_bad_features2;
+
+       /* version 5 superblock fields start here */
+
+       /* feature masks */
+       __be32          sb_features_compat;
+       __be32          sb_features_ro_compat;
+       __be32          sb_features_incompat;
+       __be32          sb_features_log_incompat;
+
+       __le32          sb_crc;         /* superblock crc */
+       __be32          sb_pad;
+
+       __be64          sb_pquotino;    /* project quota inode */
+       __be64          sb_lsn;         /* last write sequence */
+
+       /* must be padded to 64 bit alignment */
+} xfs_dsb_t;
+
+/*
+ * Sequence number values for the fields.
+ */
+typedef enum {
+       XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
+       XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
+       XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
+       XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
+       XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
+       XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
+       XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
+       XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
+       XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
+       XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
+       XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
+       XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
+       XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
+       XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
+       XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
+       XFS_SBS_PQUOTINO, XFS_SBS_LSN,
+       XFS_SBS_FIELDCOUNT
+} xfs_sb_field_t;
+
+/*
+ * Mask values, defined based on the xfs_sb_field_t values.
+ * Only define the ones we're using.
+ */
+#define        XFS_SB_MVAL(x)          (1LL << XFS_SBS_ ## x)
+#define        XFS_SB_UUID             XFS_SB_MVAL(UUID)
+#define        XFS_SB_FNAME            XFS_SB_MVAL(FNAME)
+#define        XFS_SB_ROOTINO          XFS_SB_MVAL(ROOTINO)
+#define        XFS_SB_RBMINO           XFS_SB_MVAL(RBMINO)
+#define        XFS_SB_RSUMINO          XFS_SB_MVAL(RSUMINO)
+#define        XFS_SB_VERSIONNUM       XFS_SB_MVAL(VERSIONNUM)
+#define XFS_SB_UQUOTINO                XFS_SB_MVAL(UQUOTINO)
+#define XFS_SB_GQUOTINO                XFS_SB_MVAL(GQUOTINO)
+#define XFS_SB_QFLAGS          XFS_SB_MVAL(QFLAGS)
+#define XFS_SB_SHARED_VN       XFS_SB_MVAL(SHARED_VN)
+#define XFS_SB_UNIT            XFS_SB_MVAL(UNIT)
+#define XFS_SB_WIDTH           XFS_SB_MVAL(WIDTH)
+#define XFS_SB_ICOUNT          XFS_SB_MVAL(ICOUNT)
+#define XFS_SB_IFREE           XFS_SB_MVAL(IFREE)
+#define XFS_SB_FDBLOCKS                XFS_SB_MVAL(FDBLOCKS)
+#define XFS_SB_FEATURES2       XFS_SB_MVAL(FEATURES2)
+#define XFS_SB_BAD_FEATURES2   XFS_SB_MVAL(BAD_FEATURES2)
+#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
+#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
+#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
+#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
+#define XFS_SB_CRC             XFS_SB_MVAL(CRC)
+#define XFS_SB_PQUOTINO                XFS_SB_MVAL(PQUOTINO)
+#define        XFS_SB_NUM_BITS         ((int)XFS_SBS_FIELDCOUNT)
+#define        XFS_SB_ALL_BITS         ((1LL << XFS_SB_NUM_BITS) - 1)
+#define        XFS_SB_MOD_BITS         \
+       (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
+        XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
+        XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
+        XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
+        XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \
+        XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \
+        XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO)
+
+
+/*
+ * Misc. Flags - warning - these will be cleared by xfs_repair unless
+ * a feature bit is set when the flag is used.
+ */
+#define XFS_SBF_NOFLAGS                0x00    /* no flags set */
+#define XFS_SBF_READONLY       0x01    /* only read-only mounts allowed */
+
+/*
+ * define max. shared version we can interoperate with
+ */
+#define XFS_SB_MAX_SHARED_VN   0
+
+#define        XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
+
+/*
+ * The first XFS version we support is a v4 superblock with V2 directories.
+ */
+static inline bool xfs_sb_good_v4_features(struct xfs_sb *sbp)
+{
+       if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
+               return false;
+
+       /* check for unknown features in the fs */
+       if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
+           ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
+            (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
+               return false;
+
+       return true;
+}
+
+static inline bool xfs_sb_good_version(struct xfs_sb *sbp)
+{
+       if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
+               return true;
+       if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
+               return xfs_sb_good_v4_features(sbp);
+       return false;
+}
+
+/*
+ * Detect a mismatched features2 field.  Older kernels read/wrote
+ * this into the wrong slot, so to be safe we keep them in sync.
+ */
+static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)
+{
+       return sbp->sb_bad_features2 != sbp->sb_features2;
+}
+
+static inline bool xfs_sb_version_hasattr(struct xfs_sb *sbp)
+{
+       return (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT);
+}
+
+static inline void xfs_sb_version_addattr(struct xfs_sb *sbp)
+{
+       sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT;
+}
+
+static inline bool xfs_sb_version_hasquota(struct xfs_sb *sbp)
+{
+       return (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
+}
+
+static inline void xfs_sb_version_addquota(struct xfs_sb *sbp)
+{
+       sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
+}
+
+static inline bool xfs_sb_version_hasalign(struct xfs_sb *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
+               (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT));
+}
+
+static inline bool xfs_sb_version_hasdalign(struct xfs_sb *sbp)
+{
+       return (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
+}
+
+static inline bool xfs_sb_version_haslogv2(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
+              (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
+}
+
+static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
+              (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
+}
+
+static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp)
+{
+       return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
+}
+
+static inline bool xfs_sb_version_hasasciici(struct xfs_sb *sbp)
+{
+       return (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
+}
+
+static inline bool xfs_sb_version_hasmorebits(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
+              (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
+}
+
+/*
+ * sb_features2 bit version macros.
+ */
+static inline bool xfs_sb_version_haslazysbcount(struct xfs_sb *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
+              (xfs_sb_version_hasmorebits(sbp) &&
+               (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
+}
+
+static inline bool xfs_sb_version_hasattr2(struct xfs_sb *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
+              (xfs_sb_version_hasmorebits(sbp) &&
+               (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT));
+}
+
+static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
+{
+       sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
+       sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
+       sbp->sb_bad_features2 |= XFS_SB_VERSION2_ATTR2BIT;
+}
+
+static inline void xfs_sb_version_removeattr2(struct xfs_sb *sbp)
+{
+       sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
+       sbp->sb_bad_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
+       if (!sbp->sb_features2)
+               sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
+}
+
+static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
+              (xfs_sb_version_hasmorebits(sbp) &&
+               (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
+}
+
+static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
+{
+       sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
+       sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
+       sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
+}
+
+/*
+ * Extended v5 superblock feature masks. These are to be used for new v5
+ * superblock features only.
+ *
+ * Compat features are new features that old kernels will not notice or affect
+ * and so can mount read-write without issues.
+ *
+ * RO-Compat (read only) are features that old kernels can read but will break
+ * if they write. Hence only read-only mounts of such filesystems are allowed on
+ * kernels that don't support the feature bit.
+ *
+ * InCompat features are features which old kernels will not understand and so
+ * must not mount.
+ *
+ * Log-InCompat features are for changes to log formats or new transactions that
+ * can't be replayed on older kernels. The fields are set when the filesystem is
+ * mounted, and a clean unmount clears the fields.
+ */
+#define XFS_SB_FEAT_COMPAT_ALL 0
+#define XFS_SB_FEAT_COMPAT_UNKNOWN     ~XFS_SB_FEAT_COMPAT_ALL
+static inline bool
+xfs_sb_has_compat_feature(
+       struct xfs_sb   *sbp,
+       __uint32_t      feature)
+{
+       return (sbp->sb_features_compat & feature) != 0;
+}
+
+#define XFS_SB_FEAT_RO_COMPAT_FINOBT   (1 << 0)                /* free inode btree */
+#define XFS_SB_FEAT_RO_COMPAT_ALL \
+               (XFS_SB_FEAT_RO_COMPAT_FINOBT)
+#define XFS_SB_FEAT_RO_COMPAT_UNKNOWN  ~XFS_SB_FEAT_RO_COMPAT_ALL
+static inline bool
+xfs_sb_has_ro_compat_feature(
+       struct xfs_sb   *sbp,
+       __uint32_t      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 \
+               (XFS_SB_FEAT_INCOMPAT_FTYPE)
+
+#define XFS_SB_FEAT_INCOMPAT_UNKNOWN   ~XFS_SB_FEAT_INCOMPAT_ALL
+static inline bool
+xfs_sb_has_incompat_feature(
+       struct xfs_sb   *sbp,
+       __uint32_t      feature)
+{
+       return (sbp->sb_features_incompat & feature) != 0;
+}
+
+#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0
+#define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN       ~XFS_SB_FEAT_INCOMPAT_LOG_ALL
+static inline bool
+xfs_sb_has_incompat_log_feature(
+       struct xfs_sb   *sbp,
+       __uint32_t      feature)
+{
+       return (sbp->sb_features_log_incompat & feature) != 0;
+}
+
+/*
+ * V5 superblock specific feature checks
+ */
+static inline int xfs_sb_version_hascrc(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
+}
+
+static inline int xfs_sb_version_has_pquotino(struct xfs_sb *sbp)
+{
+       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
+}
+
+static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
+               xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) ||
+              (xfs_sb_version_hasmorebits(sbp) &&
+                (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
+}
+
+static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp)
+{
+       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) &&
+               (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT);
+}
+
+/*
+ * end of superblock version macros
+ */
+
+static inline bool
+xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
+{
+       return (ino == sbp->sb_uquotino ||
+               ino == sbp->sb_gquotino ||
+               ino == sbp->sb_pquotino);
+}
+
+#define XFS_SB_DADDR           ((xfs_daddr_t)0) /* daddr in filesystem/ag */
+#define        XFS_SB_BLOCK(mp)        XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
+#define XFS_BUF_TO_SBP(bp)     ((xfs_dsb_t *)((bp)->b_addr))
+
+#define        XFS_HDR_BLOCK(mp,d)     ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
+#define        XFS_DADDR_TO_FSB(mp,d)  XFS_AGB_TO_FSB(mp, \
+                       xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
+#define        XFS_FSB_TO_DADDR(mp,fsbno)      XFS_AGB_TO_DADDR(mp, \
+                       XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
+
+/*
+ * File system sector to basic block conversions.
+ */
+#define XFS_FSS_TO_BB(mp,sec)  ((sec) << (mp)->m_sectbb_log)
+
+/*
+ * File system block to basic block conversions.
+ */
+#define        XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
+#define        XFS_BB_TO_FSB(mp,bb)    \
+       (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
+#define        XFS_BB_TO_FSBT(mp,bb)   ((bb) >> (mp)->m_blkbb_log)
+
+/*
+ * File system block to byte conversions.
+ */
+#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
+#define XFS_B_TO_FSB(mp,b)     \
+       ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
+#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)
+
+/*
+ * Allocation group header
+ *
+ * This is divided into three structures, placed in sequential 512-byte
+ * buffers after a copy of the superblock (also in a 512-byte buffer).
+ */
+#define        XFS_AGF_MAGIC   0x58414746      /* 'XAGF' */
+#define        XFS_AGI_MAGIC   0x58414749      /* 'XAGI' */
+#define        XFS_AGFL_MAGIC  0x5841464c      /* 'XAFL' */
+#define        XFS_AGF_VERSION 1
+#define        XFS_AGI_VERSION 1
+
+#define        XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
+#define        XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
+
+/*
+ * Btree number 0 is bno, 1 is cnt.  This value gives the size of the
+ * arrays below.
+ */
+#define        XFS_BTNUM_AGF   ((int)XFS_BTNUM_CNTi + 1)
+
+/*
+ * The second word of agf_levels in the first a.g. overlaps the EFS
+ * superblock's magic number.  Since the magic numbers valid for EFS
+ * are > 64k, our value cannot be confused for an EFS superblock's.
+ */
+
+typedef struct xfs_agf {
+       /*
+        * Common allocation group header information
+        */
+       __be32          agf_magicnum;   /* magic number == XFS_AGF_MAGIC */
+       __be32          agf_versionnum; /* header version == XFS_AGF_VERSION */
+       __be32          agf_seqno;      /* sequence # starting from 0 */
+       __be32          agf_length;     /* size in blocks of a.g. */
+       /*
+        * Freespace information
+        */
+       __be32          agf_roots[XFS_BTNUM_AGF];       /* root blocks */
+       __be32          agf_spare0;     /* spare field */
+       __be32          agf_levels[XFS_BTNUM_AGF];      /* btree levels */
+       __be32          agf_spare1;     /* spare field */
+
+       __be32          agf_flfirst;    /* first freelist block's index */
+       __be32          agf_fllast;     /* last freelist block's index */
+       __be32          agf_flcount;    /* count of blocks in freelist */
+       __be32          agf_freeblks;   /* total free blocks */
+
+       __be32          agf_longest;    /* longest free space */
+       __be32          agf_btreeblks;  /* # of blocks held in AGF btrees */
+       uuid_t          agf_uuid;       /* uuid of filesystem */
+
+       /*
+        * reserve some contiguous space for future logged fields before we add
+        * the unlogged fields. This makes the range logging via flags and
+        * structure offsets much simpler.
+        */
+       __be64          agf_spare64[16];
+
+       /* unlogged fields, written during buffer writeback. */
+       __be64          agf_lsn;        /* last write sequence */
+       __be32          agf_crc;        /* crc of agf sector */
+       __be32          agf_spare2;
+
+       /* structure must be padded to 64 bit alignment */
+} xfs_agf_t;
+
+#define XFS_AGF_CRC_OFF                offsetof(struct xfs_agf, agf_crc)
+
+#define        XFS_AGF_MAGICNUM        0x00000001
+#define        XFS_AGF_VERSIONNUM      0x00000002
+#define        XFS_AGF_SEQNO           0x00000004
+#define        XFS_AGF_LENGTH          0x00000008
+#define        XFS_AGF_ROOTS           0x00000010
+#define        XFS_AGF_LEVELS          0x00000020
+#define        XFS_AGF_FLFIRST         0x00000040
+#define        XFS_AGF_FLLAST          0x00000080
+#define        XFS_AGF_FLCOUNT         0x00000100
+#define        XFS_AGF_FREEBLKS        0x00000200
+#define        XFS_AGF_LONGEST         0x00000400
+#define        XFS_AGF_BTREEBLKS       0x00000800
+#define        XFS_AGF_UUID            0x00001000
+#define        XFS_AGF_NUM_BITS        13
+#define        XFS_AGF_ALL_BITS        ((1 << XFS_AGF_NUM_BITS) - 1)
+
+#define XFS_AGF_FLAGS \
+       { XFS_AGF_MAGICNUM,     "MAGICNUM" }, \
+       { XFS_AGF_VERSIONNUM,   "VERSIONNUM" }, \
+       { XFS_AGF_SEQNO,        "SEQNO" }, \
+       { XFS_AGF_LENGTH,       "LENGTH" }, \
+       { XFS_AGF_ROOTS,        "ROOTS" }, \
+       { XFS_AGF_LEVELS,       "LEVELS" }, \
+       { XFS_AGF_FLFIRST,      "FLFIRST" }, \
+       { XFS_AGF_FLLAST,       "FLLAST" }, \
+       { XFS_AGF_FLCOUNT,      "FLCOUNT" }, \
+       { XFS_AGF_FREEBLKS,     "FREEBLKS" }, \
+       { XFS_AGF_LONGEST,      "LONGEST" }, \
+       { XFS_AGF_BTREEBLKS,    "BTREEBLKS" }, \
+       { XFS_AGF_UUID,         "UUID" }
+
+/* disk block (xfs_daddr_t) in the AG */
+#define XFS_AGF_DADDR(mp)      ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
+#define        XFS_AGF_BLOCK(mp)       XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
+#define        XFS_BUF_TO_AGF(bp)      ((xfs_agf_t *)((bp)->b_addr))
+
+/*
+ * Size of the unlinked inode hash table in the agi.
+ */
+#define        XFS_AGI_UNLINKED_BUCKETS        64
+
+typedef struct xfs_agi {
+       /*
+        * Common allocation group header information
+        */
+       __be32          agi_magicnum;   /* magic number == XFS_AGI_MAGIC */
+       __be32          agi_versionnum; /* header version == XFS_AGI_VERSION */
+       __be32          agi_seqno;      /* sequence # starting from 0 */
+       __be32          agi_length;     /* size in blocks of a.g. */
+       /*
+        * Inode information
+        * Inodes are mapped by interpreting the inode number, so no
+        * mapping data is needed here.
+        */
+       __be32          agi_count;      /* count of allocated inodes */
+       __be32          agi_root;       /* root of inode btree */
+       __be32          agi_level;      /* levels in inode btree */
+       __be32          agi_freecount;  /* number of free inodes */
+
+       __be32          agi_newino;     /* new inode just allocated */
+       __be32          agi_dirino;     /* last directory inode chunk */
+       /*
+        * Hash table of inodes which have been unlinked but are
+        * still being referenced.
+        */
+       __be32          agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
+       /*
+        * This marks the end of logging region 1 and start of logging region 2.
+        */
+       uuid_t          agi_uuid;       /* uuid of filesystem */
+       __be32          agi_crc;        /* crc of agi sector */
+       __be32          agi_pad32;
+       __be64          agi_lsn;        /* last write sequence */
+
+       __be32          agi_free_root; /* root of the free inode btree */
+       __be32          agi_free_level;/* levels in free inode btree */
+
+       /* structure must be padded to 64 bit alignment */
+} xfs_agi_t;
+
+#define XFS_AGI_CRC_OFF                offsetof(struct xfs_agi, agi_crc)
+
+#define        XFS_AGI_MAGICNUM        (1 << 0)
+#define        XFS_AGI_VERSIONNUM      (1 << 1)
+#define        XFS_AGI_SEQNO           (1 << 2)
+#define        XFS_AGI_LENGTH          (1 << 3)
+#define        XFS_AGI_COUNT           (1 << 4)
+#define        XFS_AGI_ROOT            (1 << 5)
+#define        XFS_AGI_LEVEL           (1 << 6)
+#define        XFS_AGI_FREECOUNT       (1 << 7)
+#define        XFS_AGI_NEWINO          (1 << 8)
+#define        XFS_AGI_DIRINO          (1 << 9)
+#define        XFS_AGI_UNLINKED        (1 << 10)
+#define        XFS_AGI_NUM_BITS_R1     11      /* end of the 1st agi logging region */
+#define        XFS_AGI_ALL_BITS_R1     ((1 << XFS_AGI_NUM_BITS_R1) - 1)
+#define        XFS_AGI_FREE_ROOT       (1 << 11)
+#define        XFS_AGI_FREE_LEVEL      (1 << 12)
+#define        XFS_AGI_NUM_BITS_R2     13
+
+/* disk block (xfs_daddr_t) in the AG */
+#define XFS_AGI_DADDR(mp)      ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
+#define        XFS_AGI_BLOCK(mp)       XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
+#define        XFS_BUF_TO_AGI(bp)      ((xfs_agi_t *)((bp)->b_addr))
+
+/*
+ * The third a.g. block contains the a.g. freelist, an array
+ * of block pointers to blocks owned by the allocation btree code.
+ */
+#define XFS_AGFL_DADDR(mp)     ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
+#define        XFS_AGFL_BLOCK(mp)      XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
+#define        XFS_BUF_TO_AGFL(bp)     ((xfs_agfl_t *)((bp)->b_addr))
+
+#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
+       (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
+               &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
+               (__be32 *)(bp)->b_addr)
+
+/*
+ * Size of the AGFL.  For CRC-enabled filesystes we steal a couple of
+ * slots in the beginning of the block for a proper header with the
+ * location information and CRC.
+ */
+#define XFS_AGFL_SIZE(mp) \
+       (((mp)->m_sb.sb_sectsize - \
+        (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
+               sizeof(struct xfs_agfl) : 0)) / \
+         sizeof(xfs_agblock_t))
+
+typedef struct xfs_agfl {
+       __be32          agfl_magicnum;
+       __be32          agfl_seqno;
+       uuid_t          agfl_uuid;
+       __be64          agfl_lsn;
+       __be32          agfl_crc;
+       __be32          agfl_bno[];     /* actually XFS_AGFL_SIZE(mp) */
+} xfs_agfl_t;
+
+#define XFS_AGFL_CRC_OFF       offsetof(struct xfs_agfl, agfl_crc)
+
+
+#define        XFS_AG_MAXLEVELS(mp)            ((mp)->m_ag_maxlevels)
+#define        XFS_MIN_FREELIST_RAW(bl,cl,mp)  \
+       (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
+#define        XFS_MIN_FREELIST(a,mp)          \
+       (XFS_MIN_FREELIST_RAW(          \
+               be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
+               be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
+#define        XFS_MIN_FREELIST_PAG(pag,mp)    \
+       (XFS_MIN_FREELIST_RAW(          \
+               (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
+               (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
+
+#define XFS_AGB_TO_FSB(mp,agno,agbno)  \
+       (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
+#define        XFS_FSB_TO_AGNO(mp,fsbno)       \
+       ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
+#define        XFS_FSB_TO_AGBNO(mp,fsbno)      \
+       ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
+#define        XFS_AGB_TO_DADDR(mp,agno,agbno) \
+       ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
+               (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
+#define        XFS_AG_DADDR(mp,agno,d)         (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
+
+/*
+ * For checking for bad ranges of xfs_daddr_t's, covering multiple
+ * allocation groups or a single xfs_daddr_t that's a superblock copy.
+ */
+#define        XFS_AG_CHECK_DADDR(mp,d,len)    \
+       ((len) == 1 ? \
+           ASSERT((d) == XFS_SB_DADDR || \
+                  xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
+           ASSERT(xfs_daddr_to_agno(mp, d) == \
+                  xfs_daddr_to_agno(mp, (d) + (len) - 1)))
+
+typedef struct xfs_timestamp {
+       __be32          t_sec;          /* timestamp seconds */
+       __be32          t_nsec;         /* timestamp nanoseconds */
+} xfs_timestamp_t;
+
+/*
+ * On-disk inode structure.
+ *
+ * This is just the header or "dinode core", the inode is expanded to fill a
+ * variable size the leftover area split into a data and an attribute fork.
+ * The format of the data and attribute fork depends on the format of the
+ * inode as indicated by di_format and di_aformat.  To access the data and
+ * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros
+ * below.
+ *
+ * There is a very similar struct icdinode in xfs_inode which matches the
+ * layout of the first 96 bytes of this structure, but is kept in native
+ * format instead of big endian.
+ *
+ * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed
+ * padding field for v3 inodes.
+ */
+#define        XFS_DINODE_MAGIC                0x494e  /* 'IN' */
+#define XFS_DINODE_GOOD_VERSION(v)     ((v) >= 1 && (v) <= 3)
+typedef struct xfs_dinode {
+       __be16          di_magic;       /* inode magic # = XFS_DINODE_MAGIC */
+       __be16          di_mode;        /* mode and type of file */
+       __u8            di_version;     /* inode version */
+       __u8            di_format;      /* format of di_c data */
+       __be16          di_onlink;      /* old number of links to file */
+       __be32          di_uid;         /* owner's user id */
+       __be32          di_gid;         /* owner's group id */
+       __be32          di_nlink;       /* number of links to file */
+       __be16          di_projid_lo;   /* lower part of owner's project id */
+       __be16          di_projid_hi;   /* higher part owner's project id */
+       __u8            di_pad[6];      /* unused, zeroed space */
+       __be16          di_flushiter;   /* incremented on flush */
+       xfs_timestamp_t di_atime;       /* time last accessed */
+       xfs_timestamp_t di_mtime;       /* time last modified */
+       xfs_timestamp_t di_ctime;       /* time created/inode modified */
+       __be64          di_size;        /* number of bytes in file */
+       __be64          di_nblocks;     /* # of direct & btree blocks used */
+       __be32          di_extsize;     /* basic/minimum extent size for file */
+       __be32          di_nextents;    /* number of extents in data fork */
+       __be16          di_anextents;   /* number of extents in attribute fork*/
+       __u8            di_forkoff;     /* attr fork offs, <<3 for 64b align */
+       __s8            di_aformat;     /* format of attr fork's data */
+       __be32          di_dmevmask;    /* DMIG event mask */
+       __be16          di_dmstate;     /* DMIG state info */
+       __be16          di_flags;       /* random flags, XFS_DIFLAG_... */
+       __be32          di_gen;         /* generation number */
+
+       /* di_next_unlinked is the only non-core field in the old dinode */
+       __be32          di_next_unlinked;/* agi unlinked list ptr */
+
+       /* start of the extended dinode, writable fields */
+       __le32          di_crc;         /* CRC of the inode */
+       __be64          di_changecount; /* number of attribute changes */
+       __be64          di_lsn;         /* flush sequence */
+       __be64          di_flags2;      /* more random flags */
+       __u8            di_pad2[16];    /* more padding for future expansion */
+
+       /* fields only written to during inode creation */
+       xfs_timestamp_t di_crtime;      /* time created */
+       __be64          di_ino;         /* inode number */
+       uuid_t          di_uuid;        /* UUID of the filesystem */
+
+       /* structure must be padded to 64 bit alignment */
+} xfs_dinode_t;
+
+#define XFS_DINODE_CRC_OFF     offsetof(struct xfs_dinode, di_crc)
+
+#define DI_MAX_FLUSH 0xffff
+
+/*
+ * Size of the core inode on disk.  Version 1 and 2 inodes have
+ * the same size, but version 3 has grown a few additional fields.
+ */
+static inline uint xfs_dinode_size(int version)
+{
+       if (version == 3)
+               return sizeof(struct xfs_dinode);
+       return offsetof(struct xfs_dinode, di_crc);
+}
+
+/*
+ * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
+ * Since the pathconf interface is signed, we use 2^31 - 1 instead.
+ * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
+ */
+#define        XFS_MAXLINK             ((1U << 31) - 1U)
+#define        XFS_MAXLINK_1           65535U
+
+/*
+ * Values for di_format
+ */
+typedef enum xfs_dinode_fmt {
+       XFS_DINODE_FMT_DEV,             /* xfs_dev_t */
+       XFS_DINODE_FMT_LOCAL,           /* bulk data */
+       XFS_DINODE_FMT_EXTENTS,         /* struct xfs_bmbt_rec */
+       XFS_DINODE_FMT_BTREE,           /* struct xfs_bmdr_block */
+       XFS_DINODE_FMT_UUID             /* uuid_t */
+} xfs_dinode_fmt_t;
+
+/*
+ * Inode minimum and maximum sizes.
+ */
+#define        XFS_DINODE_MIN_LOG      8
+#define        XFS_DINODE_MAX_LOG      11
+#define        XFS_DINODE_MIN_SIZE     (1 << XFS_DINODE_MIN_LOG)
+#define        XFS_DINODE_MAX_SIZE     (1 << XFS_DINODE_MAX_LOG)
+
+/*
+ * Inode size for given fs.
+ */
+#define XFS_LITINO(mp, version) \
+       ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))
+
+/*
+ * Inode data & attribute fork sizes, per inode.
+ */
+#define XFS_DFORK_Q(dip)               ((dip)->di_forkoff != 0)
+#define XFS_DFORK_BOFF(dip)            ((int)((dip)->di_forkoff << 3))
+
+#define XFS_DFORK_DSIZE(dip,mp) \
+       (XFS_DFORK_Q(dip) ? \
+               XFS_DFORK_BOFF(dip) : \
+               XFS_LITINO(mp, (dip)->di_version))
+#define XFS_DFORK_ASIZE(dip,mp) \
+       (XFS_DFORK_Q(dip) ? \
+               XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
+               0)
+#define XFS_DFORK_SIZE(dip,mp,w) \
+       ((w) == XFS_DATA_FORK ? \
+               XFS_DFORK_DSIZE(dip, mp) : \
+               XFS_DFORK_ASIZE(dip, mp))
+
+/*
+ * Return pointers to the data or attribute forks.
+ */
+#define XFS_DFORK_DPTR(dip) \
+       ((char *)dip + xfs_dinode_size(dip->di_version))
+#define XFS_DFORK_APTR(dip)    \
+       (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))
+#define XFS_DFORK_PTR(dip,w)   \
+       ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
+
+#define XFS_DFORK_FORMAT(dip,w) \
+       ((w) == XFS_DATA_FORK ? \
+               (dip)->di_format : \
+               (dip)->di_aformat)
+#define XFS_DFORK_NEXTENTS(dip,w) \
+       ((w) == XFS_DATA_FORK ? \
+               be32_to_cpu((dip)->di_nextents) : \
+               be16_to_cpu((dip)->di_anextents))
+
+/*
+ * For block and character special files the 32bit dev_t is stored at the
+ * beginning of the data fork.
+ */
+static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
+{
+       return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
+}
+
+static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
+{
+       *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);
+}
+
+/*
+ * Values for di_flags
+ * There should be a one-to-one correspondence between these flags and the
+ * XFS_XFLAG_s.
+ */
+#define XFS_DIFLAG_REALTIME_BIT  0     /* file's blocks come from rt area */
+#define XFS_DIFLAG_PREALLOC_BIT  1     /* file space has been preallocated */
+#define XFS_DIFLAG_NEWRTBM_BIT   2     /* for rtbitmap inode, new format */
+#define XFS_DIFLAG_IMMUTABLE_BIT 3     /* inode is immutable */
+#define XFS_DIFLAG_APPEND_BIT    4     /* inode is append-only */
+#define XFS_DIFLAG_SYNC_BIT      5     /* inode is written synchronously */
+#define XFS_DIFLAG_NOATIME_BIT   6     /* do not update atime */
+#define XFS_DIFLAG_NODUMP_BIT    7     /* do not dump */
+#define XFS_DIFLAG_RTINHERIT_BIT 8     /* create with realtime bit set */
+#define XFS_DIFLAG_PROJINHERIT_BIT   9 /* create with parents projid */
+#define XFS_DIFLAG_NOSYMLINKS_BIT   10 /* disallow symlink creation */
+#define XFS_DIFLAG_EXTSIZE_BIT      11 /* inode extent size allocator hint */
+#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
+#define XFS_DIFLAG_NODEFRAG_BIT     13 /* do not reorganize/defragment */
+#define XFS_DIFLAG_FILESTREAM_BIT   14  /* use filestream allocator */
+#define XFS_DIFLAG_REALTIME      (1 << XFS_DIFLAG_REALTIME_BIT)
+#define XFS_DIFLAG_PREALLOC      (1 << XFS_DIFLAG_PREALLOC_BIT)
+#define XFS_DIFLAG_NEWRTBM       (1 << XFS_DIFLAG_NEWRTBM_BIT)
+#define XFS_DIFLAG_IMMUTABLE     (1 << XFS_DIFLAG_IMMUTABLE_BIT)
+#define XFS_DIFLAG_APPEND        (1 << XFS_DIFLAG_APPEND_BIT)
+#define XFS_DIFLAG_SYNC          (1 << XFS_DIFLAG_SYNC_BIT)
+#define XFS_DIFLAG_NOATIME       (1 << XFS_DIFLAG_NOATIME_BIT)
+#define XFS_DIFLAG_NODUMP        (1 << XFS_DIFLAG_NODUMP_BIT)
+#define XFS_DIFLAG_RTINHERIT     (1 << XFS_DIFLAG_RTINHERIT_BIT)
+#define XFS_DIFLAG_PROJINHERIT   (1 << XFS_DIFLAG_PROJINHERIT_BIT)
+#define XFS_DIFLAG_NOSYMLINKS    (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
+#define XFS_DIFLAG_EXTSIZE       (1 << XFS_DIFLAG_EXTSIZE_BIT)
+#define XFS_DIFLAG_EXTSZINHERIT  (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
+#define XFS_DIFLAG_NODEFRAG      (1 << XFS_DIFLAG_NODEFRAG_BIT)
+#define XFS_DIFLAG_FILESTREAM    (1 << XFS_DIFLAG_FILESTREAM_BIT)
+
+#define XFS_DIFLAG_ANY \
+       (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
+        XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
+        XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
+        XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
+        XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
+
+/*
+ * Inode number format:
+ * low inopblog bits - offset in block
+ * next agblklog bits - block number in ag
+ * next agno_log bits - ag number
+ * high agno_log-agblklog-inopblog bits - 0
+ */
+#define        XFS_INO_MASK(k)                 (__uint32_t)((1ULL << (k)) - 1)
+#define        XFS_INO_OFFSET_BITS(mp)         (mp)->m_sb.sb_inopblog
+#define        XFS_INO_AGBNO_BITS(mp)          (mp)->m_sb.sb_agblklog
+#define        XFS_INO_AGINO_BITS(mp)          (mp)->m_agino_log
+#define        XFS_INO_AGNO_BITS(mp)           (mp)->m_agno_log
+#define        XFS_INO_BITS(mp)                \
+       XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
+#define        XFS_INO_TO_AGNO(mp,i)           \
+       ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
+#define        XFS_INO_TO_AGINO(mp,i)          \
+       ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
+#define        XFS_INO_TO_AGBNO(mp,i)          \
+       (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
+               XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
+#define        XFS_INO_TO_OFFSET(mp,i)         \
+       ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
+#define        XFS_INO_TO_FSB(mp,i)            \
+       XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
+#define        XFS_AGINO_TO_INO(mp,a,i)        \
+       (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
+#define        XFS_AGINO_TO_AGBNO(mp,i)        ((i) >> XFS_INO_OFFSET_BITS(mp))
+#define        XFS_AGINO_TO_OFFSET(mp,i)       \
+       ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
+#define        XFS_OFFBNO_TO_AGINO(mp,b,o)     \
+       ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
+
+#define        XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 56) - 1ULL))
+#define        XFS_MAXINUMBER_32       ((xfs_ino_t)((1ULL << 32) - 1ULL))
+
 /*
  * RealTime Device format definitions
  */
@@ -68,11 +1139,7 @@ struct xfs_ifork;
 #define        XFS_RTLOBIT(w)  xfs_lowbit32(w)
 #define        XFS_RTHIBIT(w)  xfs_highbit32(w)
 
-#if XFS_BIG_BLKNOS
 #define        XFS_RTBLOCKLOG(b)       xfs_highbit64(b)
-#else
-#define        XFS_RTBLOCKLOG(b)       xfs_highbit32(b)
-#endif
 
 /*
  * Dquot and dquot block format definitions
@@ -304,23 +1371,15 @@ typedef struct xfs_bmbt_rec_host {
  * Values and macros for delayed-allocation startblock fields.
  */
 #define STARTBLOCKVALBITS      17
-#define STARTBLOCKMASKBITS     (15 + XFS_BIG_BLKNOS * 20)
-#define DSTARTBLOCKMASKBITS    (15 + 20)
+#define STARTBLOCKMASKBITS     (15 + 20)
 #define STARTBLOCKMASK         \
        (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
-#define DSTARTBLOCKMASK                \
-       (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
 
 static inline int isnullstartblock(xfs_fsblock_t x)
 {
        return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
 }
 
-static inline int isnulldstartblock(xfs_dfsbno_t x)
-{
-       return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
-}
-
 static inline xfs_fsblock_t nullstartblock(int k)
 {
        ASSERT(k < (1 << STARTBLOCKVALBITS));
@@ -425,4 +1484,40 @@ struct xfs_btree_block {
 #define XFS_BTREE_LBLOCK_CRC_OFF \
        offsetof(struct xfs_btree_block, bb_u.l.bb_crc)
 
+/*
+ * On-disk XFS access control list structure.
+ */
+struct xfs_acl_entry {
+       __be32  ae_tag;
+       __be32  ae_id;
+       __be16  ae_perm;
+       __be16  ae_pad;         /* fill the implicit hole in the structure */
+};
+
+struct xfs_acl {
+       __be32                  acl_cnt;
+       struct xfs_acl_entry    acl_entry[0];
+};
+
+/*
+ * The number of ACL entries allowed is defined by the on-disk format.
+ * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is
+ * limited only by the maximum size of the xattr that stores the information.
+ */
+#define XFS_ACL_MAX_ENTRIES(mp)        \
+       (xfs_sb_version_hascrc(&mp->m_sb) \
+               ?  (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
+                                               sizeof(struct xfs_acl_entry) \
+               : 25)
+
+#define XFS_ACL_MAX_SIZE(mp) \
+       (sizeof(struct xfs_acl) + \
+               sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
+
+/* On-disk XFS extended attribute names */
+#define SGI_ACL_FILE           (char *)"SGI_ACL_FILE"
+#define SGI_ACL_DEFAULT                (char *)"SGI_ACL_DEFAULT"
+#define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)
+#define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
+
 #endif /* __XFS_FORMAT_H__ */
index d34703dbcb423b7fdbb52438b2525dd74417f1eb..18dc721ca19f85f7436ab7c3241e28506521abee 100644 (file)
@@ -255,8 +255,8 @@ typedef struct xfs_fsop_resblks {
        ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES)
 
 /* Used for sanity checks on superblock */
-#define XFS_MAX_DBLOCKS(s) ((xfs_drfsbno_t)(s)->sb_agcount * (s)->sb_agblocks)
-#define XFS_MIN_DBLOCKS(s) ((xfs_drfsbno_t)((s)->sb_agcount - 1) *     \
+#define XFS_MAX_DBLOCKS(s) ((xfs_rfsblock_t)(s)->sb_agcount * (s)->sb_agblocks)
+#define XFS_MIN_DBLOCKS(s) ((xfs_rfsblock_t)((s)->sb_agcount - 1) *    \
                         (s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
 
 /*
@@ -375,6 +375,9 @@ struct xfs_fs_eofblocks {
 #define XFS_EOF_FLAGS_GID              (1 << 2) /* filter by gid */
 #define XFS_EOF_FLAGS_PRID             (1 << 3) /* filter by project id */
 #define XFS_EOF_FLAGS_MINFILESIZE      (1 << 4) /* filter by min file size */
+#define XFS_EOF_FLAGS_UNION            (1 << 5) /* union filter algorithm;
+                                                 * kernel only, not included in
+                                                 * valid mask */
 #define XFS_EOF_FLAGS_VALID    \
        (XFS_EOF_FLAGS_SYNC |   \
         XFS_EOF_FLAGS_UID |    \
index ec2d82de64013d5611908dda1a30aabb30a2750c..a2aaff5068b7e981847f205f0509748a09b0843d 100644 (file)
  */
 static inline int
 xfs_ialloc_cluster_alignment(
-       xfs_alloc_arg_t *args)
+       struct xfs_mount        *mp)
 {
-       if (xfs_sb_version_hasalign(&args->mp->m_sb) &&
-           args->mp->m_sb.sb_inoalignmt >=
-            XFS_B_TO_FSBT(args->mp, args->mp->m_inode_cluster_size))
-               return args->mp->m_sb.sb_inoalignmt;
+       if (xfs_sb_version_hasalign(&mp->m_sb) &&
+           mp->m_sb.sb_inoalignmt >=
+                       XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
+               return mp->m_sb.sb_inoalignmt;
        return 1;
 }
 
@@ -388,7 +388,7 @@ xfs_ialloc_ag_alloc(
                 * but not to use them in the actual exact allocation.
                 */
                args.alignment = 1;
-               args.minalignslop = xfs_ialloc_cluster_alignment(&args) - 1;
+               args.minalignslop = xfs_ialloc_cluster_alignment(args.mp) - 1;
 
                /* Allow space for the inode btree to split. */
                args.minleft = args.mp->m_in_maxlevels - 1;
@@ -424,7 +424,7 @@ xfs_ialloc_ag_alloc(
                        args.alignment = args.mp->m_dalign;
                        isaligned = 1;
                } else
-                       args.alignment = xfs_ialloc_cluster_alignment(&args);
+                       args.alignment = xfs_ialloc_cluster_alignment(args.mp);
                /*
                 * Need to figure out where to allocate the inode blocks.
                 * Ideally they should be spaced out through the a.g.
@@ -453,7 +453,7 @@ xfs_ialloc_ag_alloc(
                args.type = XFS_ALLOCTYPE_NEAR_BNO;
                args.agbno = be32_to_cpu(agi->agi_root);
                args.fsbno = XFS_AGB_TO_FSB(args.mp, agno, args.agbno);
-               args.alignment = xfs_ialloc_cluster_alignment(&args);
+               args.alignment = xfs_ialloc_cluster_alignment(args.mp);
                if ((error = xfs_alloc_vextent(&args)))
                        return error;
        }
@@ -608,10 +608,24 @@ xfs_ialloc_ag_select(
                }
 
                /*
-                * Is there enough free space for the file plus a block of
-                * inodes? (if we need to allocate some)?
+                * Check that there is enough free space for the file plus a
+                * chunk of inodes if we need to allocate some. If this is the
+                * first pass across the AGs, take into account the potential
+                * space needed for alignment of inode chunks when checking the
+                * longest contiguous free space in the AG - this prevents us
+                * from getting ENOSPC because we have free space larger than
+                * m_ialloc_blks but alignment constraints prevent us from using
+                * it.
+                *
+                * If we can't find an AG with space for full alignment slack to
+                * be taken into account, we must be near ENOSPC in all AGs.
+                * Hence we don't include alignment for the second pass and so
+                * if we fail allocation due to alignment issues then it is most
+                * likely a real ENOSPC condition.
                 */
                ineed = mp->m_ialloc_blks;
+               if (flags && ineed > 1)
+                       ineed += xfs_ialloc_cluster_alignment(mp);
                longest = pag->pagf_longest;
                if (!longest)
                        longest = pag->pagf_flcount > 0;
@@ -1061,7 +1075,6 @@ xfs_dialloc_ag_finobt_newino(
                        if (error)
                                return error;
                        XFS_WANT_CORRUPTED_RETURN(i == 1);
-
                        return 0;
                }
        }
@@ -1114,11 +1127,7 @@ xfs_dialloc_ag_update_inobt(
        XFS_WANT_CORRUPTED_RETURN((rec.ir_free == frec->ir_free) &&
                                  (rec.ir_freecount == frec->ir_freecount));
 
-       error = xfs_inobt_update(cur, &rec);
-       if (error)
-               return error;
-
-       return 0;
+       return xfs_inobt_update(cur, &rec);
 }
 
 /*
@@ -2027,6 +2036,8 @@ xfs_agi_verify(
        if (!XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum)))
                return false;
 
+       if (be32_to_cpu(agi->agi_level) > XFS_BTREE_MAXLEVELS)
+               return false;
        /*
         * during growfs operations, the perag is not fully initialised,
         * so we can't use it for any useful checking. growfs ensures we can't
index 95ad1c002d600916f983806cdb6a484712f0a84b..100007d56449d0a872d78500bef7c9e75c76a745 100644 (file)
@@ -160,4 +160,8 @@ int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
                          xfs_agnumber_t agno, xfs_agblock_t agbno,
                          xfs_agblock_t length, unsigned int gen);
 
+int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
+               xfs_agnumber_t agno, struct xfs_buf **bpp);
+
+
 #endif /* __XFS_IALLOC_H__ */
index 0eac4c0f2d20ae0fe02f5152d22f1f187f46275c..1b211549b75c220b4975848496c6531c72f80a01 100644 (file)
@@ -509,7 +509,7 @@ xfs_iroot_realloc(
                ifp->if_broot_bytes = (int)new_size;
                ASSERT(XFS_BMAP_BMDR_SPACE(ifp->if_broot) <=
                        XFS_IFORK_SIZE(ip, whichfork));
-               memmove(np, op, cur_max * (uint)sizeof(xfs_dfsbno_t));
+               memmove(np, op, cur_max * (uint)sizeof(xfs_fsblock_t));
                return;
        }
 
@@ -556,7 +556,7 @@ xfs_iroot_realloc(
                                                     ifp->if_broot_bytes);
                np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, new_broot, 1,
                                                     (int)new_size);
-               memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t));
+               memcpy(np, op, new_max * (uint)sizeof(xfs_fsblock_t));
        }
        kmem_free(ifp->if_broot);
        ifp->if_broot = new_broot;
diff --git a/libxfs/xfs_inum.h b/libxfs/xfs_inum.h
deleted file mode 100644 (file)
index 90efdaf..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2000-2003,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_INUM_H__
-#define        __XFS_INUM_H__
-
-/*
- * Inode number format:
- * low inopblog bits - offset in block
- * next agblklog bits - block number in ag
- * next agno_log bits - ag number
- * high agno_log-agblklog-inopblog bits - 0
- */
-
-struct xfs_mount;
-
-#define        XFS_INO_MASK(k)                 (__uint32_t)((1ULL << (k)) - 1)
-#define        XFS_INO_OFFSET_BITS(mp)         (mp)->m_sb.sb_inopblog
-#define        XFS_INO_AGBNO_BITS(mp)          (mp)->m_sb.sb_agblklog
-#define        XFS_INO_AGINO_BITS(mp)          (mp)->m_agino_log
-#define        XFS_INO_AGNO_BITS(mp)           (mp)->m_agno_log
-#define        XFS_INO_BITS(mp)                \
-       XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
-#define        XFS_INO_TO_AGNO(mp,i)           \
-       ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
-#define        XFS_INO_TO_AGINO(mp,i)          \
-       ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
-#define        XFS_INO_TO_AGBNO(mp,i)          \
-       (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
-               XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
-#define        XFS_INO_TO_OFFSET(mp,i)         \
-       ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
-#define        XFS_INO_TO_FSB(mp,i)            \
-       XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
-#define        XFS_AGINO_TO_INO(mp,a,i)        \
-       (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
-#define        XFS_AGINO_TO_AGBNO(mp,i)        ((i) >> XFS_INO_OFFSET_BITS(mp))
-#define        XFS_AGINO_TO_OFFSET(mp,i)       \
-       ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
-#define        XFS_OFFBNO_TO_AGINO(mp,b,o)     \
-       ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
-
-#if XFS_BIG_INUMS
-#define        XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 56) - 1ULL))
-#else
-#define        XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 32) - 1ULL))
-#endif
-#define        XFS_MAXINUMBER_32       ((xfs_ino_t)((1ULL << 32) - 1ULL))
-
-#endif /* __XFS_INUM_H__ */
index f0969c77bdbe1ea7d87e732ba27a8c4d3fbd54c4..2653146904153178d474172bcacfec55e7742907 100644 (file)
@@ -361,7 +361,7 @@ typedef struct xfs_ictimestamp {
 
 /*
  * NOTE:  This structure must be kept identical to struct xfs_dinode
- *       in xfs_dinode.h except for the endianness annotations.
+ *       except for the endianness annotations.
  */
 typedef struct xfs_icdinode {
        __uint16_t      di_magic;       /* inode magic # = XFS_DINODE_MAGIC */
@@ -380,7 +380,7 @@ typedef struct xfs_icdinode {
        xfs_ictimestamp_t di_mtime;     /* time last modified */
        xfs_ictimestamp_t di_ctime;     /* time created/inode modified */
        xfs_fsize_t     di_size;        /* number of bytes in file */
-       xfs_drfsbno_t   di_nblocks;     /* # of direct & btree blocks used */
+       xfs_rfsblock_t  di_nblocks;     /* # of direct & btree blocks used */
        xfs_extlen_t    di_extsize;     /* basic/minimum extent size for file */
        xfs_extnum_t    di_nextents;    /* number of extents in data fork */
        xfs_aextnum_t   di_anextents;   /* number of extents in attribute fork*/
@@ -516,7 +516,7 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)
  * EFI/EFD log format definitions
  */
 typedef struct xfs_extent {
-       xfs_dfsbno_t    ext_start;
+       xfs_fsblock_t   ext_start;
        xfs_extlen_t    ext_len;
 } xfs_extent_t;
 
index 137e20937077a0923d7095b02094172e4992ec55..1b0a08379759dc5caee2f3acc8780d0011fbc4ad 100644 (file)
@@ -98,8 +98,6 @@ typedef __uint16_t    xfs_qwarncnt_t;
 #define XFS_IS_QUOTA_ON(mp)    ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
                                                   XFS_GQUOTA_ACTIVE | \
                                                   XFS_PQUOTA_ACTIVE))
-#define XFS_IS_OQUOTA_ON(mp)   ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \
-                                                  XFS_PQUOTA_ACTIVE))
 #define XFS_IS_UQUOTA_ON(mp)   ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
 #define XFS_IS_GQUOTA_ON(mp)   ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
 #define XFS_IS_PQUOTA_ON(mp)   ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
index 11bd98fcc1f024dc786eea1ec4d5bd633c498183..088f104de39797b71eef3fde22679363676a9ad2 100644 (file)
@@ -401,20 +401,24 @@ xfs_rtfind_forw(
 }
 
 /*
- * Read and modify the summary information for a given extent size,
+ * Read and/or modify the summary information for a given extent size,
  * bitmap block combination.
  * Keeps track of a current summary block, so we don't keep reading
  * it from the buffer cache.
+ *
+ * Summary information is returned in *sum if specified.
+ * If no delta is specified, returns summary only.
  */
 int
-xfs_rtmodify_summary(
-       xfs_mount_t     *mp,            /* file system mount point */
+xfs_rtmodify_summary_int(
+       xfs_mount_t     *mp,            /* file system mount structure */
        xfs_trans_t     *tp,            /* transaction pointer */
        int             log,            /* log2 of extent size */
        xfs_rtblock_t   bbno,           /* bitmap block number */
        int             delta,          /* change to make to summary info */
        xfs_buf_t       **rbpp,         /* in/out: summary block buffer */
-       xfs_fsblock_t   *rsb)           /* in/out: summary block number */
+       xfs_fsblock_t   *rsb,           /* in/out: summary block number */
+       xfs_suminfo_t   *sum)           /* out: summary info for this block */
 {
        xfs_buf_t       *bp;            /* buffer for the summary block */
        int             error;          /* error value */
@@ -433,7 +437,7 @@ xfs_rtmodify_summary(
        /*
         * If we have an old buffer, and the block number matches, use that.
         */
-       if (rbpp && *rbpp && *rsb == sb)
+       if (*rbpp && *rsb == sb)
                bp = *rbpp;
        /*
         * Otherwise we have to get the buffer.
@@ -442,7 +446,7 @@ xfs_rtmodify_summary(
                /*
                 * If there was an old one, get rid of it first.
                 */
-               if (rbpp && *rbpp)
+               if (*rbpp)
                        xfs_trans_brelse(tp, *rbpp);
                error = xfs_rtbuf_get(mp, tp, sb, 1, &bp);
                if (error) {
@@ -451,21 +455,38 @@ xfs_rtmodify_summary(
                /*
                 * Remember this buffer and block for the next call.
                 */
-               if (rbpp) {
-                       *rbpp = bp;
-                       *rsb = sb;
-               }
+               *rbpp = bp;
+               *rsb = sb;
        }
        /*
-        * Point to the summary information, modify and log it.
+        * Point to the summary information, modify/log it, and/or copy it out.
         */
        sp = XFS_SUMPTR(mp, bp, so);
-       *sp += delta;
-       xfs_trans_log_buf(tp, bp, (uint)((char *)sp - (char *)bp->b_addr),
-               (uint)((char *)sp - (char *)bp->b_addr + sizeof(*sp) - 1));
+       if (delta) {
+               uint first = (uint)((char *)sp - (char *)bp->b_addr);
+
+               *sp += delta;
+               xfs_trans_log_buf(tp, bp, first, first + sizeof(*sp) - 1);
+       }
+       if (sum)
+               *sum = *sp;
        return 0;
 }
 
+int
+xfs_rtmodify_summary(
+       xfs_mount_t     *mp,            /* file system mount structure */
+       xfs_trans_t     *tp,            /* transaction pointer */
+       int             log,            /* log2 of extent size */
+       xfs_rtblock_t   bbno,           /* bitmap block number */
+       int             delta,          /* change to make to summary info */
+       xfs_buf_t       **rbpp,         /* in/out: summary block buffer */
+       xfs_fsblock_t   *rsb)           /* in/out: summary block number */
+{
+       return xfs_rtmodify_summary_int(mp, tp, log, bbno,
+                                       delta, rbpp, rsb, NULL);
+}
+
 /*
  * Set the given range of bitmap bits to the given value.
  * Do whatever I/O and logging is required.
index e5b5662b42efbe1dbb78a9b8c12d2f5366b7f3b2..c5fa78ea274c8daf888232cf2bda619da72ac6f9 100644 (file)
@@ -258,11 +258,13 @@ xfs_mount_validate_sb(
            sbp->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG                    ||
            sbp->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG                    ||
            sbp->sb_blocksize != (1 << sbp->sb_blocklog)                ||
+           sbp->sb_dirblklog > XFS_MAX_BLOCKSIZE_LOG                   ||
            sbp->sb_inodesize < XFS_DINODE_MIN_SIZE                     ||
            sbp->sb_inodesize > XFS_DINODE_MAX_SIZE                     ||
            sbp->sb_inodelog < XFS_DINODE_MIN_LOG                       ||
            sbp->sb_inodelog > XFS_DINODE_MAX_LOG                       ||
            sbp->sb_inodesize != (1 << sbp->sb_inodelog)                ||
+           sbp->sb_logsunit > XLOG_MAX_RECORD_BSIZE                    ||
            sbp->sb_inopblock != howmany(sbp->sb_blocksize,sbp->sb_inodesize) ||
            (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog)   ||
            (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE)  ||
@@ -350,10 +352,11 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)
        }
 }
 
-void
-xfs_sb_from_disk(
+static void
+__xfs_sb_from_disk(
        struct xfs_sb   *to,
-       xfs_dsb_t       *from)
+       xfs_dsb_t       *from,
+       bool            convert_xquota)
 {
        to->sb_magicnum = be32_to_cpu(from->sb_magicnum);
        to->sb_blocksize = be32_to_cpu(from->sb_blocksize);
@@ -406,9 +409,22 @@ xfs_sb_from_disk(
        to->sb_features_incompat = be32_to_cpu(from->sb_features_incompat);
        to->sb_features_log_incompat =
                                be32_to_cpu(from->sb_features_log_incompat);
+       /* crc is only used on disk, not in memory; just init to 0 here. */
+       to->sb_crc = 0;
        to->sb_pad = 0;
        to->sb_pquotino = be64_to_cpu(from->sb_pquotino);
        to->sb_lsn = be64_to_cpu(from->sb_lsn);
+       /* Convert on-disk flags to in-memory flags? */
+       if (convert_xquota)
+               xfs_sb_quota_from_disk(to);
+}
+
+void
+xfs_sb_from_disk(
+       struct xfs_sb   *to,
+       xfs_dsb_t       *from)
+{
+       __xfs_sb_from_disk(to, from, true);
 }
 
 static inline void
@@ -500,6 +516,9 @@ xfs_sb_to_disk(
        if (!fields)
                return;
 
+       /* We should never write the crc here, it's updated in the IO path */
+       fields &= ~XFS_SB_CRC;
+
        xfs_sb_quota_to_disk(to, from, &fields);
        while (fields) {
                f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
@@ -541,7 +560,11 @@ xfs_sb_verify(
        struct xfs_mount *mp = bp->b_target->bt_mount;
        struct xfs_sb   sb;
 
-       xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp));
+       /*
+        * Use call variant which doesn't convert quota flags from disk
+        * format, because xfs_mount_validate_sb checks the on-disk flags.
+        */
+       __xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp), false);
 
        /*
         * Only check the in progress field for the primary superblock as
index c43c2d609a24bb38816b422d60b80ba06b18fcd4..8eb1c54bafbf987e8b9bfd98abc858cd081cedd1 100644 (file)
 #ifndef __XFS_SB_H__
 #define        __XFS_SB_H__
 
-/*
- * Super block
- * Fits into a sector-sized buffer at address 0 of each allocation group.
- * Only the first of these is ever updated except during growfs.
- */
-
-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 */
-#define        XFS_SB_VERSION_2        2               /* 6.2 - attributes */
-#define        XFS_SB_VERSION_3        3               /* 6.2 - new inode version */
-#define        XFS_SB_VERSION_4        4               /* 6.2+ - bitmask version */
-#define        XFS_SB_VERSION_5        5               /* CRC enabled filesystem */
-#define        XFS_SB_VERSION_NUMBITS          0x000f
-#define        XFS_SB_VERSION_ALLFBITS         0xfff0
-#define        XFS_SB_VERSION_ATTRBIT          0x0010
-#define        XFS_SB_VERSION_NLINKBIT         0x0020
-#define        XFS_SB_VERSION_QUOTABIT         0x0040
-#define        XFS_SB_VERSION_ALIGNBIT         0x0080
-#define        XFS_SB_VERSION_DALIGNBIT        0x0100
-#define        XFS_SB_VERSION_SHAREDBIT        0x0200
-#define XFS_SB_VERSION_LOGV2BIT                0x0400
-#define XFS_SB_VERSION_SECTORBIT       0x0800
-#define        XFS_SB_VERSION_EXTFLGBIT        0x1000
-#define        XFS_SB_VERSION_DIRV2BIT         0x2000
-#define        XFS_SB_VERSION_BORGBIT          0x4000  /* ASCII only case-insens. */
-#define        XFS_SB_VERSION_MOREBITSBIT      0x8000
-
-/*
- * Supported feature bit list is just all bits in the versionnum field because
- * we've used them all up and understand them all. Except, of course, for the
- * shared superblock bit, which nobody knows what it does and so is unsupported.
- */
-#define        XFS_SB_VERSION_OKBITS           \
-       ((XFS_SB_VERSION_NUMBITS | XFS_SB_VERSION_ALLFBITS) & \
-               ~XFS_SB_VERSION_SHAREDBIT)
-
-/*
- * There are two words to hold XFS "feature" bits: the original
- * word, sb_versionnum, and sb_features2.  Whenever a bit is set in
- * sb_features2, the feature bit XFS_SB_VERSION_MOREBITSBIT must be set.
- *
- * These defines represent bits in sb_features2.
- */
-#define XFS_SB_VERSION2_RESERVED1BIT   0x00000001
-#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002      /* Superblk counters */
-#define XFS_SB_VERSION2_RESERVED4BIT   0x00000004
-#define XFS_SB_VERSION2_ATTR2BIT       0x00000008      /* Inline attr rework */
-#define XFS_SB_VERSION2_PARENTBIT      0x00000010      /* parent pointers */
-#define XFS_SB_VERSION2_PROJID32BIT    0x00000080      /* 32 bit project id */
-#define XFS_SB_VERSION2_CRCBIT         0x00000100      /* metadata CRCs */
-#define XFS_SB_VERSION2_FTYPE          0x00000200      /* inode type in dir */
-
-#define        XFS_SB_VERSION2_OKBITS          \
-       (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
-        XFS_SB_VERSION2_ATTR2BIT       | \
-        XFS_SB_VERSION2_PROJID32BIT    | \
-        XFS_SB_VERSION2_FTYPE)
-
-/*
- * Superblock - in core version.  Must match the ondisk version below.
- * Must be padded to 64 bit alignment.
- */
-typedef struct xfs_sb {
-       __uint32_t      sb_magicnum;    /* magic number == XFS_SB_MAGIC */
-       __uint32_t      sb_blocksize;   /* logical block size, bytes */
-       xfs_drfsbno_t   sb_dblocks;     /* number of data blocks */
-       xfs_drfsbno_t   sb_rblocks;     /* number of realtime blocks */
-       xfs_drtbno_t    sb_rextents;    /* number of realtime extents */
-       uuid_t          sb_uuid;        /* file system unique id */
-       xfs_dfsbno_t    sb_logstart;    /* starting block of log if internal */
-       xfs_ino_t       sb_rootino;     /* root inode number */
-       xfs_ino_t       sb_rbmino;      /* bitmap inode for realtime extents */
-       xfs_ino_t       sb_rsumino;     /* summary inode for rt bitmap */
-       xfs_agblock_t   sb_rextsize;    /* realtime extent size, blocks */
-       xfs_agblock_t   sb_agblocks;    /* size of an allocation group */
-       xfs_agnumber_t  sb_agcount;     /* number of allocation groups */
-       xfs_extlen_t    sb_rbmblocks;   /* number of rt bitmap blocks */
-       xfs_extlen_t    sb_logblocks;   /* number of log blocks */
-       __uint16_t      sb_versionnum;  /* header version == XFS_SB_VERSION */
-       __uint16_t      sb_sectsize;    /* volume sector size, bytes */
-       __uint16_t      sb_inodesize;   /* inode size, bytes */
-       __uint16_t      sb_inopblock;   /* inodes per block */
-       char            sb_fname[12];   /* file system name */
-       __uint8_t       sb_blocklog;    /* log2 of sb_blocksize */
-       __uint8_t       sb_sectlog;     /* log2 of sb_sectsize */
-       __uint8_t       sb_inodelog;    /* log2 of sb_inodesize */
-       __uint8_t       sb_inopblog;    /* log2 of sb_inopblock */
-       __uint8_t       sb_agblklog;    /* log2 of sb_agblocks (rounded up) */
-       __uint8_t       sb_rextslog;    /* log2 of sb_rextents */
-       __uint8_t       sb_inprogress;  /* mkfs is in progress, don't mount */
-       __uint8_t       sb_imax_pct;    /* max % of fs for inode space */
-                                       /* statistics */
-       /*
-        * These fields must remain contiguous.  If you really
-        * want to change their layout, make sure you fix the
-        * code in xfs_trans_apply_sb_deltas().
-        */
-       __uint64_t      sb_icount;      /* allocated inodes */
-       __uint64_t      sb_ifree;       /* free inodes */
-       __uint64_t      sb_fdblocks;    /* free data blocks */
-       __uint64_t      sb_frextents;   /* free realtime extents */
-       /*
-        * End contiguous fields.
-        */
-       xfs_ino_t       sb_uquotino;    /* user quota inode */
-       xfs_ino_t       sb_gquotino;    /* group quota inode */
-       __uint16_t      sb_qflags;      /* quota flags */
-       __uint8_t       sb_flags;       /* misc. flags */
-       __uint8_t       sb_shared_vn;   /* shared version number */
-       xfs_extlen_t    sb_inoalignmt;  /* inode chunk alignment, fsblocks */
-       __uint32_t      sb_unit;        /* stripe or raid unit */
-       __uint32_t      sb_width;       /* stripe or raid width */
-       __uint8_t       sb_dirblklog;   /* log2 of dir block size (fsbs) */
-       __uint8_t       sb_logsectlog;  /* log2 of the log sector size */
-       __uint16_t      sb_logsectsize; /* sector size for the log, bytes */
-       __uint32_t      sb_logsunit;    /* stripe unit size for the log */
-       __uint32_t      sb_features2;   /* additional feature bits */
-
-       /*
-        * bad features2 field as a result of failing to pad the sb
-        * structure to 64 bits. Some machines will be using this field
-        * for features2 bits. Easiest just to mark it bad and not use
-        * it for anything else.
-        */
-       __uint32_t      sb_bad_features2;
-
-       /* version 5 superblock fields start here */
-
-       /* feature masks */
-       __uint32_t      sb_features_compat;
-       __uint32_t      sb_features_ro_compat;
-       __uint32_t      sb_features_incompat;
-       __uint32_t      sb_features_log_incompat;
-
-       __uint32_t      sb_crc;         /* superblock crc */
-       __uint32_t      sb_pad;
-
-       xfs_ino_t       sb_pquotino;    /* project quota inode */
-       xfs_lsn_t       sb_lsn;         /* last write sequence */
-
-       /* must be padded to 64 bit alignment */
-} xfs_sb_t;
-
-#define XFS_SB_CRC_OFF         offsetof(struct xfs_sb, sb_crc)
-
-/*
- * Superblock - on disk version.  Must match the in core version above.
- * Must be padded to 64 bit alignment.
- */
-typedef struct xfs_dsb {
-       __be32          sb_magicnum;    /* magic number == XFS_SB_MAGIC */
-       __be32          sb_blocksize;   /* logical block size, bytes */
-       __be64          sb_dblocks;     /* number of data blocks */
-       __be64          sb_rblocks;     /* number of realtime blocks */
-       __be64          sb_rextents;    /* number of realtime extents */
-       uuid_t          sb_uuid;        /* file system unique id */
-       __be64          sb_logstart;    /* starting block of log if internal */
-       __be64          sb_rootino;     /* root inode number */
-       __be64          sb_rbmino;      /* bitmap inode for realtime extents */
-       __be64          sb_rsumino;     /* summary inode for rt bitmap */
-       __be32          sb_rextsize;    /* realtime extent size, blocks */
-       __be32          sb_agblocks;    /* size of an allocation group */
-       __be32          sb_agcount;     /* number of allocation groups */
-       __be32          sb_rbmblocks;   /* number of rt bitmap blocks */
-       __be32          sb_logblocks;   /* number of log blocks */
-       __be16          sb_versionnum;  /* header version == XFS_SB_VERSION */
-       __be16          sb_sectsize;    /* volume sector size, bytes */
-       __be16          sb_inodesize;   /* inode size, bytes */
-       __be16          sb_inopblock;   /* inodes per block */
-       char            sb_fname[12];   /* file system name */
-       __u8            sb_blocklog;    /* log2 of sb_blocksize */
-       __u8            sb_sectlog;     /* log2 of sb_sectsize */
-       __u8            sb_inodelog;    /* log2 of sb_inodesize */
-       __u8            sb_inopblog;    /* log2 of sb_inopblock */
-       __u8            sb_agblklog;    /* log2 of sb_agblocks (rounded up) */
-       __u8            sb_rextslog;    /* log2 of sb_rextents */
-       __u8            sb_inprogress;  /* mkfs is in progress, don't mount */
-       __u8            sb_imax_pct;    /* max % of fs for inode space */
-                                       /* statistics */
-       /*
-        * These fields must remain contiguous.  If you really
-        * want to change their layout, make sure you fix the
-        * code in xfs_trans_apply_sb_deltas().
-        */
-       __be64          sb_icount;      /* allocated inodes */
-       __be64          sb_ifree;       /* free inodes */
-       __be64          sb_fdblocks;    /* free data blocks */
-       __be64          sb_frextents;   /* free realtime extents */
-       /*
-        * End contiguous fields.
-        */
-       __be64          sb_uquotino;    /* user quota inode */
-       __be64          sb_gquotino;    /* group quota inode */
-       __be16          sb_qflags;      /* quota flags */
-       __u8            sb_flags;       /* misc. flags */
-       __u8            sb_shared_vn;   /* shared version number */
-       __be32          sb_inoalignmt;  /* inode chunk alignment, fsblocks */
-       __be32          sb_unit;        /* stripe or raid unit */
-       __be32          sb_width;       /* stripe or raid width */
-       __u8            sb_dirblklog;   /* log2 of dir block size (fsbs) */
-       __u8            sb_logsectlog;  /* log2 of the log sector size */
-       __be16          sb_logsectsize; /* sector size for the log, bytes */
-       __be32          sb_logsunit;    /* stripe unit size for the log */
-       __be32          sb_features2;   /* additional feature bits */
-       /*
-        * bad features2 field as a result of failing to pad the sb
-        * structure to 64 bits. Some machines will be using this field
-        * for features2 bits. Easiest just to mark it bad and not use
-        * it for anything else.
-        */
-       __be32          sb_bad_features2;
-
-       /* version 5 superblock fields start here */
-
-       /* feature masks */
-       __be32          sb_features_compat;
-       __be32          sb_features_ro_compat;
-       __be32          sb_features_incompat;
-       __be32          sb_features_log_incompat;
-
-       __le32          sb_crc;         /* superblock crc */
-       __be32          sb_pad;
-
-       __be64          sb_pquotino;    /* project quota inode */
-       __be64          sb_lsn;         /* last write sequence */
-
-       /* must be padded to 64 bit alignment */
-} xfs_dsb_t;
-
-/*
- * Sequence number values for the fields.
- */
-typedef enum {
-       XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
-       XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
-       XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
-       XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
-       XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
-       XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
-       XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
-       XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
-       XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
-       XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
-       XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
-       XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
-       XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
-       XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
-       XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
-       XFS_SBS_PQUOTINO, XFS_SBS_LSN,
-       XFS_SBS_FIELDCOUNT
-} xfs_sb_field_t;
-
-/*
- * Mask values, defined based on the xfs_sb_field_t values.
- * Only define the ones we're using.
- */
-#define        XFS_SB_MVAL(x)          (1LL << XFS_SBS_ ## x)
-#define        XFS_SB_UUID             XFS_SB_MVAL(UUID)
-#define        XFS_SB_FNAME            XFS_SB_MVAL(FNAME)
-#define        XFS_SB_ROOTINO          XFS_SB_MVAL(ROOTINO)
-#define        XFS_SB_RBMINO           XFS_SB_MVAL(RBMINO)
-#define        XFS_SB_RSUMINO          XFS_SB_MVAL(RSUMINO)
-#define        XFS_SB_VERSIONNUM       XFS_SB_MVAL(VERSIONNUM)
-#define XFS_SB_UQUOTINO                XFS_SB_MVAL(UQUOTINO)
-#define XFS_SB_GQUOTINO                XFS_SB_MVAL(GQUOTINO)
-#define XFS_SB_QFLAGS          XFS_SB_MVAL(QFLAGS)
-#define XFS_SB_SHARED_VN       XFS_SB_MVAL(SHARED_VN)
-#define XFS_SB_UNIT            XFS_SB_MVAL(UNIT)
-#define XFS_SB_WIDTH           XFS_SB_MVAL(WIDTH)
-#define XFS_SB_ICOUNT          XFS_SB_MVAL(ICOUNT)
-#define XFS_SB_IFREE           XFS_SB_MVAL(IFREE)
-#define XFS_SB_FDBLOCKS                XFS_SB_MVAL(FDBLOCKS)
-#define XFS_SB_FEATURES2       XFS_SB_MVAL(FEATURES2)
-#define XFS_SB_BAD_FEATURES2   XFS_SB_MVAL(BAD_FEATURES2)
-#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
-#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
-#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
-#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
-#define XFS_SB_CRC             XFS_SB_MVAL(CRC)
-#define XFS_SB_PQUOTINO                XFS_SB_MVAL(PQUOTINO)
-#define        XFS_SB_NUM_BITS         ((int)XFS_SBS_FIELDCOUNT)
-#define        XFS_SB_ALL_BITS         ((1LL << XFS_SB_NUM_BITS) - 1)
-#define        XFS_SB_MOD_BITS         \
-       (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
-        XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
-        XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
-        XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
-        XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \
-        XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \
-        XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO)
-
-
-/*
- * Misc. Flags - warning - these will be cleared by xfs_repair unless
- * a feature bit is set when the flag is used.
- */
-#define XFS_SBF_NOFLAGS                0x00    /* no flags set */
-#define XFS_SBF_READONLY       0x01    /* only read-only mounts allowed */
-
-/*
- * define max. shared version we can interoperate with
- */
-#define XFS_SB_MAX_SHARED_VN   0
-
-#define        XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
-
-/*
- * The first XFS version we support is a v4 superblock with V2 directories.
- */
-static inline bool xfs_sb_good_v4_features(struct xfs_sb *sbp)
-{
-       if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
-               return false;
-
-       /* check for unknown features in the fs */
-       if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
-           ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
-            (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
-               return false;
-
-       return true;
-}
-
-static inline bool xfs_sb_good_version(struct xfs_sb *sbp)
-{
-       if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
-               return true;
-       if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
-               return xfs_sb_good_v4_features(sbp);
-       return false;
-}
-
-/*
- * Detect a mismatched features2 field.  Older kernels read/wrote
- * this into the wrong slot, so to be safe we keep them in sync.
- */
-static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)
-{
-       return sbp->sb_bad_features2 != sbp->sb_features2;
-}
-
-static inline bool xfs_sb_version_hasattr(struct xfs_sb *sbp)
-{
-       return (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT);
-}
-
-static inline void xfs_sb_version_addattr(struct xfs_sb *sbp)
-{
-       sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT;
-}
-
-static inline bool xfs_sb_version_hasquota(struct xfs_sb *sbp)
-{
-       return (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
-}
-
-static inline void xfs_sb_version_addquota(struct xfs_sb *sbp)
-{
-       sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
-}
-
-static inline bool xfs_sb_version_hasalign(struct xfs_sb *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
-               (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT));
-}
-
-static inline bool xfs_sb_version_hasdalign(struct xfs_sb *sbp)
-{
-       return (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
-}
-
-static inline bool xfs_sb_version_haslogv2(struct xfs_sb *sbp)
-{
-       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
-              (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
-}
-
-static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp)
-{
-       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
-              (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
-}
-
-static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp)
-{
-       return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
-}
-
-static inline bool xfs_sb_version_hasasciici(struct xfs_sb *sbp)
-{
-       return (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
-}
-
-static inline bool xfs_sb_version_hasmorebits(struct xfs_sb *sbp)
-{
-       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
-              (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
-}
-
-/*
- * sb_features2 bit version macros.
- */
-static inline bool xfs_sb_version_haslazysbcount(struct xfs_sb *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
-              (xfs_sb_version_hasmorebits(sbp) &&
-               (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
-}
-
-static inline bool xfs_sb_version_hasattr2(struct xfs_sb *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
-              (xfs_sb_version_hasmorebits(sbp) &&
-               (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT));
-}
-
-static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
-{
-       sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
-       sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
-       sbp->sb_bad_features2 |= XFS_SB_VERSION2_ATTR2BIT;
-}
-
-static inline void xfs_sb_version_removeattr2(struct xfs_sb *sbp)
-{
-       sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
-       sbp->sb_bad_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
-       if (!sbp->sb_features2)
-               sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
-}
-
-static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
-              (xfs_sb_version_hasmorebits(sbp) &&
-               (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
-}
-
-static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
-{
-       sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
-       sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
-       sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
-}
-
-/*
- * Extended v5 superblock feature masks. These are to be used for new v5
- * superblock features only.
- *
- * Compat features are new features that old kernels will not notice or affect
- * and so can mount read-write without issues.
- *
- * RO-Compat (read only) are features that old kernels can read but will break
- * if they write. Hence only read-only mounts of such filesystems are allowed on
- * kernels that don't support the feature bit.
- *
- * InCompat features are features which old kernels will not understand and so
- * must not mount.
- *
- * Log-InCompat features are for changes to log formats or new transactions that
- * can't be replayed on older kernels. The fields are set when the filesystem is
- * mounted, and a clean unmount clears the fields.
- */
-#define XFS_SB_FEAT_COMPAT_ALL 0
-#define XFS_SB_FEAT_COMPAT_UNKNOWN     ~XFS_SB_FEAT_COMPAT_ALL
-static inline bool
-xfs_sb_has_compat_feature(
-       struct xfs_sb   *sbp,
-       __uint32_t      feature)
-{
-       return (sbp->sb_features_compat & feature) != 0;
-}
-
-#define XFS_SB_FEAT_RO_COMPAT_FINOBT   (1 << 0)                /* free inode btree */
-#define XFS_SB_FEAT_RO_COMPAT_ALL \
-               (XFS_SB_FEAT_RO_COMPAT_FINOBT)
-#define XFS_SB_FEAT_RO_COMPAT_UNKNOWN  ~XFS_SB_FEAT_RO_COMPAT_ALL
-static inline bool
-xfs_sb_has_ro_compat_feature(
-       struct xfs_sb   *sbp,
-       __uint32_t      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 \
-               (XFS_SB_FEAT_INCOMPAT_FTYPE)
-
-#define XFS_SB_FEAT_INCOMPAT_UNKNOWN   ~XFS_SB_FEAT_INCOMPAT_ALL
-static inline bool
-xfs_sb_has_incompat_feature(
-       struct xfs_sb   *sbp,
-       __uint32_t      feature)
-{
-       return (sbp->sb_features_incompat & feature) != 0;
-}
-
-#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0
-#define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN       ~XFS_SB_FEAT_INCOMPAT_LOG_ALL
-static inline bool
-xfs_sb_has_incompat_log_feature(
-       struct xfs_sb   *sbp,
-       __uint32_t      feature)
-{
-       return (sbp->sb_features_log_incompat & feature) != 0;
-}
-
-/*
- * V5 superblock specific feature checks
- */
-static inline int xfs_sb_version_hascrc(struct xfs_sb *sbp)
-{
-       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
-}
-
-static inline int xfs_sb_version_has_pquotino(struct xfs_sb *sbp)
-{
-       return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
-}
-
-static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
-               xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) ||
-              (xfs_sb_version_hasmorebits(sbp) &&
-                (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
-}
-
-static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp)
-{
-       return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) &&
-               (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT);
-}
-
-/*
- * end of superblock version macros
- */
-
-static inline bool
-xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
-{
-       return (ino == sbp->sb_uquotino ||
-               ino == sbp->sb_gquotino ||
-               ino == sbp->sb_pquotino);
-}
-
-#define XFS_SB_DADDR           ((xfs_daddr_t)0) /* daddr in filesystem/ag */
-#define        XFS_SB_BLOCK(mp)        XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
-#define XFS_BUF_TO_SBP(bp)     ((xfs_dsb_t *)((bp)->b_addr))
-
-#define        XFS_HDR_BLOCK(mp,d)     ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
-#define        XFS_DADDR_TO_FSB(mp,d)  XFS_AGB_TO_FSB(mp, \
-                       xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
-#define        XFS_FSB_TO_DADDR(mp,fsbno)      XFS_AGB_TO_DADDR(mp, \
-                       XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
-
-/*
- * File system sector to basic block conversions.
- */
-#define XFS_FSS_TO_BB(mp,sec)  ((sec) << (mp)->m_sectbb_log)
-
-/*
- * File system block to basic block conversions.
- */
-#define        XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
-#define        XFS_BB_TO_FSB(mp,bb)    \
-       (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
-#define        XFS_BB_TO_FSBT(mp,bb)   ((bb) >> (mp)->m_blkbb_log)
-
-/*
- * File system block to byte conversions.
- */
-#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
-#define XFS_B_TO_FSB(mp,b)     \
-       ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
-#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
  */
index accb95de7ec59393471e76a9e2ea9f49f0889e86..f0d145af4834b55cbb9d67b8992aa972468d4b54 100644 (file)
@@ -38,43 +38,18 @@ typedef     __int32_t       xfs_tid_t;      /* transaction identifier */
 typedef        __uint32_t      xfs_dablk_t;    /* dir/attr block number (in file) */
 typedef        __uint32_t      xfs_dahash_t;   /* dir/attr hash value */
 
-/*
- * These types are 64 bits on disk but are either 32 or 64 bits in memory.
- * Disk based types:
- */
-typedef __uint64_t     xfs_dfsbno_t;   /* blockno in filesystem (agno|agbno) */
-typedef __uint64_t     xfs_drfsbno_t;  /* blockno in filesystem (raw) */
-typedef        __uint64_t      xfs_drtbno_t;   /* extent (block) in realtime area */
-typedef        __uint64_t      xfs_dfiloff_t;  /* block number in a file */
-typedef        __uint64_t      xfs_dfilblks_t; /* number of blocks in a file */
-
-/*
- * Memory based types are conditional.
- */
-#if XFS_BIG_BLKNOS
 typedef        __uint64_t      xfs_fsblock_t;  /* blockno in filesystem (agno|agbno) */
 typedef __uint64_t     xfs_rfsblock_t; /* blockno in filesystem (raw) */
 typedef __uint64_t     xfs_rtblock_t;  /* extent (block) in realtime area */
-typedef        __int64_t       xfs_srtblock_t; /* signed version of xfs_rtblock_t */
-#else
-typedef        __uint32_t      xfs_fsblock_t;  /* blockno in filesystem (agno|agbno) */
-typedef __uint32_t     xfs_rfsblock_t; /* blockno in filesystem (raw) */
-typedef __uint32_t     xfs_rtblock_t;  /* extent (block) in realtime area */
-typedef        __int32_t       xfs_srtblock_t; /* signed version of xfs_rtblock_t */
-#endif
 typedef __uint64_t     xfs_fileoff_t;  /* block number in a file */
-typedef __int64_t      xfs_sfiloff_t;  /* signed block number in a file */
 typedef __uint64_t     xfs_filblks_t;  /* number of blocks in a file */
 
+typedef        __int64_t       xfs_srtblock_t; /* signed version of xfs_rtblock_t */
+typedef __int64_t      xfs_sfiloff_t;  /* signed block number in a file */
 
 /*
  * Null values for the types.
  */
-#define        NULLDFSBNO      ((xfs_dfsbno_t)-1)
-#define        NULLDRFSBNO     ((xfs_drfsbno_t)-1)
-#define        NULLDRTBNO      ((xfs_drtbno_t)-1)
-#define        NULLDFILOFF     ((xfs_dfiloff_t)-1)
-
 #define        NULLFSBLOCK     ((xfs_fsblock_t)-1)
 #define        NULLRFSBLOCK    ((xfs_rfsblock_t)-1)
 #define        NULLRTBLOCK     ((xfs_rtblock_t)-1)
index 9830e9fcd36a76f4fd0addcb292188fef74ad2aa..0c8bd2f67cb63a002e70c12eaa4679559e362b4b 100644 (file)
@@ -614,9 +614,9 @@ static void
 rtinit(
        xfs_mount_t     *mp)
 {
-       xfs_dfiloff_t   bno;
+       xfs_fileoff_t   bno;
        int             committed;
-       xfs_dfiloff_t   ebno;
+       xfs_fileoff_t   ebno;
        xfs_bmbt_irec_t *ep;
        int             error;
        xfs_fsblock_t   first;
index c03119c35974cecdb8a0e368a803354e5689c5b2..9b2b25a71f95fd4e22469d9e048ce47247abd1df 100644 (file)
@@ -195,7 +195,7 @@ char        *mopts[] = {
 /*
  * Use this macro before we have superblock and mount structure
  */
-#define        DTOBT(d)        ((xfs_drfsbno_t)((d) >> (blocklog - BBSHIFT)))
+#define        DTOBT(d)        ((xfs_rfsblock_t)((d) >> (blocklog - BBSHIFT)))
 
 /*
  * Use this for block reservations needed for mkfs's conditions
@@ -559,7 +559,7 @@ static void
 fixup_log_stripe_unit(
        int             lsflag,
        int             sunit,
-       xfs_drfsbno_t   *logblocks,
+       xfs_rfsblock_t  *logblocks,
        int             blocklog)
 {
        __uint64_t      tmp_logblocks;
@@ -589,14 +589,14 @@ fixup_log_stripe_unit(
        }
 }
 
-static xfs_dfsbno_t
+static xfs_fsblock_t
 fixup_internal_log_stripe(
        xfs_mount_t     *mp,
        int             lsflag,
-       xfs_dfsbno_t    logstart,
+       xfs_fsblock_t   logstart,
        __uint64_t      agsize,
        int             sunit,
-       xfs_drfsbno_t   *logblocks,
+       xfs_rfsblock_t  *logblocks,
        int             blocklog,
        int             *lalign)
 {
@@ -922,7 +922,7 @@ main(
        int                     c;
        int                     daflag;
        int                     dasize;
-       xfs_drfsbno_t           dblocks;
+       xfs_rfsblock_t          dblocks;
        char                    *dfile;
        int                     dirblocklog;
        int                     dirblocksize;
@@ -950,11 +950,11 @@ main(
        int                     ldflag;
        int                     liflag;
        xfs_agnumber_t          logagno;
-       xfs_drfsbno_t           logblocks;
+       xfs_rfsblock_t          logblocks;
        char                    *logfile;
        int                     loginternal;
        char                    *logsize;
-       xfs_dfsbno_t            logstart;
+       xfs_fsblock_t           logstart;
        int                     logversion;
        int                     lvflag;
        int                     lsflag;
@@ -984,9 +984,9 @@ main(
        char                    *protofile;
        char                    *protostring;
        int                     qflag;
-       xfs_drfsbno_t           rtblocks;
+       xfs_rfsblock_t          rtblocks;
        xfs_extlen_t            rtextblocks;
-       xfs_drtbno_t            rtextents;
+       xfs_rtblock_t           rtextents;
        char                    *rtextsize;
        char                    *rtfile;
        char                    *rtsize;
@@ -1939,7 +1939,7 @@ _("warning: finobt not supported without CRC support, disabled.\n"));
                                (long long)dbytes, XFS_MIN_BLOCKSIZE);
                        usage();
                }
-               dblocks = (xfs_drfsbno_t)(dbytes >> blocklog);
+               dblocks = (xfs_rfsblock_t)(dbytes >> blocklog);
                if (dbytes % blocksize)
                        fprintf(stderr, _("warning: "
        "data length %lld not a multiple of %d, truncated to %lld\n"),
@@ -1976,7 +1976,7 @@ _("warning: finobt not supported without CRC support, disabled.\n"));
                                (long long)logbytes, XFS_MIN_BLOCKSIZE);
                        usage();
                }
-               logblocks = (xfs_drfsbno_t)(logbytes >> blocklog);
+               logblocks = (xfs_rfsblock_t)(logbytes >> blocklog);
                if (logbytes % blocksize)
                        fprintf(stderr,
        _("warning: log length %lld not a multiple of %d, truncated to %lld\n"),
@@ -1998,7 +1998,7 @@ _("warning: finobt not supported without CRC support, disabled.\n"));
                                (long long)rtbytes, XFS_MIN_BLOCKSIZE);
                        usage();
                }
-               rtblocks = (xfs_drfsbno_t)(rtbytes >> blocklog);
+               rtblocks = (xfs_rfsblock_t)(rtbytes >> blocklog);
                if (rtbytes % blocksize)
                        fprintf(stderr,
        _("warning: rt length %lld not a multiple of %d, truncated to %lld\n"),
@@ -2353,7 +2353,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
                                if ( dblocks % agsize != 0 &&
                                    (dblocks % agsize <
                                    XFS_AG_MIN_BLOCKS(blocklog))) {
-                                       dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize);
+                                       dblocks = (xfs_rfsblock_t)((agcount - 1) * agsize);
                                        agcount--;
                                        ASSERT(agcount != 0);
                                }
@@ -2379,7 +2379,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
        if ( dblocks % agsize != 0 &&
             (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
                ASSERT(!daflag);
-               dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize);
+               dblocks = (xfs_rfsblock_t)((agcount - 1) * agsize);
                agcount--;
                ASSERT(agcount != 0);
        }
@@ -2752,7 +2752,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
                agf = XFS_BUF_TO_AGF(buf);
                memset(agf, 0, sectorsize);
                if (agno == agcount - 1)
-                       agsize = dblocks - (xfs_drfsbno_t)(agno * agsize);
+                       agsize = dblocks - (xfs_rfsblock_t)(agno * agsize);
                agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC);
                agf->agf_versionnum = cpu_to_be32(XFS_AGF_VERSION);
                agf->agf_seqno = cpu_to_be32(agno);
index a13b5cc5f3fe7a31db55fe4b46a81edf48ae752e..79336364299631e73ba0b8d34ed025951ce14d07 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -10069,10 +10069,10 @@ msgstr ""
 #: .././repair/scan.c:421
 #, c-format
 msgid ""
-"bad fwd (right) sibling pointer (saw %llu should be NULLDFSBNO)\n"
+"bad fwd (right) sibling pointer (saw %llu should be NULLFSBLOCK)\n"
 "\tin inode %llu (%s fork) bmap btree block %llu\n"
 msgstr ""
-"falscher fwd (rechts) Geschwisterzeiger (%llu gesehen könnte NULLDFSBNO\n"
+"falscher fwd (rechts) Geschwisterzeiger (%llu gesehen könnte NULLFSBLOCK\n"
 "\tsein) in Inode %llu (%s Unterelement) Â»bmap btree«-Block %llu\n"
 
 #: .././repair/scan.c:460
@@ -11740,9 +11740,9 @@ msgstr ""
 
 #: .././repair/dinode.c:1302
 #, c-format
-msgid "bad fwd (right) sibling pointer (saw %llu should be NULLDFSBNO)\n"
+msgid "bad fwd (right) sibling pointer (saw %llu should be NULLFSBLOCK)\n"
 msgstr ""
-"falscher fwd (rechts) Geschwisterzeiger (%llu gesehen könnte NULLDFSBNO\n"
+"falscher fwd (rechts) Geschwisterzeiger (%llu gesehen könnte NULLFSBLOCK\n"
 "sein)\n"
 
 #: .././repair/dinode.c:1305
index c8a24e13e0ff378fa5b6b4804726c8d501e5dcff..02d8c222cb2ebe1616d7ecc19c9a2d07b026814a 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
@@ -9753,8 +9753,8 @@ msgstr "i-wÄ™zeÅ‚ %<PRIu64>: liczba ekstentów dla odgałęzienia %s zbyt maÅ‚a
 
 #: .././repair/dinode.c:1039
 #, c-format
-msgid "bad fwd (right) sibling pointer (saw %<PRIu64> should be NULLDFSBNO)\n"
-msgstr "błędny wskaźnik fwd (prawy) (widziano %<PRIu64>, powinno być NULLDFSBNO)\n"
+msgid "bad fwd (right) sibling pointer (saw %<PRIu64> should be NULLFSBLOCK)\n"
+msgstr "błędny wskaźnik fwd (prawy) (widziano %<PRIu64>, powinno być NULLFSBLOCK)\n"
 
 #: .././repair/dinode.c:1042
 #, c-format
@@ -12217,10 +12217,10 @@ msgstr ""
 #: .././repair/scan.c:487
 #, c-format
 msgid ""
-"bad fwd (right) sibling pointer (saw %<PRIu64> should be NULLDFSBNO)\n"
+"bad fwd (right) sibling pointer (saw %<PRIu64> should be NULLFSBLOCK)\n"
 "\tin inode %<PRIu64> (%s fork) bmap btree block %<PRIu64>\n"
 msgstr ""
-"błędny wskaźnik w przód (prawy) (widziano %<PRIu64>, powinien być NULLDFSBNO)\n"
+"błędny wskaźnik w przód (prawy) (widziano %<PRIu64>, powinien być NULLFSBLOCK)\n"
 "\tw i-węźle %<PRIu64> (gałęzi %s) bloku bmap btree %<PRIu64>\n"
 
 #: .././repair/scan.c:545
index 5902fcd20f78211172c0037b416f712223806bac..9ae2deb36d68ccfbe712d73e4cbe5d4991370f16 100644 (file)
@@ -30,7 +30,7 @@
 static int
 verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
 {
-       xfs_drfsbno_t agblocks;
+       xfs_rfsblock_t agblocks;
        int retval = 0;
 
        /* check common fields */
@@ -73,7 +73,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
                                        cpu_to_be32(mp->m_sb.sb_agblocks);
                } else  {
                        agblocks = mp->m_sb.sb_dblocks -
-                               (xfs_drfsbno_t) mp->m_sb.sb_agblocks * i;
+                               (xfs_rfsblock_t) mp->m_sb.sb_agblocks * i;
 
                        if (be32_to_cpu(agf->agf_length) != agblocks)  {
                                retval = XR_AG_AGF;
@@ -128,7 +128,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i)
 static int
 verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)
 {
-       xfs_drfsbno_t agblocks;
+       xfs_rfsblock_t agblocks;
        int retval = 0;
 
        /* check common fields */
@@ -171,7 +171,7 @@ verify_set_agi(xfs_mount_t *mp, xfs_agi_t *agi, xfs_agnumber_t agno)
                                        cpu_to_be32(mp->m_sb.sb_agblocks);
                } else  {
                        agblocks = mp->m_sb.sb_dblocks -
-                               (xfs_drfsbno_t) mp->m_sb.sb_agblocks * agno;
+                               (xfs_rfsblock_t) mp->m_sb.sb_agblocks * agno;
 
                        if (be32_to_cpu(agi->agi_length) != agblocks)  {
                                retval = XR_AG_AGI;
index b5c10ecd8e161632db61d1f8557ebaccbc9f4a3a..5541fb96df68086232b76db4cd6c00183b25ad9c 100644 (file)
@@ -21,11 +21,11 @@ typedef struct fs_geometry  {
         * these types should match the superblock types
         */
        __uint32_t      sb_blocksize;   /* blocksize (bytes) */
-       xfs_drfsbno_t   sb_dblocks;     /* # data blocks */
-       xfs_drfsbno_t   sb_rblocks;     /* # realtime blocks */
-       xfs_drtbno_t    sb_rextents;    /* # realtime extents */
+       xfs_rfsblock_t  sb_dblocks;     /* # data blocks */
+       xfs_rfsblock_t  sb_rblocks;     /* # realtime blocks */
+       xfs_rtblock_t   sb_rextents;    /* # realtime extents */
        uuid_t          sb_uuid;        /* fs uuid */
-       xfs_dfsbno_t    sb_logstart;    /* starting log block # */
+       xfs_fsblock_t   sb_logstart;    /* starting log block # */
        xfs_agblock_t   sb_rextsize;    /* realtime extent size (blocks )*/
        xfs_agblock_t   sb_agblocks;    /* # of blocks per ag */
        xfs_agnumber_t  sb_agcount;     /* # of ags */
index d305cdb1adf38fbd99dbd3571b14ca3a0bc454a0..e4ac2446b597d0d1eb7bc4702f663eb8a2b37231 100644 (file)
@@ -145,7 +145,7 @@ traverse_int_dablock(xfs_mount_t    *mp,
        xfs_dablk_t             bno;
        int                     i;
        xfs_da_intnode_t        *node;
-       xfs_dfsbno_t            fsbno;
+       xfs_fsblock_t           fsbno;
        xfs_buf_t               *bp;
        struct xfs_da_node_entry *btree;
        struct xfs_da3_icnode_hdr nodehdr;
@@ -166,7 +166,7 @@ traverse_int_dablock(xfs_mount_t    *mp,
                 */
                fsbno = blkmap_get(da_cursor->blkmap, bno);
 
-               if (fsbno == NULLDFSBNO)
+               if (fsbno == NULLFSBLOCK)
                        goto error_out;
 
                bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno),
@@ -493,7 +493,7 @@ verify_da_path(xfs_mount_t  *mp,
 {
        xfs_da_intnode_t        *node;
        xfs_da_intnode_t        *newnode;
-       xfs_dfsbno_t            fsbno;
+       xfs_fsblock_t           fsbno;
        xfs_dablk_t             dabno;
        xfs_buf_t               *bp;
        int                     bad;
@@ -545,7 +545,7 @@ verify_da_path(xfs_mount_t  *mp,
                ASSERT(dabno != 0);
                fsbno = blkmap_get(cursor->blkmap, dabno);
 
-               if (fsbno == NULLDFSBNO) {
+               if (fsbno == NULLFSBLOCK) {
                        do_warn(_("can't get map info for block %u "
                                  "of directory inode %" PRIu64 "\n"),
                                dabno, cursor->ino);
@@ -995,7 +995,7 @@ static int
 rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap,
                xfs_dablk_t blocknum, int valuelen, char* value)
 {
-       xfs_dfsbno_t    bno;
+       xfs_fsblock_t   bno;
        xfs_buf_t       *bp;
        int             clearit = 0, i = 0, length = 0, amountdone = 0;
        int             hdrsize = 0;
@@ -1007,7 +1007,7 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap,
        /* Note that valuelen is not a multiple of blocksize */
        while (amountdone < valuelen) {
                bno = blkmap_get(blkmap, blocknum + i);
-               if (bno == NULLDFSBNO) {
+               if (bno == NULLFSBLOCK) {
                        do_warn(
        _("remote block for attributes of inode %" PRIu64 " is missing\n"), ino);
                        clearit = 1;
@@ -1330,7 +1330,7 @@ process_leaf_attr_level(xfs_mount_t       *mp,
        xfs_attr_leafblock_t    *leaf;
        xfs_buf_t               *bp;
        xfs_ino_t               ino;
-       xfs_dfsbno_t            dev_bno;
+       xfs_fsblock_t           dev_bno;
        xfs_dablk_t             da_bno;
        xfs_dablk_t             prev_bno;
        xfs_dahash_t            current_hashval = 0;
@@ -1350,7 +1350,7 @@ process_leaf_attr_level(xfs_mount_t       *mp,
                 */
                ASSERT(da_bno != 0);
 
-               if (dev_bno == NULLDFSBNO) {
+               if (dev_bno == NULLFSBLOCK) {
                        do_warn(
        _("can't map block %u for attribute fork for inode %" PRIu64 "\n"),
                                da_bno, ino);
@@ -1519,7 +1519,7 @@ process_longform_attr(
        int             *repair)        /* out - 1 if something was fixed */
 {
        xfs_attr_leafblock_t    *leaf;
-       xfs_dfsbno_t    bno;
+       xfs_fsblock_t   bno;
        xfs_buf_t       *bp;
        xfs_dahash_t    next_hashval;
        int             repairlinks = 0;
@@ -1529,7 +1529,7 @@ process_longform_attr(
 
        bno = blkmap_get(blkmap, 0);
 
-       if ( bno == NULLDFSBNO ) {
+       if ( bno == NULLFSBLOCK ) {
                if (dip->di_aformat == XFS_DINODE_FMT_EXTENTS && 
                                be16_to_cpu(dip->di_anextents) == 0)
                        return(0); /* the kernel can handle this state */
index 0d0c62cfb4d8e0ac7d974b36ab9730c1d78322d2..7010e4ff04edae74d55e4d332afaa4eb9dd38586 100644 (file)
@@ -54,39 +54,6 @@ struct xfs_icacl {
        struct xfs_icacl_entry  acl_entry[0];
 };
 
-struct xfs_acl_entry {
-       __be32          ae_tag;
-       __be32          ae_id;
-       __be16          ae_perm;
-       __be16          ae_pad;
-};
-
-struct xfs_acl {
-       __be32                  acl_cnt;
-       struct xfs_acl_entry    acl_entry[0];
-};
-
-/*
- * The number of ACL entries allowed is defined by the on-disk format.
- * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is
- * limited only by the maximum size of the xattr that stores the information.
- */
-#define XFS_ACL_MAX_ENTRIES(mp) \
-       (xfs_sb_version_hascrc(&mp->m_sb) \
-               ?  (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
-                                               sizeof(struct xfs_acl_entry) \
-               : 25)
-
-#define XFS_ACL_MAX_SIZE(mp) \
-       (sizeof(struct xfs_acl) + \
-               sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
-
-#define SGI_ACL_FILE   "SGI_ACL_FILE"
-#define SGI_ACL_DEFAULT        "SGI_ACL_DEFAULT"
-#define SGI_ACL_FILE_SIZE      (sizeof(SGI_ACL_FILE)-1)
-#define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
-
-
 /*
  * Mandatory Access Control Labels (IRIX)
  */
index 3acf997f2185056c4847f5bd006f01dead129a95..71568f4fd405a0a89d81183174cdba5ac4f9e0ce 100644 (file)
@@ -106,10 +106,10 @@ blkmap_free(
 /*
  * Get one entry from a block map.
  */
-xfs_dfsbno_t
+xfs_fsblock_t
 blkmap_get(
        blkmap_t        *blkmap,
-       xfs_dfiloff_t   o)
+       xfs_fileoff_t   o)
 {
        bmap_ext_t      *ext = blkmap->exts;
        int             i;
@@ -118,7 +118,7 @@ blkmap_get(
                if (o >= ext->startoff && o < ext->startoff + ext->blockcount)
                        return ext->startblock + (o - ext->startoff);
        }
-       return NULLDFSBNO;
+       return NULLFSBLOCK;
 }
 
 /*
@@ -127,8 +127,8 @@ blkmap_get(
 int
 blkmap_getn(
        blkmap_t        *blkmap,
-       xfs_dfiloff_t   o,
-       xfs_dfilblks_t  nb,
+       xfs_fileoff_t   o,
+       xfs_filblks_t   nb,
        bmap_ext_t      **bmpp,
        bmap_ext_t      *bmpp_single)
 {
@@ -188,20 +188,20 @@ single_ext:
        bmpp_single->blockcount = nb;
        bmpp_single->startoff = 0;      /* not even used by caller! */
        *bmpp = bmpp_single;
-       return (bmpp_single->startblock != NULLDFSBNO) ? 1 : 0;
+       return (bmpp_single->startblock != NULLFSBLOCK) ? 1 : 0;
 }
 
 /*
  * Return the last offset in a block map.
  */
-xfs_dfiloff_t
+xfs_fileoff_t
 blkmap_last_off(
        blkmap_t        *blkmap)
 {
        bmap_ext_t      *ext;
 
        if (!blkmap->nexts)
-               return NULLDFILOFF;
+               return NULLFILEOFF;
        ext = blkmap->exts + blkmap->nexts - 1;
        return ext->startoff + ext->blockcount;
 }
@@ -219,34 +219,34 @@ blkmap_last_off(
  *
  * If the blockmap contains no extents, or no more logical offsets are mapped,
  * or the extent index exceeds the number of extents in the map,
- * return NULLDFILOFF.
+ * return NULLFILEOFF.
  *
  * If offset o is beyond extent index t, the first offset in the next extent
  * after extent t will be returned.
  *
  * Intended to be called starting with offset 0, index 0, and iterated.
  */
-xfs_dfiloff_t
+xfs_fileoff_t
 blkmap_next_off(
        blkmap_t        *blkmap,
-       xfs_dfiloff_t   o,
+       xfs_fileoff_t   o,
        int             *t)
 {
        bmap_ext_t      *ext;
 
        if (!blkmap->nexts)
-               return NULLDFILOFF;
-       if (o == NULLDFILOFF) {
+               return NULLFILEOFF;
+       if (o == NULLFILEOFF) {
                *t = 0;
                return blkmap->exts[0].startoff;
        }
        if (*t >= blkmap->nexts)
-               return NULLDFILOFF;
+               return NULLFILEOFF;
        ext = blkmap->exts + *t;
        if (o < ext->startoff + ext->blockcount - 1)
                return o + 1;
        if (*t == blkmap->nexts - 1)
-               return NULLDFILOFF;
+               return NULLFILEOFF;
        (*t)++;
        return ext[1].startoff;
 }
@@ -311,9 +311,9 @@ blkmap_grow(
 int
 blkmap_set_ext(
        blkmap_t        **blkmapp,
-       xfs_dfiloff_t   o,
-       xfs_dfsbno_t    b,
-       xfs_dfilblks_t  c)
+       xfs_fileoff_t   o,
+       xfs_fsblock_t   b,
+       xfs_filblks_t   c)
 {
        blkmap_t        *blkmap = *blkmapp;
        xfs_extnum_t    i;
index ad7164ac2c76e026a1eaefd900ed6a83992f9eb7..973081a69d9ade561f772997681d11f5c203c1b3 100644 (file)
@@ -23,9 +23,9 @@
  * Extent descriptor.
  */
 typedef struct bmap_ext {
-       xfs_dfiloff_t   startoff;
-       xfs_dfsbno_t    startblock;
-       xfs_dfilblks_t  blockcount;
+       xfs_fileoff_t   startoff;
+       xfs_fsblock_t   startblock;
+       xfs_filblks_t   blockcount;
 } bmap_ext_t;
 
 /*
@@ -59,14 +59,14 @@ extern pthread_key_t ablkmap_key;
 blkmap_t       *blkmap_alloc(xfs_extnum_t nex, int whichfork);
 void           blkmap_free(blkmap_t *blkmap);
 
-int            blkmap_set_ext(blkmap_t **blkmapp, xfs_dfiloff_t o,
-                              xfs_dfsbno_t b, xfs_dfilblks_t c);
+int            blkmap_set_ext(blkmap_t **blkmapp, xfs_fileoff_t o,
+                              xfs_fsblock_t b, xfs_filblks_t c);
 
-xfs_dfsbno_t   blkmap_get(blkmap_t *blkmap, xfs_dfiloff_t o);
-int            blkmap_getn(blkmap_t *blkmap, xfs_dfiloff_t o,
-                           xfs_dfilblks_t nb, bmap_ext_t **bmpp,
+xfs_fsblock_t  blkmap_get(blkmap_t *blkmap, xfs_fileoff_t o);
+int            blkmap_getn(blkmap_t *blkmap, xfs_fileoff_t o,
+                           xfs_filblks_t nb, bmap_ext_t **bmpp,
                            bmap_ext_t *bmpp_single);
-xfs_dfiloff_t  blkmap_last_off(blkmap_t *blkmap);
-xfs_dfiloff_t  blkmap_next_off(blkmap_t *blkmap, xfs_dfiloff_t o, int *t);
+xfs_fileoff_t  blkmap_last_off(blkmap_t *blkmap);
+xfs_fileoff_t  blkmap_next_off(blkmap_t *blkmap, xfs_fileoff_t o, int *t);
 
 #endif /* _XFS_REPAIR_BMAP_H */
index 9a5e9a65d91d8cf361cfb60c4cccc329740a023a..a1ce9e71bbdcefb86db40c6a43ce29f421fb8aa8 100644 (file)
@@ -121,7 +121,7 @@ verify_inode_chunk(xfs_mount_t              *mp,
 
        if (agno == mp->m_sb.sb_agcount - 1)
                max_agbno = mp->m_sb.sb_dblocks -
-                       (xfs_drfsbno_t) mp->m_sb.sb_agblocks * agno;
+                       (xfs_rfsblock_t) mp->m_sb.sb_agblocks * agno;
        else
                max_agbno = mp->m_sb.sb_agblocks;
 
index a6be98f32c339721deb4591d42494e1572df6175..179203ee1a3062a90842688b03b1d32eb4a30e0e 100644 (file)
@@ -292,7 +292,7 @@ verify_ag_bno(xfs_sb_t *sbp,
                return (agbno >= sbp->sb_agblocks);
        if (agno == (sbp->sb_agcount - 1)) 
                return (agbno >= (sbp->sb_dblocks -
-                               ((xfs_drfsbno_t)(sbp->sb_agcount - 1) *
+                               ((xfs_rfsblock_t)(sbp->sb_agcount - 1) *
                                 sbp->sb_agblocks)));
        return 1;
 }
@@ -363,7 +363,7 @@ verify_aginum(xfs_mount_t   *mp,
  */
 int
 verify_dfsbno(xfs_mount_t      *mp,
-               xfs_dfsbno_t    fsbno)
+               xfs_fsblock_t   fsbno)
 {
        xfs_agnumber_t  agno;
        xfs_agblock_t   agbno;
@@ -384,8 +384,8 @@ verify_dfsbno(xfs_mount_t   *mp,
 
 static __inline int
 verify_dfsbno_range(xfs_mount_t        *mp,
-               xfs_dfsbno_t    fsbno,
-               xfs_dfilblks_t  count)
+               xfs_fsblock_t   fsbno,
+               xfs_filblks_t   count)
 {
        xfs_agnumber_t  agno;
        xfs_agblock_t   agbno;
@@ -426,11 +426,11 @@ process_rt_rec(
        xfs_mount_t             *mp,
        xfs_bmbt_irec_t         *irec,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        int                     check_dups)
 {
-       xfs_dfsbno_t            b;
-       xfs_drtbno_t            ext;
+       xfs_fsblock_t           b;
+       xfs_rtblock_t           ext;
        int                     state;
        int                     pwe;            /* partially-written extent */
 
@@ -485,7 +485,7 @@ _("malformed rt inode extent [%" PRIu64 " %" PRIu64 "] (fs rtext size = %u)\n"),
         */
        for (b = irec->br_startblock; b < irec->br_startblock +
                        irec->br_blockcount; b += mp->m_sb.sb_rextsize)  {
-               ext = (xfs_drtbno_t) b / mp->m_sb.sb_rextsize;
+               ext = (xfs_rtblock_t) b / mp->m_sb.sb_rextsize;
                pwe = xfs_sb_version_hasextflgbit(&mp->m_sb) &&
                                irec->br_state == XFS_EXT_UNWRITTEN &&
                                (b % mp->m_sb.sb_rextsize != 0);
@@ -559,18 +559,18 @@ process_bmbt_reclist_int(
        int                     *numrecs,
        int                     type,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        blkmap_t                **blkmapp,
-       xfs_dfiloff_t           *first_key,
-       xfs_dfiloff_t           *last_key,
+       xfs_fileoff_t           *first_key,
+       xfs_fileoff_t           *last_key,
        int                     check_dups,
        int                     whichfork)
 {
        xfs_bmbt_irec_t         irec;
-       xfs_dfilblks_t          cp = 0;         /* prev count */
-       xfs_dfsbno_t            sp = 0;         /* prev start */
-       xfs_dfiloff_t           op = 0;         /* prev offset */
-       xfs_dfsbno_t            b;
+       xfs_filblks_t           cp = 0;         /* prev count */
+       xfs_fsblock_t           sp = 0;         /* prev start */
+       xfs_fileoff_t           op = 0;         /* prev offset */
+       xfs_fsblock_t           b;
        char                    *ftype;
        char                    *forkname = get_forkname(whichfork);
        int                     i;
@@ -800,10 +800,10 @@ process_bmbt_reclist(
        int                     *numrecs,
        int                     type,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        blkmap_t                **blkmapp,
-       xfs_dfiloff_t           *first_key,
-       xfs_dfiloff_t           *last_key,
+       xfs_fileoff_t           *first_key,
+       xfs_fileoff_t           *last_key,
        int                     whichfork)
 {
        return process_bmbt_reclist_int(mp, rp, numrecs, type, ino, tot,
@@ -821,11 +821,11 @@ scan_bmbt_reclist(
        int                     *numrecs,
        int                     type,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        int                     whichfork)
 {
-       xfs_dfiloff_t           first_key = 0;
-       xfs_dfiloff_t           last_key = 0;
+       xfs_fileoff_t           first_key = 0;
+       xfs_fileoff_t           last_key = 0;
 
        return process_bmbt_reclist_int(mp, rp, numrecs, type, ino, tot,
                                NULL, &first_key, &last_key, 1, whichfork);
@@ -886,15 +886,15 @@ process_btinode(
        xfs_dinode_t            *dip,
        int                     type,
        int                     *dirty,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        __uint64_t              *nex,
        blkmap_t                **blkmapp,
        int                     whichfork,
        int                     check_dups)
 {
        xfs_bmdr_block_t        *dib;
-       xfs_dfiloff_t           last_key;
-       xfs_dfiloff_t           first_key = 0;
+       xfs_fileoff_t           last_key;
+       xfs_fileoff_t           first_key = 0;
        xfs_ino_t               lino;
        xfs_bmbt_ptr_t          *pp;
        xfs_bmbt_key_t          *pkey;
@@ -952,7 +952,7 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
        pp = XFS_BMDR_PTR_ADDR(dib, 1,
                xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork), 0));
        pkey = XFS_BMDR_KEY_ADDR(dib, 1);
-       last_key = NULLDFILOFF;
+       last_key = NULLFILEOFF;
 
        for (i = 0; i < numrecs; i++)  {
                /*
@@ -1006,7 +1006,7 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
                 * inode if the ordering doesn't hold
                 */
                if (check_dups == 0)  {
-                       if (last_key != NULLDFILOFF && last_key >=
+                       if (last_key != NULLFILEOFF && last_key >=
                            cursor.level[level-1].first_key)  {
                                do_warn(
        _("out of order bmbt root key %" PRIu64 " in inode %" PRIu64 " %s fork\n"),
@@ -1035,9 +1035,9 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
         * is NULL.
         */
        if (check_dups == 0 &&
-               cursor.level[0].right_fsbno != NULLDFSBNO)  {
+               cursor.level[0].right_fsbno != NULLFSBLOCK)  {
                do_warn(
-       _("bad fwd (right) sibling pointer (saw %" PRIu64 " should be NULLDFSBNO)\n"),
+       _("bad fwd (right) sibling pointer (saw %" PRIu64 " should be NULLFSBLOCK)\n"),
                        cursor.level[0].right_fsbno);
                do_warn(
        _("\tin inode %" PRIu64 " (%s fork) bmap btree block %" PRIu64 "\n"),
@@ -1060,7 +1060,7 @@ process_exinode(
        xfs_dinode_t            *dip,
        int                     type,
        int                     *dirty,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        __uint64_t              *nex,
        blkmap_t                **blkmapp,
        int                     whichfork,
@@ -1068,8 +1068,8 @@ process_exinode(
 {
        xfs_ino_t               lino;
        xfs_bmbt_rec_t          *rp;
-       xfs_dfiloff_t           first_key;
-       xfs_dfiloff_t           last_key;
+       xfs_fileoff_t           first_key;
+       xfs_fileoff_t           last_key;
        int32_t                 numrecs;
        int                     ret;
 
@@ -1150,7 +1150,7 @@ process_lclinode(
 static int
 process_symlink_extlist(xfs_mount_t *mp, xfs_ino_t lino, xfs_dinode_t *dino)
 {
-       xfs_dfiloff_t           expected_offset;
+       xfs_fileoff_t           expected_offset;
        xfs_bmbt_rec_t          *rp;
        xfs_bmbt_irec_t         irec;
        int                     numrecs;
@@ -1240,7 +1240,7 @@ process_symlink_remote(
        struct blkmap           *blkmap,
        char                    *dst)
 {
-       xfs_dfsbno_t            fsbno;
+       xfs_fsblock_t           fsbno;
        struct xfs_buf          *bp;
        char                    *src;
        int                     pathlen;
@@ -1257,7 +1257,7 @@ process_symlink_remote(
                int     badcrc = 0;
 
                fsbno = blkmap_get(blkmap, i);
-               if (fsbno == NULLDFSBNO) {
+               if (fsbno == NULLFSBLOCK) {
                        do_warn(
 _("cannot read inode %" PRIu64 ", file block %d, NULL disk block\n"),
                                lino, i);
@@ -1442,7 +1442,7 @@ _("size of fifo inode %" PRIu64 " != 0 (%" PRId64 " bytes)\n"), lino,
 }
 
 static int
-process_misc_ino_types_blocks(xfs_drfsbno_t totblocks, xfs_ino_t lino, int type)
+process_misc_ino_types_blocks(xfs_rfsblock_t totblocks, xfs_ino_t lino, int type)
 {
        /*
         * you can not enforce all misc types have zero data fork blocks
@@ -1774,7 +1774,7 @@ _("bad attr fork offset %d in inode %" PRIu64 ", max=%d\n"),
 static int
 process_inode_blocks_and_extents(
        xfs_dinode_t    *dino,
-       xfs_drfsbno_t   nblocks,
+       xfs_rfsblock_t  nblocks,
        __uint64_t      nextents,
        __uint64_t      anextents,
        xfs_ino_t       lino,
@@ -1865,7 +1865,7 @@ process_inode_data_fork(
        xfs_dinode_t    *dino,
        int             type,
        int             *dirty,
-       xfs_drfsbno_t   *totblocks,
+       xfs_rfsblock_t  *totblocks,
        __uint64_t      *nextents,
        blkmap_t        **dblkmap,
        int             check_dups)
@@ -1974,7 +1974,7 @@ process_inode_attr_fork(
        xfs_dinode_t    *dino,
        int             type,
        int             *dirty,
-       xfs_drfsbno_t   *atotblocks,
+       xfs_rfsblock_t  *atotblocks,
        __uint64_t      *anextents,
        int             check_dups,
        int             extra_attr_check,
@@ -2181,8 +2181,8 @@ process_dinode_int(xfs_mount_t *mp,
                int *isa_dir,           /* out == 1 if inode is a directory */
                xfs_ino_t *parent)      /* out -- parent if ino is a dir */
 {
-       xfs_drfsbno_t           totblocks = 0;
-       xfs_drfsbno_t           atotblocks = 0;
+       xfs_rfsblock_t          totblocks = 0;
+       xfs_rfsblock_t          atotblocks = 0;
        int                     di_mode;
        int                     type;
        int                     retval = 0;
index 80f3e4ea92fdb02e9014f368c326a0bb1b064206..5aebf5b3863832e3d8fb900c3eaff473b6e6190a 100644 (file)
@@ -28,14 +28,14 @@ verify_agbno(xfs_mount_t    *mp,
 
 int
 verify_dfsbno(xfs_mount_t      *mp,
-               xfs_dfsbno_t    fsbno);
+               xfs_fsblock_t   fsbno);
 
 void
 convert_extent(
        xfs_bmbt_rec_t          *rp,
-       xfs_dfiloff_t           *op,    /* starting offset (blockno in file) */
-       xfs_dfsbno_t            *sp,    /* starting block (fs blockno) */
-       xfs_dfilblks_t          *cp,    /* blockcount */
+       xfs_fileoff_t           *op,    /* starting offset (blockno in file) */
+       xfs_fsblock_t           *sp,    /* starting block (fs blockno) */
+       xfs_filblks_t           *cp,    /* blockcount */
        int                     *fp);   /* extent flag */
 
 int
@@ -44,7 +44,7 @@ process_bmbt_reclist(xfs_mount_t      *mp,
                int                     *numrecs,
                int                     type,
                xfs_ino_t               ino,
-               xfs_drfsbno_t           *tot,
+               xfs_rfsblock_t          *tot,
                struct blkmap           **blkmapp,
                __uint64_t              *first_key,
                __uint64_t              *last_key,
@@ -57,7 +57,7 @@ scan_bmbt_reclist(
        int                     *numrecs,
        int                     type,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        int                     whichfork);
 
 void
index 5177bca94ce8fc596e68d99f348bded3a5983a70..ceb8825cda005522e06678fc124252a8cba3ea6f 100644 (file)
@@ -1854,10 +1854,10 @@ process_leaf_node_dir2(
        bmap_ext_t              *bmp;
        struct xfs_buf          *bp;
        struct xfs_dir2_data_hdr *data;
-       xfs_dfiloff_t           dbno;
+       xfs_fileoff_t           dbno;
        int                     good;
        int                     i;
-       xfs_dfiloff_t           ndbno;
+       xfs_fileoff_t           ndbno;
        int                     nex;
        int                     t;
        bmap_ext_t              lbmp;
@@ -1865,7 +1865,7 @@ process_leaf_node_dir2(
 
        *repair = *dot = *dotdot = good = 0;
        *parent = NULLFSINO;
-       ndbno = NULLDFILOFF;
+       ndbno = NULLFILEOFF;
        while ((dbno = blkmap_next_off(blkmap, ndbno, &t)) < mp->m_dir_geo->leafblk) {
                nex = blkmap_getn(blkmap, dbno, mp->m_dir_geo->fsbcount, &bmp, &lbmp);
                /* Advance through map to last dfs block in this dir block */
@@ -1940,7 +1940,7 @@ process_dir2(
 {
        int             dot;
        int             dotdot;
-       xfs_dfiloff_t   last;
+       xfs_fileoff_t   last;
        int             repair;
        int             res;
 
index a8d497e8e3f1ccf73a5e693a3eb591f2af7414a0..cf1073f78abfc4f197c205b99c334a294eaa2bce 100644 (file)
@@ -190,7 +190,7 @@ static size_t               rt_bmap_size;
  */
 int
 get_rtbmap(
-       xfs_drtbno_t    bno)
+       xfs_rtblock_t   bno)
 {
        return (*(rt_bmap + bno /  XR_BB_NUM) >>
                ((bno % XR_BB_NUM) * XR_BB)) & XR_BB_MASK;
@@ -198,7 +198,7 @@ get_rtbmap(
 
 void
 set_rtbmap(
-       xfs_drtbno_t    bno,
+       xfs_rtblock_t   bno,
        int             state)
 {
        *(rt_bmap + bno / XR_BB_NUM) =
@@ -254,7 +254,7 @@ reset_bmaps(xfs_mount_t *mp)
        for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
                if (agno == mp->m_sb.sb_agcount - 1)
                        ag_size = (xfs_extlen_t)(mp->m_sb.sb_dblocks -
-                                  (xfs_drfsbno_t)mp->m_sb.sb_agblocks * agno);
+                                  (xfs_rfsblock_t)mp->m_sb.sb_agblocks * agno);
 #ifdef BTREE_STATS
                if (btree_find(ag_bmap[agno], 0, NULL)) {
                        printf("ag_bmap[%d] btree stats:\n", i);
index 5f8c188aea6d3168e65d75614c232068d9ed6f4d..ba819b4eca5490388be9a2b85a236d0e1fb4f023 100644 (file)
@@ -40,8 +40,8 @@ void          set_bmap_ext(xfs_agnumber_t agno, xfs_agblock_t agbno,
 int            get_bmap_ext(xfs_agnumber_t agno, xfs_agblock_t agbno,
                             xfs_agblock_t maxbno, xfs_extlen_t *blen);
 
-void           set_rtbmap(xfs_drtbno_t bno, int state);
-int            get_rtbmap(xfs_drtbno_t bno);
+void           set_rtbmap(xfs_rtblock_t bno, int state);
+int            get_rtbmap(xfs_rtblock_t bno);
 
 static inline void
 set_bmap(xfs_agnumber_t agno, xfs_agblock_t agbno, int state)
@@ -82,7 +82,7 @@ typedef struct extent_tree_node  {
 
 typedef struct rt_extent_tree_node  {
        avlnode_t               avl_node;
-       xfs_drtbno_t            rt_startblock;  /* starting realtime block */
+       xfs_rtblock_t           rt_startblock;  /* starting realtime block */
        xfs_extlen_t            rt_blockcount;  /* number of blocks in extent */
        extent_state_t          rt_state;       /* see state flags below */
 
@@ -175,11 +175,11 @@ int               add_dup_extent(xfs_agnumber_t agno, xfs_agblock_t startblock,
                        xfs_extlen_t blockcount);
 int            search_dup_extent(xfs_agnumber_t agno,
                        xfs_agblock_t start_agbno, xfs_agblock_t end_agbno);
-void           add_rt_dup_extent(xfs_drtbno_t  startblock,
+void           add_rt_dup_extent(xfs_rtblock_t startblock,
                                xfs_extlen_t    blockcount);
 
 int            search_rt_dup_extent(xfs_mount_t        *mp,
-                                       xfs_drtbno_t    bno);
+                                       xfs_rtblock_t   bno);
 
 /*
  * extent/tree recyling and deletion routines
@@ -547,9 +547,9 @@ void                alloc_ex_data(ino_tree_node_t *irec);
 #define XR_MAX_BMLEVELS                10      /* XXX - rcc need to verify number */
 
 typedef struct bm_level_state  {
-       xfs_dfsbno_t            fsbno;
-       xfs_dfsbno_t            left_fsbno;
-       xfs_dfsbno_t            right_fsbno;
+       xfs_fsblock_t           fsbno;
+       xfs_fsblock_t           left_fsbno;
+       xfs_fsblock_t           right_fsbno;
        __uint64_t              first_key;
        __uint64_t              last_key;
 /*
index 3414b8d51c66cb3b8ba97a94fa589b3a1c91d690..1bc5fd92e76dadc9bc51ce42ab9d4f0f289a3245 100644 (file)
@@ -34,10 +34,10 @@ init_bm_cursor(bmap_cursor_t *cursor, int num_levels)
        cursor->num_levels = num_levels;
 
        for (i = 0; i < XR_MAX_BMLEVELS; i++)  {
-               cursor->level[i].fsbno = NULLDFSBNO;
-               cursor->level[i].right_fsbno = NULLDFSBNO;
-               cursor->level[i].left_fsbno = NULLDFSBNO;
-               cursor->level[i].first_key = NULLDFILOFF;
-               cursor->level[i].last_key = NULLDFILOFF;
+               cursor->level[i].fsbno = NULLFSBLOCK;
+               cursor->level[i].right_fsbno = NULLFSBLOCK;
+               cursor->level[i].left_fsbno = NULLFSBLOCK;
+               cursor->level[i].first_key = NULLFILEOFF;
+               cursor->level[i].last_key = NULLFILEOFF;
        }
 }
index a7d61e087181e33095160c8dc5a2f8b3ed9ccbb0..826bf44b2472c21be2fb4e947a509a3199d71e78 100644 (file)
@@ -552,7 +552,7 @@ avlops_t avl_extent_tree_ops = {
  * startblocks can be 64-bit values.
  */
 static rt_extent_tree_node_t *
-mk_rt_extent_tree_nodes(xfs_drtbno_t new_startblock,
+mk_rt_extent_tree_nodes(xfs_rtblock_t new_startblock,
        xfs_extlen_t new_blockcount, extent_state_t new_state)
 {
        rt_extent_tree_node_t *new;
@@ -620,10 +620,10 @@ free_rt_dup_extent_tree(xfs_mount_t *mp)
  * add a duplicate real-time extent
  */
 void
-add_rt_dup_extent(xfs_drtbno_t startblock, xfs_extlen_t blockcount)
+add_rt_dup_extent(xfs_rtblock_t startblock, xfs_extlen_t blockcount)
 {
        rt_extent_tree_node_t *first, *last, *ext, *next_ext;
-       xfs_drtbno_t new_startblock;
+       xfs_rtblock_t new_startblock;
        xfs_extlen_t new_blockcount;
 
        pthread_mutex_lock(&rt_ext_tree_lock);
@@ -708,7 +708,7 @@ add_rt_dup_extent(xfs_drtbno_t startblock, xfs_extlen_t blockcount)
  */
 /* ARGSUSED */
 int
-search_rt_dup_extent(xfs_mount_t *mp, xfs_drtbno_t bno)
+search_rt_dup_extent(xfs_mount_t *mp, xfs_rtblock_t bno)
 {
        int ret;
 
index 189eeb93ad66fd9b1ff5e0e9d1baa5e8a7cbac41..aa79ae017557ded394bdce21171cf3859a0fcc85 100644 (file)
@@ -158,8 +158,8 @@ void
 phase4(xfs_mount_t *mp)
 {
        ino_tree_node_t         *irec;
-       xfs_drtbno_t            bno;
-       xfs_drtbno_t            rt_start;
+       xfs_rtblock_t           bno;
+       xfs_rtblock_t           rt_start;
        xfs_extlen_t            rt_len;
        xfs_agnumber_t          i;
        xfs_agblock_t           j;
@@ -194,7 +194,7 @@ phase4(xfs_mount_t *mp)
        for (i = 0; i < mp->m_sb.sb_agcount; i++)  {
                ag_end = (i < mp->m_sb.sb_agcount - 1) ? mp->m_sb.sb_agblocks :
                        mp->m_sb.sb_dblocks -
-                               (xfs_drfsbno_t) mp->m_sb.sb_agblocks * i;
+                               (xfs_rfsblock_t) mp->m_sb.sb_agblocks * i;
 
                /*
                 * set up duplicate extent list for this ag
index 3a2cdbb76fe3ab96b67396d998ee0d1ea675df48..71bf751386fc2b056bee74d9f5d1258da6453f24 100644 (file)
@@ -120,7 +120,7 @@ mk_incore_fstree(xfs_mount_t *mp, xfs_agnumber_t agno)
                ag_end = mp->m_sb.sb_agblocks;
        else
                ag_end = mp->m_sb.sb_dblocks -
-                       (xfs_drfsbno_t)mp->m_sb.sb_agblocks *
+                       (xfs_rfsblock_t)mp->m_sb.sb_agblocks *
                        (mp->m_sb.sb_agcount - 1);
 
        /*
@@ -1107,7 +1107,7 @@ build_agi(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
                agi->agi_length = cpu_to_be32(mp->m_sb.sb_agblocks);
        else
                agi->agi_length = cpu_to_be32(mp->m_sb.sb_dblocks -
-                       (xfs_drfsbno_t) mp->m_sb.sb_agblocks * agno);
+                       (xfs_rfsblock_t) mp->m_sb.sb_agblocks * agno);
        agi->agi_count = cpu_to_be32(agi_stat->count);
        agi->agi_root = cpu_to_be32(btree_curs->root);
        agi->agi_level = cpu_to_be32(btree_curs->num_levels);
@@ -1325,7 +1325,7 @@ build_agf_agfl(xfs_mount_t        *mp,
                agf->agf_length = cpu_to_be32(mp->m_sb.sb_agblocks);
        else
                agf->agf_length = cpu_to_be32(mp->m_sb.sb_dblocks -
-                       (xfs_drfsbno_t) mp->m_sb.sb_agblocks * agno);
+                       (xfs_rfsblock_t) mp->m_sb.sb_agblocks * agno);
 
        agf->agf_roots[XFS_BTNUM_BNO] = cpu_to_be32(bno_bt->root);
        agf->agf_levels[XFS_BTNUM_BNO] = cpu_to_be32(bno_bt->num_levels);
index 5a61886855fb88695f82faf43dc24ef807cda637..7843ecd8751ecd05822e7e0b9f9ebc3a9ee64fe5 100644 (file)
@@ -485,7 +485,7 @@ mk_rbmino(xfs_mount_t *mp)
        int             committed;
        int             error;
        xfs_bmap_free_t flist;
-       xfs_dfiloff_t   bno;
+       xfs_fileoff_t   bno;
        xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP];
        int             vers;
        int             times;
@@ -596,7 +596,7 @@ fill_rbmino(xfs_mount_t *mp)
        xfs_fsblock_t   first;
        int             nmap;
        int             error;
-       xfs_dfiloff_t   bno;
+       xfs_fileoff_t   bno;
        xfs_bmbt_irec_t map;
        struct xfs_trans_res tres = {0};
 
@@ -666,8 +666,8 @@ fill_rsumino(xfs_mount_t *mp)
        xfs_fsblock_t   first;
        int             nmap;
        int             error;
-       xfs_dfiloff_t   bno;
-       xfs_dfiloff_t   end_bno;
+       xfs_fileoff_t   bno;
+       xfs_fileoff_t   end_bno;
        xfs_bmbt_irec_t map;
        struct xfs_trans_res tres = {0};
 
@@ -741,7 +741,7 @@ mk_rsumino(xfs_mount_t *mp)
        int             error;
        int             nsumblocks;
        xfs_bmap_free_t flist;
-       xfs_dfiloff_t   bno;
+       xfs_fileoff_t   bno;
        xfs_bmbt_irec_t map[XFS_BMAP_MAX_NMAP];
        int             vers;
        int             times;
index b61a859231837aef36c36ce75a961066e0b02cd6..d6246ce3c149929c6efa1c5368f13f279d4d7834 100644 (file)
@@ -165,8 +165,8 @@ pf_read_bmbt_reclist(
 {
        int                     i;
        xfs_bmbt_irec_t         irec;
-       xfs_dfilblks_t          cp = 0;         /* prev count */
-       xfs_dfiloff_t           op = 0;         /* prev offset */
+       xfs_filblks_t           cp = 0;         /* prev count */
+       xfs_fileoff_t           op = 0;         /* prev offset */
 #define MAP_ARRAY_SZ 4
        struct xfs_buf_map      map_array[MAP_ARRAY_SZ];
        struct xfs_buf_map      *map = map_array;
@@ -257,7 +257,7 @@ out_free:
 
 static int
 pf_scan_lbtree(
-       xfs_dfsbno_t            dbno,
+       xfs_fsblock_t           dbno,
        int                     level,
        int                     isadir,
        prefetch_args_t         *args,
@@ -293,7 +293,7 @@ pf_scanfunc_bmap(
        xfs_bmbt_ptr_t          *pp;
        int                     numrecs;
        int                     i;
-       xfs_dfsbno_t            dbno;
+       xfs_fsblock_t           dbno;
 
        /*
         * do some validation on the block contents
@@ -340,7 +340,7 @@ pf_read_btinode(
        int                     level;
        int                     numrecs;
        int                     dsize;
-       xfs_dfsbno_t            dbno;
+       xfs_fsblock_t           dbno;
 
        dib = (xfs_bmdr_block_t *)XFS_DFORK_DPTR(dino);
 
index 042ff469a92bbefd423b1438427c703d931effce..3a488c8693384b66805a4eb6ff62a3f331dd988e 100644 (file)
@@ -60,8 +60,8 @@ generate_rtinfo(xfs_mount_t   *mp,
                xfs_rtword_t    *words,
                xfs_suminfo_t   *sumcompute)
 {
-       xfs_drtbno_t    extno;
-       xfs_drtbno_t    start_ext;
+       xfs_rtblock_t   extno;
+       xfs_rtblock_t   start_ext;
        int             bitsperblock;
        int             bmbno;
        xfs_rtword_t    freebit;
@@ -133,7 +133,7 @@ generate_rtinfo(xfs_mount_t *mp,
 int
 check_summary(xfs_mount_t *mp)
 {
-       xfs_drfsbno_t   bno;
+       xfs_rfsblock_t  bno;
        xfs_suminfo_t   *csp;
        xfs_suminfo_t   *fsp;
        int             log;
@@ -174,9 +174,9 @@ process_rtbitmap(xfs_mount_t        *mp,
        int             bitsperblock;
        int             bmbno;
        int             end_bmbno;
-       xfs_dfsbno_t    bno;
+       xfs_fsblock_t   bno;
        xfs_buf_t       *bp;
-       xfs_drtbno_t    extno;
+       xfs_rtblock_t   extno;
        int             i;
        int             len;
        int             log;
@@ -199,7 +199,7 @@ process_rtbitmap(xfs_mount_t        *mp,
        for (bmbno = 0; bmbno < end_bmbno; bmbno++) {
                bno = blkmap_get(blkmap, bmbno);
 
-               if (bno == NULLDFSBNO) {
+               if (bno == NULLFSBLOCK) {
                        do_warn(_("can't find block %d for rtbitmap inode\n"),
                                        bmbno);
                        error = 1;
@@ -261,7 +261,7 @@ process_rtsummary(xfs_mount_t       *mp,
 
        for (sumbno = 0; sumbno < blkmap->count; sumbno++) {
                bno = blkmap_get(blkmap, sumbno);
-               if (bno == NULLDFSBNO) {
+               if (bno == NULLFSBLOCK) {
                        do_warn(_("block %d for rtsummary inode is missing\n"),
                                        sumbno);
                        error++;
index 6508a47a567de512274a962a39f1a6bde7ac63af..5f79e1baab1ba7593d9e0a4c9859169b6a666c99 100644 (file)
@@ -99,15 +99,15 @@ scan_sbtree(
  */
 int
 scan_lbtree(
-       xfs_dfsbno_t    root,
+       xfs_fsblock_t   root,
        int             nlevels,
        int             (*func)(struct xfs_btree_block  *block,
                                int                     level,
                                int                     type,
                                int                     whichfork,
-                               xfs_dfsbno_t            bno,
+                               xfs_fsblock_t           bno,
                                xfs_ino_t               ino,
-                               xfs_drfsbno_t           *tot,
+                               xfs_rfsblock_t          *tot,
                                __uint64_t              *nex,
                                blkmap_t                **blkmapp,
                                bmap_cursor_t           *bm_cursor,
@@ -118,7 +118,7 @@ scan_lbtree(
        int             type,
        int             whichfork,
        xfs_ino_t       ino,
-       xfs_drfsbno_t   *tot,
+       xfs_rfsblock_t  *tot,
        __uint64_t      *nex,
        blkmap_t        **blkmapp,
        bmap_cursor_t   *bm_cursor,
@@ -174,9 +174,9 @@ scan_bmapbt(
        int                     level,
        int                     type,
        int                     whichfork,
-       xfs_dfsbno_t            bno,
+       xfs_fsblock_t           bno,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        __uint64_t              *nex,
        blkmap_t                **blkmapp,
        bmap_cursor_t           *bm_cursor,
@@ -190,8 +190,8 @@ scan_bmapbt(
        xfs_bmbt_ptr_t          *pp;
        xfs_bmbt_key_t          *pkey;
        xfs_bmbt_rec_t          *rp;
-       xfs_dfiloff_t           first_key;
-       xfs_dfiloff_t           last_key;
+       xfs_fileoff_t           first_key;
+       xfs_fileoff_t           last_key;
        char                    *forkname = get_forkname(whichfork);
        int                     numrecs;
        xfs_agnumber_t          agno;
@@ -252,7 +252,7 @@ _("wrong FS UUID, bmbt block %" PRIu64 "\n"),
                 * between the sibling pointers and the child pointers
                 * in the parent block.  blow out the inode if that happens
                 */
-               if (bm_cursor->level[level].fsbno != NULLDFSBNO)  {
+               if (bm_cursor->level[level].fsbno != NULLFSBLOCK)  {
                        /*
                         * this is not the first block on this level
                         * so the cursor for this level has recorded the
@@ -283,7 +283,7 @@ _("bad back (left) sibling pointer (saw %llu parent block says %" PRIu64 ")\n"
                         * This is the first or only block on this level.
                         * Check that the left sibling pointer is NULL
                         */
-                       if (be64_to_cpu(block->bb_u.l.bb_leftsib) != NULLDFSBNO) {
+                       if (be64_to_cpu(block->bb_u.l.bb_leftsib) != NULLFSBLOCK) {
                                do_warn(
 _("bad back (left) sibling pointer (saw %llu should be NULL (0))\n"
   "\tin inode %" PRIu64 " (%s fork) bmap btree block %" PRIu64 "\n"),
@@ -397,13 +397,13 @@ _("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
                        /*
                         * check that key ordering is monotonically increasing.
                         * if the last_key value in the cursor is set to
-                        * NULLDFILOFF, then we know this is the first block
+                        * NULLFILEOFF, then we know this is the first block
                         * on the leaf level and we shouldn't check the
                         * last_key value.
                         */
                        if (first_key <= bm_cursor->level[level].last_key &&
                                        bm_cursor->level[level].last_key !=
-                                       NULLDFILOFF)  {
+                                       NULLFILEOFF)  {
                                do_warn(
 _("out-of-order bmap key (file offset) in inode %" PRIu64 ", %s fork, fsbno %" PRIu64 "\n"),
                                        ino, forkname, bno);
@@ -433,7 +433,7 @@ _("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
        pp = XFS_BMBT_PTR_ADDR(mp, block, 1, mp->m_bmap_dmxr[1]);
        pkey = XFS_BMBT_KEY_ADDR(mp, block, 1);
 
-       last_key = NULLDFILOFF;
+       last_key = NULLFILEOFF;
 
        for (i = 0, err = 0; i < numrecs; i++)  {
                /*
@@ -498,10 +498,10 @@ _("bad btree key (is %llu, should be %" PRIu64 ") in inode %" PRIu64 "\n"
         * block's forward sibling pointer is NULL.
         */
        if (check_dups == 0 &&
-                       bm_cursor->level[level].right_fsbno == NULLDFSBNO &&
-                       bm_cursor->level[level - 1].right_fsbno != NULLDFSBNO) {
+                       bm_cursor->level[level].right_fsbno == NULLFSBLOCK &&
+                       bm_cursor->level[level - 1].right_fsbno != NULLFSBLOCK) {
                do_warn(
-_("bad fwd (right) sibling pointer (saw %" PRIu64 " should be NULLDFSBNO)\n"
+_("bad fwd (right) sibling pointer (saw %" PRIu64 " should be NULLFSBLOCK)\n"
   "\tin inode %" PRIu64 " (%s fork) bmap btree block %" PRIu64 "\n"),
                        bm_cursor->level[level - 1].right_fsbno,
                        ino, forkname, bm_cursor->level[level - 1].fsbno);
index 92593e9faa2e1210f60c95a98ea5aa4dcd90dc1d..ea8c0bf254a8f960e455e61e81394fbd9d93e134 100644 (file)
 struct blkmap;
 
 int scan_lbtree(
-       xfs_dfsbno_t    root,
+       xfs_fsblock_t   root,
        int             nlevels,
        int             (*func)(struct xfs_btree_block  *block,
                                int                     level,
                                int                     type,
                                int                     whichfork,
-                               xfs_dfsbno_t            bno,
+                               xfs_fsblock_t           bno,
                                xfs_ino_t               ino,
-                               xfs_drfsbno_t           *tot,
+                               xfs_rfsblock_t          *tot,
                                __uint64_t              *nex,
                                struct blkmap           **blkmapp,
                                bmap_cursor_t           *bm_cursor,
@@ -40,7 +40,7 @@ int scan_lbtree(
        int             type,
        int             whichfork,
        xfs_ino_t       ino,
-       xfs_drfsbno_t   *tot,
+       xfs_rfsblock_t  *tot,
        __uint64_t      *nex,
        struct blkmap   **blkmapp,
        bmap_cursor_t   *bm_cursor,
@@ -54,9 +54,9 @@ int scan_bmapbt(
        int                     level,
        int                     type,
        int                     whichfork,
-       xfs_dfsbno_t            bno,
+       xfs_fsblock_t           bno,
        xfs_ino_t               ino,
-       xfs_drfsbno_t           *tot,
+       xfs_rfsblock_t          *tot,
        __uint64_t              *nex,
        struct blkmap           **blkmapp,
        bmap_cursor_t           *bm_cursor,