Merge ../linus
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_bmap_btree.h
index ff0102d14918b82ab29773769794ca2dcc3e64d5..6478cfa0e5395054e35b6c9f75c686f7d6010ad2 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2000,2002-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * 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 version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
  * published by the Free Software Foundation.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.         Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * 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_BMAP_BTREE_H__
 #define __XFS_BMAP_BTREE_H__
@@ -42,10 +28,9 @@ struct xfs_inode;
 /*
  * Bmap root header, on-disk form only.
  */
-typedef struct xfs_bmdr_block
-{
-       __uint16_t      bb_level;       /* 0 is a leaf */
-       __uint16_t      bb_numrecs;     /* current # of data records */
+typedef struct xfs_bmdr_block {
+       __be16          bb_level;       /* 0 is a leaf */
+       __be16          bb_numrecs;     /* current # of data records */
 } xfs_bmdr_block_t;
 
 /*
@@ -226,36 +211,36 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
 
 #define XFS_BMAP_REC_DADDR(bb,i,cur)   \
        (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 #define XFS_BMAP_REC_IADDR(bb,i,cur)   \
        (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 
 #define XFS_BMAP_KEY_DADDR(bb,i,cur)   \
        (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 #define XFS_BMAP_KEY_IADDR(bb,i,cur)   \
        (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 
 #define XFS_BMAP_PTR_DADDR(bb,i,cur)   \
        (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 #define XFS_BMAP_PTR_IADDR(bb,i,cur)   \
        (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE(                       \
-                       INT_GET((bb)->bb_level, ARCH_CONVERT), cur),    \
+                       be16_to_cpu((bb)->bb_level), cur),              \
                        xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS(       \
-                               INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+                               be16_to_cpu((bb)->bb_level), cur)))
 
 /*
  * These are to be used when we know the size of the block and
@@ -268,7 +253,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
 #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
        (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
 
-#define XFS_BMAP_BROOT_NUMRECS(bb)     INT_GET((bb)->bb_numrecs, ARCH_CONVERT)
+#define XFS_BMAP_BROOT_NUMRECS(bb)     be16_to_cpu((bb)->bb_numrecs)
 #define XFS_BMAP_BROOT_MAXRECS(sz)     XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
 
 #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
@@ -276,7 +261,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
               ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
 
 #define XFS_BMAP_BROOT_SPACE(bb) \
-       (XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)))
+       (XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
 #define XFS_BMDR_SPACE_CALC(nrecs) \
        (int)(sizeof(xfs_bmdr_block_t) + \
               ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
@@ -287,11 +272,10 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
 #define XFS_BM_MAXLEVELS(mp,w)         ((mp)->m_bm_maxlevels[(w)])
 
 #define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
-       (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \
-        INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \
-        INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \
-        INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= \
-                        (mp)->m_bmap_dmxr[(level) != 0])
+       (be32_to_cpu((bb)->bb_magic) == XFS_BMAP_MAGIC && \
+        be16_to_cpu((bb)->bb_level) == level && \
+        be16_to_cpu((bb)->bb_numrecs) > 0 && \
+        be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0])
 
 
 #ifdef __KERNEL__
@@ -388,14 +372,6 @@ extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *,
                                xfs_exntst_t *, int *);
 #endif
 
-/*
- * Search an extent list for the extent which includes block
- * bno.
- */
-xfs_bmbt_rec_t *xfs_bmap_do_search_extents(xfs_bmbt_rec_t *,
-                       xfs_extnum_t, xfs_extnum_t, xfs_fileoff_t, int *,
-                       xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
-
 #endif /* __KERNEL__ */
 
 #endif /* __XFS_BMAP_BTREE_H__ */