/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_SUPPORT_ARCH_H__
/* do we need conversion? */
#define ARCH_NOCONVERT 1
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
#define ARCH_CONVERT 0
#else
#define ARCH_CONVERT ARCH_NOCONVERT
#define INT_SWAP_UNALIGNED_32(from,to) \
{ \
- ((__u8*)(to))[0] = ((__u8*)(from))[3]; \
- ((__u8*)(to))[1] = ((__u8*)(from))[2]; \
- ((__u8*)(to))[2] = ((__u8*)(from))[1]; \
- ((__u8*)(to))[3] = ((__u8*)(from))[0]; \
+ ((__u8*)(to))[0] = ((__u8*)(from))[3]; \
+ ((__u8*)(to))[1] = ((__u8*)(from))[2]; \
+ ((__u8*)(to))[2] = ((__u8*)(from))[1]; \
+ ((__u8*)(to))[3] = ((__u8*)(from))[0]; \
}
#define INT_SWAP_UNALIGNED_64(from,to) \
{ \
- INT_SWAP_UNALIGNED_32( ((__u8*)(from)) + 4, ((__u8*)(to))); \
- INT_SWAP_UNALIGNED_32( ((__u8*)(from)), ((__u8*)(to)) + 4); \
+ INT_SWAP_UNALIGNED_32( ((__u8*)(from)) + 4, ((__u8*)(to))); \
+ INT_SWAP_UNALIGNED_32( ((__u8*)(from)), ((__u8*)(to)) + 4); \
}
-/*
+/*
* get and set integers from potentially unaligned locations
*/
-
+
#define INT_GET_UNALIGNED_16_LE(pointer) \
- ((__u16)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 )))
+ ((__u16)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 )))
#define INT_GET_UNALIGNED_16_BE(pointer) \
((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1])))
#define INT_SET_UNALIGNED_16_LE(pointer,value) \
{ \
- ((__u8*)(pointer))[0] = (((value) ) & 0xff); \
- ((__u8*)(pointer))[1] = (((value) >> 8) & 0xff); \
+ ((__u8*)(pointer))[0] = (((value) ) & 0xff); \
+ ((__u8*)(pointer))[1] = (((value) >> 8) & 0xff); \
}
#define INT_SET_UNALIGNED_16_BE(pointer,value) \
{ \
- ((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \
- ((__u8*)(pointer))[1] = (((value) ) & 0xff); \
+ ((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \
+ ((__u8*)(pointer))[1] = (((value) ) & 0xff); \
}
-
+
#define INT_GET_UNALIGNED_32_LE(pointer) \
- ((__u32)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ) \
- |(((__u8*)(pointer))[2] << 16) | (((__u8*)(pointer))[3] << 24)))
+ ((__u32)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ) \
+ |(((__u8*)(pointer))[2] << 16) | (((__u8*)(pointer))[3] << 24)))
#define INT_GET_UNALIGNED_32_BE(pointer) \
((__u32)((((__u8*)(pointer))[0] << 24) | (((__u8*)(pointer))[1] << 16) \
- |(((__u8*)(pointer))[2] << 8) | (((__u8*)(pointer))[3] )))
-
+ |(((__u8*)(pointer))[2] << 8) | (((__u8*)(pointer))[3] )))
+
#define INT_GET_UNALIGNED_64_LE(pointer) \
(((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer))+4)) << 32 ) \
- |((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer)) )) ))
+ |((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer)) )) ))
#define INT_GET_UNALIGNED_64_BE(pointer) \
- (((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer)) )) << 32 ) \
- |((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer))+4)) ))
-
+ (((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer)) )) << 32 ) \
+ |((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer))+4)) ))
+
/*
* now pick the right ones for our MACHINE ARCHITECTURE
*/
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_LE(pointer)
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_LE(pointer)
#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_LE(pointer,value)
-#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_LE(pointer)
-#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_LE(pointer)
+#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_LE(pointer)
+#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_LE(pointer)
#else
-#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_BE(pointer)
+#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_BE(pointer)
#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_BE(pointer,value)
-#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_BE(pointer)
-#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_BE(pointer)
+#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_BE(pointer)
+#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_BE(pointer)
#endif
/* define generic INT_ macros */
#define INT_GET(reference,arch) \
(((arch) == ARCH_NOCONVERT) \
- ? \
- (reference) \
- : \
- INT_SWAP((reference),(reference)) \
+ ? \
+ (reference) \
+ : \
+ INT_SWAP((reference),(reference)) \
)
-/* does not return a value */
+/* does not return a value */
#define INT_SET(reference,arch,valueref) \
(__builtin_constant_p(valueref) ? \
(void)( (reference) = ( ((arch) != ARCH_NOCONVERT) ? (INT_SWAP((reference),(valueref))) : (valueref)) ) : \
) \
)
-/* does not return a value */
+/* does not return a value */
#define INT_MOD_EXPR(reference,arch,code) \
(void)(((arch) == ARCH_NOCONVERT) \
- ? \
- ((reference) code) \
- : \
- ( \
- (reference) = INT_GET((reference),arch) , \
- ((reference) code), \
- INT_SET(reference, arch, reference) \
- ) \
+ ? \
+ ((reference) code) \
+ : \
+ ( \
+ (reference) = INT_GET((reference),arch) , \
+ ((reference) code), \
+ INT_SET(reference, arch, reference) \
+ ) \
)
-
-/* does not return a value */
+
+/* does not return a value */
#define INT_MOD(reference,arch,delta) \
(void)( \
- INT_MOD_EXPR(reference,arch,+=(delta)) \
+ INT_MOD_EXPR(reference,arch,+=(delta)) \
)
-
+
/*
* INT_COPY - copy a value between two locations with the
- * _same architecture_ but _potentially different sizes_
+ * _same architecture_ but _potentially different sizes_
*
- * if the types of the two parameters are equal or they are
- * in native architecture, a simple copy is done
+ * if the types of the two parameters are equal or they are
+ * in native architecture, a simple copy is done
*
- * otherwise, architecture conversions are done
+ * otherwise, architecture conversions are done
*
*/
-
-/* does not return a value */
+
+/* does not return a value */
#define INT_COPY(dst,src,arch) \
(void)( \
- ((sizeof(dst) == sizeof(src)) || ((arch) == ARCH_NOCONVERT)) \
- ? \
- ((dst) = (src)) \
- : \
- INT_SET(dst, arch, INT_GET(src, arch)) \
+ ((sizeof(dst) == sizeof(src)) || ((arch) == ARCH_NOCONVERT)) \
+ ? \
+ ((dst) = (src)) \
+ : \
+ INT_SET(dst, arch, INT_GET(src, arch)) \
)
-
+
/*
- * INT_XLATE - copy a value in either direction between two locations
- * with different architectures
+ * INT_XLATE - copy a value in either direction between two locations
+ * with different architectures
*
- * dir < 0 - copy from memory to buffer (native to arch)
- * dir > 0 - copy from buffer to memory (arch to native)
+ * dir < 0 - copy from memory to buffer (native to arch)
+ * dir > 0 - copy from buffer to memory (arch to native)
*/
-
-/* does not return a value */
+
+/* does not return a value */
#define INT_XLATE(buf,mem,dir,arch) {\
ASSERT(dir); \
if (dir>0) { \
- (mem)=INT_GET(buf, arch); \
+ (mem)=INT_GET(buf, arch); \
} else { \
- INT_SET(buf, arch, mem); \
+ INT_SET(buf, arch, mem); \
} \
}
#define INT_ISZERO(reference,arch) \
((reference) == 0)
-
+
#define INT_ZERO(reference,arch) \
((reference) = 0)
-
+
#define INT_GET_UNALIGNED_16_ARCH(pointer,arch) \
( ((arch) == ARCH_NOCONVERT) \
- ? \
- (INT_GET_UNALIGNED_16(pointer)) \
- : \
- (INT_GET_UNALIGNED_16_BE(pointer)) \
+ ? \
+ (INT_GET_UNALIGNED_16(pointer)) \
+ : \
+ (INT_GET_UNALIGNED_16_BE(pointer)) \
)
#define INT_SET_UNALIGNED_16_ARCH(pointer,value,arch) \
if ((arch) == ARCH_NOCONVERT) { \
- INT_SET_UNALIGNED_16(pointer,value); \
+ INT_SET_UNALIGNED_16(pointer,value); \
} else { \
- INT_SET_UNALIGNED_16_BE(pointer,value); \
+ INT_SET_UNALIGNED_16_BE(pointer,value); \
}
#endif /* __XFS_SUPPORT_ARCH_H__ */
*
* 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
+ * 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.
typedef struct xfs_acl {
__int32_t acl_cnt;
- xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES];
+ xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES];
} xfs_acl_t;
/* On-disk XFS extended attribute names */
#define SGI_ACL_FILE "SGI_ACL_FILE"
-#define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT"
+#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)
#define _ACL_TYPE_ACCESS 1
#define _ACL_TYPE_DEFAULT 2
-#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
+#define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
#define _ACL_DECL(a) xfs_acl_t *(a) = NULL
#define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP))
#define _ACL_ZONE_DESTROY(z) (kmem_cache_destroy(z))
#define _ACL_INHERIT(c,v,d) (xfs_acl_inherit(c,v,d))
#define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
-#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
+#define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
#define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
#define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default
-#define _ACL_XFS_IACCESS(i,m,c) (XFS_IFORK_Q(i) ? xfs_acl_iaccess(i,m,c) : -1)
+#define _ACL_XFS_IACCESS(i,m,c) (XFS_IFORK_Q(i) ? xfs_acl_iaccess(i,m,c) : -1)
#define _ACL_SET_IFLAG(inode) ((inode)->i_flags |= S_POSIXACL)
-#define _ACL_CLEAR_IFLAG(inode) ((inode)->i_flags &= ~S_POSIXACL)
+#define _ACL_CLEAR_IFLAG(inode) ((inode)->i_flags &= ~S_POSIXACL)
#else
#define xfs_acl_vset(v,p,sz,t) (-ENOTSUP)
#define _ACL_ZONE_DESTROY(z) ((void)0)
#define _ACL_INHERIT(c,v,d) (0)
#define _ACL_GET_ACCESS(pv,pa) (0)
-#define _ACL_GET_DEFAULT(pv,pd) (0)
+#define _ACL_GET_DEFAULT(pv,pd) (0)
#define _ACL_ACCESS_EXISTS (NULL)
#define _ACL_DEFAULT_EXISTS (NULL)
-#define _ACL_XFS_IACCESS(i,m,c) (-1)
+#define _ACL_XFS_IACCESS(i,m,c) (-1)
#define _ACL_SET_IFLAG(inode) do { } while (0)
-#define _ACL_CLEAR_IFLAG(inode) do { } while (0)
+#define _ACL_CLEAR_IFLAG(inode) do { } while (0)
#endif
#endif /* __KERNEL__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_AG_H__
-#define __XFS_AG_H__
+#define __XFS_AG_H__
/*
* Allocation group header
- * This is divided into three structures, placed in sequential 512-byte
+ * 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_mount;
struct xfs_trans;
-#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
-#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
-#define XFS_AGF_VERSION 1
-#define XFS_AGI_VERSION 1
+#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
+#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
+#define XFS_AGF_VERSION 1
+#define XFS_AGI_VERSION 1
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_GOOD_VERSION)
int xfs_agf_good_version(unsigned v);
-#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v)
+#define XFS_AGF_GOOD_VERSION(v) xfs_agf_good_version(v)
#else
#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_GOOD_VERSION)
int xfs_agi_good_version(unsigned v);
-#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v)
+#define XFS_AGI_GOOD_VERSION(v) xfs_agi_good_version(v)
#else
#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
#endif
* 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)
+#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1)
/*
* The second word of agf_levels in the first a.g. overlaps the EFS
* Common allocation group header information
*/
__uint32_t agf_magicnum; /* magic number == XFS_AGF_MAGIC */
- __uint32_t agf_versionnum; /* header version == XFS_AGF_VERSION */
+ __uint32_t agf_versionnum; /* header version == XFS_AGF_VERSION */
xfs_agnumber_t agf_seqno; /* sequence # starting from 0 */
xfs_agblock_t agf_length; /* size in blocks of a.g. */
/*
xfs_extlen_t agf_longest; /* longest free space */
} xfs_agf_t;
-#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_NUM_BITS 11
-#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
+#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_NUM_BITS 11
+#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGF_DADDR ((xfs_daddr_t)1)
+#define XFS_AGF_DADDR ((xfs_daddr_t)1)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGF_BLOCK)
xfs_agblock_t xfs_agf_block(struct xfs_mount *mp);
-#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp)
+#define XFS_AGF_BLOCK(mp) xfs_agf_block(mp)
#else
-#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR)
+#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR)
#endif
/*
* Size of the unlinked inode hash table in the agi.
*/
-#define XFS_AGI_UNLINKED_BUCKETS 64
+#define XFS_AGI_UNLINKED_BUCKETS 64
typedef struct xfs_agi
{
* Common allocation group header information
*/
__uint32_t agi_magicnum; /* magic number == XFS_AGI_MAGIC */
- __uint32_t agi_versionnum; /* header version == XFS_AGI_VERSION */
+ __uint32_t agi_versionnum; /* header version == XFS_AGI_VERSION */
xfs_agnumber_t agi_seqno; /* sequence # starting from 0 */
xfs_agblock_t agi_length; /* size in blocks of a.g. */
/*
xfs_agino_t agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
} xfs_agi_t;
-#define XFS_AGI_MAGICNUM 0x00000001
-#define XFS_AGI_VERSIONNUM 0x00000002
-#define XFS_AGI_SEQNO 0x00000004
-#define XFS_AGI_LENGTH 0x00000008
-#define XFS_AGI_COUNT 0x00000010
-#define XFS_AGI_ROOT 0x00000020
-#define XFS_AGI_LEVEL 0x00000040
-#define XFS_AGI_FREECOUNT 0x00000080
-#define XFS_AGI_NEWINO 0x00000100
-#define XFS_AGI_DIRINO 0x00000200
-#define XFS_AGI_UNLINKED 0x00000400
-#define XFS_AGI_NUM_BITS 11
-#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1)
+#define XFS_AGI_MAGICNUM 0x00000001
+#define XFS_AGI_VERSIONNUM 0x00000002
+#define XFS_AGI_SEQNO 0x00000004
+#define XFS_AGI_LENGTH 0x00000008
+#define XFS_AGI_COUNT 0x00000010
+#define XFS_AGI_ROOT 0x00000020
+#define XFS_AGI_LEVEL 0x00000040
+#define XFS_AGI_FREECOUNT 0x00000080
+#define XFS_AGI_NEWINO 0x00000100
+#define XFS_AGI_DIRINO 0x00000200
+#define XFS_AGI_UNLINKED 0x00000400
+#define XFS_AGI_NUM_BITS 11
+#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1)
/* disk block (xfs_daddr_t) in the AG */
-#define XFS_AGI_DADDR ((xfs_daddr_t)2)
+#define XFS_AGI_DADDR ((xfs_daddr_t)2)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGI_BLOCK)
xfs_agblock_t xfs_agi_block(struct xfs_mount *mp);
-#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp)
+#define XFS_AGI_BLOCK(mp) xfs_agi_block(mp)
#else
-#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR)
+#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR)
#endif
/*
- * The third a.g. block contains the a.g. freelist, an array
+ * 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 ((xfs_daddr_t)3)
+#define XFS_AGFL_DADDR ((xfs_daddr_t)3)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGFL_BLOCK)
xfs_agblock_t xfs_agfl_block(struct xfs_mount *mp);
-#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp)
+#define XFS_AGFL_BLOCK(mp) xfs_agfl_block(mp)
#else
-#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR)
+#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR)
#endif
-#define XFS_AGFL_SIZE (BBSIZE / sizeof(xfs_agblock_t))
-typedef struct xfs_agfl
+#define XFS_AGFL_SIZE (BBSIZE / sizeof(xfs_agblock_t))
+typedef struct xfs_agfl
{
xfs_agblock_t agfl_bno[XFS_AGFL_SIZE];
} xfs_agfl_t;
__uint32_t pagf_flcount; /* count of blocks in freelist */
xfs_extlen_t pagf_freeblks; /* total free blocks */
xfs_extlen_t pagf_longest; /* longest free space */
- xfs_agino_t pagi_freecount; /* number of free inodes */
+ xfs_agino_t pagi_freecount; /* number of free inodes */
#ifdef __KERNEL__
lock_t pagb_lock; /* lock for pagb_list */
#endif
xfs_perag_busy_t *pagb_list; /* unstable blocks */
} xfs_perag_t;
-#define XFS_AG_MIN_BYTES (1LL << 24) /* 16 MB */
-#define XFS_AG_BEST_BYTES (1LL << 30) /* 1 GB */
-#define XFS_AG_MAX_BYTES (1LL << 32) /* 4 GB */
+#define XFS_AG_MIN_BYTES (1LL << 24) /* 16 MB */
+#define XFS_AG_BEST_BYTES (1LL << 30) /* 1 GB */
+#define XFS_AG_MAX_BYTES (1LL << 32) /* 4 GB */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MIN_BLOCKS)
xfs_extlen_t xfs_ag_min_blocks(int bl);
-#define XFS_AG_MIN_BLOCKS(bl) xfs_ag_min_blocks(bl)
+#define XFS_AG_MIN_BLOCKS(bl) xfs_ag_min_blocks(bl)
#else
-#define XFS_AG_MIN_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MIN_BYTES >> bl))
+#define XFS_AG_MIN_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MIN_BYTES >> bl))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_BEST_BLOCKS)
xfs_extlen_t xfs_ag_best_blocks(int bl, xfs_drfsbno_t blks);
-#define XFS_AG_BEST_BLOCKS(bl,blks) xfs_ag_best_blocks(bl,blks)
+#define XFS_AG_BEST_BLOCKS(bl,blks) xfs_ag_best_blocks(bl,blks)
#else
/*--#define XFS_AG_BEST_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl))*/
/*
* Best is XFS_AG_BEST_BLOCKS at and below 64 Gigabyte filesystems, and
* XFS_AG_MAX_BLOCKS above 64 Gigabytes.
*/
-#define XFS_AG_BEST_BLOCKS(bl,blks) ((xfs_extlen_t)((1LL << (36 - bl)) >= \
+#define XFS_AG_BEST_BLOCKS(bl,blks) ((xfs_extlen_t)((1LL << (36 - bl)) >= \
blks) ? \
((xfs_extlen_t)(XFS_AG_BEST_BYTES >> bl)) : \
XFS_AG_MAX_BLOCKS(bl))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAX_BLOCKS)
xfs_extlen_t xfs_ag_max_blocks(int bl);
-#define XFS_AG_MAX_BLOCKS(bl) xfs_ag_max_blocks(bl)
+#define XFS_AG_MAX_BLOCKS(bl) xfs_ag_max_blocks(bl)
#else
-#define XFS_AG_MAX_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MAX_BYTES >> bl))
+#define XFS_AG_MAX_BLOCKS(bl) ((xfs_extlen_t)(XFS_AG_MAX_BYTES >> bl))
#endif
-#define XFS_MAX_AGNUMBER ((xfs_agnumber_t)(NULLAGNUMBER - 1))
+#define XFS_MAX_AGNUMBER ((xfs_agnumber_t)(NULLAGNUMBER - 1))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_MAXLEVELS)
int xfs_ag_maxlevels(struct xfs_mount *mp);
-#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp)
+#define XFS_AG_MAXLEVELS(mp) xfs_ag_maxlevels(mp)
#else
-#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
+#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST)
int xfs_min_freelist(xfs_agf_t *a, struct xfs_mount *mp);
-#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp)
+#define XFS_MIN_FREELIST(a,mp) xfs_min_freelist(a,mp)
#else
-#define XFS_MIN_FREELIST(a,mp) \
+#define XFS_MIN_FREELIST(a,mp) \
XFS_MIN_FREELIST_RAW( \
INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \
INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_PAG)
int xfs_min_freelist_pag(xfs_perag_t *pag, struct xfs_mount *mp);
-#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp)
+#define XFS_MIN_FREELIST_PAG(pag,mp) xfs_min_freelist_pag(pag,mp)
#else
-#define XFS_MIN_FREELIST_PAG(pag,mp) \
+#define XFS_MIN_FREELIST_PAG(pag,mp) \
XFS_MIN_FREELIST_RAW((uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MIN_FREELIST_RAW)
int xfs_min_freelist_raw(int bl, int cl, struct xfs_mount *mp);
-#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp)
+#define XFS_MIN_FREELIST_RAW(bl,cl,mp) xfs_min_freelist_raw(bl,cl,mp)
#else
-#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
+#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
(MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + \
MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
#endif
xfs_agblock_t agbno);
#define XFS_AGB_TO_FSB(mp,agno,agbno) xfs_agb_to_fsb(mp,agno,agbno)
#else
-#define XFS_AGB_TO_FSB(mp,agno,agbno) \
+#define XFS_AGB_TO_FSB(mp,agno,agbno) \
(((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGNO)
xfs_agnumber_t xfs_fsb_to_agno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
-#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno)
+#define XFS_FSB_TO_AGNO(mp,fsbno) xfs_fsb_to_agno(mp,fsbno)
#else
-#define XFS_FSB_TO_AGNO(mp,fsbno) \
+#define XFS_FSB_TO_AGNO(mp,fsbno) \
((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_AGBNO)
xfs_agblock_t xfs_fsb_to_agbno(struct xfs_mount *mp, xfs_fsblock_t fsbno);
-#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno)
+#define XFS_FSB_TO_AGBNO(mp,fsbno) xfs_fsb_to_agbno(mp,fsbno)
#else
-#define XFS_FSB_TO_AGBNO(mp,fsbno) \
+#define XFS_FSB_TO_AGBNO(mp,fsbno) \
((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGB_TO_DADDR)
xfs_daddr_t xfs_agb_to_daddr(struct xfs_mount *mp, xfs_agnumber_t agno,
xfs_agblock_t agbno);
-#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno)
+#define XFS_AGB_TO_DADDR(mp,agno,agbno) xfs_agb_to_daddr(mp,agno,agbno)
#else
-#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
+#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))))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_DADDR)
xfs_daddr_t xfs_ag_daddr(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_daddr_t d);
-#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d)
+#define XFS_AG_DADDR(mp,agno,d) xfs_ag_daddr(mp,agno,d)
#else
-#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
+#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGF)
xfs_agf_t *xfs_buf_to_agf(struct xfs_buf *bp);
-#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp)
+#define XFS_BUF_TO_AGF(bp) xfs_buf_to_agf(bp)
#else
-#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
+#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGI)
xfs_agi_t *xfs_buf_to_agi(struct xfs_buf *bp);
-#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp)
+#define XFS_BUF_TO_AGI(bp) xfs_buf_to_agi(bp)
#else
-#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
+#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_AGFL)
xfs_agfl_t *xfs_buf_to_agfl(struct xfs_buf *bp);
-#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp)
+#define XFS_BUF_TO_AGFL(bp) xfs_buf_to_agfl(bp)
#else
-#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
+#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
#endif
/*
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AG_CHECK_DADDR)
void xfs_ag_check_daddr(struct xfs_mount *mp, xfs_daddr_t d, xfs_extlen_t len);
-#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len)
+#define XFS_AG_CHECK_DADDR(mp,d,len) xfs_ag_check_daddr(mp,d,len)
#else
-#define XFS_AG_CHECK_DADDR(mp,d,len) \
+#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)))
+ XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1)))
#endif
#endif /* __XFS_AG_H__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_ALLOC_H__
-#define __XFS_ALLOC_H__
+#define __XFS_ALLOC_H__
struct xfs_buf;
struct xfs_mount;
struct xfs_trans;
/*
- * Freespace allocation types. Argument to xfs_alloc_[v]extent.
+ * Freespace allocation types. Argument to xfs_alloc_[v]extent.
*/
typedef enum xfs_alloctype
{
/*
* Flags for xfs_alloc_fix_freelist.
*/
-#define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */
+#define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffer locking */
/*
* Argument structure for xfs_alloc routines.
xfs_extlen_t alignment; /* align answer to multiple of this */
xfs_extlen_t minalignslop; /* slop for minlen+alignment calcs */
xfs_extlen_t len; /* output: actual size of extent */
- xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */
- xfs_alloctype_t otype; /* original allocation type */
+ xfs_alloctype_t type; /* allocation type XFS_ALLOCTYPE_... */
+ xfs_alloctype_t otype; /* original allocation type */
char wasdel; /* set if allocation was prev delayed */
char wasfromfl; /* set if allocation is from freelist */
char isfl; /* set if is freelist blocks - !actg */
/*
* Types for alloc tracing.
*/
-#define XFS_ALLOC_KTRACE_ALLOC 1
-#define XFS_ALLOC_KTRACE_FREE 2
-#define XFS_ALLOC_KTRACE_MODAGF 3
-#define XFS_ALLOC_KTRACE_BUSY 4
-#define XFS_ALLOC_KTRACE_UNBUSY 5
-#define XFS_ALLOC_KTRACE_BUSYSEARCH 6
+#define XFS_ALLOC_KTRACE_ALLOC 1
+#define XFS_ALLOC_KTRACE_FREE 2
+#define XFS_ALLOC_KTRACE_MODAGF 3
+#define XFS_ALLOC_KTRACE_BUSY 4
+#define XFS_ALLOC_KTRACE_UNBUSY 5
+#define XFS_ALLOC_KTRACE_BUSYSEARCH 6
/*
* Allocation tracing buffer size.
*/
-#define XFS_ALLOC_TRACE_SIZE 4096
+#define XFS_ALLOC_TRACE_SIZE 4096
#ifdef XFS_ALL_TRACE
-#define XFS_ALLOC_TRACE
+#define XFS_ALLOC_TRACE
#endif
#if !defined(DEBUG)
*/
int /* error */
xfs_alloc_fix_freelist(
- xfs_alloc_arg_t *args, /* allocation argument structure */
- int flags); /* XFS_ALLOC_FLAG_... */
+ xfs_alloc_arg_t *args, /* allocation argument structure */
+ int flags); /* XFS_ALLOC_FLAG_... */
/*
* Get a block from the freelist.
xfs_alloc_get_freelist(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_buf *agbp, /* buffer containing the agf structure */
- xfs_agblock_t *bnop); /* block address retrieved from freelist */
+ xfs_agblock_t *bnop); /* block address retrieved from freelist */
/*
* Log the given fields from the agf structure.
struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */
- int flags); /* XFS_ALLOC_FLAGS_... */
+ int flags); /* XFS_ALLOC_FLAGS_... */
/*
* Put the block on the freelist for the allocation group.
*/
int /* error */
xfs_alloc_vextent(
- xfs_alloc_arg_t *args); /* allocation argument structure */
+ xfs_alloc_arg_t *args); /* allocation argument structure */
/*
* Free an extent.
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_ALLOC_BTREE_H__
-#define __XFS_ALLOC_BTREE_H__
+#define __XFS_ALLOC_BTREE_H__
/*
* Freespace on-disk structures
* by blockcount and blockno. All blocks look the same to make the code
* simpler; if we have time later, we'll make the optimizations.
*/
-#define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */
-#define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */
+#define XFS_ABTB_MAGIC 0x41425442 /* 'ABTB' for bno tree */
+#define XFS_ABTC_MAGIC 0x41425443 /* 'ABTC' for cnt tree */
/*
* Data record/key structure
typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */
/* btree block header type */
-typedef struct xfs_btree_sblock xfs_alloc_block_t;
+typedef struct xfs_btree_sblock xfs_alloc_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_ALLOC_BLOCK)
xfs_alloc_block_t *xfs_buf_to_alloc_block(struct xfs_buf *bp);
-#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp)
+#define XFS_BUF_TO_ALLOC_BLOCK(bp) xfs_buf_to_alloc_block(bp)
#else
-#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)(XFS_BUF_PTR(bp)))
#endif
/*
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_SIZE)
int xfs_alloc_block_size(int lev, struct xfs_btree_cur *cur);
-#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur)
+#define XFS_ALLOC_BLOCK_SIZE(lev,cur) xfs_alloc_block_size(lev,cur)
#else
-#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
+#define XFS_ALLOC_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MAXRECS)
int xfs_alloc_block_maxrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur)
+#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) xfs_alloc_block_maxrecs(lev,cur)
#else
-#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \
+#define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mxr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_BLOCK_MINRECS)
int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur)
+#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) xfs_alloc_block_minrecs(lev,cur)
#else
-#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \
+#define XFS_ALLOC_BLOCK_MINRECS(lev,cur) \
((cur)->bc_mp->m_alloc_mnr[lev != 0])
#endif
* Minimum and maximum blocksize.
* The blocksize upper limit is pretty much arbitrary.
*/
-#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
-#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
-#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
-#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
+#define XFS_MIN_BLOCKSIZE_LOG 9 /* i.e. 512 bytes */
+#define XFS_MAX_BLOCKSIZE_LOG 16 /* i.e. 65536 bytes */
+#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
+#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
/*
* block numbers in the AG; SB is BB 0, AGF is BB 1, AGI is BB 2, AGFL is BB 3
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
xfs_agblock_t xfs_bno_block(struct xfs_mount *mp);
-#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp)
+#define XFS_BNO_BLOCK(mp) xfs_bno_block(mp)
#else
-#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1))
+#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp) + 1))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CNT_BLOCK)
xfs_agblock_t xfs_cnt_block(struct xfs_mount *mp);
-#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp)
+#define XFS_CNT_BLOCK(mp) xfs_cnt_block(mp)
#else
-#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1))
+#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1))
#endif
/*
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_REC_ADDR)
xfs_alloc_rec_t *xfs_alloc_rec_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
-#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur)
+#define XFS_ALLOC_REC_ADDR(bb,i,cur) xfs_alloc_rec_addr(bb,i,cur)
#else
-#define XFS_ALLOC_REC_ADDR(bb,i,cur) \
+#define XFS_ALLOC_REC_ADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_ALLOC_BLOCK_SIZE(0,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(0, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_KEY_ADDR)
xfs_alloc_key_t *xfs_alloc_key_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
-#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur)
+#define XFS_ALLOC_KEY_ADDR(bb,i,cur) xfs_alloc_key_addr(bb,i,cur)
#else
-#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \
+#define XFS_ALLOC_KEY_ADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ALLOC_PTR_ADDR)
xfs_alloc_ptr_t *xfs_alloc_ptr_addr(xfs_alloc_block_t *bb, int i,
struct xfs_btree_cur *cur);
-#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur)
+#define XFS_ALLOC_PTR_ADDR(bb,i,cur) xfs_alloc_ptr_addr(bb,i,cur)
#else
-#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
+#define XFS_ALLOC_PTR_ADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_ALLOC_BLOCK_SIZE(1,cur), xfs_alloc, bb, i, \
XFS_ALLOC_BLOCK_MAXRECS(1, cur))
#endif
xfs_alloc_decrement(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Delete the record pointed to by cur.
int /* error */
xfs_alloc_delete(
struct xfs_btree_cur *cur, /* btree cursor */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Get the data from the pointed-to record.
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t *bno, /* output: starting block of extent */
xfs_extlen_t *len, /* output: length of extent */
- int *stat); /* output: success/failure */
+ int *stat); /* output: success/failure */
/*
* Increment cursor by one record at the level.
xfs_alloc_increment(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Insert the current record at the point referenced by cur.
int /* error */
xfs_alloc_insert(
struct xfs_btree_cur *cur, /* btree cursor */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the record equal to [bno, len] in the btree given by cur.
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the first record greater than or equal to [bno, len]
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the first record less than or equal to [bno, len]
struct xfs_btree_cur *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
- int *stat); /* success/failure */
-
+ int *stat); /* success/failure */
+
/*
* Update the record referred to by cur, to the value given by [bno, len].
* This either works (return 0) or gets an EFSCORRUPTED error.
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_ARCH_H__
#ifndef XFS_BIG_FILESYSTEMS
#error XFS_BIG_FILESYSTEMS must be defined true or false
#endif
-
+
#define DIRINO4_GET_ARCH(pointer,arch) \
( ((arch) == ARCH_NOCONVERT) \
- ? \
- (INT_GET_UNALIGNED_32(pointer)) \
- : \
- (INT_GET_UNALIGNED_32_BE(pointer)) \
+ ? \
+ (INT_GET_UNALIGNED_32(pointer)) \
+ : \
+ (INT_GET_UNALIGNED_32_BE(pointer)) \
)
-
+
#if XFS_BIG_FILESYSTEMS
#define DIRINO_GET_ARCH(pointer,arch) \
( ((arch) == ARCH_NOCONVERT) \
- ? \
- (INT_GET_UNALIGNED_64(pointer)) \
- : \
- (INT_GET_UNALIGNED_64_BE(pointer)) \
+ ? \
+ (INT_GET_UNALIGNED_64(pointer)) \
+ : \
+ (INT_GET_UNALIGNED_64_BE(pointer)) \
)
#else
/* MACHINE ARCHITECTURE dependent */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
#define DIRINO_GET_ARCH(pointer,arch) \
DIRINO4_GET_ARCH((((__u8*)pointer)+4),arch)
#else
#define DIRINO_GET_ARCH(pointer,arch) \
DIRINO4_GET_ARCH(pointer,arch)
#endif
-#endif
+#endif
#define DIRINO_COPY_ARCH(from,to,arch) \
if ((arch) == ARCH_NOCONVERT) { \
- bcopy(from,to,sizeof(xfs_ino_t)); \
+ bcopy(from,to,sizeof(xfs_ino_t)); \
} else { \
- INT_SWAP_UNALIGNED_64(from,to); \
+ INT_SWAP_UNALIGNED_64(from,to); \
}
#define DIRINO4_COPY_ARCH(from,to,arch) \
if ((arch) == ARCH_NOCONVERT) { \
- bcopy((((__u8*)from+4)),to,sizeof(xfs_dir2_ino4_t)); \
+ bcopy((((__u8*)from+4)),to,sizeof(xfs_dir2_ino4_t)); \
} else { \
- INT_SWAP_UNALIGNED_32(from,to); \
+ INT_SWAP_UNALIGNED_32(from,to); \
}
#endif /* __XFS_ARCH_H__ */
/*
* Copyright (c) 2000, 2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_ATTR_LEAF_H__
-#define __XFS_ATTR_LEAF_H__
+#define __XFS_ATTR_LEAF_H__
/*
* Attribute storage layout, internal structure, access macros, etc.
* Attribute lists are structured around Btrees where all the data
* elements are in the leaf nodes. Attribute names are hashed into an int,
* then that int is used as the index into the Btree. Since the hashval
- * of an attribute name may not be unique, we may have duplicate keys. The
+ * of an attribute name may not be unique, we may have duplicate keys. The
* internal links in the Btree are logical block offsets into the file.
*/
/*
* This is the structure of the leaf nodes in the Btree.
*
- * Struct leaf_entry's are packed from the top. Name/values grow from the
+ * Struct leaf_entry's are packed from the top. Name/values grow from the
* bottom but are not packed. The freemap contains run-length-encoded entries
* for the free bytes after the leaf_entry's, but only the N largest such,
* smaller runs are dropped. When the freemap doesn't show enough space
* the leaf_entry. The namespaces are independent only because we also look
* at the root/user bit when we are looking for a matching attribute name.
*
- * We also store a "incomplete" bit in the leaf_entry. It shows that an
+ * We also store a "incomplete" bit in the leaf_entry. It shows that an
* attribute is in the middle of being created and should not be shown to
* the user if we crash during the time that the bit is set. We clear the
- * bit when we have finished setting up the attribute. We do this because
+ * bit when we have finished setting up the attribute. We do this because
* we cannot create some large attributes inside a single transaction, and we
* need some indication that we weren't finished if we crash in the middle.
*/
* NOTE: the INCOMPLETE bit must not collide with the flags bits specified
* on the system call, they are "or"ed together for various operations.
*/
-#define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */
-#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */
-#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
+#define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */
+#define XFS_ATTR_ROOT_BIT 1 /* limit access to attr to userid 0 */
+#define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/delete */
#define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT)
#define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT)
#define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT)
* Alignment for namelist and valuelist entries (since they are mixed
* there can be only one alignment value)
*/
-#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t))
+#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t))
/*
* Cast typed pointers for "local" and "remote" name/value structs.
typedef struct xfs_attr_list_context {
struct xfs_inode *dp; /* inode */
struct attrlist_cursor_kern *cursor;/* position in list */
- struct attrlist *alist; /* output buffer */
+ struct attrlist *alist; /* output buffer */
int count; /* num used entries */
- int dupcnt; /* count dup hashvals seen */
+ int dupcnt; /* count dup hashvals seen */
int bufsize;/* total buffer size */
- int firstu; /* first used byte in buffer */
+ int firstu; /* first used byte in buffer */
int flags; /* from VOP call */
int resynch;/* T/F: resynch with cursor */
} xfs_attr_list_context_t;
/*
* Copyright (c) 2000, 2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_ATTR_SF_H__
-#define __XFS_ATTR_SF_H__
+#define __XFS_ATTR_SF_H__
/*
* Attribute storage when stored inside the inode.
#endif
#ifdef XFS_ALL_TRACE
-#define XFS_ATTR_TRACE
+#define XFS_ATTR_TRACE
#endif
#if !defined(DEBUG)
struct xfs_da_node_entry;
struct xfs_attr_leafblock;
-#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */
+#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */
/*
* Trace record types.
*/
-#define XFS_ATTR_KTRACE_L_C 1 /* context */
-#define XFS_ATTR_KTRACE_L_CN 2 /* context, node */
-#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
-#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
+#define XFS_ATTR_KTRACE_L_C 1 /* context */
+#define XFS_ATTR_KTRACE_L_CN 2 /* context, node */
+#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
+#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
#if defined(XFS_ATTR_TRACE)
__psunsigned_t a12, __psunsigned_t a13,
__psunsigned_t a14, __psunsigned_t a15);
#else
-#define xfs_attr_trace_l_c(w,c)
-#define xfs_attr_trace_l_cn(w,c,n)
-#define xfs_attr_trace_l_cb(w,c,b)
-#define xfs_attr_trace_l_cl(w,c,l)
+#define xfs_attr_trace_l_c(w,c)
+#define xfs_attr_trace_l_cn(w,c,n)
+#define xfs_attr_trace_l_cb(w,c,b)
+#define xfs_attr_trace_l_cl(w,c,l)
#endif /* XFS_ATTR_TRACE */
#endif /* __XFS_ATTR_SF_H__ */
/*
* Copyright (c) 2000, 2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_BIT_H__
-#define __XFS_BIT_H__
+#define __XFS_BIT_H__
/*
* XFS bit manipulation routines.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32HI)
__uint32_t xfs_mask32hi(int n);
-#define XFS_MASK32HI(n) xfs_mask32hi(n)
+#define XFS_MASK32HI(n) xfs_mask32hi(n)
#else
-#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n)))
+#define XFS_MASK32HI(n) ((__uint32_t)-1 << (32 - (n)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64HI)
__uint64_t xfs_mask64hi(int n);
-#define XFS_MASK64HI(n) xfs_mask64hi(n)
+#define XFS_MASK64HI(n) xfs_mask64hi(n)
#else
-#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n)))
+#define XFS_MASK64HI(n) ((__uint64_t)-1 << (64 - (n)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK32LO)
__uint32_t xfs_mask32lo(int n);
-#define XFS_MASK32LO(n) xfs_mask32lo(n)
+#define XFS_MASK32LO(n) xfs_mask32lo(n)
#else
-#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1)
+#define XFS_MASK32LO(n) (((__uint32_t)1 << (n)) - 1)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MASK64LO)
__uint64_t xfs_mask64lo(int n);
-#define XFS_MASK64LO(n) xfs_mask64lo(n)
+#define XFS_MASK64LO(n) xfs_mask64lo(n)
#else
-#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1)
+#define XFS_MASK64LO(n) (((__uint64_t)1 << (n)) - 1)
#endif
/* Get high bit set out of 32-bit argument, -1 if none set */
/* Get high bit set out of 64-bit argument, -1 if none set */
extern int xfs_highbit64(__uint64_t);
-/* Count set bits in map starting with start_bit */
+/* Count set bits in map starting with start_bit */
extern int xfs_count_bits(uint *map, uint size, uint start_bit);
/* Count continuous one bits in map starting with start_bit */
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_BMAP_H__
-#define __XFS_BMAP_H__
+#define __XFS_BMAP_H__
struct getbmap;
struct xfs_bmbt_irec;
/*
* Header for free extent list.
*/
-typedef struct xfs_bmap_free
+typedef struct xfs_bmap_free
{
xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extents */
int xbf_count; /* count of items on list */
int xbf_low; /* kludge: alloc in low mode */
} xfs_bmap_free_t;
-#define XFS_BMAP_MAX_NMAP 4
+#define XFS_BMAP_MAX_NMAP 4
/*
* Flags for xfs_bmapi
*/
-#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */
+#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */
#define XFS_BMAPI_DELAY 0x002 /* delayed write operation */
#define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */
#define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */
#define XFS_BMAPI_ATTRFORK 0x020 /* use attribute fork not data */
#define XFS_BMAPI_ASYNC 0x040 /* bunmapi xactions can be async */
#define XFS_BMAPI_RSVBLOCKS 0x080 /* OK to alloc. reserved data blocks */
-#define XFS_BMAPI_PREALLOC 0x100 /* preallocation op: unwritten space */
-#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */
+#define XFS_BMAPI_PREALLOC 0x100 /* preallocation op: unwritten space */
+#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */
/* combine contig. space */
-#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */
+#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one extent */
#define XFS_BMAPI_DIRECT_IO 0x800 /* Flag from cxfs client, not used
* by xfs directly. Indicates alloc
* request is for direct I/O not
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAPI_AFLAG)
int xfs_bmapi_aflag(int w);
-#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
+#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
#else
-#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0)
+#define XFS_BMAPI_AFLAG(w) ((w) == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0)
#endif
/*
* Special values for xfs_bmbt_irec_t br_startblock field.
*/
-#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
-#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
+#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
+#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
/*
* Trace operations for bmap extent tracing
*/
-#define XFS_BMAP_KTRACE_DELETE 1
-#define XFS_BMAP_KTRACE_INSERT 2
-#define XFS_BMAP_KTRACE_PRE_UP 3
-#define XFS_BMAP_KTRACE_POST_UP 4
+#define XFS_BMAP_KTRACE_DELETE 1
+#define XFS_BMAP_KTRACE_INSERT 2
+#define XFS_BMAP_KTRACE_PRE_UP 3
+#define XFS_BMAP_KTRACE_POST_UP 4
-#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
-#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
+#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buffer */
+#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace buffer */
#if defined(XFS_ALL_TRACE)
-#define XFS_BMAP_TRACE
+#define XFS_BMAP_TRACE
#endif
#if !defined(DEBUG)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_INIT)
void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp);
-#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
+#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
#else
-#define XFS_BMAP_INIT(flp,fbp) \
+#define XFS_BMAP_INIT(flp,fbp) \
((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
(flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK)
#endif
xfs_fileoff_t off; /* offset in file filling in */
struct xfs_trans *tp; /* transaction pointer */
struct xfs_inode *ip; /* incore inode pointer */
- struct xfs_bmbt_irec *prevp; /* extent before the new one */
+ struct xfs_bmbt_irec *prevp; /* extent before the new one */
struct xfs_bmbt_irec *gotp; /* extent after, or delayed */
xfs_extlen_t alen; /* i/o length asked/allocated */
xfs_extlen_t total; /* total blocks needed for xaction */
- xfs_extlen_t minlen; /* mininum allocation size (blocks) */
+ xfs_extlen_t minlen; /* mininum allocation size (blocks) */
xfs_extlen_t minleft; /* amount must be left after alloc */
char eof; /* set if allocating past last extent */
- char wasdel; /* replacing a delayed allocation */
+ char wasdel; /* replacing a delayed allocation */
char userdata;/* set if is user data */
char low; /* low on space, using seq'l ags */
- char aeof; /* allocated space at eof */
+ char aeof; /* allocated space at eof */
} xfs_bmalloca_t;
#ifdef __KERNEL__
xfs_bmap_check_swappable(
struct xfs_inode *ip); /* incore inode */
-/*
+/*
* Compute and fill in the value of the maximum depth of a bmap btree
- * in this filesystem. Done once, during mount.
+ * in this filesystem. Done once, during mount.
*/
void
xfs_bmap_compute_maxlevels(
int whichfork); /* data or attr fork */
/*
- * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
+ * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
* caller. Frees all the extents that need freeing, which must be done
* last due to locking considerations.
*
xfs_extnum_t cnt, /* count of entries in list */
int whichfork); /* data or attr fork */
#else
-#define xfs_bmap_trace_exlist(f,ip,c,w)
+#define xfs_bmap_trace_exlist(f,ip,c,w)
#endif
/*
* must be remembered and presented to subsequent calls in "firstblock".
* An upper bound for the number of blocks to be allocated is supplied to
* the first call in "total"; if no allocation group has that many free
- * blocks then the call will fail (return NULLFSBLOCK in "firstblock").
+ * blocks then the call will fail (return NULLFSBLOCK in "firstblock").
*/
int /* error */
xfs_bmapi(
/*
* Unmap (remove) blocks from a file.
* If nexts is nonzero then the number of extents to remove is limited to
- * that value. If not all extents in the block range can be removed then
+ * that value. If not all extents in the block range can be removed then
* *done is set.
*/
int /* error */
*/
int
xfs_bmap_isaeof(
- struct xfs_inode *ip,
- xfs_fileoff_t off,
- int whichfork,
- char *aeof);
+ struct xfs_inode *ip,
+ xfs_fileoff_t off,
+ int whichfork,
+ char *aeof);
/*
- * Check if the endoff is outside the last extent. If so the caller will grow
+ * Check if the endoff is outside the last extent. If so the caller will grow
* the allocation to a stripe unit boundary
*/
int
xfs_bmap_eof(
- struct xfs_inode *ip,
- xfs_fileoff_t endoff,
- int whichfork,
- int *eof);
+ struct xfs_inode *ip,
+ xfs_fileoff_t endoff,
+ int whichfork,
+ int *eof);
/*
* Count fsblocks of the given fork.
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_BMAP_BTREE_H__
-#define __XFS_BMAP_BTREE_H__
+#define __XFS_BMAP_BTREE_H__
-#define XFS_BMAP_MAGIC 0x424d4150 /* 'BMAP' */
+#define XFS_BMAP_MAGIC 0x424d4150 /* 'BMAP' */
struct xfs_btree_cur;
struct xfs_btree_lblock;
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
-#define BMBT_EXNTFLAG_BITOFF 0
-#define BMBT_EXNTFLAG_BITLEN 1
-#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN)
-#define BMBT_STARTOFF_BITLEN 54
-#define BMBT_STARTBLOCK_BITOFF (BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN)
-#define BMBT_STARTBLOCK_BITLEN 52
-#define BMBT_BLOCKCOUNT_BITOFF \
+#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
+#define BMBT_EXNTFLAG_BITOFF 0
+#define BMBT_EXNTFLAG_BITLEN 1
+#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF + BMBT_EXNTFLAG_BITLEN)
+#define BMBT_STARTOFF_BITLEN 54
+#define BMBT_STARTBLOCK_BITOFF (BMBT_STARTOFF_BITOFF + BMBT_STARTOFF_BITLEN)
+#define BMBT_STARTBLOCK_BITLEN 52
+#define BMBT_BLOCKCOUNT_BITOFF \
(BMBT_STARTBLOCK_BITOFF + BMBT_STARTBLOCK_BITLEN)
-#define BMBT_BLOCKCOUNT_BITLEN (BMBT_TOTAL_BITLEN - BMBT_BLOCKCOUNT_BITOFF)
+#define BMBT_BLOCKCOUNT_BITLEN (BMBT_TOTAL_BITLEN - BMBT_BLOCKCOUNT_BITOFF)
#else
-#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
-#define BMBT_EXNTFLAG_BITOFF 63
-#define BMBT_EXNTFLAG_BITLEN 1
-#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF - BMBT_STARTOFF_BITLEN)
-#define BMBT_STARTOFF_BITLEN 54
-#define BMBT_STARTBLOCK_BITOFF 85 /* 128 - 43 (other 9 is in first word) */
-#define BMBT_STARTBLOCK_BITLEN 52
-#define BMBT_BLOCKCOUNT_BITOFF 64 /* Start of second 64 bit container */
-#define BMBT_BLOCKCOUNT_BITLEN 21
+#define BMBT_TOTAL_BITLEN 128 /* 128 bits, 16 bytes */
+#define BMBT_EXNTFLAG_BITOFF 63
+#define BMBT_EXNTFLAG_BITLEN 1
+#define BMBT_STARTOFF_BITOFF (BMBT_EXNTFLAG_BITOFF - BMBT_STARTOFF_BITLEN)
+#define BMBT_STARTOFF_BITLEN 54
+#define BMBT_STARTBLOCK_BITOFF 85 /* 128 - 43 (other 9 is in first word) */
+#define BMBT_STARTBLOCK_BITLEN 52
+#define BMBT_BLOCKCOUNT_BITOFF 64 /* Start of second 64 bit container */
+#define BMBT_BLOCKCOUNT_BITLEN 21
#endif
-#define BMBT_USE_64 1
+#define BMBT_USE_64 1
typedef struct xfs_bmbt_rec_32
{
__uint64_t l0, l1;
} xfs_bmbt_rec_64_t;
-#if BMBT_USE_64
-typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
+typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
-#else /* !BMBT_USE_64 */
-typedef __uint32_t xfs_bmbt_rec_base_t; /* use this for casts */
-typedef xfs_bmbt_rec_32_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
-#endif /* BMBT_USE_64 */
/*
* Values and macros for delayed-allocation startblock fields.
*/
-#define STARTBLOCKVALBITS 17
-#define STARTBLOCKMASKBITS (15 + XFS_BIG_FILESYSTEMS * 20)
-#define DSTARTBLOCKMASKBITS (15 + 20)
-#define STARTBLOCKMASK \
+#define STARTBLOCKVALBITS 17
+#define STARTBLOCKMASKBITS (15 + XFS_BIG_FILESYSTEMS * 20)
+#define DSTARTBLOCKMASKBITS (15 + 20)
+#define STARTBLOCKMASK \
(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
-#define DSTARTBLOCKMASK \
+#define DSTARTBLOCKMASK \
(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLSTARTBLOCK)
int isnullstartblock(xfs_fsblock_t x);
-#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
+#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
#else
-#define ISNULLSTARTBLOCK(x) (((x) & STARTBLOCKMASK) == STARTBLOCKMASK)
+#define ISNULLSTARTBLOCK(x) (((x) & STARTBLOCKMASK) == STARTBLOCKMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_ISNULLDSTARTBLOCK)
int isnulldstartblock(xfs_dfsbno_t x);
-#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
+#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
#else
-#define ISNULLDSTARTBLOCK(x) (((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK)
+#define ISNULLDSTARTBLOCK(x) (((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_NULLSTARTBLOCK)
xfs_fsblock_t nullstartblock(int k);
-#define NULLSTARTBLOCK(k) nullstartblock(k)
+#define NULLSTARTBLOCK(k) nullstartblock(k)
#else
-#define NULLSTARTBLOCK(k) \
+#define NULLSTARTBLOCK(k) \
((ASSERT(k < (1 << STARTBLOCKVALBITS))), (STARTBLOCKMASK | (k)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_STARTBLOCKVAL)
xfs_filblks_t startblockval(xfs_fsblock_t x);
-#define STARTBLOCKVAL(x) startblockval(x)
+#define STARTBLOCKVAL(x) startblockval(x)
#else
-#define STARTBLOCKVAL(x) ((xfs_filblks_t)((x) & ~STARTBLOCKMASK))
+#define STARTBLOCKVAL(x) ((xfs_filblks_t)((x) & ~STARTBLOCKMASK))
#endif
/*
* Possible extent formats.
*/
-typedef enum {
+typedef enum {
XFS_EXTFMT_NOSTATE = 0,
XFS_EXTFMT_HASSTATE
} xfs_exntfmt_t;
/*
* Possible extent states.
*/
-typedef enum {
+typedef enum {
XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
XFS_EXT_DMAPI_OFFLINE
} xfs_exntst_t;
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTFMT_INODE )
xfs_exntfmt_t xfs_extfmt_inode(struct xfs_inode *ip);
-#define XFS_EXTFMT_INODE(x) xfs_extfmt_inode(x)
+#define XFS_EXTFMT_INODE(x) xfs_extfmt_inode(x)
#else
-#define XFS_EXTFMT_INODE(x) \
+#define XFS_EXTFMT_INODE(x) \
(XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \
XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
#endif
-#define ISUNWRITTEN(x) ((x) == XFS_EXT_UNWRITTEN)
+#define ISUNWRITTEN(x) ((x) == XFS_EXT_UNWRITTEN)
/*
* Incore version of above.
typedef xfs_dfsbno_t xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; /* btree pointer type */
/* btree block header type */
-typedef struct xfs_btree_lblock xfs_bmbt_block_t;
+typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BMBT_BLOCK)
xfs_bmbt_block_t *xfs_buf_to_bmbt_block(struct xfs_buf *bp);
-#define XFS_BUF_TO_BMBT_BLOCK(bp) xfs_buf_to_bmbt_block(bp)
+#define XFS_BUF_TO_BMBT_BLOCK(bp) xfs_buf_to_bmbt_block(bp)
#else
-#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_DSIZE)
int xfs_bmap_rblock_dsize(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) xfs_bmap_rblock_dsize(lev,cur)
+#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) xfs_bmap_rblock_dsize(lev,cur)
#else
-#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
+#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_RBLOCK_ISIZE)
int xfs_bmap_rblock_isize(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) xfs_bmap_rblock_isize(lev,cur)
+#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) xfs_bmap_rblock_isize(lev,cur)
#else
-#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
+#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
(cur)->bc_private.b.whichfork)->if_broot_bytes)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_IBLOCK_SIZE)
int xfs_bmap_iblock_size(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_IBLOCK_SIZE(lev,cur) xfs_bmap_iblock_size(lev,cur)
+#define XFS_BMAP_IBLOCK_SIZE(lev,cur) xfs_bmap_iblock_size(lev,cur)
#else
-#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
+#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DSIZE)
int xfs_bmap_block_dsize(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_DSIZE(lev,cur) xfs_bmap_block_dsize(lev,cur)
+#define XFS_BMAP_BLOCK_DSIZE(lev,cur) xfs_bmap_block_dsize(lev,cur)
#else
-#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
+#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BMAP_RBLOCK_DSIZE(lev,cur) : \
XFS_BMAP_IBLOCK_SIZE(lev,cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_ISIZE)
int xfs_bmap_block_isize(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_ISIZE(lev,cur) xfs_bmap_block_isize(lev,cur)
+#define XFS_BMAP_BLOCK_ISIZE(lev,cur) xfs_bmap_block_isize(lev,cur)
#else
-#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
+#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BMAP_RBLOCK_ISIZE(lev,cur) : \
XFS_BMAP_IBLOCK_SIZE(lev,cur))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMAXRECS)
int xfs_bmap_block_dmaxrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) xfs_bmap_block_dmaxrecs(lev,cur)
+#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) xfs_bmap_block_dmaxrecs(lev,cur)
#else
-#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
+#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
xfs_bmdr, (lev) == 0) : \
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMAXRECS)
int xfs_bmap_block_imaxrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) xfs_bmap_block_imaxrecs(lev,cur)
+#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) xfs_bmap_block_imaxrecs(lev,cur)
#else
-#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \
+#define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \
xfs_bmbt, (lev) == 0) : \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_DMINRECS)
int xfs_bmap_block_dminrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) xfs_bmap_block_dminrecs(lev,cur)
+#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) xfs_bmap_block_dminrecs(lev,cur)
#else
-#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \
+#define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
xfs_bmdr, (lev) == 0) : \
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BLOCK_IMINRECS)
int xfs_bmap_block_iminrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) xfs_bmap_block_iminrecs(lev,cur)
+#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) xfs_bmap_block_iminrecs(lev,cur)
#else
-#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \
+#define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \
((lev) == (cur)->bc_nlevels - 1 ? \
XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur), \
xfs_bmbt, (lev) == 0) : \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_DADDR)
xfs_bmbt_rec_t *
xfs_bmap_rec_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_REC_DADDR(bb,i,cur) xfs_bmap_rec_daddr(bb,i,cur)
+#define XFS_BMAP_REC_DADDR(bb,i,cur) xfs_bmap_rec_daddr(bb,i,cur)
#else
-#define XFS_BMAP_REC_DADDR(bb,i,cur) \
+#define XFS_BMAP_REC_DADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_REC_IADDR)
xfs_bmbt_rec_t *
xfs_bmap_rec_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_REC_IADDR(bb,i,cur) xfs_bmap_rec_iaddr(bb,i,cur)
+#define XFS_BMAP_REC_IADDR(bb,i,cur) xfs_bmap_rec_iaddr(bb,i,cur)
#else
-#define XFS_BMAP_REC_IADDR(bb,i,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), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_DADDR)
xfs_bmbt_key_t *
xfs_bmap_key_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_KEY_DADDR(bb,i,cur) xfs_bmap_key_daddr(bb,i,cur)
+#define XFS_BMAP_KEY_DADDR(bb,i,cur) xfs_bmap_key_daddr(bb,i,cur)
#else
-#define XFS_BMAP_KEY_DADDR(bb,i,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), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_KEY_IADDR)
xfs_bmbt_key_t *
xfs_bmap_key_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_KEY_IADDR(bb,i,cur) xfs_bmap_key_iaddr(bb,i,cur)
+#define XFS_BMAP_KEY_IADDR(bb,i,cur) xfs_bmap_key_iaddr(bb,i,cur)
#else
-#define XFS_BMAP_KEY_IADDR(bb,i,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), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_DADDR)
xfs_bmbt_ptr_t *
xfs_bmap_ptr_daddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_PTR_DADDR(bb,i,cur) xfs_bmap_ptr_daddr(bb,i,cur)
+#define XFS_BMAP_PTR_DADDR(bb,i,cur) xfs_bmap_ptr_daddr(bb,i,cur)
#else
-#define XFS_BMAP_PTR_DADDR(bb,i,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), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_PTR_IADDR)
xfs_bmbt_ptr_t *
xfs_bmap_ptr_iaddr(xfs_bmbt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_BMAP_PTR_IADDR(bb,i,cur) xfs_bmap_ptr_iaddr(bb,i,cur)
+#define XFS_BMAP_PTR_IADDR(bb,i,cur) xfs_bmap_ptr_iaddr(bb,i,cur)
#else
-#define XFS_BMAP_PTR_IADDR(bb,i,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), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_REC_ADDR)
xfs_bmbt_rec_t *xfs_bmap_broot_rec_addr(xfs_bmbt_block_t *bb, int i, int sz);
-#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) xfs_bmap_broot_rec_addr(bb,i,sz)
+#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) xfs_bmap_broot_rec_addr(bb,i,sz)
#else
-#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
+#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_KEY_ADDR)
xfs_bmbt_key_t *xfs_bmap_broot_key_addr(xfs_bmbt_block_t *bb, int i, int sz);
-#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) xfs_bmap_broot_key_addr(bb,i,sz)
+#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) xfs_bmap_broot_key_addr(bb,i,sz)
#else
-#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
+#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_PTR_ADDR)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_NUMRECS)
int xfs_bmap_broot_numrecs(xfs_bmdr_block_t *bb);
-#define XFS_BMAP_BROOT_NUMRECS(bb) xfs_bmap_broot_numrecs(bb)
+#define XFS_BMAP_BROOT_NUMRECS(bb) xfs_bmap_broot_numrecs(bb)
#else
-#define XFS_BMAP_BROOT_NUMRECS(bb) (INT_GET((bb)->bb_numrecs, ARCH_CONVERT))
+#define XFS_BMAP_BROOT_NUMRECS(bb) (INT_GET((bb)->bb_numrecs, ARCH_CONVERT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_MAXRECS)
int xfs_bmap_broot_maxrecs(int sz);
-#define XFS_BMAP_BROOT_MAXRECS(sz) xfs_bmap_broot_maxrecs(sz)
+#define XFS_BMAP_BROOT_MAXRECS(sz) xfs_bmap_broot_maxrecs(sz)
#else
-#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
+#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE_CALC)
int xfs_bmap_broot_space_calc(int nrecs);
-#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) xfs_bmap_broot_space_calc(nrecs)
+#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) xfs_bmap_broot_space_calc(nrecs)
#else
-#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
+#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
((int)(sizeof(xfs_bmbt_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_BROOT_SPACE)
int xfs_bmap_broot_space(xfs_bmdr_block_t *bb);
-#define XFS_BMAP_BROOT_SPACE(bb) xfs_bmap_broot_space(bb)
+#define XFS_BMAP_BROOT_SPACE(bb) xfs_bmap_broot_space(bb)
#else
-#define XFS_BMAP_BROOT_SPACE(bb) \
+#define XFS_BMAP_BROOT_SPACE(bb) \
XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMDR_SPACE_CALC)
int xfs_bmdr_space_calc(int nrecs);
-#define XFS_BMDR_SPACE_CALC(nrecs) xfs_bmdr_space_calc(nrecs)
+#define XFS_BMDR_SPACE_CALC(nrecs) xfs_bmdr_space_calc(nrecs)
#else
-#define XFS_BMDR_SPACE_CALC(nrecs) \
+#define XFS_BMDR_SPACE_CALC(nrecs) \
((int)(sizeof(xfs_bmdr_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BM_MAXLEVELS)
int xfs_bm_maxlevels(struct xfs_mount *mp, int w);
-#define XFS_BM_MAXLEVELS(mp,w) xfs_bm_maxlevels(mp,w)
+#define XFS_BM_MAXLEVELS(mp,w) xfs_bm_maxlevels(mp,w)
#else
-#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[w])
+#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[w])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BMAP_SANITY_CHECK)
int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
int level);
-#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
+#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
xfs_bmap_sanity_check(mp,bb,level)
#else
-#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
+#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) > 0 && \
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0])
#endif
/*
* Trace buffer entry types.
*/
-#define XFS_BMBT_KTRACE_ARGBI 1
-#define XFS_BMBT_KTRACE_ARGBII 2
-#define XFS_BMBT_KTRACE_ARGFFFI 3
-#define XFS_BMBT_KTRACE_ARGI 4
-#define XFS_BMBT_KTRACE_ARGIFK 5
-#define XFS_BMBT_KTRACE_ARGIFR 6
-#define XFS_BMBT_KTRACE_ARGIK 7
-#define XFS_BMBT_KTRACE_CUR 8
-
-#define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
-#define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
+#define XFS_BMBT_KTRACE_ARGBI 1
+#define XFS_BMBT_KTRACE_ARGBII 2
+#define XFS_BMBT_KTRACE_ARGFFFI 3
+#define XFS_BMBT_KTRACE_ARGI 4
+#define XFS_BMBT_KTRACE_ARGIFK 5
+#define XFS_BMBT_KTRACE_ARGIFR 6
+#define XFS_BMBT_KTRACE_ARGIK 7
+#define XFS_BMBT_KTRACE_CUR 8
+
+#define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
+#define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
#if defined(XFS_ALL_TRACE)
-#define XFS_BMBT_TRACE
+#define XFS_BMBT_TRACE
#endif
#if !defined(DEBUG)
xfs_bmbt_delete(
struct xfs_btree_cur *,
int,
- int *);
+ int *);
void
xfs_bmbt_get_all(
xfs_bmbt_rec_t *r,
- xfs_bmbt_irec_t *s);
+ xfs_bmbt_irec_t *s);
xfs_bmbt_block_t *
xfs_bmbt_get_block(
int
xfs_bmbt_insert(
struct xfs_btree_cur *,
- int *);
+ int *);
int
xfs_bmbt_insert_many(
struct xfs_btree_cur *,
int,
xfs_bmbt_rec_t *,
- int *);
+ int *);
void
xfs_bmbt_log_block(
void
xfs_bmbt_set_all(
xfs_bmbt_rec_t *r,
- xfs_bmbt_irec_t *s);
+ xfs_bmbt_irec_t *s);
void
xfs_bmbt_set_allf(
xfs_exntst_t);
#ifdef XFSDEBUG
-/*
+/*
* Get the data from the pointed-to record.
*/
int
*/
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 *);
+ 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 /* __XFS_BMAP_BTREE_H__ */
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_BTREE_H__
-#define __XFS_BTREE_H__
+#define __XFS_BTREE_H__
struct xfs_buf;
struct xfs_bmap_free;
/*
* This nonsense is to make -wlint happy.
*/
-#define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi)
-#define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi)
-#define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi)
+#define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi)
+#define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi)
+#define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi)
-#define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi)
-#define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi)
-#define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi)
-#define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi)
+#define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi)
+#define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi)
+#define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi)
+#define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi)
/*
* Short form header: space allocation btrees.
typedef struct xfs_btree_block
{
- xfs_btree_hdr_t bb_h; /* header */
+ xfs_btree_hdr_t bb_h; /* header */
union {
struct {
xfs_agblock_t bb_leftsib;
/*
* For logging record fields.
*/
-#define XFS_BB_MAGIC 0x01
-#define XFS_BB_LEVEL 0x02
-#define XFS_BB_NUMRECS 0x04
-#define XFS_BB_LEFTSIB 0x08
-#define XFS_BB_RIGHTSIB 0x10
-#define XFS_BB_NUM_BITS 5
-#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
+#define XFS_BB_MAGIC 0x01
+#define XFS_BB_LEVEL 0x02
+#define XFS_BB_NUMRECS 0x04
+#define XFS_BB_LEFTSIB 0x08
+#define XFS_BB_RIGHTSIB 0x10
+#define XFS_BB_NUM_BITS 5
+#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
/*
* Boolean to select which form of xfs_btree_block_t.bb_u to use.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BTREE_LONG_PTRS)
int xfs_btree_long_ptrs(xfs_btnum_t btnum);
-#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
+#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
#else
-#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
+#define XFS_BTREE_LONG_PTRS(btnum) ((btnum) == XFS_BTNUM_BMAP)
#endif
/*
* Magic numbers for btree blocks.
*/
-extern const __uint32_t xfs_magics[];
+extern const __uint32_t xfs_magics[];
/*
* Maximum and minimum records in a btree block.
* The divisor below is equivalent to lf ? (e1) : (e2) but that produces
* compiler warnings.
*/
-#define XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) \
+#define XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) \
((int)(((bsz) - (uint)sizeof(t ## _block_t)) / \
(((lf) * (uint)sizeof(t ## _rec_t)) + \
((1 - (lf)) * \
((uint)sizeof(t ## _key_t) + (uint)sizeof(t ## _ptr_t))))))
-#define XFS_BTREE_BLOCK_MINRECS(bsz,t,lf) \
+#define XFS_BTREE_BLOCK_MINRECS(bsz,t,lf) \
(XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) / 2)
/*
* Given block size, type prefix, block pointer, and index of requested entry
* (first entry numbered 1).
*/
-#define XFS_BTREE_REC_ADDR(bsz,t,bb,i,mxr) \
+#define XFS_BTREE_REC_ADDR(bsz,t,bb,i,mxr) \
((t ## _rec_t *)((char *)(bb) + sizeof(t ## _block_t) + \
((i) - 1) * sizeof(t ## _rec_t)))
-#define XFS_BTREE_KEY_ADDR(bsz,t,bb,i,mxr) \
+#define XFS_BTREE_KEY_ADDR(bsz,t,bb,i,mxr) \
((t ## _key_t *)((char *)(bb) + sizeof(t ## _block_t) + \
((i) - 1) * sizeof(t ## _key_t)))
-#define XFS_BTREE_PTR_ADDR(bsz,t,bb,i,mxr) \
+#define XFS_BTREE_PTR_ADDR(bsz,t,bb,i,mxr) \
((t ## _ptr_t *)((char *)(bb) + sizeof(t ## _block_t) + \
(mxr) * sizeof(t ## _key_t) + ((i) - 1) * sizeof(t ## _ptr_t)))
-#define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */
+#define XFS_BTREE_MAXLEVELS 8 /* max of all btrees */
/*
* Btree cursor structure.
*/
typedef struct xfs_btree_cur
{
- struct xfs_trans *bc_tp; /* transaction we're in, if any */
- struct xfs_mount *bc_mp; /* file system mount struct */
+ struct xfs_trans *bc_tp; /* transaction we're in, if any */
+ struct xfs_mount *bc_mp; /* file system mount struct */
union {
xfs_alloc_rec_t a;
xfs_bmbt_irec_t b;
struct xfs_buf *bc_bufs[XFS_BTREE_MAXLEVELS]; /* buf ptr per level */
int bc_ptrs[XFS_BTREE_MAXLEVELS]; /* key/record # */
__uint8_t bc_ra[XFS_BTREE_MAXLEVELS]; /* readahead bits */
-#define XFS_BTCUR_LEFTRA 1 /* left sibling has been read-ahead */
-#define XFS_BTCUR_RIGHTRA 2 /* right sibling has been read-ahead */
+#define XFS_BTCUR_LEFTRA 1 /* left sibling has been read-ahead */
+#define XFS_BTCUR_RIGHTRA 2 /* right sibling has been read-ahead */
__uint8_t bc_nlevels; /* number of levels in the tree */
__uint8_t bc_blocklog; /* log2(blocksize) of btree blocks */
xfs_btnum_t bc_btnum; /* identifies which btree type */
short forksize; /* fork's inode space */
char whichfork; /* data or attr fork */
char flags; /* flags */
-#define XFS_BTCUR_BPRV_WASDEL 1 /* was delayed */
+#define XFS_BTCUR_BPRV_WASDEL 1 /* was delayed */
} b;
struct { /* needed for INO */
struct xfs_buf *agbp; /* agi buffer pointer */
} bc_private; /* per-btree type data */
} xfs_btree_cur_t;
-#define XFS_BTREE_NOERROR 0
-#define XFS_BTREE_ERROR 1
+#define XFS_BTREE_NOERROR 0
+#define XFS_BTREE_ERROR 1
/*
* Convert from buffer to btree block header.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_BLOCK)
xfs_btree_block_t *xfs_buf_to_block(struct xfs_buf *bp);
-#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp)
+#define XFS_BUF_TO_BLOCK(bp) xfs_buf_to_block(bp)
#else
-#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_BLOCK(bp) ((xfs_btree_block_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_LBLOCK)
xfs_btree_lblock_t *xfs_buf_to_lblock(struct xfs_buf *bp);
-#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp)
+#define XFS_BUF_TO_LBLOCK(bp) xfs_buf_to_lblock(bp)
#else
-#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_LBLOCK(bp) ((xfs_btree_lblock_t *)(XFS_BUF_PTR(bp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBLOCK)
xfs_btree_sblock_t *xfs_buf_to_sblock(struct xfs_buf *bp);
-#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp)
+#define XFS_BUF_TO_SBLOCK(bp) xfs_buf_to_sblock(bp)
#else
-#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_SBLOCK(bp) ((xfs_btree_sblock_t *)(XFS_BUF_PTR(bp)))
#endif
#ifdef __KERNEL__
void
xfs_btree_check_block(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_block_t *block, /* generic btree block pointer */
+ xfs_btree_block_t *block, /* generic btree block pointer */
int level, /* level of the btree block */
struct xfs_buf *bp); /* buffer containing block, if any */
void *ar1, /* pointer to left (lower) record */
void *ar2); /* pointer to right (higher) record */
#else
-#define xfs_btree_check_block(a,b,c,d)
-#define xfs_btree_check_key(a,b,c)
-#define xfs_btree_check_rec(a,b,c)
+#define xfs_btree_check_block(a,b,c,d)
+#define xfs_btree_check_key(a,b,c)
+#define xfs_btree_check_rec(a,b,c)
#endif /* DEBUG */
/*
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_lblock(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_lblock_t *block, /* btree long form block pointer */
+ xfs_btree_lblock_t *block, /* btree long form block pointer */
int level, /* level of the btree block */
struct xfs_buf *bp); /* buffer containing block, if any */
xfs_btree_check_lptr(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_dfsbno_t ptr, /* btree block disk address */
- int level); /* btree block level */
+ int level); /* btree block level */
/*
* Checking routine: check that short form block header is ok.
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_sblock(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_sblock_t *block, /* btree short form block pointer */
+ xfs_btree_sblock_t *block, /* btree short form block pointer */
int level, /* level of the btree block */
struct xfs_buf *bp); /* buffer containing block */
xfs_btree_check_sptr(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_agblock_t ptr, /* btree block disk address */
- int level); /* btree block level */
+ int level); /* btree block level */
/*
* Delete the btree cursor.
void
xfs_btree_del_cursor(
xfs_btree_cur_t *cur, /* btree cursor */
- int error); /* del because of error */
+ int error); /* del because of error */
/*
* Duplicate the btree cursor.
/*
* Change the cursor to point to the first record in the current block
- * at the given level. Other levels are unaffected.
+ * at the given level. Other levels are unaffected.
*/
int /* success=1, failure=0 */
xfs_btree_firstrec(
xfs_btree_cur_t *cur, /* btree cursor */
- int level); /* level to change */
+ int level); /* level to change */
/*
* Retrieve the block pointer from the cursor at the given level.
xfs_btree_get_block(
xfs_btree_cur_t *cur, /* btree cursor */
int level, /* level in btree */
- struct xfs_buf **bpp); /* buffer containing the block */
+ struct xfs_buf **bpp); /* buffer containing the block */
/*
* Get a buffer for the block, return it with no data read.
xfs_agblock_t agbno, /* allocation group block number */
uint lock); /* lock flags for get_buf */
-/*
+/*
* Allocate a new btree cursor.
* The cursor is either for allocation (A) or bmap (B).
*/
int /* 1=is last block, 0=not last block */
xfs_btree_islastblock(
xfs_btree_cur_t *cur, /* btree cursor */
- int level); /* level to check */
+ int level); /* level to check */
/*
* Change the cursor to point to the last record in the current block
- * at the given level. Other levels are unaffected.
+ * at the given level. Other levels are unaffected.
*/
int /* success=1, failure=0 */
xfs_btree_lastrec(
xfs_btree_cur_t *cur, /* btree cursor */
- int level); /* level to change */
+ int level); /* level to change */
/*
* Compute first and last byte offsets for the fields given.
*/
void
xfs_btree_offsets(
- __int64_t fields, /* bitmask of fields */
+ __int64_t fields, /* bitmask of fields */
const short *offsets,/* table of field offsets */
int nbits, /* number of bits to inspect */
- int *first, /* output: first byte offset */
- int *last); /* output: last byte offset */
+ int *first, /* output: first byte offset */
+ int *last); /* output: last byte offset */
/*
* Get a buffer for the block, return it read in.
xfs_btree_reada_bufl(
struct xfs_mount *mp, /* file system mount point */
xfs_fsblock_t fsbno, /* file system block number */
- xfs_extlen_t count); /* count of filesystem blocks */
+ xfs_extlen_t count); /* count of filesystem blocks */
/*
* Read-ahead the block, don't wait for it, don't return a buffer.
struct xfs_mount *mp, /* file system mount point */
xfs_agnumber_t agno, /* allocation group number */
xfs_agblock_t agbno, /* allocation group block number */
- xfs_extlen_t count); /* count of filesystem blocks */
+ xfs_extlen_t count); /* count of filesystem blocks */
/*
* Read-ahead btree blocks, at the given level.
xfs_btree_readahead(
xfs_btree_cur_t *cur, /* btree cursor */
int lev, /* level in btree */
- int lr) /* left/right bits */
+ int lr) /* left/right bits */
{
- if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
- return 0;
+ if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
+ return 0;
return xfs_btree_readahead_core(cur, lev, lr);
}
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MIN)
xfs_extlen_t xfs_extlen_min(xfs_extlen_t a, xfs_extlen_t b);
-#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b)
+#define XFS_EXTLEN_MIN(a,b) xfs_extlen_min(a,b)
#else
-#define XFS_EXTLEN_MIN(a,b) \
+#define XFS_EXTLEN_MIN(a,b) \
((xfs_extlen_t)(a) < (xfs_extlen_t)(b) ? \
(xfs_extlen_t)(a) : (xfs_extlen_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_EXTLEN_MAX)
xfs_extlen_t xfs_extlen_max(xfs_extlen_t a, xfs_extlen_t b);
-#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b)
+#define XFS_EXTLEN_MAX(a,b) xfs_extlen_max(a,b)
#else
-#define XFS_EXTLEN_MAX(a,b) \
+#define XFS_EXTLEN_MAX(a,b) \
((xfs_extlen_t)(a) > (xfs_extlen_t)(b) ? \
(xfs_extlen_t)(a) : (xfs_extlen_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MIN)
xfs_agblock_t xfs_agblock_min(xfs_agblock_t a, xfs_agblock_t b);
-#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b)
+#define XFS_AGBLOCK_MIN(a,b) xfs_agblock_min(a,b)
#else
-#define XFS_AGBLOCK_MIN(a,b) \
+#define XFS_AGBLOCK_MIN(a,b) \
((xfs_agblock_t)(a) < (xfs_agblock_t)(b) ? \
(xfs_agblock_t)(a) : (xfs_agblock_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGBLOCK_MAX)
xfs_agblock_t xfs_agblock_max(xfs_agblock_t a, xfs_agblock_t b);
-#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b)
+#define XFS_AGBLOCK_MAX(a,b) xfs_agblock_max(a,b)
#else
-#define XFS_AGBLOCK_MAX(a,b) \
+#define XFS_AGBLOCK_MAX(a,b) \
((xfs_agblock_t)(a) > (xfs_agblock_t)(b) ? \
(xfs_agblock_t)(a) : (xfs_agblock_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MIN)
xfs_fileoff_t xfs_fileoff_min(xfs_fileoff_t a, xfs_fileoff_t b);
-#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b)
+#define XFS_FILEOFF_MIN(a,b) xfs_fileoff_min(a,b)
#else
-#define XFS_FILEOFF_MIN(a,b) \
+#define XFS_FILEOFF_MIN(a,b) \
((xfs_fileoff_t)(a) < (xfs_fileoff_t)(b) ? \
(xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILEOFF_MAX)
xfs_fileoff_t xfs_fileoff_max(xfs_fileoff_t a, xfs_fileoff_t b);
-#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b)
+#define XFS_FILEOFF_MAX(a,b) xfs_fileoff_max(a,b)
#else
-#define XFS_FILEOFF_MAX(a,b) \
+#define XFS_FILEOFF_MAX(a,b) \
((xfs_fileoff_t)(a) > (xfs_fileoff_t)(b) ? \
(xfs_fileoff_t)(a) : (xfs_fileoff_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MIN)
xfs_filblks_t xfs_filblks_min(xfs_filblks_t a, xfs_filblks_t b);
-#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b)
+#define XFS_FILBLKS_MIN(a,b) xfs_filblks_min(a,b)
#else
-#define XFS_FILBLKS_MIN(a,b) \
+#define XFS_FILBLKS_MIN(a,b) \
((xfs_filblks_t)(a) < (xfs_filblks_t)(b) ? \
(xfs_filblks_t)(a) : (xfs_filblks_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FILBLKS_MAX)
xfs_filblks_t xfs_filblks_max(xfs_filblks_t a, xfs_filblks_t b);
-#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b)
+#define XFS_FILBLKS_MAX(a,b) xfs_filblks_max(a,b)
#else
-#define XFS_FILBLKS_MAX(a,b) \
+#define XFS_FILBLKS_MAX(a,b) \
((xfs_filblks_t)(a) > (xfs_filblks_t)(b) ? \
(xfs_filblks_t)(a) : (xfs_filblks_t)(b))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_SANITY_CHECK)
int xfs_fsb_sanity_check(struct xfs_mount *mp, xfs_fsblock_t fsb);
-#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb)
+#define XFS_FSB_SANITY_CHECK(mp,fsb) xfs_fsb_sanity_check(mp,fsb)
#else
-#define XFS_FSB_SANITY_CHECK(mp,fsb) \
+#define XFS_FSB_SANITY_CHECK(mp,fsb) \
(XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks)
#endif
/*
* Macros to set EFSCORRUPTED & return/branch.
*/
-#define XFS_WANT_CORRUPTED_GOTO(x,l) \
+#define XFS_WANT_CORRUPTED_GOTO(x,l) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
} \
}
-#define XFS_WANT_CORRUPTED_RETURN(x) \
+#define XFS_WANT_CORRUPTED_RETURN(x) \
{ \
int fs_is_ok = (x); \
ASSERT(fs_is_ok); \
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_BUF_ITEM_H__
-#define __XFS_BUF_ITEM_H__
+#ifndef __XFS_BUF_ITEM_H__
+#define __XFS_BUF_ITEM_H__
/*
* This is the structure used to lay out a buf log item in the
- * log. The data map describes which 128 byte chunks of the buffer
+ * log. The data map describes which 128 byte chunks of the buffer
* have been logged. This structure works only on buffers that
- * reside up to the first TB in the filesystem. These buffers are
+ * reside up to the first TB in the filesystem. These buffers are
* generated only by pre-6.2 systems and are known as XFS_LI_6_1_BUF.
*/
typedef struct xfs_buf_log_format_v1 {
* This flag indicates that the buffer contains on disk inodes
* and requires special recovery handling.
*/
-#define XFS_BLI_INODE_BUF 0x1
+#define XFS_BLI_INODE_BUF 0x1
/*
* This flag indicates that the buffer should not be replayed
* during recovery because its blocks are being freed.
*/
-#define XFS_BLI_CANCEL 0x2
+#define XFS_BLI_CANCEL 0x2
/*
- * This flag indicates that the buffer contains on disk
- * user or group dquots and may require special recovery handling.
+ * This flag indicates that the buffer contains on disk
+ * user or group dquots and may require special recovery handling.
*/
-#define XFS_BLI_UDQUOT_BUF 0x4
+#define XFS_BLI_UDQUOT_BUF 0x4
/* #define XFS_BLI_PDQUOT_BUF 0x8 */
-#define XFS_BLI_GDQUOT_BUF 0x10
+#define XFS_BLI_GDQUOT_BUF 0x10
-#define XFS_BLI_CHUNK 128
-#define XFS_BLI_SHIFT 7
-#define BIT_TO_WORD_SHIFT 5
-#define NBWORD (NBBY * sizeof(unsigned int))
+#define XFS_BLI_CHUNK 128
+#define XFS_BLI_SHIFT 7
+#define BIT_TO_WORD_SHIFT 5
+#define NBWORD (NBBY * sizeof(unsigned int))
/*
* buf log item flags
*/
-#define XFS_BLI_HOLD 0x01
-#define XFS_BLI_DIRTY 0x02
-#define XFS_BLI_STALE 0x04
-#define XFS_BLI_LOGGED 0x08
-#define XFS_BLI_INODE_ALLOC_BUF 0x10
+#define XFS_BLI_HOLD 0x01
+#define XFS_BLI_DIRTY 0x02
+#define XFS_BLI_STALE 0x04
+#define XFS_BLI_LOGGED 0x08
+#define XFS_BLI_INODE_ALLOC_BUF 0x10
#ifdef __KERNEL__
struct xfs_buf_cancel *bc_next;
} xfs_buf_cancel_t;
-#define XFS_BLI_TRACE_SIZE 32
+#define XFS_BLI_TRACE_SIZE 32
#if defined(XFS_ALL_TRACE)
-#define XFS_BLI_TRACE
+#define XFS_BLI_TRACE
#endif
#if !defined(DEBUG)
#if defined(XFS_BLI_TRACE)
void xfs_buf_item_trace(char *, xfs_buf_log_item_t *);
#else
-#define xfs_buf_item_trace(id, bip)
+#define xfs_buf_item_trace(id, bip)
#endif
void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
#ifdef XFS_TRANS_DEBUG
void
xfs_buf_item_flush_log_debug(
- struct xfs_buf *bp,
+ struct xfs_buf *bp,
uint first,
uint last);
#else
-#define xfs_buf_item_flush_log_debug(bp, first, last)
+#define xfs_buf_item_flush_log_debug(bp, first, last)
#endif
#endif /* __KERNEL__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_CAP_H__
typedef __uint64_t xfs_cap_value_t;
typedef struct xfs_cap_set {
- xfs_cap_value_t cap_effective; /* use in capability checks */
- xfs_cap_value_t cap_permitted; /* combined with file attrs */
- xfs_cap_value_t cap_inheritable;/* pass through exec */
+ xfs_cap_value_t cap_effective; /* use in capability checks */
+ xfs_cap_value_t cap_permitted; /* combined with file attrs */
+ xfs_cap_value_t cap_inheritable;/* pass through exec */
} xfs_cap_set_t;
/* On-disk XFS extended attribute names */
#endif /* __KERNEL__ */
-#endif /* __XFS_CAP_H__ */
+#endif /* __XFS_CAP_H__ */
/*
* Copyright (c) 2000, 2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DA_BTREE_H__
-#define __XFS_DA_BTREE_H__
+#define __XFS_DA_BTREE_H__
struct xfs_buf;
struct xfs_bmap_free;
#define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */
#define XFS_DIR_LEAF_MAGIC 0xfeeb /* magic number: directory leaf blks */
#define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks */
-#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */
-#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */
+#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */
+#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */
-#define XFS_DIRX_LEAF_MAGIC(mp) \
+#define XFS_DIRX_LEAF_MAGIC(mp) \
(XFS_DIR_IS_V1(mp) ? XFS_DIR_LEAF_MAGIC : XFS_DIR2_LEAFN_MAGIC)
typedef struct xfs_da_blkinfo {
* Since we have duplicate keys, use a binary search but always follow
* all match in the block, not just the first match found.
*/
-#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */
+#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */
typedef struct xfs_da_intnode {
struct xfs_da_node_hdr { /* constant-structure header block */
int xfs_da_node_entries(struct xfs_mount *mp);
#define XFS_DA_NODE_ENTRIES(mp) xfs_da_node_entries(mp)
#else
-#define XFS_DA_NODE_ENTRIES(mp) ((mp)->m_da_node_ents)
+#define XFS_DA_NODE_ENTRIES(mp) ((mp)->m_da_node_ents)
#endif
-#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */
+#define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */
/*
* Macros used by directory code to interface to the filesystem.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBSIZE)
int xfs_lbsize(struct xfs_mount *mp);
-#define XFS_LBSIZE(mp) xfs_lbsize(mp)
+#define XFS_LBSIZE(mp) xfs_lbsize(mp)
#else
-#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize)
+#define XFS_LBSIZE(mp) ((mp)->m_sb.sb_blocksize)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LBLOG)
int xfs_lblog(struct xfs_mount *mp);
-#define XFS_LBLOG(mp) xfs_lblog(mp)
+#define XFS_LBLOG(mp) xfs_lblog(mp)
#else
-#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog)
+#define XFS_LBLOG(mp) ((mp)->m_sb.sb_blocklog)
#endif
/*
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_BNOENTRY)
__uint32_t xfs_da_make_bnoentry(struct xfs_mount *mp, xfs_dablk_t bno,
int entry);
-#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
+#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
xfs_da_make_bnoentry(mp,bno,entry)
#else
-#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
+#define XFS_DA_MAKE_BNOENTRY(mp,bno,entry) \
(((bno) << (mp)->m_dircook_elog) | (entry))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_MAKE_COOKIE)
xfs_off_t xfs_da_make_cookie(struct xfs_mount *mp, xfs_dablk_t bno, int entry,
xfs_dahash_t hash);
-#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
+#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
xfs_da_make_cookie(mp,bno,entry,hash)
#else
-#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
+#define XFS_DA_MAKE_COOKIE(mp,bno,entry,hash) \
(((xfs_off_t)XFS_DA_MAKE_BNOENTRY(mp, bno, entry) << 32) | (hash))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_HASH)
xfs_dahash_t xfs_da_cookie_hash(struct xfs_mount *mp, xfs_off_t cookie);
-#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie)
+#define XFS_DA_COOKIE_HASH(mp,cookie) xfs_da_cookie_hash(mp,cookie)
#else
-#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie))
+#define XFS_DA_COOKIE_HASH(mp,cookie) ((xfs_dahash_t)(cookie))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_BNO)
xfs_dablk_t xfs_da_cookie_bno(struct xfs_mount *mp, xfs_off_t cookie);
-#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie)
+#define XFS_DA_COOKIE_BNO(mp,cookie) xfs_da_cookie_bno(mp,cookie)
#else
-#define XFS_DA_COOKIE_BNO(mp,cookie) \
+#define XFS_DA_COOKIE_BNO(mp,cookie) \
(((xfs_off_t)(cookie) >> 31) == -1LL ? \
(xfs_dablk_t)0 : \
(xfs_dablk_t)((xfs_off_t)(cookie) >> ((mp)->m_dircook_elog + 32)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_COOKIE_ENTRY)
int xfs_da_cookie_entry(struct xfs_mount *mp, xfs_off_t cookie);
-#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie)
+#define XFS_DA_COOKIE_ENTRY(mp,cookie) xfs_da_cookie_entry(mp,cookie)
#else
-#define XFS_DA_COOKIE_ENTRY(mp,cookie) \
+#define XFS_DA_COOKIE_ENTRY(mp,cookie) \
(((xfs_off_t)(cookie) >> 31) == -1LL ? \
(xfs_dablk_t)0 : \
(xfs_dablk_t)(((xfs_off_t)(cookie) >> 32) & \
/*
* Structure to describe buffer(s) for a block.
- * This is needed in the directory version 2 format case, when
+ * This is needed in the directory version 2 format case, when
* multiple non-contiguous fsblocks might be needed to cover one
* logical directory block.
* If the buffer count is 1 then the data pointer points to the
#endif
struct xfs_buf *bps[1]; /* actually nbuf of these */
} xfs_dabuf_t;
-#define XFS_DA_BUF_SIZE(n) \
+#define XFS_DA_BUF_SIZE(n) \
(sizeof(xfs_dabuf_t) + sizeof(struct xfs_buf *) * ((n) - 1))
#ifdef XFS_DABUF_DEBUG
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DFRAG_H__
-#define __XFS_DFRAG_H__
+#define __XFS_DFRAG_H__
/*
* Structure passed to xfs_swapext
typedef struct xfs_swapext
{
- __int64_t sx_version; /* version */
+ __int64_t sx_version; /* version */
__int64_t sx_fdtarget; /* fd of target file */
__int64_t sx_fdtmp; /* fd of tmp file */
- xfs_off_t sx_offset; /* offset into file */
- xfs_off_t sx_length; /* leng from offset */
+ xfs_off_t sx_offset; /* offset into file */
+ xfs_off_t sx_length; /* leng from offset */
char sx_pad[16]; /* pad space, unused */
xfs_bstat_t sx_stat; /* stat of target b4 copy */
} xfs_swapext_t;
-/*
+/*
* Version flag
*/
#define XFS_SX_VERSION 0
/*
* Copyright (c) 2000, 2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DINODE_H__
-#define __XFS_DINODE_H__
+#define __XFS_DINODE_H__
struct xfs_buf;
struct xfs_mount;
-#define XFS_DINODE_VERSION_1 1
-#define XFS_DINODE_VERSION_2 2
+#define XFS_DINODE_VERSION_1 1
+#define XFS_DINODE_VERSION_2 2
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION)
int xfs_dinode_good_version(int v);
#define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v)
#define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \
((v) == XFS_DINODE_VERSION_2))
#endif
-#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
+#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
/*
* Disk inode structure.
__uint32_t di_nlink; /* number of links to file */
__uint16_t di_projid; /* owner's project id */
__uint8_t di_pad[10]; /* unused, zeroed space */
- 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 */
+ 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 */
xfs_fsize_t di_size; /* number of bytes in file */
xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */
xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
union {
xfs_bmdr_block_t di_abmbt; /* btree root block */
xfs_bmbt_rec_32_t di_abmx[1]; /* extent list */
- xfs_attr_shortform_t di_attrsf; /* shortform attribute list */
+ xfs_attr_shortform_t di_attrsf; /* shortform attribute list */
} di_a;
} xfs_dinode_t;
* 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
+#define XFS_MAXLINK ((1U << 31) - 1U)
+#define XFS_MAXLINK_1 65535U
/*
* Bit names for logging disk inodes only
*/
-#define XFS_DI_MAGIC 0x0000001
-#define XFS_DI_MODE 0x0000002
-#define XFS_DI_VERSION 0x0000004
-#define XFS_DI_FORMAT 0x0000008
-#define XFS_DI_ONLINK 0x0000010
-#define XFS_DI_UID 0x0000020
-#define XFS_DI_GID 0x0000040
-#define XFS_DI_NLINK 0x0000080
-#define XFS_DI_PROJID 0x0000100
-#define XFS_DI_PAD 0x0000200
-#define XFS_DI_ATIME 0x0000400
-#define XFS_DI_MTIME 0x0000800
-#define XFS_DI_CTIME 0x0001000
-#define XFS_DI_SIZE 0x0002000
-#define XFS_DI_NBLOCKS 0x0004000
-#define XFS_DI_EXTSIZE 0x0008000
-#define XFS_DI_NEXTENTS 0x0010000
-#define XFS_DI_NAEXTENTS 0x0020000
-#define XFS_DI_FORKOFF 0x0040000
-#define XFS_DI_AFORMAT 0x0080000
-#define XFS_DI_DMEVMASK 0x0100000
-#define XFS_DI_DMSTATE 0x0200000
-#define XFS_DI_FLAGS 0x0400000
-#define XFS_DI_GEN 0x0800000
-#define XFS_DI_NEXT_UNLINKED 0x1000000
-#define XFS_DI_U 0x2000000
-#define XFS_DI_A 0x4000000
-#define XFS_DI_NUM_BITS 27
-#define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1)
-#define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A))
+#define XFS_DI_MAGIC 0x0000001
+#define XFS_DI_MODE 0x0000002
+#define XFS_DI_VERSION 0x0000004
+#define XFS_DI_FORMAT 0x0000008
+#define XFS_DI_ONLINK 0x0000010
+#define XFS_DI_UID 0x0000020
+#define XFS_DI_GID 0x0000040
+#define XFS_DI_NLINK 0x0000080
+#define XFS_DI_PROJID 0x0000100
+#define XFS_DI_PAD 0x0000200
+#define XFS_DI_ATIME 0x0000400
+#define XFS_DI_MTIME 0x0000800
+#define XFS_DI_CTIME 0x0001000
+#define XFS_DI_SIZE 0x0002000
+#define XFS_DI_NBLOCKS 0x0004000
+#define XFS_DI_EXTSIZE 0x0008000
+#define XFS_DI_NEXTENTS 0x0010000
+#define XFS_DI_NAEXTENTS 0x0020000
+#define XFS_DI_FORKOFF 0x0040000
+#define XFS_DI_AFORMAT 0x0080000
+#define XFS_DI_DMEVMASK 0x0100000
+#define XFS_DI_DMSTATE 0x0200000
+#define XFS_DI_FLAGS 0x0400000
+#define XFS_DI_GEN 0x0800000
+#define XFS_DI_NEXT_UNLINKED 0x1000000
+#define XFS_DI_U 0x2000000
+#define XFS_DI_A 0x4000000
+#define XFS_DI_NUM_BITS 27
+#define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1)
+#define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI_A))
/*
* Values for di_format
/* LNK: di_symlink */
XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */
XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */
- XFS_DINODE_FMT_UUID /* MNT: di_uuid */
+ XFS_DINODE_FMT_UUID /* MNT: di_uuid */
} 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)
+#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.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO)
int xfs_litino(struct xfs_mount *mp);
-#define XFS_LITINO(mp) xfs_litino(mp)
+#define XFS_LITINO(mp) xfs_litino(mp)
#else
-#define XFS_LITINO(mp) ((mp)->m_litino)
+#define XFS_LITINO(mp) ((mp)->m_litino)
#endif
-#define XFS_BROOT_SIZE_ADJ \
+#define XFS_BROOT_SIZE_ADJ \
(sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t))
/*
* Fork identifiers. Here so utilities can use them without including
* xfs_inode.h.
*/
-#define XFS_DATA_FORK 0
-#define XFS_ATTR_FORK 1
+#define XFS_DATA_FORK 0
+#define XFS_ATTR_FORK 1
/*
* Inode data & attribute fork sizes, per inode.
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q)
int xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch);
int xfs_cfork_q(xfs_dinode_core_t *dcp);
-#define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch)
-#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
+#define XFS_CFORK_Q_ARCH(dcp,arch) xfs_cfork_q_arch(dcp,arch)
+#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp)
#else
-#define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch))
-#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
+#define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch))
+#define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF)
int xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch);
int xfs_cfork_boff(xfs_dinode_core_t *dcp);
-#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch)
-#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
+#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch)
+#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp)
#else
-#define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3))
-#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
+#define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3))
+#define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE)
int xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch);
int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
-#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch)
-#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
+#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch)
+#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp)
#else
-#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \
+#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \
(XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_CFORK_BOFF_ARCH(dcp, arch) : XFS_LITINO(mp))
#define XFS_CFORK_DSIZE(dcp,mp) \
(XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE)
int xfs_cfork_asize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch);
int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp);
-#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch)
-#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
+#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch)
+#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp)
#else
-#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \
+#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \
(XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_ARCH(dcp, arch) : 0)
#define XFS_CFORK_ASIZE(dcp,mp) \
(XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE)
int xfs_cfork_size_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w, xfs_arch_t arch);
int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w);
-#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch)
-#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
+#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch)
+#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w)
#else
-#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \
+#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \
((w) == XFS_DATA_FORK ? \
XFS_CFORK_DSIZE_ARCH(dcp, mp, arch) : XFS_CFORK_ASIZE_ARCH(dcp, mp, arch))
#define XFS_CFORK_SIZE(dcp,mp,w) \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE)
int xfs_dfork_dsize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch);
int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp);
-#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch)
-#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp)
+#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch)
+#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp)
#else
-#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch)
-#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT)
+#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch)
+#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE)
int xfs_dfork_asize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch);
int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp);
-#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch)
-#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
+#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch)
+#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp)
#else
-#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch)
-#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT)
+#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch)
+#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE)
int xfs_dfork_size_arch(xfs_dinode_t *dip, struct xfs_mount *mp, int w, xfs_arch_t arch);
int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w);
-#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch)
-#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
+#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch)
+#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w)
#else
-#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch)
-#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT)
+#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch)
+#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q)
int xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch);
int xfs_dfork_q(xfs_dinode_t *dip);
-#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch)
-#define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
+#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch)
+#define XFS_DFORK_Q(dip) xfs_dfork_q(dip)
#else
-#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch)
-#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT)
+#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch)
+#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF)
int xfs_dfork_boff_arch(xfs_dinode_t *dip, xfs_arch_t arch);
int xfs_dfork_boff(xfs_dinode_t *dip);
-#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch)
-#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
+#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch)
+#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip)
#else
-#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch)
-#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT)
+#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch)
+#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR)
char *xfs_dfork_dptr_arch(xfs_dinode_t *dip, xfs_arch_t arch);
char *xfs_dfork_dptr(xfs_dinode_t *dip);
-#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch)
-#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
+#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch)
+#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip)
#else
-#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c)
-#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT)
+#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c)
+#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR)
char *xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch);
char *xfs_dfork_aptr(xfs_dinode_t *dip);
-#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch)
-#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
+#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch)
+#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip)
#else
-#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch))
-#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT)
+#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch))
+#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR)
char *xfs_dfork_ptr_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
char *xfs_dfork_ptr(xfs_dinode_t *dip, int w);
-#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch)
-#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
+#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch)
+#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w)
#else
-#define XFS_DFORK_PTR_ARCH(dip,w,arch) \
+#define XFS_DFORK_PTR_ARCH(dip,w,arch) \
((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR_ARCH(dip, arch) : XFS_DFORK_APTR_ARCH(dip, arch))
-#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT)
+#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT)
int xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch);
int xfs_cfork_format(xfs_dinode_core_t *dcp, int w);
-#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch)
-#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
+#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch)
+#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w)
#else
-#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \
+#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \
((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_format, arch) : INT_GET((dcp)->di_aformat, arch))
-#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT)
+#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET)
void xfs_cfork_fmt_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch);
void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n);
-#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch)
-#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
+#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch)
+#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n)
#else
-#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \
+#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \
((w) == XFS_DATA_FORK ? \
(INT_SET((dcp)->di_format, arch, (n))) : \
(INT_SET((dcp)->di_aformat, arch, (n))))
-#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
+#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS)
int xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch);
int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w);
-#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch)
-#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
+#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch)
+#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w)
#else
-#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \
+#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \
((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_nextents, arch) : INT_GET((dcp)->di_anextents, arch))
-#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT)
+#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET)
void xfs_cfork_next_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch);
void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n);
-#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch)
-#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
+#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch)
+#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n)
#else
-#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \
+#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \
((w) == XFS_DATA_FORK ? \
(INT_SET((dcp)->di_nextents, arch, (n))) : \
(INT_SET((dcp)->di_anextents, arch, (n))))
-#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
+#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FORMAT)
int xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
int xfs_dfork_format(xfs_dinode_t *dip, int w);
-#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch)
-#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w)
+#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch)
+#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w)
#else
-#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch)
-#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT)
+#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch)
+#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FMT_SET)
void xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch);
void xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n);
-#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch)
-#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n)
+#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch)
+#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n)
#else
-#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch)
-#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
+#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch)
+#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS)
int xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch);
int xfs_dfork_nextents(xfs_dinode_t *dip, int w);
-#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch)
-#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
+#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch)
+#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w)
#else
-#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch)
-#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT)
+#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch)
+#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXT_SET)
void xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch);
void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
-#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch)
-#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n)
+#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch)
+#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n)
#else
-#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch)
-#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
+#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch)
+#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT)
#endif
/*
* File types (mode field)
*/
-#define IFMT 0170000 /* type of file */
-#define IFIFO 0010000 /* named pipe (fifo) */
-#define IFCHR 0020000 /* character special */
-#define IFDIR 0040000 /* directory */
-#define IFBLK 0060000 /* block special */
-#define IFREG 0100000 /* regular */
-#define IFLNK 0120000 /* symbolic link */
-#define IFSOCK 0140000 /* socket */
-#define IFMNT 0160000 /* mount point */
+#define IFMT 0170000 /* type of file */
+#define IFIFO 0010000 /* named pipe (fifo) */
+#define IFCHR 0020000 /* character special */
+#define IFDIR 0040000 /* directory */
+#define IFBLK 0060000 /* block special */
+#define IFREG 0100000 /* regular */
+#define IFLNK 0120000 /* symbolic link */
+#define IFSOCK 0140000 /* socket */
+#define IFMNT 0160000 /* mount point */
/*
* File execution and access modes.
*/
-#define ISUID 04000 /* set user id on execution */
-#define ISGID 02000 /* set group id on execution */
-#define ISVTX 01000 /* sticky directory */
-#define IREAD 0400 /* read, write, execute permissions */
-#define IWRITE 0200
-#define IEXEC 0100
+#define ISUID 04000 /* set user id on execution */
+#define ISGID 02000 /* set group id on execution */
+#define ISVTX 01000 /* sticky directory */
+#define IREAD 0400 /* read, write, execute permissions */
+#define IWRITE 0200
+#define IEXEC 0100
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE)
xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
-#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
+#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
#else
-#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp)))
#endif
/*
* 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_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
+#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_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_ALL \
+#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
+#define XFS_DIFLAG_ALL \
(XFS_DIFLAG_REALTIME|XFS_DIFLAG_PREALLOC|XFS_DIFLAG_NEWRTBM)
#endif /* __XFS_DINODE_H__ */
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR_H__
-#define __XFS_DIR_H__
+#define __XFS_DIR_H__
/*
* Large directories are structured around Btrees where all the data
* elements are in the leaf nodes. Filenames are hashed into an int,
* then that int is used as the index into the Btree. Since the hashval
- * of a filename may not be unique, we may have duplicate keys. The
+ * of a filename may not be unique, we may have duplicate keys. The
* internal links in the Btree are logical block offsets into the file.
*
* Small directories use a different format and are packed as tightly
*/
#ifdef XFS_ALL_TRACE
-#define XFS_DIR_TRACE
+#define XFS_DIR_TRACE
#endif
#if !defined(DEBUG)
*/
void xfs_dir_startup(void); /* called exactly once */
-#define XFS_DIR_MOUNT(mp) \
+#define XFS_DIR_MOUNT(mp) \
((mp)->m_dirops.xd_mount(mp))
-#define XFS_DIR_ISEMPTY(mp,dp) \
+#define XFS_DIR_ISEMPTY(mp,dp) \
((mp)->m_dirops.xd_isempty(dp))
-#define XFS_DIR_INIT(mp,tp,dp,pdp) \
+#define XFS_DIR_INIT(mp,tp,dp,pdp) \
((mp)->m_dirops.xd_init(tp,dp,pdp))
-#define XFS_DIR_CREATENAME(mp,tp,dp,name,namelen,inum,first,flist,total) \
+#define XFS_DIR_CREATENAME(mp,tp,dp,name,namelen,inum,first,flist,total) \
((mp)->m_dirops.xd_createname(tp,dp,name,namelen,inum,first,flist,\
total))
-#define XFS_DIR_LOOKUP(mp,tp,dp,name,namelen,inum) \
+#define XFS_DIR_LOOKUP(mp,tp,dp,name,namelen,inum) \
((mp)->m_dirops.xd_lookup(tp,dp,name,namelen,inum))
-#define XFS_DIR_REMOVENAME(mp,tp,dp,name,namelen,ino,first,flist,total) \
+#define XFS_DIR_REMOVENAME(mp,tp,dp,name,namelen,ino,first,flist,total) \
((mp)->m_dirops.xd_removename(tp,dp,name,namelen,ino,first,flist,total))
-#define XFS_DIR_GETDENTS(mp,tp,dp,uio,eofp) \
+#define XFS_DIR_GETDENTS(mp,tp,dp,uio,eofp) \
((mp)->m_dirops.xd_getdents(tp,dp,uio,eofp))
-#define XFS_DIR_REPLACE(mp,tp,dp,name,namelen,inum,first,flist,total) \
+#define XFS_DIR_REPLACE(mp,tp,dp,name,namelen,inum,first,flist,total) \
((mp)->m_dirops.xd_replace(tp,dp,name,namelen,inum,first,flist,total))
-#define XFS_DIR_CANENTER(mp,tp,dp,name,namelen) \
+#define XFS_DIR_CANENTER(mp,tp,dp,name,namelen) \
((mp)->m_dirops.xd_canenter(tp,dp,name,namelen))
-#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) \
+#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) \
((mp)->m_dirops.xd_shortform_validate_ondisk(mp,dip))
-#define XFS_DIR_SHORTFORM_TO_SINGLE(mp,args) \
+#define XFS_DIR_SHORTFORM_TO_SINGLE(mp,args) \
((mp)->m_dirops.xd_shortform_to_single(args))
-#define XFS_DIR_IS_V1(mp) ((mp)->m_dirversion == 1)
+#define XFS_DIR_IS_V1(mp) ((mp)->m_dirversion == 1)
extern xfs_dirops_t xfsv1_dirops;
#endif /* __XFS_DIR_H__ */
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_H__
-#define __XFS_DIR2_H__
+#define __XFS_DIR2_H__
struct dirent;
struct uio;
/*
* Byte offset in data block and shortform entry.
*/
-typedef __uint16_t xfs_dir2_data_off_t;
-#define NULLDATAOFF 0xffffU
+typedef __uint16_t xfs_dir2_data_off_t;
+#define NULLDATAOFF 0xffffU
typedef uint xfs_dir2_data_aoff_t; /* argument form */
/*
* Directory block number (logical dirblk in file)
*/
-typedef __uint32_t xfs_dir2_db_t;
+typedef __uint32_t xfs_dir2_db_t;
/*
* Byte offset in a directory.
*/
-typedef xfs_off_t xfs_dir2_off_t;
+typedef xfs_off_t xfs_dir2_off_t;
/*
* For getdents, argument struct for put routines.
struct uio *uio; /* uio control structure */
} xfs_dir2_put_args_t;
-#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2)
+#define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2)
extern xfs_dirops_t xfsv2_dirops;
/*
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_BLOCK_H__
-#define __XFS_DIR2_BLOCK_H__
+#define __XFS_DIR2_BLOCK_H__
/*
* xfs_dir2_block.h
* xfs_dir2_block_tail_t structure
*/
-#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */
+#define XFS_DIR2_BLOCK_MAGIC 0x58443242 /* XD2B: for one block dirs */
typedef struct xfs_dir2_block_tail {
__uint32_t count; /* count of leaf entries */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_TAIL_P)
xfs_dir2_block_tail_t *
xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block);
-#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block)
+#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block)
#else
-#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \
+#define XFS_DIR2_BLOCK_TAIL_P(mp,block) \
(((xfs_dir2_block_tail_t *)((char *)(block) + (mp)->m_dirblksize)) - 1)
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_LEAF_P)
struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p_arch(
- xfs_dir2_block_tail_t *btp, xfs_arch_t arch);
-#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \
- xfs_dir2_block_leaf_p_arch(btp,arch)
+ xfs_dir2_block_tail_t *btp, xfs_arch_t arch);
+#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \
+ xfs_dir2_block_leaf_p_arch(btp,arch)
#else
-#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \
+#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \
(((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, arch))
#endif
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_DATA_H__
-#define __XFS_DIR2_DATA_H__
+#define __XFS_DIR2_DATA_H__
/*
* Directory format 2, data block structures.
/*
* Constants.
*/
-#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multiblock dirs */
-#define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */
-#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG)
-#define XFS_DIR2_DATA_FREE_TAG 0xffff
-#define XFS_DIR2_DATA_FD_COUNT 3
+#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multiblock dirs */
+#define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */
+#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG)
+#define XFS_DIR2_DATA_FREE_TAG 0xffff
+#define XFS_DIR2_DATA_FD_COUNT 3
/*
* Directory address space divided into sections,
* spaces separated by 32gb.
*/
-#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG))
-#define XFS_DIR2_DATA_SPACE 0
-#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)
-#define XFS_DIR2_DATA_FIRSTDB(mp) \
+#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG))
+#define XFS_DIR2_DATA_SPACE 0
+#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)
+#define XFS_DIR2_DATA_FIRSTDB(mp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATA_OFFSET)
/*
* Offsets of . and .. in data space (always block 0)
*/
-#define XFS_DIR2_DATA_DOT_OFFSET \
+#define XFS_DIR2_DATA_DOT_OFFSET \
((xfs_dir2_data_aoff_t)sizeof(xfs_dir2_data_hdr_t))
-#define XFS_DIR2_DATA_DOTDOT_OFFSET \
+#define XFS_DIR2_DATA_DOTDOT_OFFSET \
(XFS_DIR2_DATA_DOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(1))
-#define XFS_DIR2_DATA_FIRST_OFFSET \
+#define XFS_DIR2_DATA_FIRST_OFFSET \
(XFS_DIR2_DATA_DOTDOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(2))
/*
int xfs_dir2_data_entsize(int n);
#define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n)
#else
-#define XFS_DIR2_DATA_ENTSIZE(n) \
+#define XFS_DIR2_DATA_ENTSIZE(n) \
((int)(roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
(uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN)))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTRY_TAG_P)
xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep);
-#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
+#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
#else
-#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \
+#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \
((xfs_dir2_data_off_t *)\
((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \
(uint)sizeof(xfs_dir2_data_off_t)))
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P)
xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p_arch(
- xfs_dir2_data_unused_t *dup, xfs_arch_t arch);
-#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \
- xfs_dir2_data_unused_tag_p_arch(dup,arch)
+ xfs_dir2_data_unused_t *dup, xfs_arch_t arch);
+#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \
+ xfs_dir2_data_unused_tag_p_arch(dup,arch)
#else
-#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \
+#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \
((xfs_dir2_data_off_t *)\
((char *)(dup) + INT_GET((dup)->length, arch) \
- - (uint)sizeof(xfs_dir2_data_off_t)))
+ - (uint)sizeof(xfs_dir2_data_off_t)))
#endif
/*
extern void
xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
#else
-#define xfs_dir2_data_check(dp,bp)
+#define xfs_dir2_data_check(dp,bp)
#endif
extern xfs_dir2_data_free_t *
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_LEAF_H__
-#define __XFS_DIR2_LEAF_H__
+#define __XFS_DIR2_LEAF_H__
/*
* Directory version 2, leaf block structures.
* Offset of the leaf/node space. First block in this space
* is the btree root.
*/
-#define XFS_DIR2_LEAF_SPACE 1
-#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)
-#define XFS_DIR2_LEAF_FIRSTDB(mp) \
+#define XFS_DIR2_LEAF_SPACE 1
+#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)
+#define XFS_DIR2_LEAF_FIRSTDB(mp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET)
/*
/*
* Offset in data space of a data entry.
*/
-typedef __uint32_t xfs_dir2_dataptr_t;
-#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0x7fffffff)
-#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0)
+typedef __uint32_t xfs_dir2_dataptr_t;
+#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0x7fffffff)
+#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0)
/*
* Structures.
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_MAX_LEAF_ENTS)
int
xfs_dir2_max_leaf_ents(struct xfs_mount *mp);
-#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
+#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
xfs_dir2_max_leaf_ents(mp)
#else
-#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
+#define XFS_DIR2_MAX_LEAF_ENTS(mp) \
((int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) / \
(uint)sizeof(xfs_dir2_leaf_entry_t)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_TAIL_P)
xfs_dir2_leaf_tail_t *
xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp);
-#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \
+#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \
xfs_dir2_leaf_tail_p(mp, lp)
#else
-#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \
+#define XFS_DIR2_LEAF_TAIL_P(mp,lp) \
((xfs_dir2_leaf_tail_t *)\
((char *)(lp) + (mp)->m_dirblksize - \
(uint)sizeof(xfs_dir2_leaf_tail_t)))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P)
xfs_dir2_data_off_t *
xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch);
-#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch)
+#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch)
#else
-#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \
+#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \
((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, arch))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_BYTE)
xfs_dir2_off_t
xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
-#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)
+#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)
#else
-#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \
+#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) \
((xfs_dir2_off_t)(dp) << XFS_DIR2_DATA_ALIGN_LOG)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DATAPTR)
xfs_dir2_dataptr_t
xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by);
-#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by)
+#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by)
#else
-#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \
+#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) \
((xfs_dir2_dataptr_t)((by) >> XFS_DIR2_DATA_ALIGN_LOG))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_DB)
xfs_dir2_db_t
xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
-#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
+#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
#else
-#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \
+#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATAPTR_TO_OFF)
xfs_dir2_data_aoff_t
xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp);
-#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
+#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
#else
-#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \
+#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) \
XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp))
#endif
xfs_dir2_off_t
xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
xfs_dir2_data_aoff_t o);
-#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
+#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
xfs_dir2_db_off_to_byte(mp, db, o)
#else
-#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
+#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
(((xfs_dir2_off_t)(db) << \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)) + (o))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DB)
xfs_dir2_db_t xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by);
-#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
+#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
#else
-#define XFS_DIR2_BYTE_TO_DB(mp,by) \
+#define XFS_DIR2_BYTE_TO_DB(mp,by) \
((xfs_dir2_db_t)((by) >> \
((mp)->m_sb.sb_blocklog + (mp)->m_sb.sb_dirblklog)))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_DA)
xfs_dablk_t xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by);
-#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
+#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
#else
-#define XFS_DIR2_BYTE_TO_DA(mp,by) \
+#define XFS_DIR2_BYTE_TO_DA(mp,by) \
XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BYTE_TO_OFF)
xfs_dir2_data_aoff_t
xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by);
-#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
+#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
#else
-#define XFS_DIR2_BYTE_TO_OFF(mp,by) \
+#define XFS_DIR2_BYTE_TO_OFF(mp,by) \
((xfs_dir2_data_aoff_t)((by) & \
((1 << ((mp)->m_sb.sb_blocklog + \
(mp)->m_sb.sb_dirblklog)) - 1)))
xfs_dir2_dataptr_t
xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
xfs_dir2_data_aoff_t o);
-#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
+#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
xfs_dir2_db_off_to_dataptr(mp, db, o)
#else
-#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
+#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_DA)
xfs_dablk_t xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db);
-#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
+#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
#else
-#define XFS_DIR2_DB_TO_DA(mp,db) \
+#define XFS_DIR2_DB_TO_DA(mp,db) \
((xfs_dablk_t)((db) << (mp)->m_sb.sb_dirblklog))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DA_TO_DB)
xfs_dir2_db_t xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da);
-#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da)
+#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da)
#else
-#define XFS_DIR2_DA_TO_DB(mp,da) \
+#define XFS_DIR2_DA_TO_DB(mp,da) \
((xfs_dir2_db_t)((da) >> (mp)->m_sb.sb_dirblklog))
#endif
xfs_dir2_off_t xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da);
#define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da)
#else
-#define XFS_DIR2_DA_TO_BYTE(mp,da) \
+#define XFS_DIR2_DA_TO_BYTE(mp,da) \
XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0)
#endif
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_NODE_H__
-#define __XFS_DIR2_NODE_H__
+#define __XFS_DIR2_NODE_H__
/*
* Directory version 2, btree node format structures
/*
* Offset of the freespace index.
*/
-#define XFS_DIR2_FREE_SPACE 2
-#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)
-#define XFS_DIR2_FREE_FIRSTDB(mp) \
+#define XFS_DIR2_FREE_SPACE 2
+#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)
+#define XFS_DIR2_FREE_FIRSTDB(mp) \
XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_FREE_OFFSET)
-#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
+#define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
/*
* Structures.
*/
-typedef struct xfs_dir2_free_hdr {
+typedef struct xfs_dir2_free_hdr {
__uint32_t magic; /* XFS_DIR2_FREE_MAGIC */
__int32_t firstdb; /* db of first entry */
__int32_t nvalid; /* count of valid entries */
xfs_dir2_data_off_t bests[1]; /* best free counts */
/* unused entries are -1 */
} xfs_dir2_free_t;
-#define XFS_DIR2_MAX_FREE_BESTS(mp) \
+#define XFS_DIR2_MAX_FREE_BESTS(mp) \
(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_free_hdr_t)) / \
(uint)sizeof(xfs_dir2_data_off_t))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDB)
xfs_dir2_db_t
xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db);
-#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
+#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
#else
-#define XFS_DIR2_DB_TO_FDB(mp,db) \
+#define XFS_DIR2_DB_TO_FDB(mp,db) \
(XFS_DIR2_FREE_FIRSTDB(mp) + (db) / XFS_DIR2_MAX_FREE_BESTS(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DB_TO_FDINDEX)
int
xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db);
-#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
+#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
#else
-#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp))
+#define XFS_DIR2_DB_TO_FDINDEX(mp,db) ((db) % XFS_DIR2_MAX_FREE_BESTS(mp))
#endif
-/*
+/*
* Functions.
*/
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR2_SF_H__
-#define __XFS_DIR2_SF_H__
+#define __XFS_DIR2_SF_H__
/*
* Directory layout when stored internal to an inode.
/*
* Maximum size of a shortform directory.
*/
-#define XFS_DIR2_SF_MAX_SIZE \
+#define XFS_DIR2_SF_MAX_SIZE \
(XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \
(uint)sizeof(xfs_agino_t))
/*
* Inode number stored as 8 8-bit values.
*/
-typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t;
+typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t;
-#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \
+#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \
(xfs_ino_t)(DIRINO_GET_ARCH(&di,arch))
-#define XFS_DIR2_SF_GET_INO8(di) \
- XFS_DIR2_SF_GET_INO8_ARCH(di,ARCH_NOCONVERT)
+#define XFS_DIR2_SF_GET_INO8(di) \
+ XFS_DIR2_SF_GET_INO8_ARCH(di,ARCH_NOCONVERT)
/*
* Inode number stored as 4 8-bit values.
* fit in 32 bits.
*/
typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t;
-#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \
+#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \
(xfs_ino_t)(DIRINO4_GET_ARCH(&di,arch))
-#define XFS_DIR2_SF_GET_INO4(di) \
+#define XFS_DIR2_SF_GET_INO4(di) \
XFS_DIR2_SF_GET_INO4_ARCH(di,ARCH_NOCONVERT)
typedef union {
- xfs_dir2_ino8_t i8;
- xfs_dir2_ino4_t i4;
+ xfs_dir2_ino8_t i8;
+ xfs_dir2_ino4_t i4;
} xfs_dir2_inou_t;
-#define XFS_DIR2_MAX_SHORT_INUM ((xfs_ino_t)0xffffffffULL)
+#define XFS_DIR2_MAX_SHORT_INUM ((xfs_ino_t)0xffffffffULL)
/*
* Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t.
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_HDR_SIZE)
int xfs_dir2_sf_hdr_size(int i8count);
-#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count)
+#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count)
#else
-#define XFS_DIR2_SF_HDR_SIZE(i8count) \
+#define XFS_DIR2_SF_HDR_SIZE(i8count) \
((uint)sizeof(xfs_dir2_sf_hdr_t) - \
((i8count) == 0) * \
((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_INUMBERP)
xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep);
-#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep)
+#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep)
#else
-#define XFS_DIR2_SF_INUMBERP(sfep) \
+#define XFS_DIR2_SF_INUMBERP(sfep) \
((xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER)
-xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from,
- xfs_arch_t arch);
-#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \
+xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from,
+ xfs_arch_t arch);
+#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \
xfs_dir2_sf_get_inumber_arch(sfp, from, arch)
#else
-#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \
+#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \
((sfp)->hdr.i8count == 0 ? \
(xfs_intino_t)XFS_DIR2_SF_GET_INO4_ARCH(*(from), arch) : \
(xfs_intino_t)XFS_DIR2_SF_GET_INO8_ARCH(*(from), arch))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER)
void xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
- xfs_dir2_inou_t *to, xfs_arch_t arch);
-#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \
+ xfs_dir2_inou_t *to, xfs_arch_t arch);
+#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \
xfs_dir2_sf_put_inumber_arch(sfp,from,to,arch)
#else
-#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \
+#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \
if ((sfp)->hdr.i8count == 0) { \
- DIRINO4_COPY_ARCH(from,to,arch); \
- } else { \
- DIRINO_COPY_ARCH(from,to,arch); \
- }
+ DIRINO4_COPY_ARCH(from,to,arch); \
+ } else { \
+ DIRINO_COPY_ARCH(from,to,arch); \
+ }
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_OFFSET)
-xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset_arch(xfs_dir2_sf_entry_t *sfep,
- xfs_arch_t arch);
+xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset_arch(xfs_dir2_sf_entry_t *sfep,
+ xfs_arch_t arch);
xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep);
-#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \
- xfs_dir2_sf_get_offset_arch(sfep,arch)
+#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \
+ xfs_dir2_sf_get_offset_arch(sfep,arch)
#else
-#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \
- INT_GET_UNALIGNED_16_ARCH(&(sfep)->offset.i,arch)
+#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \
+ INT_GET_UNALIGNED_16_ARCH(&(sfep)->offset.i,arch)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET)
void xfs_dir2_sf_put_offset_arch(xfs_dir2_sf_entry_t *sfep,
- xfs_dir2_data_aoff_t off, xfs_arch_t arch);
-#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \
- xfs_dir2_sf_put_offset_arch(sfep,off,arch)
+ xfs_dir2_data_aoff_t off, xfs_arch_t arch);
+#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \
+ xfs_dir2_sf_put_offset_arch(sfep,off,arch)
#else
-#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \
- INT_SET_UNALIGNED_16_ARCH(&(sfep)->offset.i,off,arch)
+#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \
+ INT_SET_UNALIGNED_16_ARCH(&(sfep)->offset.i,off,arch)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME)
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR_LEAF_H__
-#define __XFS_DIR_LEAF_H__
+#define __XFS_DIR_LEAF_H__
/*
* Directory layout, internal structure, access macros, etc.
* Large directories are structured around Btrees where all the data
* elements are in the leaf nodes. Filenames are hashed into an int,
* then that int is used as the index into the Btree. Since the hashval
- * of a filename may not be unique, we may have duplicate keys. The
+ * of a filename may not be unique, we may have duplicate keys. The
* internal links in the Btree are logical block offsets into the file.
*/
/*
* This is the structure of the leaf nodes in the Btree.
*
- * Struct leaf_entry's are packed from the top. Names grow from the bottom
- * but are not packed. The freemap contains run-length-encoded entries
+ * Struct leaf_entry's are packed from the top. Names grow from the bottom
+ * but are not packed. The freemap contains run-length-encoded entries
* for the free bytes after the leaf_entry's, but only the N largest such,
* smaller runs are dropped. When the freemap doesn't show enough space
* for an allocation, we compact the namelist area and try again. If we
* The parent directory and the self-pointer are explicitly represented
* (ie: there are entries for "." and "..").
*
- * Note that the count being a __uint16_t limits us to something like a
+ * Note that the count being a __uint16_t limits us to something like a
* blocksize of 1.3MB in the face of worst case (short) filenames.
*/
#define XFS_DIR_LEAF_MAPSIZE 3 /* how many freespace slots */
* Length of name for which a 512-byte block filesystem
* can get a double split.
*/
-#define XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN \
+#define XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN \
(512 - (uint)sizeof(xfs_dir_leaf_hdr_t) - \
(uint)sizeof(xfs_dir_leaf_entry_t) * 2 - \
(uint)sizeof(xfs_dir_leaf_name_t) * 2 - (MAXNAMELEN - 2) + 1 + 1)
} s;
} xfs_dircook_t;
-#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \
+#define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \
((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash))
-#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \
+#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \
DIRINO_GET_ARCH(&(di),arch)
-#define XFS_GET_DIR_INO(mp,di) \
+#define XFS_GET_DIR_INO(mp,di) \
XFS_GET_DIR_INO_ARCH(mp,di,ARCH_NOCONVERT)
typedef struct xfs_dir_put_args
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DIR_SF_H__
-#define __XFS_DIR_SF_H__
+#define __XFS_DIR_SF_H__
/*
* Directory layout when stored internal to an inode.
/*
* We generate this then sort it, so that readdirs are returned in
- * hash-order. Else seekdir won't work.
+ * hash-order. Else seekdir won't work.
*/
typedef struct xfs_dir_sf_sort {
__uint8_t entno; /* .=0, ..=1, else entry# + 2 */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO)
void xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch);
void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to);
-#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch)
-#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
+#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch)
+#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
#else
-#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
-#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
+#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
+#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO)
void xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch);
void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to);
-#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch)
-#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
+#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch)
+#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
#else
-#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
-#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
+#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
+#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME)
int xfs_dir_sf_entsize_byname(int len);
#endif
#ifdef XFS_ALL_TRACE
-#define XFS_DIR_TRACE
+#define XFS_DIR_TRACE
#endif
#if !defined(DEBUG)
struct xfs_dir_leafblock;
struct xfs_dir_leaf_entry;
-#define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */
+#define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */
/*
* Trace record types.
*/
-#define XFS_DIR_KTRACE_G_DU 1 /* dp, uio */
-#define XFS_DIR_KTRACE_G_DUB 2 /* dp, uio, bno */
-#define XFS_DIR_KTRACE_G_DUN 3 /* dp, uio, node */
-#define XFS_DIR_KTRACE_G_DUL 4 /* dp, uio, leaf */
-#define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */
-#define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */
+#define XFS_DIR_KTRACE_G_DU 1 /* dp, uio */
+#define XFS_DIR_KTRACE_G_DUB 2 /* dp, uio, bno */
+#define XFS_DIR_KTRACE_G_DUN 3 /* dp, uio, node */
+#define XFS_DIR_KTRACE_G_DUL 4 /* dp, uio, leaf */
+#define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */
+#define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */
#if defined(XFS_DIR_TRACE)
__psunsigned_t a8, __psunsigned_t a9,
__psunsigned_t a10, __psunsigned_t a11);
#else
-#define xfs_dir_trace_g_du(w,d,u)
-#define xfs_dir_trace_g_dub(w,d,u,b)
-#define xfs_dir_trace_g_dun(w,d,u,n)
-#define xfs_dir_trace_g_dul(w,d,u,l)
-#define xfs_dir_trace_g_due(w,d,u,e)
-#define xfs_dir_trace_g_duc(w,d,u,c)
+#define xfs_dir_trace_g_du(w,d,u)
+#define xfs_dir_trace_g_dub(w,d,u,b)
+#define xfs_dir_trace_g_dun(w,d,u,n)
+#define xfs_dir_trace_g_dul(w,d,u,l)
+#define xfs_dir_trace_g_due(w,d,u,e)
+#define xfs_dir_trace_g_duc(w,d,u,c)
#endif /* DEBUG */
#endif /* __XFS_DIR_SF_H__ */
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DQBLK_H__
/*
* The ondisk form of a dquot structure.
*/
-#define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
+#define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
#define XFS_DQUOT_VERSION (u_int8_t)0x01 /* latest version number */
-/*
- * This is the main portion of the on-disk representation of quota
+/*
+ * This is the main portion of the on-disk representation of quota
* information for a user. This is the q_core of the xfs_dquot_t that
* is kept in kernel memory. We pad this with some more expansion room
* to construct the on disk structure.
/*64*/ xfs_qcnt_t d_ino_softlimit;/* preferred inode limit */
/*64*/ xfs_qcnt_t d_bcount; /* disk blocks owned by the user */
/*64*/ xfs_qcnt_t d_icount; /* inodes owned by the user */
-/*32*/ __int32_t d_itimer; /* zero if within inode limits if not,
+/*32*/ __int32_t d_itimer; /* zero if within inode limits if not,
this is when we refuse service */
/*32*/ __int32_t d_btimer; /* similar to above; for disk blocks */
-/*16*/ xfs_qwarncnt_t d_iwarns; /* warnings issued wrt num inodes */
-/*16*/ xfs_qwarncnt_t d_bwarns; /* warnings issued wrt disk blocks */
+/*16*/ xfs_qwarncnt_t d_iwarns; /* warnings issued wrt num inodes */
+/*16*/ xfs_qwarncnt_t d_bwarns; /* warnings issued wrt disk blocks */
/*32*/ __int32_t d_pad0; /* 64 bit align */
/*64*/ xfs_qcnt_t d_rtb_hardlimit;/* absolute limit on realtime blks */
/*64*/ xfs_qcnt_t d_rtb_softlimit;/* preferred limit on RT disk blks */
/*64*/ xfs_qcnt_t d_rtbcount; /* realtime blocks owned */
/*32*/ __int32_t d_rtbtimer; /* similar to above; for RT disk blocks */
-/*16*/ xfs_qwarncnt_t d_rtbwarns; /* warnings issued wrt RT disk blocks */
+/*16*/ xfs_qwarncnt_t d_rtbwarns; /* warnings issued wrt RT disk blocks */
/*16*/ __uint16_t d_pad;
} xfs_disk_dquot_t;
*/
typedef struct xfs_dqblk {
xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */
- char dd_fill[32]; /* filling for posterity */
+ char dd_fill[32]; /* filling for posterity */
} xfs_dqblk_t;
/*
* flags for q_flags field in the dquot.
*/
-#define XFS_DQ_USER 0x0001 /* a user quota */
-/* #define XFS_DQ_PROJ 0x0002 -- project quota (IRIX) */
-#define XFS_DQ_GROUP 0x0004 /* a group quota */
+#define XFS_DQ_USER 0x0001 /* a user quota */
+/* #define XFS_DQ_PROJ 0x0002 -- project quota (IRIX) */
+#define XFS_DQ_GROUP 0x0004 /* a group quota */
#define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */
#define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */
#define XFS_DQ_WANT 0x0020 /* for lookup/reclaim race */
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_DQUOT_ITEM_H__
* We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
* to the first and ensures that the first logitem is taken out of the AIL
* only when the last one is securely committed.
- */
+ */
typedef struct xfs_qoff_logformat {
unsigned short qf_type; /* quotaoff log item type */
unsigned short qf_size; /* size of this item */
xfs_log_item_t qli_item; /* common portion */
struct xfs_dquot *qli_dquot; /* dquot ptr */
xfs_lsn_t qli_flush_lsn; /* lsn at last flush */
- unsigned short qli_pushbuf_flag; /* one bit used in push_ail */
+ unsigned short qli_pushbuf_flag; /* one bit used in push_ail */
#ifdef DEBUG
- uint64_t qli_push_owner;
+ uint64_t qli_push_owner;
#endif
xfs_dq_logformat_t qli_format; /* logged structure */
} xfs_dq_logitem_t;
typedef struct xfs_qoff_logitem {
xfs_log_item_t qql_item; /* common portion */
- struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */
+ struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if any */
xfs_qoff_logformat_t qql_format; /* logged structure */
} xfs_qoff_logitem_t;
extern void xfs_qm_dquot_logitem_init(struct xfs_dquot *);
-extern xfs_qoff_logitem_t *xfs_qm_qoff_logitem_init(struct xfs_mount *,
+extern xfs_qoff_logitem_t *xfs_qm_qoff_logitem_init(struct xfs_mount *,
xfs_qoff_logitem_t *, uint);
-extern xfs_qoff_logitem_t *xfs_trans_get_qoff_item(struct xfs_trans *,
+extern xfs_qoff_logitem_t *xfs_trans_get_qoff_item(struct xfs_trans *,
xfs_qoff_logitem_t *, uint);
extern void xfs_trans_log_quotaoff_item(struct xfs_trans *,
xfs_qoff_logitem_t *);
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_EXTFREE_ITEM_H__
-#define __XFS_EXTFREE_ITEM_H__
+#ifndef __XFS_EXTFREE_ITEM_H__
+#define __XFS_EXTFREE_ITEM_H__
struct xfs_mount;
struct xfs_zone;
/*
* This is the structure used to lay out an efi log item in the
- * log. The efi_extents field is a variable size array whose
+ * log. The efi_extents field is a variable size array whose
* size is given by efi_nextents.
*/
typedef struct xfs_efi_log_format {
unsigned short efi_size; /* size of this item */
uint efi_nextents; /* # extents to free */
__uint64_t efi_id; /* efi identifier */
- xfs_extent_t efi_extents[1]; /* array of extents to free */
+ xfs_extent_t efi_extents[1]; /* array of extents to free */
} xfs_efi_log_format_t;
/*
* This is the structure used to lay out an efd log item in the
- * log. The efd_extents array is a variable size array whose
+ * log. The efd_extents array is a variable size array whose
* size is given by efd_nextents;
*/
typedef struct xfs_efd_log_format {
unsigned short efd_size; /* size of this item */
uint efd_nextents; /* # of extents freed */
__uint64_t efd_efi_id; /* id of corresponding efi */
- xfs_extent_t efd_extents[1]; /* array of extents freed */
+ xfs_extent_t efd_extents[1]; /* array of extents freed */
} xfs_efd_log_format_t;
/*
* Max number of extents in fast allocation path.
*/
-#define XFS_EFI_MAX_FAST_EXTENTS 16
+#define XFS_EFI_MAX_FAST_EXTENTS 16
/*
* Define EFI flags.
*/
-#define XFS_EFI_RECOVERED 0x1
-#define XFS_EFI_COMMITTED 0x2
-#define XFS_EFI_CANCELED 0x4
+#define XFS_EFI_RECOVERED 0x1
+#define XFS_EFI_COMMITTED 0x2
+#define XFS_EFI_CANCELED 0x4
/*
* This is the "extent free intention" log item. It is used
/*
* Max number of extents in fast allocation path.
*/
-#define XFS_EFD_MAX_FAST_EXTENTS 16
+#define XFS_EFD_MAX_FAST_EXTENTS 16
extern struct xfs_zone *xfs_efi_zone;
extern struct xfs_zone *xfs_efd_zone;
*
* 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
+ * 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.
#define XFS_SUPER_MAGIC 0x58465342
#define XFS_NAME "xfs"
-/*
+/*
* Direct I/O attribute record used with XFS_IOC_DIOINFO
* d_miniosz is the min xfer size, xfer size multiple and file seek offset
* alignment.
*/
struct dioattr {
- __u32 d_mem; /* data buffer memory alignment */
+ __u32 d_mem; /* data buffer memory alignment */
__u32 d_miniosz; /* min xfer size */
__u32 d_maxiosz; /* max xfer size */
};
* Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR.
*/
struct fsxattr {
- __u32 fsx_xflags; /* xflags field value (get/set) */
- __u32 fsx_extsize; /* extsize field value (get/set)*/
- __u32 fsx_nextents; /* nextents field value (get) */
+ __u32 fsx_xflags; /* xflags field value (get/set) */
+ __u32 fsx_extsize; /* extsize field value (get/set)*/
+ __u32 fsx_nextents; /* nextents field value (get) */
unsigned char fsx_pad[16];
};
* There should be a one-to-one correspondence between these flags and the
* XFS_DIFLAG_s.
*/
-#define XFS_XFLAG_REALTIME 0x00000001
-#define XFS_XFLAG_PREALLOC 0x00000002
-#define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
-#define XFS_XFLAG_ALL \
+#define XFS_XFLAG_REALTIME 0x00000001
+#define XFS_XFLAG_PREALLOC 0x00000002
+#define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
+#define XFS_XFLAG_ALL \
( XFS_XFLAG_REALTIME|XFS_XFLAG_PREALLOC|XFS_XFLAG_HASATTR )
};
/*
- * Structure for XFS_IOC_GETBMAPX. Fields bmv_offset through bmv_entries
+ * Structure for XFS_IOC_GETBMAPX. Fields bmv_offset through bmv_entries
* are used exactly as in the getbmap structure. The getbmapx structure
* has additional bmv_iflags and bmv_oflags fields. The bmv_iflags field
- * is only used for the first structure. It contains input flags
+ * is only used for the first structure. It contains input flags
* specifying XFS_IOC_GETBMAPX actions. The bmv_oflags field is filled
* in by the XFS_IOC_GETBMAPX command for each returned structure after
* the first.
};
/* bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */
-#define BMV_IF_ATTRFORK 0x1 /* return attr fork rather than data */
+#define BMV_IF_ATTRFORK 0x1 /* return attr fork rather than data */
#define BMV_IF_NO_DMAPI_READ 0x2 /* Do not generate DMAPI read event */
#define BMV_IF_PREALLOC 0x4 /* rtn status BMV_OF_PREALLOC if req */
#define BMV_IF_VALID (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC)
#ifdef __KERNEL__
-#define BMV_IF_EXTENDED 0x40000000 /* getpmapx if set */
+#define BMV_IF_EXTENDED 0x40000000 /* getpmapx if set */
#endif
/* bmv_oflags values - returned for for each non-header segment */
#define BMV_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */
/* Convert getbmap <-> getbmapx - move fields from p1 to p2. */
-#define GETBMAP_CONVERT(p1,p2) { \
+#define GETBMAP_CONVERT(p1,p2) { \
p2.bmv_offset = p1.bmv_offset; \
p2.bmv_block = p1.bmv_block; \
p2.bmv_length = p1.bmv_length; \
__s16 l_whence;
__s64 l_start;
__s64 l_len; /* len == 0 means until end of file */
- __s32 l_sysid;
- pid_t l_pid;
+ __s32 l_sysid;
+ pid_t l_pid;
__s32 l_pad[4]; /* reserve area */
} xfs_flock64_t;
* Output for XFS_IOC_FSGEOMETRY_V1
*/
typedef struct xfs_fsop_geom_v1 {
- __u32 blocksize; /* filesystem (data) block size */
+ __u32 blocksize; /* filesystem (data) block size */
__u32 rtextsize; /* realtime extent size */
__u32 agblocks; /* fsblocks in an AG */
- __u32 agcount; /* number of allocation groups */
+ __u32 agcount; /* number of allocation groups */
__u32 logblocks; /* fsblocks in the log */
__u32 sectsize; /* (data) sector size, bytes */
__u32 inodesize; /* inode size in bytes */
* Output for XFS_IOC_FSGEOMETRY
*/
typedef struct xfs_fsop_geom {
- __u32 blocksize; /* filesystem (data) block size */
+ __u32 blocksize; /* filesystem (data) block size */
__u32 rtextsize; /* realtime extent size */
__u32 agblocks; /* fsblocks in an AG */
- __u32 agcount; /* number of allocation groups */
+ __u32 agcount; /* number of allocation groups */
__u32 logblocks; /* fsblocks in the log */
__u32 sectsize; /* (data) sector size, bytes */
__u32 inodesize; /* inode size in bytes */
__u64 resblks_avail;
} xfs_fsop_resblks_t;
-#define XFS_FSOP_GEOM_VERSION 0
+#define XFS_FSOP_GEOM_VERSION 0
-#define XFS_FSOP_GEOM_FLAGS_ATTR 0x01 /* attributes in use */
-#define XFS_FSOP_GEOM_FLAGS_NLINK 0x02 /* 32-bit nlink values */
-#define XFS_FSOP_GEOM_FLAGS_QUOTA 0x04 /* quotas enabled */
-#define XFS_FSOP_GEOM_FLAGS_IALIGN 0x08 /* inode alignment */
-#define XFS_FSOP_GEOM_FLAGS_DALIGN 0x10 /* large data alignment */
-#define XFS_FSOP_GEOM_FLAGS_SHARED 0x20 /* read-only shared */
-#define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x40 /* special extent flag */
-#define XFS_FSOP_GEOM_FLAGS_DIRV2 0x80 /* directory version 2 */
+#define XFS_FSOP_GEOM_FLAGS_ATTR 0x01 /* attributes in use */
+#define XFS_FSOP_GEOM_FLAGS_NLINK 0x02 /* 32-bit nlink values */
+#define XFS_FSOP_GEOM_FLAGS_QUOTA 0x04 /* quotas enabled */
+#define XFS_FSOP_GEOM_FLAGS_IALIGN 0x08 /* inode alignment */
+#define XFS_FSOP_GEOM_FLAGS_DALIGN 0x10 /* large data alignment */
+#define XFS_FSOP_GEOM_FLAGS_SHARED 0x20 /* read-only shared */
+#define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x40 /* special extent flag */
+#define XFS_FSOP_GEOM_FLAGS_DIRV2 0x80 /* directory version 2 */
#define XFS_FSOP_GEOM_FLAGS_LOGV2 0x100 /* log format version 2 */
/*
* Minimum and maximum sizes need for growth checks
*/
-#define XFS_MIN_AG_BLOCKS 64
-#define XFS_MIN_LOG_BLOCKS 512
-#define XFS_MAX_LOG_BLOCKS (64 * 1024)
-#define XFS_MIN_LOG_BYTES (256 * 1024)
-#define XFS_MAX_LOG_BYTES (128 * 1024 * 1024)
+#define XFS_MIN_AG_BLOCKS 64
+#define XFS_MIN_LOG_BLOCKS 512
+#define XFS_MAX_LOG_BLOCKS (64 * 1024)
+#define XFS_MIN_LOG_BYTES (256 * 1024)
+#define XFS_MAX_LOG_BYTES (128 * 1024 * 1024)
/*
* Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT
* Error injection.
*/
typedef struct xfs_error_injection {
- __s32 fd;
- __s32 errtag;
+ __s32 fd;
+ __s32 errtag;
} xfs_error_injection_t;
* Compound structures for passing args through Handle Request interfaces
* xfs_fssetdm_by_handle, xfs_attrlist_by_handle, xfs_attrmulti_by_handle
* - ioctls: XFS_IOC_FSSETDM_BY_HANDLE, XFS_IOC_ATTRLIST_BY_HANDLE, and
- * XFS_IOC_ATTRMULTI_BY_HANDLE
+ * XFS_IOC_ATTRMULTI_BY_HANDLE
*/
typedef struct xfs_fsop_setdm_handlereq {
struct xfs_fsop_handlereq hreq; /* handle interface structure */
- struct fsdmidata *data; /* DMAPI data to set */
+ struct fsdmidata *data; /* DMAPI data to set */
} xfs_fsop_setdm_handlereq_t;
typedef struct xfs_attrlist_cursor {
typedef struct xfs_fsop_attrlist_handlereq {
struct xfs_fsop_handlereq hreq; /* handle interface structure */
struct xfs_attrlist_cursor pos; /* opaque cookie, list offset */
- __u32 flags; /* flags, use ROOT/USER names */
- __u32 buflen; /* length of buffer supplied */
- void *buffer; /* attrlist data to return */
+ __u32 flags; /* flags, use ROOT/USER names */
+ __u32 buflen; /* length of buffer supplied */
+ void *buffer; /* attrlist data to return */
} xfs_fsop_attrlist_handlereq_t;
typedef struct xfs_attr_multiop {
typedef struct xfs_fsop_attrmulti_handlereq {
struct xfs_fsop_handlereq hreq; /* handle interface structure */
- __u32 opcount; /* count of following multiop */
- struct xfs_attr_multiop *ops; /* attr_multi data to get/set */
+ __u32 opcount; /* count of following multiop */
+ struct xfs_attr_multiop *ops; /* attr_multi data to get/set */
} xfs_fsop_attrmulti_handlereq_t;
/*
* This is typically called by a stateless file server in order to generate
* "file handles".
*/
-#define MAXFIDSZ 46
+#define MAXFIDSZ 46
typedef struct fid {
__u16 fid_len; /* length of data in bytes */
unsigned char fid_data[MAXFIDSZ]; /* data (variable length) */
__u16 xfs_fid_len; /* length of remainder */
__u16 xfs_fid_pad;
__u32 xfs_fid_gen; /* generation number */
- __u64 xfs_fid_ino; /* 64 bits inode number */
+ __u64 xfs_fid_ino; /* 64 bits inode number */
} xfs_fid_t;
typedef struct xfs_fid2 {
__s64 align; /* force alignment of ha_fid */
xfs_fsid_t _ha_fsid; /* unique file system identifier */
} ha_u;
- xfs_fid_t ha_fid; /* file system specific file ID */
+ xfs_fid_t ha_fid; /* file system specific file ID */
} xfs_handle_t;
#define ha_fsid ha_u._ha_fsid
-#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \
+#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \
- (char *) &(handle)) \
+ (handle).ha_fid.xfs_fid_len)
* For 'documentation' purposed more than anything else,
* the "cmd #" field reflects the IRIX fcntl number.
*/
-#define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)
-#define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)
-#define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr)
-#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
-#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
-#define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64)
-#define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64)
-#define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
-#define XFS_IOC_FSSETDM _IOW ('X', 39, struct fsdmidata)
-#define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64)
-#define XFS_IOC_UNRESVSP _IOW ('X', 41, struct xfs_flock64)
-#define XFS_IOC_RESVSP64 _IOW ('X', 42, struct xfs_flock64)
-#define XFS_IOC_UNRESVSP64 _IOW ('X', 43, struct xfs_flock64)
-#define XFS_IOC_GETBMAPA _IOWR('X', 44, struct getbmap)
-#define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr)
-/* XFS_IOC_SETBIOSIZE ---- deprecated 46 */
-/* XFS_IOC_GETBIOSIZE ---- deprecated 47 */
-#define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap)
+#define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)
+#define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)
+#define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr)
+#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
+#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)
+#define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64)
+#define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64)
+#define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
+#define XFS_IOC_FSSETDM _IOW ('X', 39, struct fsdmidata)
+#define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64)
+#define XFS_IOC_UNRESVSP _IOW ('X', 41, struct xfs_flock64)
+#define XFS_IOC_RESVSP64 _IOW ('X', 42, struct xfs_flock64)
+#define XFS_IOC_UNRESVSP64 _IOW ('X', 43, struct xfs_flock64)
+#define XFS_IOC_GETBMAPA _IOWR('X', 44, struct getbmap)
+#define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr)
+/* XFS_IOC_SETBIOSIZE ---- deprecated 46 */
+/* XFS_IOC_GETBIOSIZE ---- deprecated 47 */
+#define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap)
/*
* ioctl commands that replace IRIX syssgi()'s
*/
-#define XFS_IOC_FSGEOMETRY_V1 _IOR ('X', 100, struct xfs_fsop_geom_v1)
-#define XFS_IOC_FSBULKSTAT _IOWR('X', 101, struct xfs_fsop_bulkreq)
-#define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkreq)
-#define XFS_IOC_FSINUMBERS _IOWR('X', 103, struct xfs_fsop_bulkreq)
-#define XFS_IOC_PATH_TO_FSHANDLE _IOWR('X', 104, struct xfs_fsop_handlereq)
-#define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handlereq)
-#define XFS_IOC_FD_TO_HANDLE _IOWR('X', 106, struct xfs_fsop_handlereq)
-#define XFS_IOC_OPEN_BY_HANDLE _IOWR('X', 107, struct xfs_fsop_handlereq)
-#define XFS_IOC_READLINK_BY_HANDLE _IOWR('X', 108, struct xfs_fsop_handlereq)
+#define XFS_IOC_FSGEOMETRY_V1 _IOR ('X', 100, struct xfs_fsop_geom_v1)
+#define XFS_IOC_FSBULKSTAT _IOWR('X', 101, struct xfs_fsop_bulkreq)
+#define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkreq)
+#define XFS_IOC_FSINUMBERS _IOWR('X', 103, struct xfs_fsop_bulkreq)
+#define XFS_IOC_PATH_TO_FSHANDLE _IOWR('X', 104, struct xfs_fsop_handlereq)
+#define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handlereq)
+#define XFS_IOC_FD_TO_HANDLE _IOWR('X', 106, struct xfs_fsop_handlereq)
+#define XFS_IOC_OPEN_BY_HANDLE _IOWR('X', 107, struct xfs_fsop_handlereq)
+#define XFS_IOC_READLINK_BY_HANDLE _IOWR('X', 108, struct xfs_fsop_handlereq)
#define XFS_IOC_SWAPEXT _IOWR('X', 109, struct xfs_swapext)
-#define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data)
-#define XFS_IOC_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log)
-#define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt)
-#define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts)
-#define XFS_IOC_SET_RESBLKS _IOR ('X', 114, struct xfs_fsop_resblks)
-#define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks)
-#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)
-#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)
-/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */
+#define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data)
+#define XFS_IOC_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log)
+#define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt)
+#define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts)
+#define XFS_IOC_SET_RESBLKS _IOR ('X', 114, struct xfs_fsop_resblks)
+#define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks)
+#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)
+#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)
+/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */
#define XFS_IOC_FREEZE _IOWR('X', 119, int)
#define XFS_IOC_THAW _IOWR('X', 120, int)
-#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
-#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
-#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
-#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
-/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
+#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
+#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
+#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
+#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
+/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
/*
- * Block I/O parameterization. A basic block (BB) is the lowest size of
+ * Block I/O parameterization. A basic block (BB) is the lowest size of
* filesystem allocation, and must equal 512. Length units given to bio
* routines are in BB's.
*/
-#define BBSHIFT 9
-#define BBSIZE (1<<BBSHIFT)
-#define BBMASK (BBSIZE-1)
-#define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
-#define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
-#define BBTOB(bbs) ((bbs) << BBSHIFT)
+#define BBSHIFT 9
+#define BBSIZE (1<<BBSHIFT)
+#define BBMASK (BBSIZE-1)
+#define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
+#define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
+#define BBTOB(bbs) ((bbs) << BBSHIFT)
#define OFFTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
-#define OFFTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
-#define BBTOOFF(bbs) ((__u64)(bbs) << BBSHIFT)
-
+#define OFFTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
+#define BBTOOFF(bbs) ((__u64)(bbs) << BBSHIFT)
+
#define SEEKLIMIT32 0x7fffffff
#define BBSEEKLIMIT32 BTOBBT(SEEKLIMIT32)
#define SEEKLIMIT 0x7fffffffffffffffLL
-#define BBSEEKLIMIT OFFTOBBT(SEEKLIMIT)
+#define BBSEEKLIMIT OFFTOBBT(SEEKLIMIT)
#endif /* _LINUX_XFS_FS_H */
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_IALLOC_H__
-#define __XFS_IALLOC_H__
+#define __XFS_IALLOC_H__
struct xfs_buf;
struct xfs_dinode;
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_INODES)
int xfs_ialloc_inodes(struct xfs_mount *mp);
-#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp)
+#define XFS_IALLOC_INODES(mp) xfs_ialloc_inodes(mp)
#else
-#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos)
+#define XFS_IALLOC_INODES(mp) ((mp)->m_ialloc_inos)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_BLOCKS)
xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
-#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp)
+#define XFS_IALLOC_BLOCKS(mp) xfs_ialloc_blocks(mp)
#else
-#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks)
+#define XFS_IALLOC_BLOCKS(mp) ((mp)->m_ialloc_blks)
#endif
/*
* around for xfs_dilocate(). We choose which one to use in
* xfs_mount_int().
*/
-#define XFS_INODE_BIG_CLUSTER_SIZE 8192
-#define XFS_INODE_SMALL_CLUSTER_SIZE 4096
-#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size
+#define XFS_INODE_BIG_CLUSTER_SIZE 8192
+#define XFS_INODE_SMALL_CLUSTER_SIZE 4096
+#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size
/*
* Make an inode pointer out of the buffer/offset.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MAKE_IPTR)
struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o);
-#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
+#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
#else
-#define XFS_MAKE_IPTR(mp,b,o) \
+#define XFS_MAKE_IPTR(mp,b,o) \
((xfs_dinode_t *)(xfs_buf_offset(b, (o) << (mp)->m_sb.sb_inodelog)))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_FIND_FREE)
int xfs_ialloc_find_free(xfs_inofree_t *fp);
-#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
+#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
#else
-#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp))
+#define XFS_IALLOC_FIND_FREE(fp) xfs_lowbit64(*(fp))
#endif
*
* To work within the constraint of one allocation per transaction,
* xfs_dialloc() is designed to be called twice if it has to do an
- * allocation to make more free inodes. If an inode is
+ * allocation to make more free inodes. If an inode is
* available without an allocation, agbp would be set to the current
* agbp and alloc_done set to false.
* If an allocation needed to be done, agbp would be set to the
* inode header of the allocation group and alloc_done set to true.
* The caller should then commit the current transaction and allocate a new
- * transaction. xfs_dialloc() should then be called again with
+ * transaction. xfs_dialloc() should then be called again with
* the agbp value returned from the previous call.
*
* Once we successfully pick an inode its number is returned and the
- * on-disk data structures are updated. The inode itself is not read
+ * on-disk data structures are updated. The inode itself is not read
* in, since doing so would break ordering constraints with xfs_reclaim.
*
* *agbp should be set to NULL on the first call, *alloc_done set to FALSE.
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_IALLOC_BTREE_H__
-#define __XFS_IALLOC_BTREE_H__
+#define __XFS_IALLOC_BTREE_H__
/*
* Inode map on-disk structures
/*
* There is a btree for the inode map per allocation group.
*/
-#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */
+#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */
-typedef __uint64_t xfs_inofree_t;
-#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))
-#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
-#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
+typedef __uint64_t xfs_inofree_t;
+#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))
+#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
+#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASKN)
xfs_inofree_t xfs_inobt_maskn(int i, int n);
-#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
+#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
#else
-#define XFS_INOBT_MASKN(i,n) \
+#define XFS_INOBT_MASKN(i,n) \
((((n) >= XFS_INODES_PER_CHUNK ? \
(xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i))
#endif
typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */
/* btree block header type */
-typedef struct xfs_btree_sblock xfs_inobt_block_t;
+typedef struct xfs_btree_sblock xfs_inobt_block_t;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_INOBT_BLOCK)
xfs_inobt_block_t *xfs_buf_to_inobt_block(struct xfs_buf *bp);
-#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp)
+#define XFS_BUF_TO_INOBT_BLOCK(bp) xfs_buf_to_inobt_block(bp)
#else
-#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp)))
+#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)(XFS_BUF_PTR(bp)))
#endif
/*
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_MASK)
xfs_inofree_t xfs_inobt_mask(int i);
-#define XFS_INOBT_MASK(i) xfs_inobt_mask(i)
+#define XFS_INOBT_MASK(i) xfs_inobt_mask(i)
#else
-#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
+#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE)
int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch);
-#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch)
+#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch)
#else
-#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \
- & XFS_INOBT_MASK(i)) != 0)
+#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \
+ & XFS_INOBT_MASK(i)) != 0)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE)
void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch);
-#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch)
+#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch)
#else
-#define XFS_INOBT_SET_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= XFS_INOBT_MASK(i)))
+#define XFS_INOBT_SET_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= XFS_INOBT_MASK(i)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_CLR_FREE)
void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch);
-#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch)
+#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch)
#else
-#define XFS_INOBT_CLR_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i)))
+#define XFS_INOBT_CLR_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i)))
#endif
/*
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_SIZE)
int xfs_inobt_block_size(int lev, struct xfs_btree_cur *cur);
-#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur)
+#define XFS_INOBT_BLOCK_SIZE(lev,cur) xfs_inobt_block_size(lev,cur)
#else
-#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
+#define XFS_INOBT_BLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MAXRECS)
int xfs_inobt_block_maxrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur)
+#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) xfs_inobt_block_maxrecs(lev,cur)
#else
-#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \
+#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) \
((cur)->bc_mp->m_inobt_mxr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_BLOCK_MINRECS)
int xfs_inobt_block_minrecs(int lev, struct xfs_btree_cur *cur);
-#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur)
+#define XFS_INOBT_BLOCK_MINRECS(lev,cur) xfs_inobt_block_minrecs(lev,cur)
#else
-#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \
+#define XFS_INOBT_BLOCK_MINRECS(lev,cur) \
((cur)->bc_mp->m_inobt_mnr[lev != 0])
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_LAST_REC)
int xfs_inobt_is_last_rec(struct xfs_btree_cur *cur);
-#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur)
+#define XFS_INOBT_IS_LAST_REC(cur) xfs_inobt_is_last_rec(cur)
#else
-#define XFS_INOBT_IS_LAST_REC(cur) \
+#define XFS_INOBT_IS_LAST_REC(cur) \
((cur)->bc_ptrs[0] == \
INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
#endif
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IN_MAXLEVELS)
int xfs_in_maxlevels(struct xfs_mount *mp);
-#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp)
+#define XFS_IN_MAXLEVELS(mp) xfs_in_maxlevels(mp)
#else
-#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
+#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
#endif
/*
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IBT_BLOCK)
xfs_agblock_t xfs_ibt_block(struct xfs_mount *mp);
-#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp)
+#define XFS_IBT_BLOCK(mp) xfs_ibt_block(mp)
#else
-#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
+#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_PREALLOC_BLOCKS)
xfs_agblock_t xfs_prealloc_blocks(struct xfs_mount *mp);
-#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp)
+#define XFS_PREALLOC_BLOCKS(mp) xfs_prealloc_blocks(mp)
#else
-#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
+#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
#endif
/*
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_REC_ADDR)
xfs_inobt_rec_t *
xfs_inobt_rec_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur)
+#define XFS_INOBT_REC_ADDR(bb,i,cur) xfs_inobt_rec_addr(bb,i,cur)
#else
-#define XFS_INOBT_REC_ADDR(bb,i,cur) \
+#define XFS_INOBT_REC_ADDR(bb,i,cur) \
XFS_BTREE_REC_ADDR(XFS_INOBT_BLOCK_SIZE(0,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(0, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_KEY_ADDR)
xfs_inobt_key_t *
xfs_inobt_key_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur)
+#define XFS_INOBT_KEY_ADDR(bb,i,cur) xfs_inobt_key_addr(bb,i,cur)
#else
-#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
+#define XFS_INOBT_KEY_ADDR(bb,i,cur) \
XFS_BTREE_KEY_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(1, cur))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_PTR_ADDR)
xfs_inobt_ptr_t *
xfs_inobt_ptr_addr(xfs_inobt_block_t *bb, int i, struct xfs_btree_cur *cur);
-#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur)
+#define XFS_INOBT_PTR_ADDR(bb,i,cur) xfs_inobt_ptr_addr(bb,i,cur)
#else
-#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
+#define XFS_INOBT_PTR_ADDR(bb,i,cur) \
XFS_BTREE_PTR_ADDR(XFS_INOBT_BLOCK_SIZE(1,cur), xfs_inobt, bb, i, \
XFS_INOBT_BLOCK_MAXRECS(1, cur))
#endif
int /* error */
xfs_inobt_delete(
struct xfs_btree_cur *cur, /* btree cursor */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
#endif /* _NOTYET_ */
/*
xfs_inobt_increment(
struct xfs_btree_cur *cur, /* btree cursor */
int level, /* level in btree, 0 is leaf */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Insert the current record at the point referenced by cur.
int /* error */
xfs_inobt_insert(
struct xfs_btree_cur *cur, /* btree cursor */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the record equal to ino in the btree given by cur.
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the first record greater than or equal to ino
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
- int *stat); /* success/failure */
+ int *stat); /* success/failure */
/*
* Lookup the first record less than or equal to ino
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
- int *stat); /* success/failure */
-
+ int *stat); /* success/failure */
+
/*
* Update the record referred to by cur, to the value given
* by [ino, fcnt, free].
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_IMAP_H__
-#define __XFS_IMAP_H__
+#define __XFS_IMAP_H__
/*
* This is the structure passed to xfs_imap() to map
* an inode number to its on disk location.
*/
typedef struct xfs_imap {
- xfs_daddr_t im_blkno; /* starting BB of inode chunk */
+ xfs_daddr_t im_blkno; /* starting BB of inode chunk */
uint im_len; /* length in BBs of inode chunk */
xfs_agblock_t im_agblkno; /* logical block of inode chunk in ag */
ushort im_ioffset; /* inode offset in block in "inodes" */
ushort im_boffset; /* inode offset in block in bytes */
} xfs_imap_t;
-
+
#ifdef __KERNEL__
struct xfs_mount;
struct xfs_trans;
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_INODE_H__
-#define __XFS_INODE_H__
+#ifndef __XFS_INODE_H__
+#define __XFS_INODE_H__
/*
* File incore extent information, present for each of data & attr forks.
*/
-#define XFS_INLINE_EXTS 2
-#define XFS_INLINE_DATA 32
+#define XFS_INLINE_EXTS 2
+#define XFS_INLINE_DATA 32
typedef struct xfs_ifork {
- int if_bytes; /* bytes in if_u1 */
+ int if_bytes; /* bytes in if_u1 */
int if_real_bytes; /* bytes allocated in if_u1 */
xfs_bmbt_block_t *if_broot; /* file's incore btree root */
- short if_broot_bytes; /* bytes allocated for root */
+ short if_broot_bytes; /* bytes allocated for root */
unsigned char if_flags; /* per-fork flags */
unsigned char if_ext_max; /* max # of extent records */
xfs_extnum_t if_lastex; /* last if_extents used */
/*
* Flags for xfs_ichgtime().
*/
-#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
-#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
-#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
+#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
+#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
+#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
/*
* Per-fork incore inode flags.
*/
-#define XFS_IFINLINE 0x0001 /* Inline data is read in */
-#define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */
-#define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */
+#define XFS_IFINLINE 0x0001 /* Inline data is read in */
+#define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */
+#define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */
/*
* Flags for xfs_imap() and xfs_dilocate().
*/
-#define XFS_IMAP_LOOKUP 0x1
+#define XFS_IMAP_LOOKUP 0x1
/*
* Maximum number of extent pointers in if_u1.if_extents.
*/
-#define XFS_MAX_INCORE_EXTENTS 32768
+#define XFS_MAX_INCORE_EXTENTS 32768
#ifdef __KERNEL__
* This structure is used to hold common pieces of the buffer
* and file for xfs_dio_write and xfs_dio_read.
*/
-typedef struct xfs_dio {
+typedef struct xfs_dio {
struct xfs_buf *xd_bp;
bhv_desc_t *xd_bdp;
struct xfs_inode *xd_ip;
} xfs_iocore_t;
-#define io_dmevmask io_dmattrs.da_dmevmask
-#define io_dmstate io_dmattrs.da_dmstate
+#define io_dmevmask io_dmattrs.da_dmevmask
+#define io_dmstate io_dmattrs.da_dmstate
#define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj))
#define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj))
*/
typedef struct xfs_ihash {
struct xfs_inode *ih_next;
- mrlock_t ih_lock;
+ rwlock_t ih_lock;
uint ih_version;
} xfs_ihash_t;
#if defined(MP)
#define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)ino) % (mp)->m_ihsize))
/*
- * This is the xfs inode cluster hash. This hash is used by xfs_iflush to
+ * This is the xfs inode cluster hash. This hash is used by xfs_iflush to
* find inodes that share a cluster and can be flushed to disk at the same
* time.
*/
typedef struct xfs_chashlist {
struct xfs_chashlist *chl_next;
struct xfs_inode *chl_ip;
- xfs_daddr_t chl_blkno; /* starting block number of
+ xfs_daddr_t chl_blkno; /* starting block number of
* the cluster */
#ifdef DEBUG
struct xfs_buf *chl_buf; /* debug: the inode buffer */
* Most of the on-disk inode is embedded in the i_d field.
*
* The extent pointers/inline file space, however, are managed
- * separately. The memory for this information is pointed to by
+ * separately. The memory for this information is pointed to by
* the if_u1 unions depending on the type of the data.
* This is used to linearize the array of extents for fast in-core
* access. This is used until the file's number of extents
* Other state kept in the in-core inode is used for identification,
* locking, transactional updating, etc of the inode.
*
- * Generally, we do not want to hold the i_rlock while holding the
- * i_ilock. Hierarchy is i_iolock followed by i_rlock.
+ * Generally, we do not want to hold the i_rlock while holding the
+ * i_ilock. Hierarchy is i_iolock followed by i_rlock.
*
* xfs_iptr_t contains all the inode fields upto and including the
* i_mnext and i_mprev fields, it is used as a marker in the inode
unsigned char i_update_core; /* timestamps/size is dirty */
unsigned char i_update_size; /* di_size field is dirty */
unsigned int i_gen; /* generation count */
- unsigned int i_delayed_blks; /* count of delay alloc blks */
+ unsigned int i_delayed_blks; /* count of delay alloc blks */
xfs_dinode_core_t i_d; /* most of ondisk inode */
xfs_chashlist_t *i_chash; /* cluster hash list header */
struct ktrace *i_xtrace; /* inode extent list trace */
struct ktrace *i_btrace; /* inode bmap btree trace */
struct ktrace *i_rwtrace; /* inode read/write trace */
- struct ktrace *i_strat_trace; /* inode strat_write trace */
+ struct ktrace *i_strat_trace; /* inode strat_write trace */
struct ktrace *i_lock_trace; /* inode lock/unlock trace */
struct ktrace *i_dir_trace; /* inode directory trace */
#endif /* DEBUG */
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR)
xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w);
-#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
+#define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
#else
-#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
+#define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q)
int xfs_ifork_q(xfs_inode_t *ip);
-#define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
+#define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
#else
-#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
+#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE)
int xfs_ifork_dsize(xfs_inode_t *ip);
-#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
+#define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
#else
-#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
+#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE)
int xfs_ifork_asize(xfs_inode_t *ip);
-#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
+#define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
#else
-#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
+#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE)
int xfs_ifork_size(xfs_inode_t *ip, int w);
-#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
+#define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
#else
-#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
+#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT)
int xfs_ifork_format(xfs_inode_t *ip, int w);
-#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
+#define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
#else
-#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
+#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET)
void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n);
-#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
+#define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
#else
-#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
+#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS)
int xfs_ifork_nextents(xfs_inode_t *ip, int w);
-#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
+#define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
#else
-#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
+#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET)
void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
-#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
+#define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
#else
-#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
+#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
#endif
/*
* In-core inode flags.
*/
-#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */
-#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */
-#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */
-#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */
+#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */
+#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */
+#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */
+#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */
/*
* Flags for inode locking.
*/
-#define XFS_IOLOCK_EXCL 0x001
-#define XFS_IOLOCK_SHARED 0x002
-#define XFS_ILOCK_EXCL 0x004
-#define XFS_ILOCK_SHARED 0x008
-#define XFS_IUNLOCK_NONOTIFY 0x010
+#define XFS_IOLOCK_EXCL 0x001
+#define XFS_IOLOCK_SHARED 0x002
+#define XFS_ILOCK_EXCL 0x004
+#define XFS_ILOCK_SHARED 0x008
+#define XFS_IUNLOCK_NONOTIFY 0x010
#define XFS_EXTENT_TOKEN_RD 0x040
#define XFS_SIZE_TOKEN_RD 0x080
#define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD)
#define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */
#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
-#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
+#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
/*
* Flags for xfs_iflush()
*/
-#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
-#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
-#define XFS_IFLUSH_SYNC 3
-#define XFS_IFLUSH_ASYNC 4
-#define XFS_IFLUSH_DELWRI 5
+#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
+#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
+#define XFS_IFLUSH_SYNC 3
+#define XFS_IFLUSH_ASYNC 4
+#define XFS_IFLUSH_DELWRI 5
/*
* Flags for xfs_iflush_all.
*/
-#define XFS_FLUSH_ALL 0x1
+#define XFS_FLUSH_ALL 0x1
/*
* Flags for xfs_itruncate_start().
*/
-#define XFS_ITRUNC_DEFINITE 0x1
-#define XFS_ITRUNC_MAYBE 0x2
+#define XFS_ITRUNC_DEFINITE 0x1
+#define XFS_ITRUNC_MAYBE 0x2
/*
* if XFS_BIG_FILES, 2^(31+PAGE_SHIFT) - 1 (due to linux page cache),
* else 2^40 - 1 (40=31+9) (might be an int holding a block #)
- * For the not XFS_BIG_FILES case, the value could be 1 higher but we don't
- * do that, for symmetry.
*
* NOTE: XFS itself can handle 2^63 - 1 (largest positive value of xfs_fsize_t)
* but Linux can't go above 2^(31+PAGE_SHIFT)-1: the Linux VM uses a 32 bit
- * signed variable to index cache data, so 2^31 * PAGE_SIZE is as big as
+ * signed variable to index cache data, so 2^31 * PAGE_SIZE is as big as
* you can go.
*/
-#if XFS_BIG_FILES
#define XFS_MAX_FILE_OFFSET ((long long)((1ULL<<(31+PAGE_SHIFT))-1ULL))
-#else
-#define XFS_MAX_FILE_OFFSET ((1LL<<40)-1LL)
-#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
struct vnode *xfs_itov(xfs_inode_t *ip);
-#define XFS_ITOV(ip) xfs_itov(ip)
+#define XFS_ITOV(ip) xfs_itov(ip)
#else
-#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
+#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
#endif
-#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
+#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV)
struct bhv_desc *xfs_itobhv(xfs_inode_t *ip);
-#define XFS_ITOBHV(ip) xfs_itobhv(ip)
+#define XFS_ITOBHV(ip) xfs_itobhv(ip)
#else
-#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
+#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI)
xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
-#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
+#define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
#else
-#define XFS_BHVTOI(bhvp) \
+#define XFS_BHVTOI(bhvp) \
((xfs_inode_t *)((char *)(bhvp) - \
(char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
#endif
void xfs_chash_free(struct xfs_mount *);
xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
struct xfs_trans *);
-void xfs_inode_lock_init(xfs_inode_t *, struct vnode *);
+void xfs_inode_lock_init(xfs_inode_t *, struct vnode *);
int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
uint, xfs_inode_t **, xfs_daddr_t);
int xfs_vn_iget(vfs_t *, struct vnode *, xfs_ino_t);
xfs_inode_t **, xfs_daddr_t);
int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t,
- dev_t, struct cred *, xfs_prid_t, int,
+ dev_t, struct cred *, xfs_prid_t, int,
struct xfs_buf **, boolean_t *, xfs_inode_t **);
void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, int,
xfs_arch_t);
int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_32_t *, int);
int xfs_iflush(xfs_inode_t *, uint);
int xfs_iflush_all(struct xfs_mount *, int);
-int xfs_ibusy_check(xfs_inode_t *, int);
+int xfs_ibusy_check(xfs_inode_t *, int);
int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
uint xfs_iroundup(uint);
void xfs_ichgtime(xfs_inode_t *, int);
#if defined(DEBUG)
void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
#else
-#define xfs_inobp_check(mp, bp)
+#define xfs_inobp_check(mp, bp)
#endif /* DEBUG */
extern struct xfs_zone *xfs_chashlist_zone;
#ifdef XFS_ILOCK_TRACE
#define XFS_ILOCK_KTRACE_SIZE 32
-void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
+void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
inst_t *ra);
#endif
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_INODE_ITEM_H__
-#define __XFS_INODE_ITEM_H__
+#ifndef __XFS_INODE_ITEM_H__
+#define __XFS_INODE_ITEM_H__
/*
* This is the structure used to lay out an inode log item in the
- * log. The size of the inline data/extents/b-tree root to be logged
+ * log. The size of the inline data/extents/b-tree root to be logged
* (if any) is indicated in the ilf_dsize field. Changes to this structure
* must be added on to the end.
*
* -Version 2 of this structure (XFS_LI_6_1_INODE) is currently the entire
* structure. This was released with IRIX 6.0.1-XFS and IRIX 6.1.
* -Version 3 of this structure (XFS_LI_INODE) is the same as version 2
- * so a new structure definition wasn't necessary. However, we had
+ * so a new structure definition wasn't necessary. However, we had
* to add a new type because the inode cluster size changed from 4K
* to 8K and the version number had to be rev'ved to keep older kernels
* from trying to recover logs with the 8K buffers in them. The logging
* code can handle recovery on different-sized clusters now so hopefully
* this'll be the last time we need to change the inode log item just
- * for a change in the inode cluster size. This new version was
+ * for a change in the inode cluster size. This new version was
* released with IRIX 6.2.
*/
typedef struct xfs_inode_log_format {
/*
* Flags for xfs_trans_log_inode flags field.
*/
-#define XFS_ILOG_CORE 0x001 /* log standard inode fields */
-#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
-#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
-#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
-#define XFS_ILOG_DEV 0x010 /* log the dev field */
-#define XFS_ILOG_UUID 0x020 /* log the uuid field */
-#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
-#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
-#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
-
-#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
+#define XFS_ILOG_CORE 0x001 /* log standard inode fields */
+#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
+#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
+#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
+#define XFS_ILOG_DEV 0x010 /* log the dev field */
+#define XFS_ILOG_UUID 0x020 /* log the uuid field */
+#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
+#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
+#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
+
+#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
XFS_ILOG_UUID | XFS_ILOG_ADATA | \
XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
-#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
+#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
XFS_ILOG_DBROOT)
-#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
+#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
XFS_ILOG_ABROOT)
-#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
+#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
XFS_ILOG_DEV | XFS_ILOG_UUID | \
XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
XFS_ILOG_ABROOT)
-#define XFS_ILI_HOLD 0x1
-#define XFS_ILI_IOLOCKED_EXCL 0x2
-#define XFS_ILI_IOLOCKED_SHARED 0x4
+#define XFS_ILI_HOLD 0x1
+#define XFS_ILI_IOLOCKED_EXCL 0x2
+#define XFS_ILI_IOLOCKED_SHARED 0x4
-#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
+#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
#ifdef __KERNEL__
unsigned short ili_logged; /* flushed logged data */
unsigned int ili_last_fields; /* fields when flushed */
struct xfs_bmbt_rec_32 *ili_extents_buf; /* array of logged exts */
- unsigned int ili_pushbuf_flag; /* one bit used in push_ail */
+ unsigned int ili_pushbuf_flag; /* one bit used in push_ail */
#ifdef DEBUG
- uint64_t ili_push_owner; /* one who sets pushbuf_flag
+ uint64_t ili_push_owner; /* one who sets pushbuf_flag
above gets to push the buf */
#endif
#ifdef XFS_TRANS_DEBUG
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
int xfs_ilog_fdata(int w);
-#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
+#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
#else
-#define XFS_ILOG_FDATA(w) \
+#define XFS_ILOG_FDATA(w) \
((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
int xfs_ilog_fbroot(int w);
-#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
+#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
#else
-#define XFS_ILOG_FBROOT(w) \
+#define XFS_ILOG_FBROOT(w) \
((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT)
int xfs_ilog_fext(int w);
-#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
+#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
#else
-#define XFS_ILOG_FEXT(w) \
+#define XFS_ILOG_FEXT(w) \
((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT)
#endif
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_INUM_H__
-#define __XFS_INUM_H__
+#define __XFS_INUM_H__
/*
* Inode number format:
* high agno_log-agblklog-inopblog bits - 0
*/
-typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */
+typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */
/*
* Useful inode bits for this kernel.
* costs too much.
*/
#if XFS_BIG_FILESYSTEMS
-typedef xfs_ino_t xfs_intino_t;
+typedef xfs_ino_t xfs_intino_t;
#else
-typedef __uint32_t xfs_intino_t;
+typedef __uint32_t xfs_intino_t;
#endif
-#define NULLFSINO ((xfs_ino_t)-1)
-#define NULLAGINO ((xfs_agino_t)-1)
+#define NULLFSINO ((xfs_ino_t)-1)
+#define NULLAGINO ((xfs_agino_t)-1)
struct xfs_mount;
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK)
__uint32_t xfs_ino_mask(int k);
-#define XFS_INO_MASK(k) xfs_ino_mask(k)
+#define XFS_INO_MASK(k) xfs_ino_mask(k)
#else
-#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1))
+#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS)
int xfs_ino_offset_bits(struct xfs_mount *mp);
-#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp)
+#define XFS_INO_OFFSET_BITS(mp) xfs_ino_offset_bits(mp)
#else
-#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
+#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS)
int xfs_ino_agbno_bits(struct xfs_mount *mp);
-#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp)
+#define XFS_INO_AGBNO_BITS(mp) xfs_ino_agbno_bits(mp)
#else
-#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog)
+#define XFS_INO_AGBNO_BITS(mp) ((mp)->m_sb.sb_agblklog)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS)
int xfs_ino_agino_bits(struct xfs_mount *mp);
-#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp)
+#define XFS_INO_AGINO_BITS(mp) xfs_ino_agino_bits(mp)
#else
-#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log)
+#define XFS_INO_AGINO_BITS(mp) ((mp)->m_agino_log)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS)
int xfs_ino_agno_bits(struct xfs_mount *mp);
-#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp)
+#define XFS_INO_AGNO_BITS(mp) xfs_ino_agno_bits(mp)
#else
-#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log)
+#define XFS_INO_AGNO_BITS(mp) ((mp)->m_agno_log)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS)
int xfs_ino_bits(struct xfs_mount *mp);
-#define XFS_INO_BITS(mp) xfs_ino_bits(mp)
+#define XFS_INO_BITS(mp) xfs_ino_bits(mp)
#else
-#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
+#define XFS_INO_BITS(mp) (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO)
xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i);
-#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i)
+#define XFS_INO_TO_AGNO(mp,i) xfs_ino_to_agno(mp,i)
#else
-#define XFS_INO_TO_AGNO(mp,i) \
+#define XFS_INO_TO_AGNO(mp,i) \
((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO)
xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i);
-#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i)
+#define XFS_INO_TO_AGINO(mp,i) xfs_ino_to_agino(mp,i)
#else
-#define XFS_INO_TO_AGINO(mp,i) \
+#define XFS_INO_TO_AGINO(mp,i) \
((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO)
xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i);
-#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i)
+#define XFS_INO_TO_AGBNO(mp,i) xfs_ino_to_agbno(mp,i)
#else
-#define XFS_INO_TO_AGBNO(mp,i) \
+#define XFS_INO_TO_AGBNO(mp,i) \
(((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET)
int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i);
-#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i)
+#define XFS_INO_TO_OFFSET(mp,i) xfs_ino_to_offset(mp,i)
#else
-#define XFS_INO_TO_OFFSET(mp,i) \
+#define XFS_INO_TO_OFFSET(mp,i) \
((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB)
xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i);
-#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i)
+#define XFS_INO_TO_FSB(mp,i) xfs_ino_to_fsb(mp,i)
#else
-#define XFS_INO_TO_FSB(mp,i) \
+#define XFS_INO_TO_FSB(mp,i) \
XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO)
xfs_ino_t
xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i);
-#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i)
+#define XFS_AGINO_TO_INO(mp,a,i) xfs_agino_to_ino(mp,a,i)
#else
-#define XFS_AGINO_TO_INO(mp,a,i) \
+#define XFS_AGINO_TO_INO(mp,a,i) \
(((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO)
xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i);
-#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i)
+#define XFS_AGINO_TO_AGBNO(mp,i) xfs_agino_to_agbno(mp,i)
#else
-#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
+#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET)
int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i);
-#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i)
+#define XFS_AGINO_TO_OFFSET(mp,i) xfs_agino_to_offset(mp,i)
#else
-#define XFS_AGINO_TO_OFFSET(mp,i) \
+#define XFS_AGINO_TO_OFFSET(mp,i) \
((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO)
xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
-#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o)
+#define XFS_OFFBNO_TO_AGINO(mp,b,o) xfs_offbno_to_agino(mp,b,o)
#else
-#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
+#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
#endif
#if XFS_BIG_FILESYSTEMS
-#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
-#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))
+#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
+#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))
#else
-#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))
+#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))
#endif
-#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
+#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
#endif /* __XFS_INUM_H__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_LOG_H__
+#ifndef __XFS_LOG_H__
#define __XFS_LOG_H__
#if __BYTE_ORDER == __LITTLE_ENDIAN
#endif
/* get lsn fields */
-
+
#define CYCLE_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)], arch))
#define BLOCK_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch))
/* this is used in a spot where we might otherwise double-endian-flip */
if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch))
return (CYCLE_LSN(lsn1, arch)<CYCLE_LSN(lsn2, arch))? -999 : 999;
- if (BLOCK_LSN(lsn1, arch) != BLOCK_LSN(lsn2, arch))
- return (BLOCK_LSN(lsn1, arch)<BLOCK_LSN(lsn2, arch))? -999 : 999;
-
- return 0;
+ if (BLOCK_LSN(lsn1, arch) != BLOCK_LSN(lsn2, arch))
+ return (BLOCK_LSN(lsn1, arch)<BLOCK_LSN(lsn2, arch))? -999 : 999;
+
+ return 0;
}
-#define XFS_LSN_CMP_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
-#define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT)
-#define XFS_LSN_DIFF_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
-#define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT)
+#define XFS_LSN_CMP_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
+#define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT)
+#define XFS_LSN_DIFF_ARCH(x,y,arch) _lsn_cmp(x, y, arch)
+#define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT)
/*
* Macros, structures, prototypes for interface to the log manager.
/*
* Flags to xfs_log_done()
*/
-#define XFS_LOG_REL_PERM_RESERV 0x1
+#define XFS_LOG_REL_PERM_RESERV 0x1
/*
* to the log manager.
*/
typedef struct xfs_log_callback {
- struct xfs_log_callback *cb_next;
+ struct xfs_log_callback *cb_next;
void (*cb_func)(void *, int);
- void *cb_arg;
+ void *cb_arg;
} xfs_log_callback_t;
__uint8_t clientid,
uint flags);
int xfs_log_write(struct xfs_mount *mp,
- xfs_log_iovec_t region[],
+ xfs_log_iovec_t region[],
int nentries,
xfs_log_ticket_t ticket,
xfs_lsn_t *start_lsn);
int xfs_log_unmount(struct xfs_mount *mp);
int xfs_log_unmount_write(struct xfs_mount *mp);
-void xfs_log_unmount_dealloc(struct xfs_mount *mp);
+void xfs_log_unmount_dealloc(struct xfs_mount *mp);
int xfs_log_force_umount(struct xfs_mount *mp, int logerror);
int xfs_log_need_covered(struct xfs_mount *mp);
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_LOG_PRIV_H__
+#ifndef __XFS_LOG_PRIV_H__
#define __XFS_LOG_PRIV_H__
#if defined(XFS_ALL_TRACE)
-#define XFS_LOG_TRACE
+#define XFS_LOG_TRACE
#endif
#if !defined(DEBUG)
#define XLOG_TOTAL_REC_SHIFT(log) \
BTOBB(XLOG_MAX_ICLOGS << (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? \
XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
-
+
/*
* set lsns
*/
INT_SET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch, (block));
#define ASSIGN_ANY_LSN(lsn,cycle,block,arch) \
{ \
- ASSIGN_LSN_CYCLE(lsn,cycle,arch); \
- ASSIGN_LSN_BLOCK(lsn,block,arch); \
+ ASSIGN_LSN_CYCLE(lsn,cycle,arch); \
+ ASSIGN_LSN_BLOCK(lsn,block,arch); \
}
#define ASSIGN_LSN(lsn,log,arch) \
ASSIGN_ANY_LSN(lsn,(log)->l_curr_cycle,(log)->l_curr_block,arch);
-
+
#define XLOG_SET(f,b) (((f) & (b)) == (b))
#define GET_CYCLE(ptr, arch) \
(INT_GET(*(uint *)(ptr), arch) == XLOG_HEADER_MAGIC_NUM ? \
- INT_GET(*((uint *)(ptr)+1), arch) : \
- INT_GET(*(uint *)(ptr), arch) \
+ INT_GET(*((uint *)(ptr)+1), arch) : \
+ INT_GET(*(uint *)(ptr), arch) \
)
-
+
#define BLK_AVG(blk1, blk2) ((blk1+blk2) >> 1)
* get client id from packed copy.
*
* this hack is here because the xlog_pack code copies four bytes
- * of xlog_op_header containing the fields oh_clientid, oh_flags
+ * of xlog_op_header containing the fields oh_clientid, oh_flags
* and oh_res2 into the packed copy.
*
- * later on this four byte chunk is treated as an int and the
+ * later on this four byte chunk is treated as an int and the
* client id is pulled out.
*
* this has endian issues, of course.
- */
+ */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define GET_CLIENT_ID(i,arch) \
if (type == 'w') { \
(log)->l_grant_write_bytes -= (bytes); \
if ((log)->l_grant_write_bytes < 0) { \
- (log)->l_grant_write_bytes += (log)->l_logsize; \
+ (log)->l_grant_write_bytes += (log)->l_logsize; \
(log)->l_grant_write_cycle--; \
} \
} else { \
if (type == 'w') { \
(log)->l_grant_write_bytes += (bytes); \
if ((log)->l_grant_write_bytes > (log)->l_logsize) { \
- (log)->l_grant_write_bytes -= (log)->l_logsize; \
+ (log)->l_grant_write_bytes -= (log)->l_logsize; \
(log)->l_grant_write_cycle++; \
} \
} else { \
*/
#define XLOG_CHKSUM_MISMATCH 0x1 /* used only during recovery */
#define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */
-#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */
+#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */
#define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being
shutdown */
typedef __uint32_t xlog_tid_t;
* non-dummy transaction. The first dummy changes the h_tail_lsn to
* the first transaction before the dummy. The second dummy causes
* h_tail_lsn to point to the first dummy. Recovery starts at h_tail_lsn.
- *
+ *
* These dummy transactions get committed when everything
* is idle (after there has been some activity).
*
*
* 1.) In xfs_sync, when we detect an idle log and are in NEED or NEED2.
* We commit the dummy transaction and switch to DONE or DONE2,
- * respectively. In all other states, we don't do anything.
+ * respectively. In all other states, we don't do anything.
*
* 2.) When we finish writing the on-disk log (xlog_state_clean_log).
*
* So, if we aren't in the DONE or DONE2 states, the next state
* is NEED. We can't be finishing a write of the dummy record
* unless it was committed and the state switched to DONE or DONE2.
- *
+ *
* If we are in the DONE state and this was a write of the
* dummy transaction, we move to NEED2.
*
typedef struct xlog_ticket {
sv_t t_sema; /* sleep on this semaphore :20 */
- struct xlog_ticket *t_next; /* : 4 */
+ struct xlog_ticket *t_next; /* : 4 */
struct xlog_ticket *t_prev; /* : 4 */
xlog_tid_t t_tid; /* transaction identifier : 4 */
int t_curr_res; /* current reservation in bytes : 4 */
- int t_unit_res; /* unit reservation in bytes : 4 */
+ int t_unit_res; /* unit reservation in bytes : 4 */
__uint8_t t_ocnt; /* original count : 1 */
__uint8_t t_cnt; /* current count : 1 */
__uint8_t t_clientid; /* who does this belong to; : 1 */
typedef struct xlog_op_header {
xlog_tid_t oh_tid; /* transaction id of operation : 4 b */
int oh_len; /* bytes in data region : 4 b */
- __uint8_t oh_clientid; /* who sent me this : 1 b */
- __uint8_t oh_flags; /* : 1 b */
+ __uint8_t oh_clientid; /* who sent me this : 1 b */
+ __uint8_t oh_flags; /* : 1 b */
ushort oh_res2; /* 32 bit align : 2 b */
} xlog_op_header_t;
xfs_lsn_t h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */
uint h_chksum; /* may not be used; non-zero if used : 4 */
int h_prev_block; /* block number to previous LR : 4 */
- int h_num_logops; /* number of log operations in this LR : 4 */
- uint h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE];
- /* new fields */
- int h_fmt; /* format of log record : 4 */
- uuid_t h_fs_uuid; /* uuid of FS : 16 */
- int h_size; /* iclog size : 4 */
+ int h_num_logops; /* number of log operations in this LR : 4 */
+ uint h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE];
+ /* new fields */
+ int h_fmt; /* format of log record : 4 */
+ uuid_t h_fs_uuid; /* uuid of FS : 16 */
+ int h_size; /* iclog size : 4 */
} xlog_rec_header_t;
typedef struct xlog_rec_ext_header {
} xlog_rec_ext_header_t;
#ifdef __KERNEL__
/*
- * - A log record header is 512 bytes. There is plenty of room to grow the
+ * - A log record header is 512 bytes. There is plenty of room to grow the
* xlog_rec_header_t into the reserved space.
* - ic_data follows, so a write to disk can start at the beginning of
* the iclog.
sv_t ic_forcesema;
struct xlog_in_core *ic_next;
struct xlog_in_core *ic_prev;
- struct xfs_buf *ic_bp;
+ struct xfs_buf *ic_bp;
struct log *ic_log;
xfs_log_callback_t *ic_callback;
xfs_log_callback_t **ic_callback_tail;
#ifdef DEBUG
struct ktrace *ic_trace;
#endif
- int ic_size;
- int ic_offset;
- int ic_refcnt;
+ int ic_size;
+ int ic_offset;
+ int ic_refcnt;
int ic_roundoff;
int ic_bwritecnt;
ushort_t ic_state;
/*
* Defines to save our code from this glop.
*/
-#define ic_forcesema hic_fields.ic_forcesema
+#define ic_forcesema hic_fields.ic_forcesema
#define ic_write_sched hic_fields.ic_write_sched
-#define ic_next hic_fields.ic_next
-#define ic_prev hic_fields.ic_prev
-#define ic_bp hic_fields.ic_bp
-#define ic_log hic_fields.ic_log
-#define ic_callback hic_fields.ic_callback
-#define ic_callback_tail hic_fields.ic_callback_tail
-#define ic_trace hic_fields.ic_trace
-#define ic_size hic_fields.ic_size
-#define ic_offset hic_fields.ic_offset
-#define ic_refcnt hic_fields.ic_refcnt
-#define ic_roundoff hic_fields.ic_roundoff
-#define ic_bwritecnt hic_fields.ic_bwritecnt
-#define ic_state hic_fields.ic_state
+#define ic_next hic_fields.ic_next
+#define ic_prev hic_fields.ic_prev
+#define ic_bp hic_fields.ic_bp
+#define ic_log hic_fields.ic_log
+#define ic_callback hic_fields.ic_callback
+#define ic_callback_tail hic_fields.ic_callback_tail
+#define ic_trace hic_fields.ic_trace
+#define ic_size hic_fields.ic_size
+#define ic_offset hic_fields.ic_offset
+#define ic_refcnt hic_fields.ic_refcnt
+#define ic_roundoff hic_fields.ic_roundoff
+#define ic_bwritecnt hic_fields.ic_bwritecnt
+#define ic_state hic_fields.ic_state
#define ic_datap hic_fields.ic_datap
#define ic_header hic_data->ic_h.hic_header
*/
typedef struct log {
/* The following block of fields are changed while holding icloglock */
- sema_t l_flushsema; /* iclog flushing semaphore */
+ sema_t l_flushsema; /* iclog flushing semaphore */
int l_flushcnt; /* # of procs waiting on this sema */
int l_ticket_cnt; /* free ticket count */
int l_ticket_tcnt; /* total ticket count */
int l_covered_state;/* state of "covering disk log entries" */
- xlog_ticket_t *l_freelist; /* free list of tickets */
+ xlog_ticket_t *l_freelist; /* free list of tickets */
xlog_ticket_t *l_unmount_free;/* kmem_free these addresses */
- xlog_ticket_t *l_tail; /* free list of tickets */
- xlog_in_core_t *l_iclog; /* head log queue */
- lock_t l_icloglock; /* grab to change iclog state */
- xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */
+ xlog_ticket_t *l_tail; /* free list of tickets */
+ xlog_in_core_t *l_iclog; /* head log queue */
+ lock_t l_icloglock; /* grab to change iclog state */
+ xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */
xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */
- struct xfs_mount *l_mp; /* mount point */
- struct xfs_buf *l_xbuf; /* extra buffer for log wrapping */
- dev_t l_dev; /* dev_t of log */
- xfs_daddr_t l_logBBstart; /* start block of log */
- int l_logsize; /* size of log in bytes */
- int l_logBBsize; /* size of log in 512 byte chunks */
+ struct xfs_mount *l_mp; /* mount point */
+ struct xfs_buf *l_xbuf; /* extra buffer for log wrapping */
+ dev_t l_dev; /* dev_t of log */
+ xfs_daddr_t l_logBBstart; /* start block of log */
+ int l_logsize; /* size of log in bytes */
+ int l_logBBsize; /* size of log in 512 byte chunks */
int l_roundoff; /* round off error of all iclogs */
- int l_curr_cycle; /* Cycle number of log writes */
- int l_prev_cycle; /* Cycle # b4 last block increment */
- int l_curr_block; /* current logical block of log */
- int l_prev_block; /* previous logical block of log */
+ int l_curr_cycle; /* Cycle number of log writes */
+ int l_prev_cycle; /* Cycle # b4 last block increment */
+ int l_curr_block; /* current logical block of log */
+ int l_prev_block; /* previous logical block of log */
int l_iclog_size; /* size of log in bytes */
int l_iclog_size_log;/* log power size of log */
int l_iclog_bufs; /* number of iclog buffers */
#endif
uint l_flags;
uint l_quotaoffs_flag;/* XFS_DQ_*, if QUOTAOFFs found */
- struct xfs_buf_cancel **l_buf_cancel_table;
- int l_iclog_hsize; /* size of iclog header */
- int l_iclog_heads; /* number of iclog header sectors */
+ struct xfs_buf_cancel **l_buf_cancel_table;
+ int l_iclog_hsize; /* size of iclog header */
+ int l_iclog_heads; /* number of iclog header sectors */
} xlog_t;
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_LOG_RECOVER_H__
+#ifndef __XFS_LOG_RECOVER_H__
#define __XFS_LOG_RECOVER_H__
/*
* Macros, structures, prototypes for internal log manager use.
*/
-#define XLOG_RHASH_BITS 4
-#define XLOG_RHASH_SIZE 16
+#define XLOG_RHASH_BITS 4
+#define XLOG_RHASH_SIZE 16
#define XLOG_RHASH_SHIFT 2
-#define XLOG_RHASH(tid) \
+#define XLOG_RHASH(tid) \
((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1))
#define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK / 2 + 1)
* This is the number of entries in the l_buf_cancel_table used during
* recovery.
*/
-#define XLOG_BC_TABLE_SIZE 64
+#define XLOG_BC_TABLE_SIZE 64
-#define XLOG_RECOVER_PASS1 1
-#define XLOG_RECOVER_PASS2 2
+#define XLOG_RECOVER_PASS1 1
+#define XLOG_RECOVER_PASS2 2
#endif /* __XFS_LOG_RECOVER_H__ */
*
* 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
+ * 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.
* divisions (MINT). This is actually a header for the data structure which
* will have an ml_list with more than one element.
*
- * -------------------------------
- * | ml_msen_type | ml_mint_type |
- * -------------------------------
- * | ml_level | ml_grade |
- * -------------------------------
- * | ml_catcount |
- * -------------------------------
- * | ml_divcount |
- * -------------------------------
- * | category 1 |
- * | . . . |
- * | category N | (where N = ml_catcount)
- * -------------------------------
- * | division 1 |
- * | . . . |
- * | division M | (where M = ml_divcount)
- * -------------------------------
+ * -------------------------------
+ * | ml_msen_type | ml_mint_type |
+ * -------------------------------
+ * | ml_level | ml_grade |
+ * -------------------------------
+ * | ml_catcount |
+ * -------------------------------
+ * | ml_divcount |
+ * -------------------------------
+ * | category 1 |
+ * | . . . |
+ * | category N | (where N = ml_catcount)
+ * -------------------------------
+ * | division 1 |
+ * | . . . |
+ * | division M | (where M = ml_divcount)
+ * -------------------------------
*/
#define XFS_MAC_MAX_SETS 250
typedef struct xfs_mac_label {
__uint16_t ml_list[XFS_MAC_MAX_SETS];
} xfs_mac_label_t;
-/* MSEN label type names. Choose an upper case ASCII character. */
+/* MSEN label type names. Choose an upper case ASCII character. */
#define XFS_MSEN_ADMIN_LABEL 'A' /* Admin: low<admin != tcsec<high */
#define XFS_MSEN_EQUAL_LABEL 'E' /* Wildcard - always equal */
#define XFS_MSEN_HIGH_LABEL 'H' /* System High - always dominates */
-#define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */
+#define XFS_MSEN_MLD_HIGH_LABEL 'I' /* System High, multi-level dir */
#define XFS_MSEN_LOW_LABEL 'L' /* System Low - always dominated */
#define XFS_MSEN_MLD_LABEL 'M' /* TCSEC label on a multi-level dir */
#define XFS_MSEN_MLD_LOW_LABEL 'N' /* System Low, multi-level dir */
#define XFS_MSEN_TCSEC_LABEL 'T' /* TCSEC label */
#define XFS_MSEN_UNKNOWN_LABEL 'U' /* unknown label */
-/* MINT label type names. Choose a lower case ASCII character. */
+/* MINT label type names. Choose a lower case ASCII character. */
#define XFS_MINT_BIBA_LABEL 'b' /* Dual of a TCSEC label */
#define XFS_MINT_EQUAL_LABEL 'e' /* Wildcard - always equal */
#define XFS_MINT_HIGH_LABEL 'h' /* High Grade - always dominates */
#define _MAC_EXISTS xfs_mac_vhaslabel
#else
-#define _MAC_XFS_IACCESS(i,m,c) (0)
+#define _MAC_XFS_IACCESS(i,m,c) (0)
#define _MAC_VACCESS(v,c,m) (0)
#define _MAC_EXISTS (NULL)
#endif
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_MOUNT_H__
-#define __XFS_MOUNT_H__
+#define __XFS_MOUNT_H__
typedef struct xfs_trans_reservations {
uint tr_attrset; /* set/create an attribute */
uint tr_attrrm; /* remove an attribute */
uint tr_clearagi; /* clear bad agi unlinked ino bucket */
- uint tr_growrtalloc; /* grow realtime allocations */
+ uint tr_growrtalloc; /* grow realtime allocations */
uint tr_growrtzero; /* grow realtime zeroing */
uint tr_growrtfree; /* grow realtime freeing */
} xfs_trans_reservations_t;
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
#else
struct cred;
-struct mounta;
struct vfs;
struct vnode;
struct xfs_args;
struct xfs_bmbt_irec;
struct xfs_bmap_free;
-#define SPLDECL(s) unsigned long s
-#define AIL_LOCK_T lock_t
-#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
-#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
-#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock)
-#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s)
+#define SPLDECL(s) unsigned long s
+#define AIL_LOCK_T lock_t
+#define AIL_LOCKINIT(x,y) spinlock_init(x,y)
+#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
+#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock)
+#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s)
/* Prototypes and functions for I/O core modularization, a vector
typedef xfs_fsize_t (*xfs_setsize_t)(void *, xfs_off_t);
typedef xfs_fsize_t (*xfs_lastbyte_t)(void *);
-#ifdef CELL_CAPABLE
-typedef int (*xfs_checklock_t)(bhv_desc_t *, struct vnode *,
- int, off_t, off_t, int, struct cred *,
- struct flid *, vrwlock_t, int);
-#endif
-
typedef struct xfs_ioops {
xfs_dio_write_t xfs_dio_write_func;
xfs_dio_read_t xfs_dio_read_func;
xfs_lock_demote_t xfs_ilock_demote;
xfs_lock_nowait_t xfs_ilock_nowait;
xfs_unlk_t xfs_unlock;
- xfs_chgtime_t xfs_chgtime;
+ xfs_chgtime_t xfs_chgtime;
xfs_size_t xfs_size_func;
xfs_setsize_t xfs_setsize_func;
xfs_lastbyte_t xfs_lastbyte;
-#ifdef CELL_CAPABLE
- xfs_checklock_t xfs_checklock;
-#endif
} xfs_ioops_t;
xfs_sb_t m_sb; /* copy of fs superblock */
lock_t m_sb_lock; /* sb counter mutex */
struct xfs_buf *m_sb_bp; /* buffer for superblock */
- char *m_fsname; /* filesystem name */
+ char *m_fsname; /* filesystem name */
int m_fsname_len; /* strlen of fs name */
int m_bsize; /* fs logical block size */
xfs_agnumber_t m_agfrotor; /* last ag where space found */
#define m_dev m_ddev_targ.dev
#define m_logdev m_logdev_targ.dev
#define m_rtdev m_rtdev_targ.dev
- __uint8_t m_dircook_elog; /* log d-cookie entry bits */
+ __uint8_t m_dircook_elog; /* log d-cookie entry bits */
__uint8_t m_blkbit_log; /* blocklog + NBBY */
__uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
__uint8_t m_agno_log; /* log #ag's */
uint m_blockmask; /* sb_blocksize-1 */
uint m_blockwsize; /* sb_blocksize in words */
uint m_blockwmask; /* blockwsize-1 */
- uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
- uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
- uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
- uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
- uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
- uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
- uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
+ uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */
+ uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */
+ uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */
+ uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */
+ uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */
+ uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */
+ uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
- uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
+ uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
struct xfs_perag *m_perag; /* per-ag accounting info */
struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
sema_t m_growlock; /* growfs mutex */
- int m_fixedfsid[2]; /* unchanged for life of FS */
+ int m_fixedfsid[2]; /* unchanged for life of FS */
uint m_dmevmask; /* DMI events for this FS */
uint m_flags; /* global mount flags */
uint m_attroffset; /* inode attribute offset */
- int m_da_node_ents; /* how many entries in danode */
+ int m_da_node_ents; /* how many entries in danode */
int m_ialloc_inos; /* inodes in inode allocation */
int m_ialloc_blks; /* blocks in inode allocation */
int m_litino; /* size of inode union area */
int m_lstripemask; /* log stripe mask */
int m_sinoalign; /* stripe unit inode alignmnt */
int m_attr_magicpct;/* 37% of the blocksize */
- int m_dir_magicpct; /* 37% of the dir blocksize */
+ int m_dir_magicpct; /* 37% of the dir blocksize */
__uint8_t m_mk_sharedro; /* mark shared ro on unmount */
- __uint8_t m_inode_quiesce;/* call quiesce on new inodes.
- field governed by m_ilock */
+ __uint8_t m_inode_quiesce;/* call quiesce on new inodes.
+ field governed by m_ilock */
__uint8_t m_dirversion; /* 1 or 2 */
xfs_dirops_t m_dirops; /* table of dir funcs */
int m_dirblksize; /* directory block sz--bytes */
struct xfs_chash *m_chash; /* fs private inode per-cluster
* hash table */
struct xfs_ioops m_io_ops; /* vector of I/O ops */
- struct xfs_expinfo *m_expinfo; /* info to export to other
- cells. */
+ struct xfs_expinfo *m_expinfo; /* info to export to other
+ cells. */
uint64_t m_shadow_pinmask;
/* which bits matter in rpc
log item pin masks */
uint m_frozen; /* FS frozen for shutdown or
* snapshot */
sv_t m_wait_unfreeze;/* waiting to unfreeze */
- atomic_t m_active_trans; /* number trans frozen */
+ atomic_t m_active_trans; /* number trans frozen */
struct timer_list m_sbdirty_timer;/* superblock dirty timer
* for nfs refcache */
} xfs_mount_t;
/*
* Flags for m_flags.
*/
-#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops
+#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops
must be synchronous except
for space allocations */
#if XFS_BIG_FILESYSTEMS
-#define XFS_MOUNT_INO64 0x00000002
+#define XFS_MOUNT_INO64 0x00000002
#endif
#define XFS_MOUNT_ROOTQCHECK 0x00000004
/* 0x00000008 -- currently unused */
disk errors in metadata */
#define XFS_MOUNT_NOATIME 0x00000020 /* don't modify inode access
times on reads */
-#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to
- user */
-#define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment
+#define XFS_MOUNT_RETERR 0x00000040 /* return alignment errors to
+ user */
+#define XFS_MOUNT_NOALIGN 0x00000080 /* turn off stripe alignment
allocations */
- /* 0x00000100 -- currently unused */
-#define XFS_MOUNT_REGISTERED 0x00000200 /* registered with cxfs master
- cell logic */
-#define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */
-#define XFS_MOUNT_SHARED 0x00000800 /* shared mount */
-#define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */
-#define XFS_MOUNT_OSYNCISOSYNC 0x00002000 /* o_sync is REALLY o_sync */
+ /* 0x00000100 -- currently unused */
+#define XFS_MOUNT_REGISTERED 0x00000200 /* registered with cxfs master
+ cell logic */
+#define XFS_MOUNT_NORECOVERY 0x00000400 /* no recovery - dirty fs */
+#define XFS_MOUNT_SHARED 0x00000800 /* shared mount */
+#define XFS_MOUNT_DFLT_IOSIZE 0x00001000 /* set default i/o size */
+#define XFS_MOUNT_OSYNCISOSYNC 0x00002000 /* o_sync is REALLY o_sync */
/* osyncisdsync is now default*/
#define XFS_MOUNT_NOUUID 0x00004000 /* ignore uuid during mount */
#define XFS_MOUNT_32BITINODES 0x00008000 /* do not create inodes above
#define XFS_CXFS_CLIENT 0x00000004 /* We're a CXFS client */
#define XFS_CXFS_REC_ENABLED 0x00000008 /* recovery is enabled */
-#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
+#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN)
/*
* Default minimum read and write sizes.
*/
-#define XFS_READIO_LOG_LARGE 12
-#define XFS_WRITEIO_LOG_LARGE 12
+#define XFS_READIO_LOG_LARGE 12
+#define XFS_WRITEIO_LOG_LARGE 12
/*
* Default allocation size
*/
/*
* Max and min values for UIO and mount-option defined I/O sizes;
- * min value can't be less than a page. Currently unused.
+ * min value can't be less than a page. Currently unused.
*/
#define XFS_MAX_IO_LOG 16 /* 64K */
#define XFS_MIN_IO_LOG PAGE_SHIFT
* Synchronous read and write sizes. This should be
* better for NFSv2 wsync filesystems.
*/
-#define XFS_WSYNC_READIO_LOG 15 /* 32K */
-#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */
+#define XFS_WSYNC_READIO_LOG 15 /* 32K */
+#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */
#define xfs_force_shutdown(m,f) _xfs_force_shutdown(m,f,__FILE__,__LINE__);
-/*
+/*
* Flags sent to xfs_force_shutdown.
*/
#define XFS_METADATA_IO_ERROR 0x1
#define XFS_FORCE_UMOUNT 0x4
#define XFS_CORRUPT_INCORE 0x8 /* corrupt in-memory data structures */
#if CELL_CAPABLE
-#define XFS_SHUTDOWN_REMOTE_REQ 0x10 /* shutdown req came from remote cell */
+#define XFS_SHUTDOWN_REMOTE_REQ 0x10 /* shutdown req came from remote cell */
#endif
/*
/*
* Flags for xfs_mountfs
*/
-#define XFS_MFSI_SECOND 0x01 /* Is a cxfs secondary mount -- skip */
+#define XFS_MFSI_SECOND 0x01 /* Is a cxfs secondary mount -- skip */
/* stuff which should only be done */
/* once. */
-#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */
+#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */
#define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */
/* log recovery */
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MTOVFS)
struct vfs *xfs_mtovfs(xfs_mount_t *mp);
-#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
+#define XFS_MTOVFS(mp) xfs_mtovfs(mp)
#else
-#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv))
+#define XFS_MTOVFS(mp) (bhvtovfs(&(mp)->m_bhv))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOM)
xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp);
-#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
+#define XFS_BHVTOM(bdp) xfs_bhvtom(bdp)
#else
-#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp))
+#define XFS_BHVTOM(bdp) ((xfs_mount_t *)BHV_PDATA(bdp))
#endif
-
+
/*
* Moved here from xfs_ag.h to avoid reordering header files
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGNO)
xfs_agnumber_t xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d);
-#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
+#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
#else
static inline xfs_agnumber_t XFS_DADDR_TO_AGNO(xfs_mount_t *mp, xfs_daddr_t d)
{
- d = XFS_BB_TO_FSBT(mp, d);
- do_div(d, mp->m_sb.sb_agblocks);
- return (xfs_agnumber_t) d;
+ d = XFS_BB_TO_FSBT(mp, d);
+ do_div(d, mp->m_sb.sb_agblocks);
+ return (xfs_agnumber_t) d;
}
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_AGBNO)
xfs_agblock_t xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d);
-#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
+#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
#else
static inline xfs_agblock_t XFS_DADDR_TO_AGBNO(xfs_mount_t *mp, xfs_daddr_t d)
{
- d = XFS_BB_TO_FSBT(mp, d);
- return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks);
+ d = XFS_BB_TO_FSBT(mp, d);
+ return (xfs_agblock_t) do_div(d, mp->m_sb.sb_agblocks);
}
#endif
int msb_delta; /* change to make to the specified field */
} xfs_mod_sb_t;
-#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD)
-#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
-#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock)
-#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s))
+#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock), PINOD)
+#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
+#define XFS_SB_LOCK(mp) mutex_spinlock(&(mp)->m_sb_lock)
+#define XFS_SB_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_sb_lock,(s))
void xfs_mod_sb(xfs_trans_t *, __int64_t);
xfs_mount_t *xfs_mount_init(void);
int xfs_unmountfs(xfs_mount_t *, int, struct cred *);
void xfs_unmountfs_close(xfs_mount_t *, int, struct cred *);
-int xfs_unmountfs_writesb(xfs_mount_t *);
-int xfs_unmount_flush(xfs_mount_t *, int);
+int xfs_unmountfs_writesb(xfs_mount_t *);
+int xfs_unmount_flush(xfs_mount_t *, int);
int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int, int);
int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, uint, int);
int xfs_readsb(xfs_mount_t *mp);
struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
-void xfs_freesb(xfs_mount_t *);
+void xfs_freesb(xfs_mount_t *);
void _xfs_force_shutdown(struct xfs_mount *, int, char *, int);
int xfs_syncsub(xfs_mount_t *, int, int, int *);
void xfs_initialize_perag(xfs_mount_t *, int);
void xfs_start_freeze(xfs_mount_t *, int);
void xfs_finish_freeze(xfs_mount_t *);
-void xfs_check_frozen(xfs_mount_t *, bhv_desc_t *, int, int);
+void xfs_check_frozen(xfs_mount_t *, bhv_desc_t *, int);
extern struct vfsops xfs_vfsops;
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_QUOTA_H__
#define __XFS_QUOTA_H__
-/*
+/*
* uid_t and gid_t are hard-coded to 32 bits in the inode.
* Hence, an 'id' in a dquot is 32 bits..
*/
typedef __int32_t xfs_dqid_t;
/*
- * Eventhough users may not have quota limits occupying all 64-bits,
+ * Eventhough users may not have quota limits occupying all 64-bits,
* they may need 64-bit accounting. Hence, 64-bit quota-counters,
* and quota-limits. This is a waste in the common case, but hey ...
*/
typedef __uint64_t xfs_qcnt_t;
-typedef __uint16_t xfs_qwarncnt_t;
+typedef __uint16_t xfs_qwarncnt_t;
-/*
+/*
* Disk quotas status in m_qflags, and also sb_qflags. 16 bits.
*/
-#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */
-#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */
-#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */
-#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */
-#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */
-#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */
-#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
-
-/*
+#define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */
+#define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */
+#define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */
+#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */
+#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */
+#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */
+#define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
+
+/*
* Incore only flags for quotaoff - these bits get cleared when quota(s)
* are in the process of getting turned off. These flags are in m_qflags but
* never in sb_qflags.
*/
-#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */
-#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */
+#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */
+#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */
/*
- * Typically, we turn quotas off if we weren't explicitly asked to
+ * Typically, we turn quotas off if we weren't explicitly asked to
* mount quotas. This is the mount option not to do that.
* This option is handy in the miniroot, when trying to mount /root.
* We can't really know what's in /etc/fstab until /root is already mounted!
* Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees
* quota will be not be switched off as long as that inode lock is held.
*/
-#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
+#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
XFS_GQUOTA_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_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
/*
* Flags to tell various functions what to do. Not all of these are meaningful
#define XFS_QMOPT_QUOTAOFF 0x0000080 /* quotas are being turned off */
#define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */
#define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */
-#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */
+#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */
#define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */
#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */
-/*
+/*
* flags to xfs_trans_mod_dquot to indicate which field needs to be
* modified.
*/
-#define XFS_QMOPT_RES_REGBLKS 0x0010000
+#define XFS_QMOPT_RES_REGBLKS 0x0010000
#define XFS_QMOPT_RES_RTBLKS 0x0020000
#define XFS_QMOPT_BCOUNT 0x0040000
#define XFS_QMOPT_ICOUNT 0x0080000
*/
#define XFS_QMOPT_INHERIT 0x8000000
-/*
+/*
* flags to xfs_trans_mod_dquot.
*/
#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS
-#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
+#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS
#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT
#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT
/*
* This check is done typically without holding the inode lock;
* that may seem racey, but it is harmless in the context that it is used.
- * The inode cannot go inactive as long a reference is kept, and
+ * The inode cannot go inactive as long a reference is kept, and
* therefore if dquot(s) were attached, they'll stay consistent.
* If, for example, the ownership of the inode changes while
* we didnt have the inode locked, the appropriate dquot(s) will be
/*
* External Interface to the XFS disk quota subsystem.
*/
-struct xfs_disk_dquot;
-struct xfs_dqhash;
-struct xfs_dquot;
-struct xfs_inode;
-struct xfs_mount;
-struct xfs_trans;
+struct xfs_disk_dquot;
+struct xfs_dqhash;
+struct xfs_dquot;
+struct xfs_inode;
+struct xfs_mount;
+struct xfs_trans;
/*
* Quota Manager Interface.
*/
extern struct xfs_qm *xfs_qm_init(void);
-extern void xfs_qm_destroy(struct xfs_qm *);
+extern void xfs_qm_destroy(struct xfs_qm *);
extern int xfs_qm_dqflush_all(struct xfs_mount *, int);
extern int xfs_qm_dqattach(struct xfs_inode *, uint);
extern int xfs_qm_dqpurge_all(struct xfs_mount *, uint);
extern void xfs_qm_mount_quotainit(struct xfs_mount *, uint);
extern void xfs_qm_unmount_quotadestroy(struct xfs_mount *);
extern int xfs_qm_mount_quotas(struct xfs_mount *);
-extern int xfs_qm_unmount_quotas(struct xfs_mount *);
+extern int xfs_qm_unmount_quotas(struct xfs_mount *);
extern void xfs_qm_dqdettach_inode(struct xfs_inode *);
-extern int xfs_qm_sync(struct xfs_mount *, short);
+extern int xfs_qm_sync(struct xfs_mount *, short);
/*
* Dquot interface.
extern void xfs_dqunlock(struct xfs_dquot *);
extern void xfs_dqunlock_nonotify(struct xfs_dquot *);
extern void xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *);
-extern void xfs_qm_dqput(struct xfs_dquot *);
-extern void xfs_qm_dqrele(struct xfs_dquot *);
+extern void xfs_qm_dqput(struct xfs_dquot *);
+extern void xfs_qm_dqrele(struct xfs_dquot *);
extern xfs_dqid_t xfs_qm_dqid(struct xfs_dquot *);
-extern int xfs_qm_dqget(struct xfs_mount *,
+extern int xfs_qm_dqget(struct xfs_mount *,
struct xfs_inode *, xfs_dqid_t,
uint, uint, struct xfs_dquot **);
-extern int xfs_qm_dqcheck(struct xfs_disk_dquot *,
+extern int xfs_qm_dqcheck(struct xfs_disk_dquot *,
xfs_dqid_t, uint, uint, char *);
/*
* Vnodeops specific code that should actually be _in_ xfs_vnodeops.c, but
- * is here because it's nicer to keep vnodeops (therefore, XFS) lean
+ * is here because it's nicer to keep vnodeops (therefore, XFS) lean
* and clean.
*/
-extern struct xfs_dquot * xfs_qm_vop_chown(struct xfs_trans *,
- struct xfs_inode *,
+extern struct xfs_dquot * xfs_qm_vop_chown(struct xfs_trans *,
+ struct xfs_inode *,
struct xfs_dquot **,
struct xfs_dquot *);
extern int xfs_qm_vop_dqalloc(struct xfs_mount *,
extern void xfs_qm_vop_dqattach_and_dqmod_newinode(
struct xfs_trans *,
struct xfs_inode *,
- struct xfs_dquot *,
+ struct xfs_dquot *,
struct xfs_dquot *);
/*
* Dquot Transaction interface
*/
-extern void xfs_trans_alloc_dqinfo(struct xfs_trans *);
-extern void xfs_trans_free_dqinfo(struct xfs_trans *);
-extern void xfs_trans_dup_dqinfo(struct xfs_trans *,
+extern void xfs_trans_alloc_dqinfo(struct xfs_trans *);
+extern void xfs_trans_free_dqinfo(struct xfs_trans *);
+extern void xfs_trans_dup_dqinfo(struct xfs_trans *,
struct xfs_trans *);
-extern void xfs_trans_mod_dquot(struct xfs_trans *,
+extern void xfs_trans_mod_dquot(struct xfs_trans *,
struct xfs_dquot *,
uint, long);
-extern void xfs_trans_mod_dquot_byino(struct xfs_trans *,
+extern void xfs_trans_mod_dquot_byino(struct xfs_trans *,
struct xfs_inode *,
uint, long);
extern void xfs_trans_apply_dquot_deltas(struct xfs_trans *);
# define _XQM_ZONE_DESTROY(z) do { } while (0)
#endif /* CONFIG_XFS_QUOTA */
-/*
- * Regular disk block quota reservations
+/*
+ * Regular disk block quota reservations
*/
-#define xfs_trans_reserve_blkquota(tp, ip, nblks) \
+#define xfs_trans_reserve_blkquota(tp, ip, nblks) \
xfs_trans_reserve_quota_nblks(tp, ip, nblks, 0, XFS_QMOPT_RES_REGBLKS)
#define xfs_trans_reserve_blkquota_force(tp, ip, nblks) \
xfs_trans_reserve_quota_nblks(tp, ip, nblks, 0, \
XFS_QMOPT_RES_REGBLKS|XFS_QMOPT_FORCE_RES)
-#define xfs_trans_unreserve_blkquota(tp, ip, nblks) \
+#define xfs_trans_unreserve_blkquota(tp, ip, nblks) \
(void)xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_REGBLKS)
-#define xfs_trans_reserve_quota(tp, udq, gdq, nb, ni, f) \
-xfs_trans_reserve_quota_bydquots(tp, udq, gdq, nb, ni, f|XFS_QMOPT_RES_REGBLKS)
+#define xfs_trans_reserve_quota(tp, udq, gdq, nb, ni, f) \
+xfs_trans_reserve_quota_bydquots(tp, udq, gdq, nb, ni, f|XFS_QMOPT_RES_REGBLKS)
-#define xfs_trans_unreserve_quota(tp, ud, gd, b, i, f) \
+#define xfs_trans_unreserve_quota(tp, ud, gd, b, i, f) \
xfs_trans_reserve_quota_bydquots(tp, ud, gd, -(b), -(i), f|XFS_QMOPT_RES_REGBLKS)
/*
- * Realtime disk block quota reservations
+ * Realtime disk block quota reservations
*/
-#define xfs_trans_reserve_rtblkquota(mp, tp, ip, nblks) \
+#define xfs_trans_reserve_rtblkquota(mp, tp, ip, nblks) \
xfs_trans_reserve_quota_nblks(tp, ip, nblks, 0, XFS_QMOPT_RES_RTBLKS)
-
-#define xfs_trans_unreserve_rtblkquota(tp, ip, nblks) \
+
+#define xfs_trans_unreserve_rtblkquota(tp, ip, nblks) \
(void)xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), 0, XFS_QMOPT_RES_RTBLKS)
-#define xfs_trans_reserve_rtquota(mp, tp, uq, pq, blks, f) \
-xfs_trans_reserve_quota_bydquots(mp, tp, uq, pq, blks, 0, f|XFS_QMOPT_RES_RTBLKS)
+#define xfs_trans_reserve_rtquota(mp, tp, uq, pq, blks, f) \
+xfs_trans_reserve_quota_bydquots(mp, tp, uq, pq, blks, 0, f|XFS_QMOPT_RES_RTBLKS)
-#define xfs_trans_unreserve_rtquota(tp, uq, pq, blks) \
+#define xfs_trans_unreserve_rtquota(tp, uq, pq, blks) \
xfs_trans_reserve_quota_bydquots(tp, uq, pq, -(blks), XFS_QMOPT_RES_RTBLKS)
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_RTALLOC_H__
-#define __XFS_RTALLOC_H__
+#define __XFS_RTALLOC_H__
struct xfs_mount;
struct xfs_trans;
/* Min and max rt extent sizes, specified in bytes */
-#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
-#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */
-#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4KB */
+#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
+#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */
+#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4KB */
/*
* Constants for bit manipulations.
*/
-#define XFS_NBBYLOG 3 /* log2(NBBY) */
-#define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */
-#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
-#define XFS_NBWORD (1 << XFS_NBWORDLOG)
-#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
+#define XFS_NBBYLOG 3 /* log2(NBBY) */
+#define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t)) */
+#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
+#define XFS_NBWORD (1 << XFS_NBWORDLOG)
+#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
-#define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize)
-#define XFS_BLOCKMASK(mp) ((mp)->m_blockmask)
-#define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize)
-#define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask)
+#define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize)
+#define XFS_BLOCKMASK(mp) ((mp)->m_blockmask)
+#define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize)
+#define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask)
/*
* Summary and bit manipulation macros.
*/
-#define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb)))
-#define XFS_SUMOFFSTOBLOCK(mp,s) \
+#define XFS_SUMOFFS(mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb)))
+#define XFS_SUMOFFSTOBLOCK(mp,s) \
(((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog)
-#define XFS_SUMPTR(mp,bp,so) \
+#define XFS_SUMPTR(mp,bp,so) \
((xfs_suminfo_t *)((char *)XFS_BUF_PTR(bp) + \
(((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp))))
-#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log)
-#define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log)
-#define XFS_BITTOWORD(mp,bi) \
+#define XFS_BITTOBLOCK(mp,bi) ((bi) >> (mp)->m_blkbit_log)
+#define XFS_BLOCKTOBIT(mp,bb) ((bb) << (mp)->m_blkbit_log)
+#define XFS_BITTOWORD(mp,bi) \
((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp)))
-#define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b))
-#define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b))
+#define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b))
+#define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b))
-#define XFS_RTLOBIT(w) xfs_lowbit32(w)
-#define XFS_RTHIBIT(w) xfs_highbit32(w)
+#define XFS_RTLOBIT(w) xfs_lowbit32(w)
+#define XFS_RTHIBIT(w) xfs_highbit32(w)
#if XFS_BIG_FILESYSTEMS
-#define XFS_RTBLOCKLOG(b) xfs_highbit64(b)
+#define XFS_RTBLOCKLOG(b) xfs_highbit64(b)
#else
-#define XFS_RTBLOCKLOG(b) xfs_highbit32(b)
+#define XFS_RTBLOCKLOG(b) xfs_highbit32(b)
#endif
/*
* Allocate an extent in the realtime subvolume, with the usual allocation
- * parameters. The length units are all in realtime extents, as is the
+ * parameters. The length units are all in realtime extents, as is the
* result block number.
*/
int /* error */
xfs_rtallocate_extent(
struct xfs_trans *tp, /* transaction pointer */
xfs_rtblock_t bno, /* starting block number to allocate */
- xfs_extlen_t minlen, /* minimum length to allocate */
- xfs_extlen_t maxlen, /* maximum length to allocate */
+ xfs_extlen_t minlen, /* minimum length to allocate */
+ xfs_extlen_t maxlen, /* maximum length to allocate */
xfs_extlen_t *len, /* out: actual length allocated */
xfs_alloctype_t type, /* allocation type XFS_ALLOCTYPE... */
- int wasdel, /* was a delayed allocation extent */
+ int wasdel, /* was a delayed allocation extent */
xfs_extlen_t prod, /* extent product factor */
xfs_rtblock_t *rtblock); /* out: start block allocated */
struct xfs_mount *mp); /* file system mount structure */
/*
- * Get the bitmap and summary inodes into the mount structure
+ * Get the bitmap and summary inodes into the mount structure
* at mount time.
*/
int /* error */
struct xfs_mount *mp, /* file system mount point */
struct xfs_trans *tp, /* transaction pointer */
xfs_extlen_t len, /* allocation length (rtextents) */
- xfs_rtblock_t *pick); /* result rt extent */
+ xfs_rtblock_t *pick); /* result rt extent */
/*
* Debug code: print out the value of a range in the bitmap.
xfs_growfs_rt_t *in); /* user supplied growfs struct */
#else
-# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS)
-# define xfs_rtfree_extent(t,b,l) (ENOSYS)
-# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
-# define xfs_growfs_rt(mp,in) (ENOSYS)
-# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
-# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
+# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS)
+# define xfs_rtfree_extent(t,b,l) (ENOSYS)
+# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
+# define xfs_growfs_rt(mp,in) (ENOSYS)
+# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
+# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
#endif /* CONFIG_XFS_RT */
#endif /* __KERNEL__ */
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_SB_H__
-#define __XFS_SB_H__
+#define __XFS_SB_H__
/*
* Super block
struct xfs_buf;
struct xfs_mount;
-#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_NUMBITS 0x000f
-#define XFS_SB_VERSION_ALLFBITS 0xfff0
-#define XFS_SB_VERSION_SASHFBITS 0xf000
-#define XFS_SB_VERSION_REALFBITS 0x0ff0
-#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_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_NUMBITS 0x000f
+#define XFS_SB_VERSION_ALLFBITS 0xfff0
+#define XFS_SB_VERSION_SASHFBITS 0xf000
+#define XFS_SB_VERSION_REALFBITS 0x0ff0
+#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_EXTFLGBIT 0x1000
-#define XFS_SB_VERSION_DIRV2BIT 0x2000
-#define XFS_SB_VERSION_OKSASHFBITS \
+#define XFS_SB_VERSION_EXTFLGBIT 0x1000
+#define XFS_SB_VERSION_DIRV2BIT 0x2000
+#define XFS_SB_VERSION_OKSASHFBITS \
(XFS_SB_VERSION_EXTFLGBIT | \
XFS_SB_VERSION_DIRV2BIT)
-#define XFS_SB_VERSION_OKREALFBITS \
+#define XFS_SB_VERSION_OKREALFBITS \
(XFS_SB_VERSION_ATTRBIT | \
XFS_SB_VERSION_NLINKBIT | \
XFS_SB_VERSION_QUOTABIT | \
XFS_SB_VERSION_DALIGNBIT | \
XFS_SB_VERSION_SHAREDBIT | \
XFS_SB_VERSION_LOGV2BIT)
-#define XFS_SB_VERSION_OKSASHBITS \
+#define XFS_SB_VERSION_OKSASHBITS \
(XFS_SB_VERSION_NUMBITS | \
XFS_SB_VERSION_REALFBITS | \
XFS_SB_VERSION_OKSASHFBITS)
-#define XFS_SB_VERSION_OKREALBITS \
+#define XFS_SB_VERSION_OKREALBITS \
(XFS_SB_VERSION_NUMBITS | \
XFS_SB_VERSION_OKREALFBITS | \
XFS_SB_VERSION_OKSASHFBITS)
-#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na) \
+#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dirv2,na) \
(((ia) || (dia) || (extflag) || (dirv2) || (na)) ? \
(XFS_SB_VERSION_4 | \
((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) | \
__uint8_t sb_imax_pct; /* max % of fs for inode space */
/* statistics */
/*
- * These fields must remain contiguous. If you really
+ * 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().
*/
__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 */
+ __uint32_t sb_width; /* stripe or raid width */
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
- __uint8_t sb_dummy[3]; /* padding */
+ __uint8_t sb_dummy[3]; /* padding */
__uint32_t sb_logsunit; /* stripe unit size for the log */
} xfs_sb_t;
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_DUMMY, XFS_SBS_LOGSUNIT,
+ XFS_SBS_DUMMY, XFS_SBS_LOGSUNIT,
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_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_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
-#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
-#define XFS_SB_MOD_BITS \
+#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)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM)
int xfs_sb_version_num(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
+#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
#else
-#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
+#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION)
int xfs_sb_good_version(xfs_sb_t *sbp);
-#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
+#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
#else
-#define XFS_SB_GOOD_VERSION_INT(sbp) \
+#define XFS_SB_GOOD_VERSION_INT(sbp) \
((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS)
#ifdef __KERNEL__
-#define XFS_SB_GOOD_VERSION(sbp) \
+#define XFS_SB_GOOD_VERSION(sbp) \
(XFS_SB_GOOD_VERSION_INT(sbp) && \
(sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) ))
#else
#endif /* __KERNEL__ */
#endif
-#define XFS_SB_GOOD_SASH_VERSION(sbp) \
+#define XFS_SB_GOOD_SASH_VERSION(sbp) \
((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW)
unsigned xfs_sb_version_tonew(unsigned v);
-#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
+#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
#else
-#define XFS_SB_VERSION_TONEW(v) \
+#define XFS_SB_VERSION_TONEW(v) \
((((v) == XFS_SB_VERSION_1) ? \
0 : \
(((v) == XFS_SB_VERSION_2) ? \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD)
unsigned xfs_sb_version_toold(unsigned v);
-#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
+#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
#else
-#define XFS_SB_VERSION_TOOLD(v) \
+#define XFS_SB_VERSION_TOOLD(v) \
(((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
0 : \
(((v) & XFS_SB_VERSION_NLINKBIT) ? \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR)
int xfs_sb_version_hasattr(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
+#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
#else
-#define XFS_SB_VERSION_HASATTR(sbp) \
+#define XFS_SB_VERSION_HASATTR(sbp) \
(((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR)
void xfs_sb_version_addattr(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
+#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
#else
-#define XFS_SB_VERSION_ADDATTR(sbp) \
+#define XFS_SB_VERSION_ADDATTR(sbp) \
((sbp)->sb_versionnum = \
(((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
XFS_SB_VERSION_2 : \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK)
int xfs_sb_version_hasnlink(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
+#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
#else
-#define XFS_SB_VERSION_HASNLINK(sbp) \
+#define XFS_SB_VERSION_HASNLINK(sbp) \
(((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT)))
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK)
void xfs_sb_version_addnlink(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
+#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
#else
-#define XFS_SB_VERSION_ADDNLINK(sbp) \
+#define XFS_SB_VERSION_ADDNLINK(sbp) \
((sbp)->sb_versionnum = \
((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
XFS_SB_VERSION_3 : \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA)
int xfs_sb_version_hasquota(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
+#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
#else
-#define XFS_SB_VERSION_HASQUOTA(sbp) \
+#define XFS_SB_VERSION_HASQUOTA(sbp) \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA)
void xfs_sb_version_addquota(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
+#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
#else
-#define XFS_SB_VERSION_ADDQUOTA(sbp) \
+#define XFS_SB_VERSION_ADDQUOTA(sbp) \
((sbp)->sb_versionnum = \
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN)
int xfs_sb_version_hasalign(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
+#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
#else
-#define XFS_SB_VERSION_HASALIGN(sbp) \
+#define XFS_SB_VERSION_HASALIGN(sbp) \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN)
void xfs_sb_version_subalign(xfs_sb_t *sbp);
-#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
+#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
#else
-#define XFS_SB_VERSION_SUBALIGN(sbp) \
+#define XFS_SB_VERSION_SUBALIGN(sbp) \
((sbp)->sb_versionnum = \
XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT))
#endif
#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
#else
#define XFS_SB_VERSION_ADDDALIGN(sbp) \
- ((sbp)->sb_versionnum = \
- ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT))
+ ((sbp)->sb_versionnum = \
+ ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSHARED)
#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
#else
#define XFS_SB_VERSION_HASSHARED(sbp) \
- ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
+ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT))
#endif
#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
#else
#define XFS_SB_VERSION_ADDSHARED(sbp) \
- ((sbp)->sb_versionnum = \
- ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT))
+ ((sbp)->sb_versionnum = \
+ ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBSHARED)
#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
#else
#define XFS_SB_VERSION_SUBSHARED(sbp) \
- ((sbp)->sb_versionnum = \
- ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT))
+ ((sbp)->sb_versionnum = \
+ ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDIRV2)
#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
#else
#define XFS_SB_VERSION_HASDIRV2(sbp) \
- ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
+ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
#endif
#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
#else
#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) \
- ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
+ ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT))
#endif
#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
#else
#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) \
- ((sbp)->sb_versionnum = \
- ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT))
+ ((sbp)->sb_versionnum = \
+ ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBEXTFLGBIT)
#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
#else
#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) \
- ((sbp)->sb_versionnum = \
- ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT))
+ ((sbp)->sb_versionnum = \
+ ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT))
#endif
/*
* end of superblock version macros
*/
-#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
+#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
-#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
+#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
#else
-#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
+#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK)
xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d);
-#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
+#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
#else
-#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
+#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB)
xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d);
-#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
+#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
#else
-#define XFS_DADDR_TO_FSB(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))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR)
xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
-#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
+#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
#else
-#define XFS_FSB_TO_DADDR(mp,fsbno) \
+#define XFS_FSB_TO_DADDR(mp,fsbno) \
XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \
XFS_FSB_TO_AGBNO(mp,fsbno))
#endif
/*
* 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) \
+#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)
-#define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
+#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log)
+#define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
/*
* File system block to byte conversions.
*/
-#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << \
+#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << \
(mp)->m_sb.sb_blocklog)
-#define XFS_B_TO_FSB(mp,b) \
+#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)
+#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)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
-#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
+#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
#else
-#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
+#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
#endif
#endif /* __XFS_SB_H__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-#ifndef __XFS_TRANS_H__
-#define __XFS_TRANS_H__
+#ifndef __XFS_TRANS_H__
+#define __XFS_TRANS_H__
/*
* This is the structure written in the log at the head of
uint th_num_items; /* num items logged by trans */
} xfs_trans_header_t;
-#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */
+#define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */
/*
* Log item types.
*/
-#define XFS_LI_5_3_BUF 0x1234 /* v1 bufs, 1-block inode buffers */
-#define XFS_LI_5_3_INODE 0x1235 /* 1-block inode buffers */
-#define XFS_LI_EFI 0x1236
-#define XFS_LI_EFD 0x1237
-#define XFS_LI_IUNLINK 0x1238
-#define XFS_LI_6_1_INODE 0x1239 /* 4K non-aligned inode bufs */
-#define XFS_LI_6_1_BUF 0x123a /* v1, 4K inode buffers */
-#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */
-#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */
-#define XFS_LI_DQUOT 0x123d
-#define XFS_LI_QUOTAOFF 0x123e
-#define XFS_LI_RPC 0x123f /* CXFS RPC return info */
+#define XFS_LI_5_3_BUF 0x1234 /* v1 bufs, 1-block inode buffers */
+#define XFS_LI_5_3_INODE 0x1235 /* 1-block inode buffers */
+#define XFS_LI_EFI 0x1236
+#define XFS_LI_EFD 0x1237
+#define XFS_LI_IUNLINK 0x1238
+#define XFS_LI_6_1_INODE 0x1239 /* 4K non-aligned inode bufs */
+#define XFS_LI_6_1_BUF 0x123a /* v1, 4K inode buffers */
+#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */
+#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */
+#define XFS_LI_DQUOT 0x123d
+#define XFS_LI_QUOTAOFF 0x123e
+#define XFS_LI_RPC 0x123f /* CXFS RPC return info */
/*
* Transaction types. Used to distinguish types of buffers.
#define XFS_TRANS_GROWFS 14
#define XFS_TRANS_STRAT_WRITE 15
#define XFS_TRANS_DIOSTRAT 16
-#define XFS_TRANS_WRITE_SYNC 17
-#define XFS_TRANS_WRITEID 18
-#define XFS_TRANS_ADDAFORK 19
-#define XFS_TRANS_ATTRINVAL 20
-#define XFS_TRANS_ATRUNCATE 21
-#define XFS_TRANS_ATTR_SET 22
-#define XFS_TRANS_ATTR_RM 23
-#define XFS_TRANS_ATTR_FLAG 24
-#define XFS_TRANS_CLEAR_AGI_BUCKET 25
+#define XFS_TRANS_WRITE_SYNC 17
+#define XFS_TRANS_WRITEID 18
+#define XFS_TRANS_ADDAFORK 19
+#define XFS_TRANS_ATTRINVAL 20
+#define XFS_TRANS_ATRUNCATE 21
+#define XFS_TRANS_ATTR_SET 22
+#define XFS_TRANS_ATTR_RM 23
+#define XFS_TRANS_ATTR_FLAG 24
+#define XFS_TRANS_CLEAR_AGI_BUCKET 25
#define XFS_TRANS_QM_SBCHANGE 26
/*
* Dummy entries since we use the transaction type to index into the
#define XFS_TRANS_QM_QUOTAOFF_END 34
#define XFS_TRANS_SB_UNIT 35
#define XFS_TRANS_FSYNC_TS 36
-#define XFS_TRANS_GROWFSRT_ALLOC 37
-#define XFS_TRANS_GROWFSRT_ZERO 38
-#define XFS_TRANS_GROWFSRT_FREE 39
-#define XFS_TRANS_SWAPEXT 40
+#define XFS_TRANS_GROWFSRT_ALLOC 37
+#define XFS_TRANS_GROWFSRT_ZERO 38
+#define XFS_TRANS_GROWFSRT_FREE 39
+#define XFS_TRANS_SWAPEXT 40
/* new transaction types need to be reflected in xfs_logprint(8) */
struct xfs_item_ops *li_ops; /* function list */
} xfs_log_item_t;
-#define XFS_LI_IN_AIL 0x1
+#define XFS_LI_IN_AIL 0x1
#define XFS_LI_ABORTED 0x2
typedef struct xfs_item_ops {
void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
} xfs_item_ops_t;
-#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
-#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
-#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
-#define IOP_UNPIN(ip) (*(ip)->li_ops->iop_unpin)(ip)
-#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
-#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
-#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
-#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
-#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
-#define IOP_ABORT(ip) (*(ip)->li_ops->iop_abort)(ip)
-#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
+#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
+#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
+#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
+#define IOP_UNPIN(ip) (*(ip)->li_ops->iop_unpin)(ip)
+#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
+#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
+#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
+#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
+#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
+#define IOP_ABORT(ip) (*(ip)->li_ops->iop_abort)(ip)
+#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
#define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)
/*
* Return values for the IOP_TRYLOCK() routines.
*/
-#define XFS_ITEM_SUCCESS 0
-#define XFS_ITEM_PINNED 1
-#define XFS_ITEM_LOCKED 2
-#define XFS_ITEM_FLUSHING 3
-#define XFS_ITEM_PUSHBUF 4
+#define XFS_ITEM_SUCCESS 0
+#define XFS_ITEM_PINNED 1
+#define XFS_ITEM_LOCKED 2
+#define XFS_ITEM_FLUSHING 3
+#define XFS_ITEM_PUSHBUF 4
#endif /* __KERNEL__ */
unsigned char lid_index;
} xfs_log_item_desc_t;
-#define XFS_LID_DIRTY 0x1
-#define XFS_LID_PINNED 0x2
-#define XFS_LID_SYNC_UNLOCK 0x4
+#define XFS_LID_DIRTY 0x1
+#define XFS_LID_PINNED 0x2
+#define XFS_LID_SYNC_UNLOCK 0x4
/*
* This structure is used to maintain a chunk list of log_item_desc
* in this chunk's array are free. The unused field is the first value
* not used since this chunk was allocated.
*/
-#define XFS_LIC_NUM_SLOTS 15
+#define XFS_LIC_NUM_SLOTS 15
typedef struct xfs_log_item_chunk {
struct xfs_log_item_chunk *lic_next;
ushort lic_free;
xfs_log_item_desc_t lic_descs[XFS_LIC_NUM_SLOTS];
} xfs_log_item_chunk_t;
-#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1)
-#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1)
+#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1)
+#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1)
/*
- * Initialize the given chunk. Set the chunk's free descriptor mask
+ * Initialize the given chunk. Set the chunk's free descriptor mask
* to indicate that all descriptors are free. The caller gets to set
- * lic_unused to the right value (0 matches all free). The
+ * lic_unused to the right value (0 matches all free). The
* lic_descs.lid_index values are set up as each desc is allocated.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT)
void xfs_lic_init(xfs_log_item_chunk_t *cp);
-#define XFS_LIC_INIT(cp) xfs_lic_init(cp)
+#define XFS_LIC_INIT(cp) xfs_lic_init(cp)
#else
-#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
+#define XFS_LIC_INIT(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_INIT_SLOT)
void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot);
-#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot)
+#define XFS_LIC_INIT_SLOT(cp,slot) xfs_lic_init_slot(cp, slot)
#else
-#define XFS_LIC_INIT_SLOT(cp,slot) \
+#define XFS_LIC_INIT_SLOT(cp,slot) \
((cp)->lic_descs[slot].lid_index = (unsigned char)(slot))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_VACANCY)
int xfs_lic_vacancy(xfs_log_item_chunk_t *cp);
-#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp)
+#define XFS_LIC_VACANCY(cp) xfs_lic_vacancy(cp)
#else
-#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK)
+#define XFS_LIC_VACANCY(cp) (((cp)->lic_free) & XFS_LIC_FREEMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ALL_FREE)
void xfs_lic_all_free(xfs_log_item_chunk_t *cp);
-#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp)
+#define XFS_LIC_ALL_FREE(cp) xfs_lic_all_free(cp)
#else
-#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
+#define XFS_LIC_ALL_FREE(cp) ((cp)->lic_free = XFS_LIC_FREEMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ARE_ALL_FREE)
int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp);
-#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp)
+#define XFS_LIC_ARE_ALL_FREE(cp) xfs_lic_are_all_free(cp)
#else
-#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\
+#define XFS_LIC_ARE_ALL_FREE(cp) (((cp)->lic_free & XFS_LIC_FREEMASK) ==\
XFS_LIC_FREEMASK)
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_ISFREE)
int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot);
-#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot)
+#define XFS_LIC_ISFREE(cp,slot) xfs_lic_isfree(cp,slot)
#else
-#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot)))
+#define XFS_LIC_ISFREE(cp,slot) ((cp)->lic_free & (1 << (slot)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_CLAIM)
void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot);
-#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot)
+#define XFS_LIC_CLAIM(cp,slot) xfs_lic_claim(cp,slot)
#else
-#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot)))
+#define XFS_LIC_CLAIM(cp,slot) ((cp)->lic_free &= ~(1 << (slot)))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_RELSE)
void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot);
-#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot)
+#define XFS_LIC_RELSE(cp,slot) xfs_lic_relse(cp,slot)
#else
-#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot))
+#define XFS_LIC_RELSE(cp,slot) ((cp)->lic_free |= 1 << (slot))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_SLOT)
xfs_log_item_desc_t *xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot);
-#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot)
+#define XFS_LIC_SLOT(cp,slot) xfs_lic_slot(cp,slot)
#else
-#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot]))
+#define XFS_LIC_SLOT(cp,slot) (&((cp)->lic_descs[slot]))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_SLOT)
int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp);
-#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp)
+#define XFS_LIC_DESC_TO_SLOT(dp) xfs_lic_desc_to_slot(dp)
#else
-#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index))
+#define XFS_LIC_DESC_TO_SLOT(dp) ((uint)((dp)->lid_index))
#endif
/*
* Calculate the address of a chunk given a descriptor pointer:
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LIC_DESC_TO_CHUNK)
xfs_log_item_chunk_t *xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp);
-#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp)
+#define XFS_LIC_DESC_TO_CHUNK(dp) xfs_lic_desc_to_chunk(dp)
#else
-#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \
+#define XFS_LIC_DESC_TO_CHUNK(dp) ((xfs_log_item_chunk_t*) \
(((xfs_caddr_t)((dp) - (dp)->lid_index)) -\
(xfs_caddr_t)(((xfs_log_item_chunk_t*) \
0)->lic_descs)))
xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
} xfs_log_busy_chunk_t;
-#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1)
-#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1)
+#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1)
+#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1)
-#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK)
-#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot)))
-#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)]))
-#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK)
-#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot)))
+#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK)
+#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot)))
+#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)]))
+#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK)
+#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot)))
/*
* This is the type of function which can be given to xfs_trans_callback()
unsigned int t_log_res; /* amt of log space resvd */
unsigned int t_log_count; /* count for perm log res */
unsigned int t_blk_res; /* # of blocks resvd */
- unsigned int t_blk_res_used; /* # of resvd blocks used */
+ unsigned int t_blk_res_used; /* # of resvd blocks used */
unsigned int t_rtx_res; /* # of rt extents resvd */
- unsigned int t_rtx_res_used; /* # of resvd rt extents used */
+ unsigned int t_rtx_res_used; /* # of resvd rt extents used */
xfs_log_ticket_t t_ticket; /* log mgr ticket */
sema_t t_sema; /* sema for commit completion */
xfs_lsn_t t_lsn; /* log seq num of trans commit*/
struct xfs_mount *t_mountp; /* ptr to fs mount struct */
- struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */
+ struct xfs_dquot_acct *t_dqinfo; /* accting info for dquots */
xfs_trans_callback_t t_callback; /* transaction callback */
void *t_callarg; /* callback arg */
unsigned int t_flags; /* misc flags */
- long t_icount_delta; /* superblock icount change */
+ long t_icount_delta; /* superblock icount change */
long t_ifree_delta; /* superblock ifree change */
long t_fdblocks_delta; /* superblock fdblocks chg */
long t_res_fdblocks_delta; /* on-disk only chg */
#endif /* __KERNEL__ */
-#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
+#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
/*
* Values for t_flags.
*/
-#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */
-#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */
-#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */
-#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */
+#define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */
+#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */
+#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */
+#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */
#define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */
-#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
+#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
/*
* Values for call flags parameter.
*/
-#define XFS_TRANS_NOSLEEP 0x1
-#define XFS_TRANS_WAIT 0x2
-#define XFS_TRANS_RELEASE_LOG_RES 0x4
-#define XFS_TRANS_ABORT 0x8
+#define XFS_TRANS_NOSLEEP 0x1
+#define XFS_TRANS_WAIT 0x2
+#define XFS_TRANS_RELEASE_LOG_RES 0x4
+#define XFS_TRANS_ABORT 0x8
/*
* Field values for xfs_trans_mod_sb.
*/
-#define XFS_TRANS_SB_ICOUNT 0x00000001
-#define XFS_TRANS_SB_IFREE 0x00000002
-#define XFS_TRANS_SB_FDBLOCKS 0x00000004
-#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008
-#define XFS_TRANS_SB_FREXTENTS 0x00000010
-#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020
-#define XFS_TRANS_SB_DBLOCKS 0x00000040
-#define XFS_TRANS_SB_AGCOUNT 0x00000080
-#define XFS_TRANS_SB_IMAXPCT 0x00000100
-#define XFS_TRANS_SB_REXTSIZE 0x00000200
-#define XFS_TRANS_SB_RBMBLOCKS 0x00000400
-#define XFS_TRANS_SB_RBLOCKS 0x00000800
-#define XFS_TRANS_SB_REXTENTS 0x00001000
-#define XFS_TRANS_SB_REXTSLOG 0x00002000
+#define XFS_TRANS_SB_ICOUNT 0x00000001
+#define XFS_TRANS_SB_IFREE 0x00000002
+#define XFS_TRANS_SB_FDBLOCKS 0x00000004
+#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008
+#define XFS_TRANS_SB_FREXTENTS 0x00000010
+#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020
+#define XFS_TRANS_SB_DBLOCKS 0x00000040
+#define XFS_TRANS_SB_AGCOUNT 0x00000080
+#define XFS_TRANS_SB_IMAXPCT 0x00000100
+#define XFS_TRANS_SB_REXTSIZE 0x00000200
+#define XFS_TRANS_SB_RBMBLOCKS 0x00000400
+#define XFS_TRANS_SB_RBLOCKS 0x00000800
+#define XFS_TRANS_SB_REXTENTS 0x00001000
+#define XFS_TRANS_SB_REXTSLOG 0x00002000
/*
* involved in freeing or allocating an extent.
* 2 trees * (2 blocks/level * max depth - 1) * block size
*/
-#define XFS_ALLOCFREE_LOG_RES(mp,nx) \
+#define XFS_ALLOCFREE_LOG_RES(mp,nx) \
((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1)))
-#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \
+#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \
((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1)))
/*
* v2 directory blocks can be fragmented below the dirblksize down to the fsb
* size, so account for that in the DAENTER macros.
*/
-#define XFS_DIROP_LOG_RES(mp) \
+#define XFS_DIROP_LOG_RES(mp) \
(XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \
(XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)))
-#define XFS_DIROP_LOG_COUNT(mp) \
+#define XFS_DIROP_LOG_COUNT(mp) \
(XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \
XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
-#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write)
+#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write)
/*
* In truncating a file we free up to two extents at once. We can modify:
* worst case split in allocation btrees per extent assuming 4 extents:
* 4 exts * 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \
+#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \
XFS_ALLOCFREE_LOG_RES(mp, 4) + \
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))))))
-#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate)
+#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate)
/*
* In renaming a files we can modify:
* the superblock for the free block count: sector size
* the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_RENAME_LOG_RES(mp) \
+#define XFS_CALC_RENAME_LOG_RES(mp) \
(MAX( \
((4 * (mp)->m_sb.sb_inodesize) + \
(2 * XFS_DIROP_LOG_RES(mp)) + \
XFS_ALLOCFREE_LOG_RES(mp, 3) + \
(128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3))))))
-#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename)
+#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename)
/*
* For creating a link to an inode:
* the superblock for the free block count: sector size
* the allocation btrees: 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_LINK_LOG_RES(mp) \
+#define XFS_CALC_LINK_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
- (mp)->m_sb.sb_inodesize + \
+ (mp)->m_sb.sb_inodesize + \
XFS_DIROP_LOG_RES(mp) + \
(128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
((mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
-#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link)
+#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link)
/*
* For removing a directory entry we can modify:
* the superblock for the free block count: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_REMOVE_LOG_RES(mp) \
+#define XFS_CALC_REMOVE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
- (mp)->m_sb.sb_inodesize + \
+ (mp)->m_sb.sb_inodesize + \
XFS_DIROP_LOG_RES(mp) + \
(128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
((2 * (mp)->m_sb.sb_sectsize) + \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
-#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove)
+#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove)
/*
* For symlink we can modify:
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_SYMLINK_LOG_RES(mp) \
+#define XFS_CALC_SYMLINK_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
-#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
+#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
/*
* For create we can modify:
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (max depth - 1) * block size
*/
-#define XFS_CALC_CREATE_LOG_RES(mp) \
+#define XFS_CALC_CREATE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
-#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
+#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
/*
* Making a new directory is the same as creating a new file.
*/
-#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp)
+#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp)
-#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir)
+#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir)
/*
* In freeing an inode we can modify:
* the inode btree entry: block size
* the on disk inode before ours in the agi hash list: inode cluster size
*/
-#define XFS_CALC_IFREE_LOG_RES(mp) \
+#define XFS_CALC_IFREE_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + \
(mp)->m_sb.sb_sectsize + \
MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \
(128 * 5))
-#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree)
+#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree)
/*
* When only changing the inode we log the inode and possibly the superblock
* We also add a bit of slop for the transaction stuff.
*/
-#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \
+#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + 512)
-#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange)
+#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange)
/*
* Growing the data section of the filesystem.
* agi and agf
* allocation btrees
*/
-#define XFS_CALC_GROWDATA_LOG_RES(mp) \
+#define XFS_CALC_GROWDATA_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize * 3 + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
-#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata)
+#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdata)
/*
* Growing the rt section of the filesystem.
* bitmap/summary inode: inode size
* allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocksize
*/
-#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \
+#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \
(2 * (mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \
(mp)->m_sb.sb_inodesize + \
(3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
-#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc)
+#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_growrtalloc)
/*
* Growing the rt section of the filesystem.
* In the second set of transactions (ZERO) we zero the new metadata blocks.
* one bitmap/summary block: blocksize
*/
-#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \
+#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \
((mp)->m_sb.sb_blocksize + 128)
-#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero)
+#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_growrtzero)
/*
* Growing the rt section of the filesystem.
* one bitmap block: blocksize
* summary blocks: new summary size
*/
-#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \
+#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize + \
2 * (mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_blocksize + \
(mp)->m_rsumsize + \
(128 * 5))
-#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree)
+#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_growrtfree)
/*
* Logging the inode modification timestamp on a synchronous write.
* inode
*/
-#define XFS_CALC_SWRITE_LOG_RES(mp) \
- ((mp)->m_sb.sb_inodesize + 128)
+#define XFS_CALC_SWRITE_LOG_RES(mp) \
+ ((mp)->m_sb.sb_inodesize + 128)
-#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
+#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/*
* Logging the inode timestamps on an fsync -- same as SWRITE
* as long as SWRITE logs the entire inode core
*/
-#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
+#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/*
* Logging the inode mode bits when writing a setuid/setgid file
* inode
*/
-#define XFS_CALC_WRITEID_LOG_RES(mp) \
- ((mp)->m_sb.sb_inodesize + 128)
+#define XFS_CALC_WRITEID_LOG_RES(mp) \
+ ((mp)->m_sb.sb_inodesize + 128)
-#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
+#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/*
* Converting the inode from non-attributed to attributed.
* bmap blocks for the new directory block
* allocation btrees
*/
-#define XFS_CALC_ADDAFORK_LOG_RES(mp) \
+#define XFS_CALC_ADDAFORK_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize * 2 + \
(mp)->m_dirblksize + \
XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
-#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork)
+#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork)
/*
* Removing the attribute fork of a file
* worst case split in allocation btrees per extent assuming 4 extents:
* 4 exts * 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \
+#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
XFS_ALLOCFREE_LOG_RES(mp, 4) + \
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))))))
-#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval)
+#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval)
/*
* Setting an attribute.
* Since attribute transaction space is dependent on the size of the attribute,
* the calculation is done partially at mount time and partially at runtime.
*/
-#define XFS_CALC_ATTRSET_LOG_RES(mp) \
+#define XFS_CALC_ATTRSET_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
- (128 * (2 + XFS_DA_NODE_MAXDEPTH)))
+ (128 * (2 + XFS_DA_NODE_MAXDEPTH)))
-#define XFS_ATTRSET_LOG_RES(mp, ext) \
+#define XFS_ATTRSET_LOG_RES(mp, ext) \
((mp)->m_reservations.tr_attrset + \
(ext * (mp)->m_sb.sb_sectsize) + \
(ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \
* the superblock for the free block count: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
*/
-#define XFS_CALC_ATTRRM_LOG_RES(mp) \
+#define XFS_CALC_ATTRRM_LOG_RES(mp) \
(MAX( \
- ((mp)->m_sb.sb_inodesize + \
+ ((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
(128 * (1 + XFS_DA_NODE_MAXDEPTH + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
-#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
+#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
/*
* Clearing a bad agino number in an agi hash bucket.
*/
-#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \
+#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize + 128)
-#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi)
+#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi)
/*
* Various log count values.
*/
-#define XFS_DEFAULT_LOG_COUNT 1
-#define XFS_DEFAULT_PERM_LOG_COUNT 2
-#define XFS_ITRUNCATE_LOG_COUNT 2
-#define XFS_CREATE_LOG_COUNT 2
-#define XFS_MKDIR_LOG_COUNT 3
-#define XFS_SYMLINK_LOG_COUNT 3
-#define XFS_REMOVE_LOG_COUNT 2
-#define XFS_LINK_LOG_COUNT 2
-#define XFS_RENAME_LOG_COUNT 2
-#define XFS_WRITE_LOG_COUNT 2
-#define XFS_ADDAFORK_LOG_COUNT 2
-#define XFS_ATTRINVAL_LOG_COUNT 1
-#define XFS_ATTRSET_LOG_COUNT 3
-#define XFS_ATTRRM_LOG_COUNT 3
+#define XFS_DEFAULT_LOG_COUNT 1
+#define XFS_DEFAULT_PERM_LOG_COUNT 2
+#define XFS_ITRUNCATE_LOG_COUNT 2
+#define XFS_CREATE_LOG_COUNT 2
+#define XFS_MKDIR_LOG_COUNT 3
+#define XFS_SYMLINK_LOG_COUNT 3
+#define XFS_REMOVE_LOG_COUNT 2
+#define XFS_LINK_LOG_COUNT 2
+#define XFS_RENAME_LOG_COUNT 2
+#define XFS_WRITE_LOG_COUNT 2
+#define XFS_ADDAFORK_LOG_COUNT 2
+#define XFS_ATTRINVAL_LOG_COUNT 1
+#define XFS_ATTRSET_LOG_COUNT 3
+#define XFS_ATTRRM_LOG_COUNT 3
/*
* Here we centralize the specification of XFS meta-data buffer
* reference count values. This determine how hard the buffer
* cache tries to hold onto the buffer.
*/
-#define XFS_AGF_REF 4
-#define XFS_AGI_REF 4
-#define XFS_AGFL_REF 3
-#define XFS_INO_BTREE_REF 3
-#define XFS_ALLOC_BTREE_REF 2
-#define XFS_BMAP_BTREE_REF 2
-#define XFS_DIR_BTREE_REF 2
-#define XFS_ATTR_BTREE_REF 1
-#define XFS_INO_REF 1
-#define XFS_DQUOT_REF 1
+#define XFS_AGF_REF 4
+#define XFS_AGI_REF 4
+#define XFS_AGFL_REF 3
+#define XFS_INO_BTREE_REF 3
+#define XFS_ALLOC_BTREE_REF 2
+#define XFS_BMAP_BTREE_REF 2
+#define XFS_DIR_BTREE_REF 2
+#define XFS_ATTR_BTREE_REF 1
+#define XFS_INO_REF 1
+#define XFS_DQUOT_REF 1
#ifdef __KERNEL__
/*
* XFS transaction mechanism exported interfaces that are
* actually macros.
*/
-#define xfs_trans_get_log_res(tp) ((tp)->t_log_res)
-#define xfs_trans_get_log_count(tp) ((tp)->t_log_count)
-#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res)
-#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC)
+#define xfs_trans_get_log_res(tp) ((tp)->t_log_res)
+#define xfs_trans_get_log_count(tp) ((tp)->t_log_count)
+#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res)
+#define xfs_trans_set_sync(tp) ((tp)->t_flags |= XFS_TRANS_SYNC)
#ifdef DEBUG
-#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (long)d)
-#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (long)d)
-#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (long)d)
+#define xfs_trans_agblocks_delta(tp, d) ((tp)->t_ag_freeblks_delta += (long)d)
+#define xfs_trans_agflist_delta(tp, d) ((tp)->t_ag_flist_delta += (long)d)
+#define xfs_trans_agbtree_delta(tp, d) ((tp)->t_ag_btree_delta += (long)d)
#else
-#define xfs_trans_agblocks_delta(tp, d)
-#define xfs_trans_agflist_delta(tp, d)
-#define xfs_trans_agbtree_delta(tp, d)
+#define xfs_trans_agblocks_delta(tp, d)
+#define xfs_trans_agflist_delta(tp, d)
+#define xfs_trans_agbtree_delta(tp, d)
#endif
/*
void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *);
void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint);
void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint);
-struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
+struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
void xfs_efi_release(struct xfs_efi_log_item *, uint);
void xfs_trans_log_efi_extent(xfs_trans_t *,
struct xfs_efi_log_item *,
xfs_fsblock_t,
xfs_extlen_t);
-struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *,
+struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *,
struct xfs_efi_log_item *,
uint);
void xfs_trans_log_efd_extent(xfs_trans_t *,
xfs_fsblock_t,
xfs_extlen_t);
void xfs_trans_log_create_rpc(xfs_trans_t *, int, xfs_ino_t);
-void xfs_trans_log_setattr_rpc(xfs_trans_t *, int);
+void xfs_trans_log_setattr_rpc(xfs_trans_t *, int);
int xfs_trans_commit(xfs_trans_t *, uint flags, xfs_lsn_t *);
void xfs_trans_commit_async(struct xfs_mount *);
void xfs_trans_cancel(xfs_trans_t *, int);
/*
* Copyright (c) 2000 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_TRANS_SPACE_H__
/*
* Components of space reservations.
*/
-#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \
- (((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0]))
-#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1)
+#define XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) \
+ (((mp)->m_alloc_mxr[0]) - ((mp)->m_alloc_mnr[0]))
+#define XFS_EXTENTADD_SPACE_RES(mp,w) (XFS_BM_MAXLEVELS(mp,w) - 1)
#define XFS_NEXTENTADD_SPACE_RES(mp,b,w)\
- (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
- XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
- XFS_EXTENTADD_SPACE_RES(mp,w))
-#define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1)
-#define XFS_DAENTER_DBS(mp,w) \
+ (((b + XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp) - 1) / \
+ XFS_MAX_CONTIG_EXTENTS_PER_BLOCK(mp)) * \
+ XFS_EXTENTADD_SPACE_RES(mp,w))
+#define XFS_DAENTER_1B(mp,w) ((w) == XFS_DATA_FORK ? (mp)->m_dirblkfsbs : 1)
+#define XFS_DAENTER_DBS(mp,w) \
(XFS_DA_NODE_MAXDEPTH + \
((XFS_DIR_IS_V2(mp) && (w) == XFS_DATA_FORK) ? 2 : 0))
-#define XFS_DAENTER_BLOCKS(mp,w) \
+#define XFS_DAENTER_BLOCKS(mp,w) \
(XFS_DAENTER_1B(mp,w) * XFS_DAENTER_DBS(mp,w))
-#define XFS_DAENTER_BMAP1B(mp,w) \
+#define XFS_DAENTER_BMAP1B(mp,w) \
XFS_NEXTENTADD_SPACE_RES(mp, XFS_DAENTER_1B(mp, w), w)
-#define XFS_DAENTER_BMAPS(mp,w) \
+#define XFS_DAENTER_BMAPS(mp,w) \
(XFS_DAENTER_DBS(mp,w) * XFS_DAENTER_BMAP1B(mp,w))
-#define XFS_DAENTER_SPACE_RES(mp,w) \
+#define XFS_DAENTER_SPACE_RES(mp,w) \
(XFS_DAENTER_BLOCKS(mp,w) + XFS_DAENTER_BMAPS(mp,w))
-#define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w)
-#define XFS_DIRENTER_MAX_SPLIT(mp,nl) \
+#define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w)
+#define XFS_DIRENTER_MAX_SPLIT(mp,nl) \
(((mp)->m_sb.sb_blocksize == 512 && \
XFS_DIR_IS_V1(mp) && \
(nl) >= XFS_DIR_LEAF_CAN_DOUBLE_SPLIT_LEN) ? 2 : 1)
-#define XFS_DIRENTER_SPACE_RES(mp,nl) \
+#define XFS_DIRENTER_SPACE_RES(mp,nl) \
(XFS_DAENTER_SPACE_RES(mp, XFS_DATA_FORK) * \
XFS_DIRENTER_MAX_SPLIT(mp,nl))
-#define XFS_DIRREMOVE_SPACE_RES(mp) \
+#define XFS_DIRREMOVE_SPACE_RES(mp) \
XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
-#define XFS_IALLOC_SPACE_RES(mp) \
+#define XFS_IALLOC_SPACE_RES(mp) \
(XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp)-1)
/*
* Space reservation values for various transactions.
*/
-#define XFS_ADDAFORK_SPACE_RES(mp) \
+#define XFS_ADDAFORK_SPACE_RES(mp) \
((mp)->m_dirblkfsbs + \
(XFS_DIR_IS_V1(mp) ? 0 : XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK)))
-#define XFS_ATTRRM_SPACE_RES(mp) \
+#define XFS_ATTRRM_SPACE_RES(mp) \
XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK)
/* This macro is not used - see inline code in xfs_attr_set */
-#define XFS_ATTRSET_SPACE_RES(mp, v) \
+#define XFS_ATTRSET_SPACE_RES(mp, v) \
(XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK) + XFS_B_TO_FSB(mp, v))
-#define XFS_CREATE_SPACE_RES(mp,nl) \
+#define XFS_CREATE_SPACE_RES(mp,nl) \
(XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl))
-#define XFS_DIOSTRAT_SPACE_RES(mp, v) \
+#define XFS_DIOSTRAT_SPACE_RES(mp, v) \
(XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + (v))
-#define XFS_GROWFS_SPACE_RES(mp) \
+#define XFS_GROWFS_SPACE_RES(mp) \
(2 * XFS_AG_MAXLEVELS(mp))
-#define XFS_GROWFSRT_SPACE_RES(mp,b) \
+#define XFS_GROWFSRT_SPACE_RES(mp,b) \
((b) + XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK))
-#define XFS_LINK_SPACE_RES(mp,nl) \
+#define XFS_LINK_SPACE_RES(mp,nl) \
XFS_DIRENTER_SPACE_RES(mp,nl)
-#define XFS_MKDIR_SPACE_RES(mp,nl) \
+#define XFS_MKDIR_SPACE_RES(mp,nl) \
(XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl))
-#define XFS_QM_DQALLOC_SPACE_RES(mp) \
+#define XFS_QM_DQALLOC_SPACE_RES(mp) \
(XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK) + \
XFS_DQUOT_CLUSTER_SIZE_FSB)
-#define XFS_QM_QINOCREATE_SPACE_RES(mp) \
+#define XFS_QM_QINOCREATE_SPACE_RES(mp) \
XFS_IALLOC_SPACE_RES(mp)
-#define XFS_REMOVE_SPACE_RES(mp) \
+#define XFS_REMOVE_SPACE_RES(mp) \
XFS_DIRREMOVE_SPACE_RES(mp)
-#define XFS_RENAME_SPACE_RES(mp,nl) \
+#define XFS_RENAME_SPACE_RES(mp,nl) \
(XFS_DIRREMOVE_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl))
-#define XFS_SYMLINK_SPACE_RES(mp,nl,b) \
+#define XFS_SYMLINK_SPACE_RES(mp,nl,b) \
(XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl) + (b))
#endif /* __XFS_TRANS_SPACE_H__ */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef __XFS_TYPES_H__
-#define __XFS_TYPES_H__
+#define __XFS_TYPES_H__
/*
* Some types are conditional based on the selected configuration.
- * Set XFS_BIG_FILES=1 or 0 and XFS_BIG_FILESYSTEMS=1 or 0 depending
- * on the desired configuration.
- * XFS_BIG_FILES needs pgno_t to be 64 bits (64-bit kernels).
- * XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits (N32 and 64-bit kernels).
+ * Set XFS_BIG_FILESYSTEMS=1 or 0 depending on the desired configuration.
+ * XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits
*
- * Expect these to be set from klocaldefs, or from the machine-type
- * defs files for the normal case.
+ * On linux right now we are limited to 2^32 512 byte blocks in a
+ * filesystem, Once this limit is changed, setting this to 1
+ * will allow XFS to go larger. With BIG_FILESYSTEMS set to 0
+ * a 4K block filesystem could still theoretically be 16Gbytes
+ * long, so on an ia32 box the 32 bit page index will then be
+ * the limiting factor.
*/
-#define XFS_BIG_FILES 1
-#define XFS_BIG_FILESYSTEMS 1
+#define XFS_BIG_FILESYSTEMS 0
typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
-typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
-typedef __uint32_t xfs_agnumber_t; /* allocation group number */
+typedef __uint32_t xfs_extlen_t; /* extent length in blocks */
+typedef __uint32_t xfs_agnumber_t; /* allocation group number */
typedef __int32_t xfs_extnum_t; /* # of extents in a file */
typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */
-typedef __int64_t xfs_fsize_t; /* bytes in a file */
+typedef __int64_t xfs_fsize_t; /* bytes in a file */
typedef __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
-typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
-typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
+typedef __int32_t xfs_suminfo_t; /* type of bitmap summary info */
+typedef __int32_t xfs_rtword_t; /* word type for bitmap manipulations */
-typedef __int64_t xfs_lsn_t; /* log sequence number */
-typedef __int32_t xfs_tid_t; /* transaction identifier */
+typedef __int64_t xfs_lsn_t; /* log sequence number */
+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 */
+typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
+typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
typedef __uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */
*/
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 */
+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_FILESYSTEMS
-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_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 */
+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_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
-#if XFS_BIG_FILES
-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 */
-#else
-typedef __uint32_t xfs_fileoff_t; /* block number in a file */
-typedef __int32_t xfs_sfiloff_t; /* signed block number in a file */
-typedef __uint32_t xfs_filblks_t; /* number of blocks in a file */
+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 __uint8_t xfs_arch_t; /* architecutre of an xfs fs */
+typedef __uint8_t xfs_arch_t; /* architecutre of an xfs fs */
/*
* 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 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)
-#define NULLFILEOFF ((xfs_fileoff_t)-1)
+#define NULLFSBLOCK ((xfs_fsblock_t)-1)
+#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
+#define NULLRTBLOCK ((xfs_rtblock_t)-1)
+#define NULLFILEOFF ((xfs_fileoff_t)-1)
-#define NULLAGBLOCK ((xfs_agblock_t)-1)
-#define NULLAGNUMBER ((xfs_agnumber_t)-1)
-#define NULLEXTNUM ((xfs_extnum_t)-1)
+#define NULLAGBLOCK ((xfs_agblock_t)-1)
+#define NULLAGNUMBER ((xfs_agnumber_t)-1)
+#define NULLEXTNUM ((xfs_extnum_t)-1)
#define NULLCOMMITLSN ((xfs_lsn_t)-1)
/*
* Max values for extlen, extnum, aextnum.
*/
-#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
-#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
-#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
+#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits */
+#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed int */
+#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed short */
/*
* MAXNAMELEN is the length (including the terminating null) of
__uint32_t xs_allocb;
__uint32_t xs_freex;
__uint32_t xs_freeb;
-# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
+# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
__uint32_t xs_abt_lookup;
__uint32_t xs_abt_compare;
__uint32_t xs_abt_insrec;
#define MKDEV(major, minor) makedev(major, minor)
#endif
-#define IRIX_DEV_BITSMAJOR 14
-#define IRIX_DEV_BITSMINOR 18
-#define IRIX_DEV_MAXMAJ 0x1ff
-#define IRIX_DEV_MAXMIN 0x3ffff
-#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>IRIX_DEV_BITSMINOR) \
- & IRIX_DEV_MAXMAJ))
-#define IRIX_DEV_MINOR(dev) ((int)((dev)&IRIX_DEV_MAXMIN))
+#define IRIX_DEV_BITSMAJOR 14
+#define IRIX_DEV_BITSMINOR 18
+#define IRIX_DEV_MAXMAJ 0x1ff
+#define IRIX_DEV_MAXMIN 0x3ffff
+#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev)>>IRIX_DEV_BITSMINOR) \
+ & IRIX_DEV_MAXMAJ))
+#define IRIX_DEV_MINOR(dev) ((int)((dev)&IRIX_DEV_MAXMIN))
#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major)<<IRIX_DEV_BITSMINOR) \
- | (minor&IRIX_DEV_MAXMIN)))
-
-#define IRIX_DEV_TO_KDEVT(dev) MKDEV(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
+ | (minor&IRIX_DEV_MAXMIN)))
+
+#define IRIX_DEV_TO_KDEVT(dev) MKDEV(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
#ifdef __KERNEL__
/* __psint_t is the same size as a pointer */
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
*
* 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
+ * 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.
* Checks whether a given device has a mounted, writable
* filesystem, returns 1 if it does & fatal (just warns
* if not fatal, but allows us to proceed).
- *
+ *
* Useful to tools which will produce uncertain results
* if the filesystem is active - repair, check, logprint.
*/
}
-/* libxfs_device_to_fd:
+/* libxfs_device_to_fd:
* lookup a device number in the device map
* return the associated fd
*/
libxfs_device_to_fd(dev_t device)
{
int d;
-
+
for (d=0;d<MAX_DEVS;d++)
- if (dev_map[d].dev == device)
+ if (dev_map[d].dev == device)
return dev_map[d].fd;
-
- fprintf(stderr, "%s: device_to_fd: device %lld is not open\n",
+
+ fprintf(stderr, "%s: device_to_fd: device %lld is not open\n",
progname, (long long)device);
exit(1);
}
int fd;
dev_t dev;
int d;
- struct stat statb;
+ struct stat statb;
if ((fd = open(path,
(readonly ? O_RDONLY : O_RDWR) |
for (d=0;d<MAX_DEVS;d++)
if (dev_map[d].dev == dev) {
- fprintf(stderr, "%s: device %lld is already open\n",
+ fprintf(stderr, "%s: device %lld is already open\n",
progname, (long long)dev);
exit(1);
}
if (!dev_map[d].dev) {
dev_map[d].dev=dev;
dev_map[d].fd=fd;
-
+
return dev;
}
void
libxfs_device_close(dev_t dev)
{
- int d;
+ int d;
for (d=0;d<MAX_DEVS;d++)
if (dev_map[d].dev == dev) {
int fd;
-
+
fd=dev_map[d].dev;
dev_map[d].dev=dev_map[d].fd=0;
-
+
fsync(fd);
ioctl(fd, BLKFLSBUF, 0);
close(fd);
-
+
return;
}
if (dname[0] != '/' && needcd)
chdir(curdir);
if (a->disfile) {
- a->ddev= libxfs_device_open(dname, a->dcreat, readonly,
+ a->ddev= libxfs_device_open(dname, a->dcreat, readonly,
a->setblksize);
a->dfd = libxfs_device_to_fd(a->ddev);
} else {
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
/*
* Free the given descriptor.
- *
+ *
* This requires setting the bit in the chunk's free mask corresponding
* to the given slot.
*/
void
-xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
+xfs_trans_free_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
{
uint slot;
xfs_log_item_chunk_t *licp;
* the chunk. First pull it from the chunk list and then
* free it back to the heap. We didn't bother with a doubly
* linked list here because the lists should be very short
- * and this is not a performance path. It's better to save
+ * and this is not a performance path. It's better to save
* the memory of the extra pointer.
*
* Also decrement the transaction structure's count of free items
* This is called to find the descriptor corresponding to the given
* log item. It returns a pointer to the descriptor.
* The log item MUST have a corresponding descriptor in the given
- * transaction. This routine does not return NULL, it panics.
+ * transaction. This routine does not return NULL, it panics.
*
* The descriptor pointer is kept in the log item's li_desc field.
* Just return it.
*/
xfs_log_item_desc_t *
-xfs_trans_find_item(xfs_trans_t *tp, xfs_log_item_t *lip)
+xfs_trans_find_item(xfs_trans_t *tp, xfs_log_item_t *lip)
{
ASSERT(lip->li_desc != NULL);
(XFS_BUF_ADDR(bp) == blkno) &&
(XFS_BUF_COUNT(bp) == len)) {
/*
- * We found it. Break out and
+ * We found it. Break out and
* return the pointer to the buffer.
*/
#ifdef LI_DEBUG
(XFS_BUF_ADDR(bp) == blkno) &&
(XFS_BUF_COUNT(bp) == len)) {
/*
- * We found it. Break out and
+ * We found it. Break out and
* return the pointer to the buffer.
*/
#ifdef LI_DEBUG
/*
* Check to see if there is already a buf log item for
- * this buffer. If there is, it is guaranteed to be
+ * this buffer. If there is, it is guaranteed to be
* the first. If we do already have one, there is
* nothing to do here so return.
*/
*
* 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
+ * 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.
#include <xfs_log.h>
#include <xfs_log_priv.h>
-#define BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT)
-#define BDSTRAT_SIZE (256 * 1024)
+#define BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT)
+#define BDSTRAT_SIZE (256 * 1024)
void
libxfs_device_zero(dev_t dev, xfs_daddr_t start, uint len)
{
- xfs_daddr_t bno;
+ xfs_daddr_t bno;
uint nblks;
int size;
int fd;
int
libxfs_log_clear(
- dev_t device,
- xfs_daddr_t start,
- uint length,
- uuid_t *fs_uuid,
+ dev_t device,
+ xfs_daddr_t start,
+ uint length,
+ uuid_t *fs_uuid,
int version,
int sunit,
- int fmt)
+ int fmt)
{
xfs_buf_t *buf;
- xlog_rec_header_t *head;
- xlog_op_header_t *op;
+ xlog_rec_header_t *head;
+ xlog_op_header_t *op;
int i, len;
- /* the data section must be 32 bit size aligned */
- struct {
- __uint16_t magic;
- __uint16_t pad1;
- __uint32_t pad2; /* may as well make it 64 bits */
- } magic = { XLOG_UNMOUNT_TYPE, 0, 0 };
-
+ /* the data section must be 32 bit size aligned */
+ struct {
+ __uint16_t magic;
+ __uint16_t pad1;
+ __uint32_t pad2; /* may as well make it 64 bits */
+ } magic = { XLOG_UNMOUNT_TYPE, 0, 0 };
+
if (!device || !fs_uuid)
return -EINVAL;
-
- /* first zero the log */
- libxfs_device_zero(device, start, length);
-
- /* then write a log record header */
+
+ /* first zero the log */
+ libxfs_device_zero(device, start, length);
+
+ /* then write a log record header */
if ((version == 2) && sunit)
len = BTOBB(sunit);
else
len = 1;
- buf = libxfs_getbuf(device, start, len);
- if (!buf)
- return -1;
-
- memset(XFS_BUF_PTR(buf), 0, BBSIZE * len);
+ buf = libxfs_getbuf(device, start, len);
+ if (!buf)
+ return -1;
+
+ memset(XFS_BUF_PTR(buf), 0, BBSIZE * len);
head = (xlog_rec_header_t *)XFS_BUF_PTR(buf);
-
- /* note that oh_tid actually contains the cycle number
- * and the tid is stored in h_cycle_data[0] - that's the
- * way things end up on disk.
- */
-
- INT_SET(head->h_magicno, ARCH_CONVERT, XLOG_HEADER_MAGIC_NUM);
- INT_SET(head->h_cycle, ARCH_CONVERT, 1);
- INT_SET(head->h_version, ARCH_CONVERT, version);
+
+ /* note that oh_tid actually contains the cycle number
+ * and the tid is stored in h_cycle_data[0] - that's the
+ * way things end up on disk.
+ */
+
+ INT_SET(head->h_magicno, ARCH_CONVERT, XLOG_HEADER_MAGIC_NUM);
+ INT_SET(head->h_cycle, ARCH_CONVERT, 1);
+ INT_SET(head->h_version, ARCH_CONVERT, version);
if (len != 1)
- INT_SET(head->h_len, ARCH_CONVERT, sunit - BBSIZE);
+ INT_SET(head->h_len, ARCH_CONVERT, sunit - BBSIZE);
else
- INT_SET(head->h_len, ARCH_CONVERT, 20);
- INT_SET(head->h_chksum, ARCH_CONVERT, 0);
- INT_SET(head->h_prev_block, ARCH_CONVERT, -1);
- INT_SET(head->h_num_logops, ARCH_CONVERT, 1);
- INT_SET(head->h_cycle_data[0], ARCH_CONVERT, 0xb0c0d0d0);
- INT_SET(head->h_fmt, ARCH_CONVERT, fmt);
+ INT_SET(head->h_len, ARCH_CONVERT, 20);
+ INT_SET(head->h_chksum, ARCH_CONVERT, 0);
+ INT_SET(head->h_prev_block, ARCH_CONVERT, -1);
+ INT_SET(head->h_num_logops, ARCH_CONVERT, 1);
+ INT_SET(head->h_cycle_data[0], ARCH_CONVERT, 0xb0c0d0d0);
+ INT_SET(head->h_fmt, ARCH_CONVERT, fmt);
INT_SET(head->h_size, ARCH_CONVERT, XLOG_HEADER_CYCLE_SIZE);
-
- ASSIGN_ANY_LSN(head->h_lsn, 1, 0, ARCH_CONVERT);
- ASSIGN_ANY_LSN(head->h_tail_lsn, 1, 0, ARCH_CONVERT);
-
- memcpy(head->h_fs_uuid, fs_uuid, sizeof(uuid_t));
+
+ ASSIGN_ANY_LSN(head->h_lsn, 1, 0, ARCH_CONVERT);
+ ASSIGN_ANY_LSN(head->h_tail_lsn, 1, 0, ARCH_CONVERT);
+
+ memcpy(head->h_fs_uuid, fs_uuid, sizeof(uuid_t));
if (len > 1) {
xfs_caddr_t dp;
dp += BBSIZE;
}
}
-
- if (libxfs_writebuf(buf, 0))
- return -1;
-
- buf = libxfs_getbuf(device, start + 1, 1);
- if (!buf)
- return -1;
-
- /* now a log unmount op */
- memset(XFS_BUF_PTR(buf), 0, BBSIZE);
+
+ if (libxfs_writebuf(buf, 0))
+ return -1;
+
+ buf = libxfs_getbuf(device, start + 1, 1);
+ if (!buf)
+ return -1;
+
+ /* now a log unmount op */
+ memset(XFS_BUF_PTR(buf), 0, BBSIZE);
op = (xlog_op_header_t *)XFS_BUF_PTR(buf);
- INT_SET(op->oh_tid, ARCH_CONVERT, 1);
- INT_SET(op->oh_len, ARCH_CONVERT, sizeof(magic));
- INT_SET(op->oh_clientid, ARCH_CONVERT, XFS_LOG);
- INT_SET(op->oh_flags, ARCH_CONVERT, XLOG_UNMOUNT_TRANS);
- INT_SET(op->oh_res2, ARCH_CONVERT, 0);
-
- /* and the data for this op */
-
- memcpy(XFS_BUF_PTR(buf) + sizeof(xlog_op_header_t),
- &magic,
- sizeof(magic));
-
- if (libxfs_writebuf(buf, 0))
- return -1;
+ INT_SET(op->oh_tid, ARCH_CONVERT, 1);
+ INT_SET(op->oh_len, ARCH_CONVERT, sizeof(magic));
+ INT_SET(op->oh_clientid, ARCH_CONVERT, XFS_LOG);
+ INT_SET(op->oh_flags, ARCH_CONVERT, XLOG_UNMOUNT_TRANS);
+ INT_SET(op->oh_res2, ARCH_CONVERT, 0);
+
+ /* and the data for this op */
+
+ memcpy(XFS_BUF_PTR(buf) + sizeof(xlog_op_header_t),
+ &magic,
+ sizeof(magic));
+
+ if (libxfs_writebuf(buf, 0))
+ return -1;
return 0;
}
libxfs_putbuf(xfs_buf_t *buf)
{
if (buf != NULL) {
- xfs_buf_log_item_t *bip;
- extern xfs_zone_t *xfs_buf_item_zone;
-
- bip = XFS_BUF_FSPRIVATE(buf, xfs_buf_log_item_t *);
-
- if (bip)
- libxfs_zone_free(xfs_buf_item_zone, bip);
+ xfs_buf_log_item_t *bip;
+ extern xfs_zone_t *xfs_buf_item_zone;
+
+ bip = XFS_BUF_FSPRIVATE(buf, xfs_buf_log_item_t *);
+
+ if (bip)
+ libxfs_zone_free(xfs_buf_item_zone, bip);
#ifdef IO_DEBUG
fprintf(stderr, "putbuf released %ubytes, %p\n",
buf->b_bcount, buf);
ptr->zone_unitsize = size;
ptr->zone_name = name;
#ifdef MEM_DEBUG
- ptr->allocated = 0;
+ ptr->allocated = 0;
fprintf(stderr, "new zone %p for \"%s\", size=%d\n", ptr, name, size);
#endif
return ptr;
exit(1);
}
#ifdef MEM_DEBUG
- z->allocated++;
- fprintf(stderr, "## zone alloc'd item %p from %s (%d bytes) (%d active)\n",
- ptr, z->zone_name, z->zone_unitsize,
- z->allocated);
+ z->allocated++;
+ fprintf(stderr, "## zone alloc'd item %p from %s (%d bytes) (%d active)\n",
+ ptr, z->zone_name, z->zone_unitsize,
+ z->allocated);
#endif
return ptr;
}
libxfs_zone_free(xfs_zone_t *z, void *ptr)
{
#ifdef MEM_DEBUG
- z->allocated--;
- fprintf(stderr, "## zone freed item %p from %s (%d bytes) (%d active)\n",
- ptr, z->zone_name, z->zone_unitsize,
- z->allocated);
+ z->allocated--;
+ fprintf(stderr, "## zone freed item %p from %s (%d bytes) (%d active)\n",
+ ptr, z->zone_name, z->zone_unitsize,
+ z->allocated);
#endif
if (ptr != NULL) {
free(ptr);
exit(1);
}
#ifdef MEM_DEBUG
- fprintf(stderr, "## calloc'd item %p size %d bytes\n",
- ptr, size);
+ fprintf(stderr, "## calloc'd item %p size %d bytes\n",
+ ptr, size);
#endif
return ptr;
}
libxfs_free(void *ptr)
{
#ifdef MEM_DEBUG
- fprintf(stderr, "## freed item %p\n",
- ptr);
+ fprintf(stderr, "## freed item %p\n",
+ ptr);
#endif
if (ptr != NULL) {
free(ptr);
libxfs_realloc(void *ptr, size_t size)
{
#ifdef MEM_DEBUG
- void *optr=ptr;
+ void *optr=ptr;
#endif
if ((ptr = realloc(ptr, size)) == NULL) {
fprintf(stderr, "%s: realloc failed (%d bytes): %s\n",
exit(1);
}
#ifdef MEM_DEBUG
- fprintf(stderr, "## realloc'd item %p now %p size %d bytes\n",
- optr, ptr, size);
+ fprintf(stderr, "## realloc'd item %p now %p size %d bytes\n",
+ optr, ptr, size);
#endif
return ptr;
}
void
libxfs_iput(xfs_inode_t *ip, uint lock_flags)
{
- extern xfs_zone_t *xfs_ili_zone;
+ extern xfs_zone_t *xfs_ili_zone;
extern xfs_zone_t *xfs_inode_zone;
if (ip != NULL) {
-
- /* free attached inode log item */
- if (ip->i_itemp)
- libxfs_zone_free(xfs_ili_zone, ip->i_itemp);
- ip->i_itemp = NULL;
-
+
+ /* free attached inode log item */
+ if (ip->i_itemp)
+ libxfs_zone_free(xfs_ili_zone, ip->i_itemp);
+ ip->i_itemp = NULL;
+
libxfs_zone_free(xfs_inode_zone, ip);
ip = NULL;
}
*
* 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
+ * 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.
/*
* Attempt to reserve the needed disk blocks by decrementing
- * the number needed from the number available. This will
+ * the number needed from the number available. This will
* fail if the count would go below zero.
*/
if (blocks > 0) {
libxfs_trans_cancel(xfs_trans_t *tp, int flags)
{
#ifdef XACT_DEBUG
- xfs_trans_t *otp = tp;
+ xfs_trans_t *otp = tp;
#endif
if (tp != NULL) {
xfs_trans_free_items(tp, flags);
* This is called to mark bytes first through last inclusive of the given
* buffer as needing to be logged when the transaction is committed.
* The buffer must already be associated with the given transaction.
- *
+ *
* First and last are numbers relative to the beginning of this buffer,
* so the first byte in the buffer is numbered 0 regardless of the
* value of b_blkno.
* to the file system's superblock when the transaction commits.
* For now, just store the change in the transaction structure.
* Mark the transaction structure to indicate that the superblock
- * needs to be updated before committing.
+ * needs to be updated before committing.
*
* Originally derived from xfs_trans_mod_sb().
*/
* Unlock each item pointed to by a descriptor in the given chunk.
* Free descriptors pointing to items which are not dirty if freeing_chunk
* is zero. If freeing_chunk is non-zero, then we need to unlock all
- * items in the chunk. Return the number of descriptors freed.
+ * items in the chunk. Return the number of descriptors freed.
* Originally based on xfs_trans_unlock_chunk() - adapted for libxfs
* transactions though.
*/
int
xfs_trans_unlock_chunk(
- xfs_log_item_chunk_t *licp,
+ xfs_log_item_chunk_t *licp,
int freeing_chunk,
int abort,
xfs_lsn_t commit_lsn) /* nb: unused */
*
* 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
+ * 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.
*/
int
libxfs_inode_alloc(
- xfs_trans_t **tp,
- xfs_inode_t *pip,
+ xfs_trans_t **tp,
+ xfs_inode_t *pip,
mode_t mode,
ushort nlink,
dev_t rdev,
/*
* Change the requested timestamp in the given inode.
- *
+ *
* This was once shared with the kernel, but has diverged to the point
* where its no longer worth the hassle of maintaining common code.
*/
void
libxfs_ichgtime(xfs_inode_t *ip, int flags)
{
- struct timespec tv;
+ struct timespec tv;
struct timeval stv;
gettimeofday(&stv, (struct timezone *)0);
ip->i_d.di_version == XFS_DINODE_VERSION_1) {
ip->i_d.di_version = XFS_DINODE_VERSION_2;
/* old link count, projid field, pad field already zeroed */
- }
+ }
ip->i_d.di_size = 0;
ip->i_d.di_nextents = 0;
if (ip->i_df.if_flags & XFS_IFEXTENTS) {
nextents = ip->i_df.if_bytes / (uint)sizeof(*ep);
for (ep = ip->i_df.if_u1.if_extents, i = 0; i < nextents; i++, ep++) {
- xfs_bmbt_irec_t rec;
+ xfs_bmbt_irec_t rec;
xfs_bmbt_get_all(ep, &rec);
printf("\t%d: startoff %llu, startblock 0x%llx,"
xfs_fileoff_t bno; /* current block */
int eof; /* hit end of file */
int error; /* error return value */
- xfs_bmbt_irec_t got; /* current extent value */
+ xfs_bmbt_irec_t got; /* current extent value */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_extnum_t lastx; /* last extent used */
- xfs_bmbt_irec_t prev; /* previous extent value */
+ xfs_bmbt_irec_t prev; /* previous extent value */
if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
* Like xfs_dir_removename, but only for removing entries with
* (name, hashvalue) pairs that may not be consistent (hashvalue
* may not be correctly set for the name).
- *
+ *
* This was originally in the kernel, but only used in xfs_repair.
*/
int
* Like xfs_dir_removename, but only for removing entries with
* (name, hashvalue) pairs that may not be consistent (hashvalue
* may not be correctly set for the name).
- *
+ *
* This was originally in the kernel, but only used in xfs_repair.
*/
int
xfs_inode_t *dp, /* incore directory inode */
char *name, /* name of entry to remove */
xfs_fsblock_t *first, /* bmap's firstblock */
- xfs_bmap_free_t *flist, /* bmap's freeblock list */
+ xfs_bmap_free_t *flist, /* bmap's freeblock list */
xfs_extlen_t total, /* bmap's total block count */
xfs_dahash_t hash, /* name's real hash value */
int namelen) /* entry's name length */
int
libxfs_bmap_finish(
xfs_trans_t **tp,
- xfs_bmap_free_t *flist,
+ xfs_bmap_free_t *flist,
xfs_fsblock_t firstblock,
int *committed)
{
xfs_filblks_t allocated_fsb;
xfs_filblks_t allocatesize_fsb;
xfs_fsblock_t firstfsb;
- xfs_bmap_free_t free_list;
- xfs_bmbt_irec_t *imapp;
- xfs_bmbt_irec_t imaps[1];
+ xfs_bmap_free_t free_list;
+ xfs_bmbt_irec_t *imapp;
+ xfs_bmbt_irec_t imaps[1];
int reccount;
uint resblks;
xfs_fileoff_t startoffset_fsb;
/*
* Get a buffer for the dir/attr block, fill in the contents.
* Don't check magic number, the caller will (it's xfs_repair).
- *
+ *
* Originally from xfs_da_btree.c in the kernel, but only used
* in userspace so it now resides here.
*/
/*
* Hold dabuf at transaction commit.
- *
+ *
* Originally from xfs_da_btree.c in the kernel, but only used
* in userspace so it now resides here.
*/
/*
* Join dabuf to transaction.
- *
+ *
* Originally from xfs_da_btree.c in the kernel, but only used
* in userspace so it now resides here.
*/
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
-
+
#include <xfs.h>
#define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
-#define XFSA_FIXUP_BNO_OK 1
-#define XFSA_FIXUP_CNT_OK 2
+#define XFSA_FIXUP_BNO_OK 1
+#define XFSA_FIXUP_CNT_OK 2
/*
* Compute aligned version of the found extent.
*/
STATIC void
xfs_alloc_fix_len(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
xfs_extlen_t k;
xfs_extlen_t rlen;
*/
STATIC int
xfs_alloc_fix_minleft(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
xfs_agf_t *agf; /* a.g. freelist header */
int diff; /* free space difference */
*/
STATIC int /* error code */
xfs_alloc_fixup_trees(
- xfs_btree_cur_t *cnt_cur, /* cursor for by-size btree */
- xfs_btree_cur_t *bno_cur, /* cursor for by-block btree */
+ xfs_btree_cur_t *cnt_cur, /* cursor for by-size btree */
+ xfs_btree_cur_t *bno_cur, /* cursor for by-block btree */
xfs_agblock_t fbno, /* starting block of free extent */
xfs_extlen_t flen, /* length of free extent */
xfs_agblock_t rbno, /* starting block of returned extent */
xfs_alloc_trace_alloc(
char *name, /* function tag string */
char *str, /* additional string */
- xfs_alloc_arg_t *args, /* allocation argument structure */
+ xfs_alloc_arg_t *args, /* allocation argument structure */
int line) /* source line number */
{
ktrace_enter(xfs_alloc_trace_buf,
*/
STATIC int /* error */
xfs_alloc_ag_vextent(
- xfs_alloc_arg_t *args) /* argument structure for allocation */
+ xfs_alloc_arg_t *args) /* argument structure for allocation */
{
int error=0;
#ifdef XFS_ALLOC_TRACE
#ifdef XFS_ALLOC_TRACE
xfs_mount_t *mp = args->mp;
#endif
- long slen = (long)args->len;
+ long slen = (long)args->len;
ASSERT(args->len >= args->minlen && args->len <= args->maxlen);
ASSERT(!(args->wasfromfl) || !args->isfl);
*/
STATIC int /* error */
xfs_alloc_ag_vextent_exact(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
- xfs_btree_cur_t *bno_cur;/* by block-number btree cursor */
- xfs_btree_cur_t *cnt_cur;/* by count btree cursor */
+ xfs_btree_cur_t *bno_cur;/* by block-number btree cursor */
+ xfs_btree_cur_t *cnt_cur;/* by count btree cursor */
xfs_agblock_t end; /* end of allocated extent */
int error;
xfs_agblock_t fbno; /* start block of found extent */
static char fname[] = "xfs_alloc_ag_vextent_exact";
#endif
int i; /* success/failure of operation */
- xfs_agblock_t maxend; /* end of maximal extent */
- xfs_agblock_t minend; /* end of minimal extent */
+ xfs_agblock_t maxend; /* end of maximal extent */
+ xfs_agblock_t minend; /* end of minimal extent */
xfs_extlen_t rlen; /* length of returned extent */
ASSERT(args->alignment == 1);
minend = args->agbno + args->minlen;
maxend = args->agbno + args->maxlen;
fend = fbno + flen;
- /*
+ /*
* Give up if the freespace isn't long enough for the minimum request.
*/
if (fend < minend) {
ASSERT(args->agbno + args->len <=
INT_GET(XFS_BUF_TO_AGF(args->agbp)->agf_length,
ARCH_CONVERT));
- if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen,
+ if ((error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen,
args->agbno, args->len, XFSA_FIXUP_BNO_OK))) {
xfs_btree_del_cursor(cnt_cur, XFS_BTREE_ERROR);
goto error0;
*/
STATIC int /* error */
xfs_alloc_ag_vextent_near(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
- xfs_btree_cur_t *bno_cur_gt; /* cursor for bno btree, right side */
- xfs_btree_cur_t *bno_cur_lt; /* cursor for bno btree, left side */
- xfs_btree_cur_t *cnt_cur; /* cursor for count btree */
+ xfs_btree_cur_t *bno_cur_gt; /* cursor for bno btree, right side */
+ xfs_btree_cur_t *bno_cur_lt; /* cursor for bno btree, left side */
+ xfs_btree_cur_t *cnt_cur; /* cursor for count btree */
#ifdef XFS_ALLOC_TRACE
static char fname[] = "xfs_alloc_ag_vextent_near";
#endif
/*
* If none, then pick up the last entry in the tree unless the
* tree is empty.
- */
+ */
if (!i) {
if ((error = xfs_alloc_ag_vextent_small(args, cnt_cur, <bno,
<len, &i)))
ASSERT(i == 1);
}
args->wasfromfl = 0;
- /*
+ /*
* First algorithm.
* If the requested extent is large wrt the freespaces available
* in this a.g., then the cursor will be pointing to a btree entry
*/
STATIC int /* error */
xfs_alloc_ag_vextent_size(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
- xfs_btree_cur_t *bno_cur; /* cursor for bno btree */
- xfs_btree_cur_t *cnt_cur; /* cursor for cnt btree */
+ xfs_btree_cur_t *bno_cur; /* cursor for bno btree */
+ xfs_btree_cur_t *cnt_cur; /* cursor for cnt btree */
int error; /* error result */
xfs_agblock_t fbno; /* start of found freespace */
xfs_extlen_t flen; /* length of found freespace */
/*
* If none, then pick up the last entry in the tree unless the
* tree is empty.
- */
+ */
if (!i) {
if ((error = xfs_alloc_ag_vextent_small(args, cnt_cur, &fbno,
&flen, &i)))
xfs_alloc_compute_aligned(fbno, flen, args->alignment, args->minlen,
&rbno, &rlen);
rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
- XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
+ XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
(rlen <= flen && rbno + rlen <= fbno + flen), error0);
if (rlen < args->maxlen) {
xfs_agblock_t bestfbno;
if (rlen == args->maxlen)
break;
}
- }
+ }
if ((error = xfs_alloc_lookup_eq(cnt_cur, bestfbno, bestflen,
&i)))
goto error0;
*/
STATIC int /* error */
xfs_alloc_ag_vextent_small(
- xfs_alloc_arg_t *args, /* allocation argument structure */
- xfs_btree_cur_t *ccur, /* by-size cursor */
- xfs_agblock_t *fbnop, /* result block number */
- xfs_extlen_t *flenp, /* result length */
+ xfs_alloc_arg_t *args, /* allocation argument structure */
+ xfs_btree_cur_t *ccur, /* by-size cursor */
+ xfs_agblock_t *fbnop, /* result block number */
+ xfs_extlen_t *flenp, /* result length */
int *stat) /* status: 0-freelist, 1-normal/none */
{
int error;
xfs_extlen_t len, /* length of extent */
int isfl) /* set if is freelist blocks - no sb acctg */
{
- xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */
- xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */
+ xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */
+ xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */
int error; /* error return value */
#ifdef XFS_ALLOC_TRACE
static char fname[] = "xfs_free_ag_extent";
xfs_extlen_t nlen; /* new length of freespace */
mp = tp->t_mountp;
- /*
+ /*
* Allocate and initialize a cursor for the by-block btree.
*/
bno_cur = xfs_btree_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_BNO, 0,
0);
cnt_cur = NULL;
- /*
+ /*
* Look for a neighboring block on the left (lower block numbers)
* that is contiguous with this space.
*/
XFS_WANT_CORRUPTED_GOTO(ltbno + ltlen <= bno, error0);
}
}
- /*
+ /*
* Look for a neighboring block on the right (higher block numbers)
* that is contiguous with this space.
*/
goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
/*
- * Update the starting block and length of the right
+ * Update the starting block and length of the right
* neighbor in the by-block tree.
*/
nbno = bno;
* used in xfs_bmap_finish, we can't allow block to be available
* for reallocation and non-transaction writing (user data)
* until we know that the transaction that moved it to the free
- * list is permanently on disk. We track the blocks by declaring
- * these blocks as "busy"; the busy list is maintained on a per-ag
- * basis and each transaction records which entries should be removed
+ * list is permanently on disk. We track the blocks by declaring
+ * these blocks as "busy"; the busy list is maintained on a per-ag
+ * basis and each transaction records which entries should be removed
* when the iclog commits to disk. If a busy block is allocated,
* the iclog is pushed up to the LSN that freed the block.
*/
return error;
}
-/*
+/*
* Visible (exported) allocation/free functions.
* Some of these are used just by xfs_alloc_btree.c and this file.
*/
*/
int /* error */
xfs_alloc_fix_freelist(
- xfs_alloc_arg_t *args, /* allocation argument structure */
+ xfs_alloc_arg_t *args, /* allocation argument structure */
int flags) /* XFS_ALLOC_FLAG_... */
{
xfs_buf_t *agbp; /* agf buffer pointer */
xfs_mount_t *mp; /* file system mount point structure */
xfs_extlen_t need; /* total blocks needed in freelist */
xfs_perag_t *pag; /* per-ag information structure */
- xfs_alloc_arg_t targs; /* local allocation arguments */
+ xfs_alloc_arg_t targs; /* local allocation arguments */
xfs_trans_t *tp; /* transaction pointer */
mp = args->mp;
if ((error = xfs_alloc_ag_vextent(&targs)))
return error;
/*
- * Stop if we run out. Won't happen if callers are obeying
- * the restrictions correctly. Can happen for free calls
+ * Stop if we run out. Won't happen if callers are obeying
+ * the restrictions correctly. Can happen for free calls
* on a completely full ag.
*/
if (targs.agbno == NULLAGBLOCK)
* As blocks are freed, they are added to the per-ag busy list
* and remain there until the freeing transaction is committed to
* disk. Now that we have allocated blocks, this list must be
- * searched to see if a block is being reused. If one is, then
+ * searched to see if a block is being reused. If one is, then
* the freeing transaction must be pushed to disk NOW by forcing
* to disk all iclogs up that transaction's LSN.
*/
xfs_alloc_log_agf(
xfs_trans_t *tp, /* transaction pointer */
xfs_buf_t *bp, /* buffer for a.g. freelist header */
- int fields) /* mask of fields to be logged (XFS_AGF_...) */
+ int fields) /* mask of fields to be logged (XFS_AGF_...) */
{
int first; /* first byte offset */
int last; /* last byte offset */
INT_GET(agf->agf_seqno, ARCH_CONVERT), &agflbp)))
return error;
agfl = XFS_BUF_TO_AGFL(agflbp);
- INT_MOD(agf->agf_fllast, ARCH_CONVERT, 1);
- if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE)
+ INT_MOD(agf->agf_fllast, ARCH_CONVERT, 1);
+ if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE)
INT_ZERO(agf->agf_fllast, ARCH_CONVERT);
pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)];
INT_MOD(agf->agf_flcount, ARCH_CONVERT, 1);
* used in xfs_bmap_finish, we can't allow block to be available
* for reallocation and non-transaction writing (user data)
* until we know that the transaction that moved it to the free
- * list is permanently on disk. We track the blocks by declaring
+ * list is permanently on disk. We track the blocks by declaring
* these blocks as "busy"; the busy list is maintained on a per-ag
* basis and each transaction records which entries should be removed
* when the iclog commits to disk. If a busy block is allocated,
*/
int /* error */
xfs_alloc_vextent(
- xfs_alloc_arg_t *args) /* allocation argument structure */
+ xfs_alloc_arg_t *args) /* allocation argument structure */
{
- xfs_agblock_t agsize; /* allocation group size */
+ xfs_agblock_t agsize; /* allocation group size */
int error;
int flags; /* XFS_ALLOC_FLAG_... locking flags */
#ifdef XFS_ALLOC_TRACE
xfs_extlen_t minleft;/* minimum left value, temp copy */
xfs_mount_t *mp; /* mount structure pointer */
xfs_agnumber_t sagno; /* starting allocation group number */
- xfs_alloctype_t type; /* input allocation type */
+ xfs_alloctype_t type; /* input allocation type */
int bump_rotor = 0;
int no_min = 0;
args->type = XFS_ALLOCTYPE_THIS_AG;
if (++(args->agno) == mp->m_sb.sb_agcount)
args->agno = 0;
- /*
+ /*
* Reached the starting a.g., must either be done
* or switch to non-trylock mode.
*/
#ifdef DEBUG
xfs_agf_t *agf; /* a.g. freespace header */
#endif
- xfs_alloc_arg_t args; /* allocation argument structure */
+ xfs_alloc_arg_t args; /* allocation argument structure */
int error;
ASSERT(len != 0);
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
int *stat) /* fail/done/go-on */
{
xfs_agf_t *agf; /* allocation group freelist header */
- xfs_alloc_block_t *block; /* btree block record/key lives in */
+ xfs_alloc_block_t *block; /* btree block record/key lives in */
xfs_agblock_t bno; /* btree block number */
xfs_buf_t *bp; /* buffer for block */
int error; /* error return value */
int ptr; /* index in btree block for this rec */
xfs_agblock_t rbno; /* right block's block number */
xfs_buf_t *rbp; /* right block's buffer pointer */
- xfs_alloc_block_t *right; /* right btree block */
+ xfs_alloc_block_t *right; /* right btree block */
xfs_alloc_key_t *rkp; /* right block key pointer */
xfs_alloc_ptr_t *rpp; /* right block address pointer */
int rrecs=0; /* number of records in right block */
}
}
/*
- * It's a leaf. Excise the record being deleted, by sliding the
+ * It's a leaf. Excise the record being deleted, by sliding the
* entries past it down one. Log the changed areas of the block.
*/
else {
}
/*
* Otherwise, grab the number of records in right for
- * future reference, and fix up the temp cursor to point
+ * future reference, and fix up the temp cursor to point
* to our block again (last record).
*/
rrecs = INT_GET(right->bb_numrecs, ARCH_CONVERT);
}
/*
* Otherwise, we can't fix the imbalance.
- * Just return. This is probably a logic error, but it's not fatal.
+ * Just return. This is probably a logic error, but it's not fatal.
*/
else {
if (level > 0 && (error = xfs_alloc_decrement(cur, level, &i)))
INT_GET(left->bb_numrecs, ARCH_CONVERT) + INT_GET(right->bb_numrecs, ARCH_CONVERT));
} else {
/*
- * It's a leaf. Move records.
+ * It's a leaf. Move records.
*/
lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT) + 1, cur);
rrp = XFS_ALLOC_REC_ADDR(right, 1, cur);
left->bb_rightsib = right->bb_rightsib; /* INT_: direct copy */
xfs_alloc_log_block(cur->bc_tp, lbp, XFS_BB_NUMRECS | XFS_BB_RIGHTSIB);
/*
- * If there is a right sibling now, make it point to the
+ * If there is a right sibling now, make it point to the
* remaining block.
*/
if (INT_GET(left->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) {
*/
if (level > 0)
cur->bc_ptrs[level]--;
- /*
+ /*
* Return value means the next level up has something to do.
*/
*stat = 2;
int level, /* level to insert record at */
xfs_agblock_t *bnop, /* i/o: block number inserted */
xfs_alloc_rec_t *recp, /* i/o: record data inserted */
- xfs_btree_cur_t **curp, /* output: new cursor replacing cur */
+ xfs_btree_cur_t **curp, /* output: new cursor replacing cur */
int *stat) /* output: success/failure */
{
xfs_agf_t *agf; /* allocation group freelist header */
- xfs_alloc_block_t *block; /* btree block record/key lives in */
+ xfs_alloc_block_t *block; /* btree block record/key lives in */
xfs_buf_t *bp; /* buffer for block */
int error; /* error return value */
int i; /* loop index */
#ifdef DEBUG
if ((error = xfs_btree_check_sblock(cur, block, level, bp)))
return error;
- /*
+ /*
* Check that the new entry is being inserted in the right place.
*/
if (ptr <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) {
xfs_alloc_log_block(
xfs_trans_t *tp, /* transaction pointer */
xfs_buf_t *bp, /* buffer containing btree block */
- int fields) /* mask of fields: XFS_BB_... */
+ int fields) /* mask of fields: XFS_BB_... */
{
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_alloc_log_keys(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int kfirst, /* index of first key to log */
+ int kfirst, /* index of first key to log */
int klast) /* index of last key to log */
{
- xfs_alloc_block_t *block; /* btree block to log from */
+ xfs_alloc_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
xfs_alloc_key_t *kp; /* key pointer in btree block */
int last; /* last byte offset logged */
xfs_alloc_log_ptrs(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int pfirst, /* index of first pointer to log */
+ int pfirst, /* index of first pointer to log */
int plast) /* index of last pointer to log */
{
- xfs_alloc_block_t *block; /* btree block to log from */
+ xfs_alloc_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_alloc_ptr_t *pp; /* block-pointer pointer in btree blk */
xfs_alloc_log_recs(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int rfirst, /* index of first record to log */
+ int rfirst, /* index of first record to log */
int rlast) /* index of last record to log */
{
- xfs_alloc_block_t *block; /* btree block to log from */
+ xfs_alloc_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_alloc_rec_t *rp; /* record pointer for btree block */
#ifdef DEBUG
{
xfs_agf_t *agf;
- xfs_alloc_rec_t *p;
+ xfs_alloc_rec_t *p;
agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp);
for (p = &rp[rfirst - 1]; p <= &rp[rlast - 1]; p++)
bp = (xfs_buf_t *)0;
if (!bp) {
/*
- * Need to get a new buffer. Read it, then
+ * Need to get a new buffer. Read it, then
* set it in the cursor, releasing the old one.
*/
if ((error = xfs_btree_read_bufs(mp, cur->bc_tp, agno,
*/
else {
int high; /* high entry number */
- xfs_alloc_key_t *kkbase=NULL;/* base of keys in block */
- xfs_alloc_rec_t *krbase=NULL;/* base of records in block */
+ xfs_alloc_key_t *kkbase=NULL;/* base of keys in block */
+ xfs_alloc_rec_t *krbase=NULL;/* base of records in block */
int low; /* low entry number */
/*
* Get startblock & blockcount.
*/
if (level > 0) {
- xfs_alloc_key_t *kkp;
+ xfs_alloc_key_t *kkp;
kkp = kkbase + keyno - 1;
startblock = INT_GET(kkp->ar_startblock, ARCH_CONVERT);
blockcount = INT_GET(kkp->ar_blockcount, ARCH_CONVERT);
} else {
- xfs_alloc_rec_t *krp;
+ xfs_alloc_rec_t *krp;
krp = krbase + keyno - 1;
startblock = INT_GET(krp->ar_startblock, ARCH_CONVERT);
xfs_alloc_block_t *left; /* left neighbor btree block */
int nrec; /* new number of left block entries */
xfs_buf_t *rbp; /* buffer for right (current) block */
- xfs_alloc_block_t *right; /* right (current) btree block */
+ xfs_alloc_block_t *right; /* right (current) btree block */
xfs_alloc_key_t *rkp=NULL; /* key pointer for right block */
xfs_alloc_ptr_t *rpp=NULL; /* address pointer for right block */
xfs_alloc_rec_t *rrp=NULL; /* record pointer for right block */
return 0;
}
/*
- * If the cursor entry is the one that would be moved, don't
+ * If the cursor entry is the one that would be moved, don't
* do it... it's too complicated.
*/
if (cur->bc_ptrs[level] <= 1) {
* If non-leaf, copy a key and a ptr to the left block.
*/
if (level > 0) {
- xfs_alloc_key_t *lkp; /* key pointer for left block */
- xfs_alloc_ptr_t *lpp; /* address pointer for left block */
+ xfs_alloc_key_t *lkp; /* key pointer for left block */
+ xfs_alloc_ptr_t *lpp; /* address pointer for left block */
lkp = XFS_ALLOC_KEY_ADDR(left, nrec, cur);
rkp = XFS_ALLOC_KEY_ADDR(right, 1, cur);
* If leaf, copy a record to the left block.
*/
else {
- xfs_alloc_rec_t *lrp; /* record pointer for left block */
+ xfs_alloc_rec_t *lrp; /* record pointer for left block */
lrp = XFS_ALLOC_REC_ADDR(left, nrec, cur);
rrp = XFS_ALLOC_REC_ADDR(right, 1, cur);
int nptr; /* new value for key index, 1 or 2 */
xfs_agblock_t rbno; /* right block number */
xfs_buf_t *rbp; /* right btree buffer */
- xfs_alloc_block_t *right; /* right btree block */
+ xfs_alloc_block_t *right; /* right btree block */
mp = cur->bc_mp;
INT_SET(new->bb_level, ARCH_CONVERT, (__uint16_t)cur->bc_nlevels);
INT_SET(new->bb_numrecs, ARCH_CONVERT, 2);
INT_SET(new->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
- INT_SET(new->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
+ INT_SET(new->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
xfs_alloc_log_block(cur->bc_tp, nbp, XFS_BB_ALL_BITS);
ASSERT(lbno != NULLAGBLOCK && rbno != NULLAGBLOCK);
/*
kp[0] = *XFS_ALLOC_KEY_ADDR(left, 1, cur); /* INT_: structure copy */
kp[1] = *XFS_ALLOC_KEY_ADDR(right, 1, cur);/* INT_: structure copy */
} else {
- xfs_alloc_rec_t *rp; /* btree record pointer */
+ xfs_alloc_rec_t *rp; /* btree record pointer */
rp = XFS_ALLOC_REC_ADDR(left, 1, cur);
kp[0].ar_startblock = rp->ar_startblock; /* INT_: direct copy */
xfs_buf_t *lbp; /* buffer for left (current) block */
xfs_alloc_block_t *left; /* left (current) btree block */
xfs_buf_t *rbp; /* buffer for right neighbor block */
- xfs_alloc_block_t *right; /* right neighbor btree block */
+ xfs_alloc_block_t *right; /* right neighbor btree block */
xfs_alloc_key_t *rkp; /* key pointer for right block */
xfs_btree_cur_t *tcur; /* temporary cursor */
* copy the last left block entry to the hole.
*/
if (level > 0) {
- xfs_alloc_key_t *lkp; /* key pointer for left block */
- xfs_alloc_ptr_t *lpp; /* address pointer for left block */
- xfs_alloc_ptr_t *rpp; /* address pointer for right block */
+ xfs_alloc_key_t *lkp; /* key pointer for left block */
+ xfs_alloc_ptr_t *lpp; /* address pointer for left block */
+ xfs_alloc_ptr_t *rpp; /* address pointer for right block */
lkp = XFS_ALLOC_KEY_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur);
lpp = XFS_ALLOC_PTR_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur);
xfs_alloc_log_ptrs(cur, rbp, 1, INT_GET(right->bb_numrecs, ARCH_CONVERT) + 1);
xfs_btree_check_key(cur->bc_btnum, rkp, rkp + 1);
} else {
- xfs_alloc_rec_t *lrp; /* record pointer for left block */
- xfs_alloc_rec_t *rrp; /* record pointer for right block */
+ xfs_alloc_rec_t *lrp; /* record pointer for left block */
+ xfs_alloc_rec_t *rrp; /* record pointer for right block */
lrp = XFS_ALLOC_REC_ADDR(left, INT_GET(left->bb_numrecs, ARCH_CONVERT), cur);
rrp = XFS_ALLOC_REC_ADDR(right, 1, cur);
int level, /* level to split */
xfs_agblock_t *bnop, /* output: block number allocated */
xfs_alloc_key_t *keyp, /* output: first key of new block */
- xfs_btree_cur_t **curp, /* output: new cursor */
+ xfs_btree_cur_t **curp, /* output: new cursor */
int *stat) /* success/failure */
{
int error; /* error return value */
xfs_alloc_block_t *left; /* left (current) btree block */
xfs_agblock_t rbno; /* right (new) block number */
xfs_buf_t *rbp; /* buffer for right block */
- xfs_alloc_block_t *right; /* right (new) btree block */
+ xfs_alloc_block_t *right; /* right (new) btree block */
/*
* Allocate the new block from the freelist.
* For non-leaf blocks, copy keys and addresses over to the new block.
*/
if (level > 0) {
- xfs_alloc_key_t *lkp; /* left btree key pointer */
- xfs_alloc_ptr_t *lpp; /* left btree address pointer */
- xfs_alloc_key_t *rkp; /* right btree key pointer */
- xfs_alloc_ptr_t *rpp; /* right btree address pointer */
+ xfs_alloc_key_t *lkp; /* left btree key pointer */
+ xfs_alloc_ptr_t *lpp; /* left btree address pointer */
+ xfs_alloc_key_t *rkp; /* right btree key pointer */
+ xfs_alloc_ptr_t *rpp; /* right btree address pointer */
lkp = XFS_ALLOC_KEY_ADDR(left, i, cur);
lpp = XFS_ALLOC_PTR_ADDR(left, i, cur);
* For leaf blocks, copy records over to the new block.
*/
else {
- xfs_alloc_rec_t *lrp; /* left btree record pointer */
- xfs_alloc_rec_t *rrp; /* right btree record pointer */
+ xfs_alloc_rec_t *lrp; /* left btree record pointer */
+ xfs_alloc_rec_t *rrp; /* right btree record pointer */
lrp = XFS_ALLOC_REC_ADDR(left, i, cur);
rrp = XFS_ALLOC_REC_ADDR(right, 1, cur);
* at the first entry in the block.
*/
for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) {
- xfs_alloc_block_t *block; /* btree block */
+ xfs_alloc_block_t *block; /* btree block */
xfs_buf_t *bp; /* buffer for block */
#ifdef DEBUG
int error; /* error return value */
int level, /* level in btree, 0 is leaf */
int *stat) /* success/failure */
{
- xfs_alloc_block_t *block; /* btree block */
+ xfs_alloc_block_t *block; /* btree block */
int error; /* error return value */
int lev; /* btree level */
if (--cur->bc_ptrs[lev] > 0)
break;
/*
- * Read-ahead the left block, we're going to read it
+ * Read-ahead the left block, we're going to read it
* in the next loop.
*/
xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
*/
int /* error */
xfs_alloc_delete(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
int *stat) /* success/failure */
{
int error; /* error return value */
return 0;
}
-/*
+/*
* Get the data from the pointed-to record.
*/
int /* error */
xfs_extlen_t *len, /* output: length of extent */
int *stat) /* output: success/failure */
{
- xfs_alloc_block_t *block; /* btree block */
+ xfs_alloc_block_t *block; /* btree block */
#ifdef DEBUG
int error; /* error return value */
#endif
int level, /* level in btree, 0 is leaf */
int *stat) /* success/failure */
{
- xfs_alloc_block_t *block; /* btree block */
+ xfs_alloc_block_t *block; /* btree block */
xfs_buf_t *bp; /* tree block buffer */
int error; /* error return value */
int lev; /* btree level */
if (++cur->bc_ptrs[lev] <= INT_GET(block->bb_numrecs, ARCH_CONVERT))
break;
/*
- * Read-ahead the right block, we're going to read it
+ * Read-ahead the right block, we're going to read it
* in the next loop.
*/
xfs_btree_readahead(cur, lev, XFS_BTCUR_RIGHTRA);
*/
int /* error */
xfs_alloc_insert(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
int *stat) /* success/failure */
{
int error; /* error return value */
int i; /* result value, 0 for failure */
int level; /* current level number in btree */
xfs_agblock_t nbno; /* new block number (split result) */
- xfs_btree_cur_t *ncur; /* new cursor (split result) */
- xfs_alloc_rec_t nrec; /* record being inserted this level */
- xfs_btree_cur_t *pcur; /* previous level's cursor */
+ xfs_btree_cur_t *ncur; /* new cursor (split result) */
+ xfs_alloc_rec_t nrec; /* record being inserted this level */
+ xfs_btree_cur_t *pcur; /* previous level's cursor */
level = 0;
nbno = NULLAGBLOCK;
*/
int /* error */
xfs_alloc_lookup_eq(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat) /* success/failure */
*/
int /* error */
xfs_alloc_lookup_ge(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat) /* success/failure */
*/
int /* error */
xfs_alloc_lookup_le(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len, /* length of extent */
int *stat) /* success/failure */
xfs_agblock_t bno, /* starting block of extent */
xfs_extlen_t len) /* length of extent */
{
- xfs_alloc_block_t *block; /* btree block to update */
+ xfs_alloc_block_t *block; /* btree block to update */
int error; /* error return value */
int ptr; /* current record number (updating) */
* Updating first record in leaf. Pass new key value up to our parent.
*/
if (ptr == 1) {
- xfs_alloc_key_t key; /* key containing [bno, len] */
+ xfs_alloc_key_t key; /* key containing [bno, len] */
INT_SET(key.ar_startblock, ARCH_CONVERT, bno);
INT_SET(key.ar_blockcount, ARCH_CONVERT, len);
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
/*
* After compaction, the block is guaranteed to have only one
- * free region, in freemap[0]. If it is not big enough, give up.
+ * free region, in freemap[0]. If it is not big enough, give up.
*/
if (INT_GET(hdr->freemap[0].size, ARCH_CONVERT)
< (entsize + sizeof(xfs_attr_leaf_entry_t)))
/*
* Copy the attribute name and value into the new space.
*
- * For "remote" attribute values, simply note that we need to
+ * For "remote" attribute values, simply note that we need to
* allocate space for the "remote" value. We can't actually
* allocate the extents in this transaction, and we can't decide
* which blocks they should be as we might allocate more blocks
*
* This code adjusts the args->index/blkno and args->index2/blkno2 fields
* to match what it is doing in splitting the attribute leaf block. Those
- * values are used in "atomic rename" operations on attributes. Note that
+ * values are used in "atomic rename" operations on attributes. Note that
* the "new" and "old" values can end up in different blocks.
*/
STATIC void
entry = &leaf1->entries[0];
for (count = index = 0; count < max; entry++, index++, count++) {
-#define XFS_ATTR_ABS(A) (((A) < 0) ? -(A) : (A))
+#define XFS_ATTR_ABS(A) (((A) < 0) ? -(A) : (A))
/*
* The new entry is in the first block, account for it.
*/
*/
totallen -= count * sizeof(*entry);
if (foundit) {
- totallen -= sizeof(*entry) +
+ totallen -= sizeof(*entry) +
xfs_attr_leaf_newentsize(state->args,
state->blocksize,
NULL);
bzero(tmpbuffer, state->blocksize);
tmp_leaf = (xfs_attr_leafblock_t *)tmpbuffer;
tmp_hdr = &tmp_leaf->hdr;
- tmp_hdr->info = save_hdr->info; /* struct copy */
+ tmp_hdr->info = save_hdr->info; /* struct copy */
INT_ZERO(tmp_hdr->count, ARCH_CONVERT);
INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize);
if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) {
ASSERT((INT_GET(hdr_s->count, ARCH_CONVERT) > 0)
&& (INT_GET(hdr_s->count, ARCH_CONVERT)
< (XFS_LBSIZE(mp)/8)));
- ASSERT(INT_GET(hdr_s->firstused, ARCH_CONVERT) >=
+ ASSERT(INT_GET(hdr_s->firstused, ARCH_CONVERT) >=
((INT_GET(hdr_s->count, ARCH_CONVERT)
* sizeof(*entry_s))+sizeof(*hdr_s)));
ASSERT(INT_GET(hdr_d->count, ARCH_CONVERT) < (XFS_LBSIZE(mp)/8));
- ASSERT(INT_GET(hdr_d->firstused, ARCH_CONVERT) >=
+ ASSERT(INT_GET(hdr_d->firstused, ARCH_CONVERT) >=
((INT_GET(hdr_d->count, ARCH_CONVERT)
* sizeof(*entry_d))+sizeof(*hdr_d)));
#ifdef GROT
/*
* Code to drop INCOMPLETE entries. Difficult to use as we
- * may also need to change the insertion index. Code turned
+ * may also need to change the insertion index. Code turned
* off for 6.2, should be revisited later.
*/
if (entry_s->flags & XFS_ATTR_INCOMPLETE) { /* skip partials? */
&& (INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0)
&& ( (INT_GET(leaf2->entries[ 0 ].hashval, ARCH_CONVERT) <
INT_GET(leaf1->entries[ 0 ].hashval, ARCH_CONVERT))
- || (INT_GET(leaf2->entries[INT_GET(leaf2->hdr.count,
+ || (INT_GET(leaf2->entries[INT_GET(leaf2->hdr.count,
ARCH_CONVERT)-1].hashval, ARCH_CONVERT) <
INT_GET(leaf1->entries[INT_GET(leaf1->hdr.count,
ARCH_CONVERT)-1].hashval, ARCH_CONVERT))) ) {
int size;
size = XFS_ATTR_LEAF_ENTSIZE_LOCAL(args->namelen, args->valuelen);
- if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) {
+ if (size < XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(blocksize)) {
if (local) {
*local = 1;
}
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
xfs_bmap_add_extent(
xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t idx, /* extent number to update/insert */
- xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
+ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
xfs_bmbt_irec_t *new, /* new data to put in extent list */
- xfs_fsblock_t *first, /* pointer to firstblock variable */
- xfs_bmap_free_t *flist, /* list of extents to be freed */
+ xfs_fsblock_t *first, /* pointer to firstblock variable */
+ xfs_bmap_free_t *flist, /* list of extents to be freed */
int *logflagsp, /* inode logging flags */
int whichfork, /* data or attr fork */
int rsvd) /* OK to use reserved data blocks */
&logflags, whichfork)))
goto done;
} else {
- xfs_bmbt_irec_t prev; /* old extent at offset idx */
+ xfs_bmbt_irec_t prev; /* old extent at offset idx */
/*
* Get the record referred to by idx.
*/
if (!ISNULLSTARTBLOCK(new->br_startblock) &&
new->br_startoff + new->br_blockcount > prev.br_startoff) {
- if (prev.br_state != XFS_EXT_UNWRITTEN &&
+ if (prev.br_state != XFS_EXT_UNWRITTEN &&
ISNULLSTARTBLOCK(prev.br_startblock)) {
da_old = STARTBLOCKVAL(prev.br_startblock);
if (cur)
xfs_bmap_add_extent_delay_real(
xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t idx, /* extent number to update/insert */
- xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
+ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
xfs_bmbt_irec_t *new, /* new data to put in extent list */
xfs_filblks_t *dnew, /* new delayed-alloc indirect blocks */
- xfs_fsblock_t *first, /* pointer to firstblock variable */
- xfs_bmap_free_t *flist, /* list of extents to be freed */
+ xfs_fsblock_t *first, /* pointer to firstblock variable */
+ xfs_bmap_free_t *flist, /* list of extents to be freed */
int *logflagsp, /* inode logging flags */
int rsvd) /* OK to use reserved data block allocation */
{
xfs_fileoff_t new_endoff; /* end offset of new entry */
xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
/* left is 0, right is 1, prev is 2 */
- int rval=0; /* return value (logging flags) */
+ int rval=0; /* return value (logging flags) */
int state = 0;/* state bits, accessed thru macros */
xfs_filblks_t temp; /* value for dnew calculations */
xfs_filblks_t temp2; /* value for dnew calculations */
LEFT_VALID, RIGHT_VALID
};
-#define LEFT r[0]
-#define RIGHT r[1]
-#define PREV r[2]
-#define MASK(b) (1 << (b))
-#define MASK2(a,b) (MASK(a) | MASK(b))
-#define MASK3(a,b,c) (MASK2(a,b) | MASK(c))
-#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d))
-#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
-#define STATE_TEST(b) (state & MASK(b))
-#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
+#define LEFT r[0]
+#define RIGHT r[1]
+#define PREV r[2]
+#define MASK(b) (1 << (b))
+#define MASK2(a,b) (MASK(a) | MASK(b))
+#define MASK3(a,b,c) (MASK2(a,b) | MASK(c))
+#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d))
+#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
+#define STATE_TEST(b) (state & MASK(b))
+#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
((state &= ~MASK(b)), 0))
-#define SWITCH_STATE \
+#define SWITCH_STATE \
(state & MASK4(LEFT_FILLING, RIGHT_FILLING, LEFT_CONTIG, RIGHT_CONTIG))
/*
xfs_bmbt_get_all(ep - 1, &LEFT);
STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(LEFT.br_startblock));
}
- STATE_SET(LEFT_CONTIG,
+ STATE_SET(LEFT_CONTIG,
STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) &&
LEFT.br_startoff + LEFT.br_blockcount == new->br_startoff &&
LEFT.br_startblock + LEFT.br_blockcount == new->br_startblock &&
xfs_bmbt_get_all(ep + 1, &RIGHT);
STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(RIGHT.br_startblock));
}
- STATE_SET(RIGHT_CONTIG,
+ STATE_SET(RIGHT_CONTIG,
STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) &&
new_endoff == RIGHT.br_startoff &&
new->br_startblock + new->br_blockcount ==
XFS_DATA_FORK);
xfs_bmbt_set_blockcount(ep, temp);
xfs_bmbt_set_allf(ep + 1, new->br_startoff, new->br_startblock,
- new->br_blockcount + RIGHT.br_blockcount,
+ new->br_blockcount + RIGHT.br_blockcount,
RIGHT.br_state);
xfs_bmap_trace_post_update(fname, "RF|RC", ip, idx + 1,
XFS_DATA_FORK);
xfs_bmap_add_extent_unwritten_real(
xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t idx, /* extent number to update/insert */
- xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
+ xfs_btree_cur_t **curp, /* if *curp is null, not a btree */
xfs_bmbt_irec_t *new, /* new data to put in extent list */
int *logflagsp) /* inode logging flags */
{
#endif
int i; /* temp state */
xfs_fileoff_t new_endoff; /* end offset of new entry */
- xfs_exntst_t newext; /* new extent state */
- xfs_exntst_t oldext; /* old extent state */
+ xfs_exntst_t newext; /* new extent state */
+ xfs_exntst_t oldext; /* old extent state */
xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
/* left is 0, right is 1, prev is 2 */
- int rval=0; /* return value (logging flags) */
+ int rval=0; /* return value (logging flags) */
int state = 0;/* state bits, accessed thru macros */
enum { /* bit number definitions for state */
LEFT_CONTIG, RIGHT_CONTIG,
LEFT_VALID, RIGHT_VALID
};
-#define LEFT r[0]
-#define RIGHT r[1]
-#define PREV r[2]
-#define MASK(b) (1 << (b))
-#define MASK2(a,b) (MASK(a) | MASK(b))
-#define MASK3(a,b,c) (MASK2(a,b) | MASK(c))
-#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d))
-#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
-#define STATE_TEST(b) (state & MASK(b))
-#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
+#define LEFT r[0]
+#define RIGHT r[1]
+#define PREV r[2]
+#define MASK(b) (1 << (b))
+#define MASK2(a,b) (MASK(a) | MASK(b))
+#define MASK3(a,b,c) (MASK2(a,b) | MASK(c))
+#define MASK4(a,b,c,d) (MASK3(a,b,c) | MASK(d))
+#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
+#define STATE_TEST(b) (state & MASK(b))
+#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
((state &= ~MASK(b)), 0))
-#define SWITCH_STATE \
+#define SWITCH_STATE \
(state & MASK4(LEFT_FILLING, RIGHT_FILLING, LEFT_CONTIG, RIGHT_CONTIG))
/*
xfs_bmbt_get_all(ep - 1, &LEFT);
STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(LEFT.br_startblock));
}
- STATE_SET(LEFT_CONTIG,
+ STATE_SET(LEFT_CONTIG,
STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) &&
LEFT.br_startoff + LEFT.br_blockcount == new->br_startoff &&
LEFT.br_startblock + LEFT.br_blockcount == new->br_startblock &&
xfs_bmbt_get_all(ep + 1, &RIGHT);
STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(RIGHT.br_startblock));
}
- STATE_SET(RIGHT_CONTIG,
+ STATE_SET(RIGHT_CONTIG,
STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) &&
new_endoff == RIGHT.br_startoff &&
new->br_startblock + new->br_blockcount ==
goto done;
ASSERT(i == 1);
if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
- PREV.br_startblock,
+ PREV.br_startblock,
PREV.br_blockcount - new->br_blockcount,
oldext)))
goto done;
goto done;
ASSERT(i == 1);
if ((error = xfs_bmbt_update(cur, PREV.br_startoff,
- PREV.br_startblock,
+ PREV.br_startblock,
PREV.br_blockcount - new->br_blockcount,
oldext)))
goto done;
xfs_filblks_t newlen=0; /* new indirect size */
xfs_filblks_t oldlen=0; /* old indirect size */
xfs_bmbt_irec_t right; /* right neighbor extent entry */
- int state; /* state bits, accessed thru macros */
+ int state; /* state bits, accessed thru macros */
xfs_filblks_t temp; /* temp for indirect calculations */
enum { /* bit number definitions for state */
LEFT_CONTIG, RIGHT_CONTIG,
LEFT_VALID, RIGHT_VALID
};
-#define MASK(b) (1 << (b))
-#define MASK2(a,b) (MASK(a) | MASK(b))
-#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
-#define STATE_TEST(b) (state & MASK(b))
-#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
+#define MASK(b) (1 << (b))
+#define MASK2(a,b) (MASK(a) | MASK(b))
+#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
+#define STATE_TEST(b) (state & MASK(b))
+#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
((state &= ~MASK(b)), 0))
-#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG))
+#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG))
base = ip->i_df.if_u1.if_extents;
ep = &base[idx];
* Set contiguity flags on the left and right neighbors.
* Don't let extents get too large, even if the pieces are contiguous.
*/
- STATE_SET(LEFT_CONTIG,
+ STATE_SET(LEFT_CONTIG,
STATE_TEST(LEFT_VALID) && STATE_TEST(LEFT_DELAY) &&
left.br_startoff + left.br_blockcount == new->br_startoff &&
left.br_blockcount + new->br_blockcount <= MAXEXTLEN);
STARTBLOCKVAL(right.br_startblock);
newlen = xfs_bmap_worst_indlen(ip, temp);
xfs_bmbt_set_allf(ep, new->br_startoff,
- NULLSTARTBLOCK((int)newlen), temp, right.br_state);
+ NULLSTARTBLOCK((int)newlen), temp, right.br_state);
xfs_bmap_trace_post_update(fname, "RC", ip, idx, XFS_DATA_FORK);
ip->i_df.if_lastex = idx;
break;
LEFT_VALID, RIGHT_VALID
};
-#define MASK(b) (1 << (b))
-#define MASK2(a,b) (MASK(a) | MASK(b))
-#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
-#define STATE_TEST(b) (state & MASK(b))
-#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
+#define MASK(b) (1 << (b))
+#define MASK2(a,b) (MASK(a) | MASK(b))
+#define STATE_SET(b,v) ((v) ? (state |= MASK(b)) : (state &= ~MASK(b)))
+#define STATE_TEST(b) (state & MASK(b))
+#define STATE_SET_TEST(b,v) ((v) ? ((state |= MASK(b)), 1) : \
((state &= ~MASK(b)), 0))
-#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG))
+#define SWITCH_STATE (state & MASK2(LEFT_CONTIG, RIGHT_CONTIG))
ifp = XFS_IFORK_PTR(ip, whichfork);
ASSERT(idx <= ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t));
* We're inserting a real allocation between "left" and "right".
* Set the contiguity flags. Don't let extents get too large.
*/
- STATE_SET(LEFT_CONTIG,
+ STATE_SET(LEFT_CONTIG,
STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) &&
left.br_startoff + left.br_blockcount == new->br_startoff &&
left.br_startblock + left.br_blockcount == new->br_startblock &&
xfs_bmalloca_t *ap) /* bmap alloc argument struct */
{
xfs_fsblock_t adjust; /* adjustment to block numbers */
- xfs_alloctype_t atype=0; /* type for allocation routines */
+ xfs_alloctype_t atype=0; /* type for allocation routines */
int error; /* error return value */
xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */
xfs_mount_t *mp; /* mount point structure */
xfs_extlen_t ralen=0; /* realtime allocation length */
#endif
-#define ISLEGAL(x,y) \
+#define ISLEGAL(x,y) \
(rt ? \
(x) < mp->m_sb.sb_rblocks : \
XFS_FSB_TO_AGNO(mp, x) == XFS_FSB_TO_AGNO(mp, y) && \
orig_end = orig_off + orig_alen;
/*
* If the file offset is unaligned vs. the extent size
- * we need to align it. This will be possible unless
+ * we need to align it. This will be possible unless
* the file was previously written with a kernel that didn't
* perform this alignment.
*/
* and if we hit the offset 0 limit then the next block
* can still overlap too.
*/
- nexto = (ap->eof || ap->gotp->br_startoff == NULLFILEOFF) ?
+ nexto = (ap->eof || ap->gotp->br_startoff == NULLFILEOFF) ?
NULLFILEOFF : ap->gotp->br_startoff;
if (!ap->eof &&
ap->off + ap->alen != orig_end &&
else
prevdiff += adjust;
/*
- * If the firstblock forbids it, can't use it,
+ * If the firstblock forbids it, can't use it,
* must use default.
*/
if (!rt && !nullfb &&
} else
gotdiff += adjust;
/*
- * If the firstblock forbids it, can't use it,
+ * If the firstblock forbids it, can't use it,
* must use default.
*/
if (!rt && !nullfb &&
if (ap->wasdel)
ap->ip->i_delayed_blks -= ralen;
/*
- * Adjust the disk quota also. This was reserved
+ * Adjust the disk quota also. This was reserved
* earlier.
*/
if (XFS_IS_QUOTA_ON(mp) &&
*/
else {
xfs_agnumber_t ag;
- xfs_alloc_arg_t args;
+ xfs_alloc_arg_t args;
xfs_extlen_t blen;
xfs_extlen_t delta;
int isaligned;
blen = longest;
} else
notinit = 1;
- if (++ag == mp->m_sb.sb_agcount)
+ if (++ag == mp->m_sb.sb_agcount)
ag = 0;
if (ag == startag)
break;
}
up_read(&mp->m_peraglock);
- /*
+ /*
* Since the above loop did a BUF_TRYLOCK, it is
* possible that there is space for this request.
- */
+ */
if (notinit || blen < ap->minlen)
- args.minlen = ap->minlen;
+ args.minlen = ap->minlen;
/*
* If the best seen length is less than the request
* length, use the best as the minimum.
* Otherwise we've seen an extent as big as alen,
* use that as the minimum.
*/
- else
+ else
args.minlen = ap->alen;
} else if (ap->low) {
args.type = XFS_ALLOCTYPE_FIRST_AG;
args.mod = (xfs_extlen_t)(args.prod - args.mod);
}
/*
- * If we are not low on available data blocks, and the
+ * If we are not low on available data blocks, and the
* underlying logical volume manager is a stripe, and
- * the file offset is zero then try to allocate data
+ * the file offset is zero then try to allocate data
* blocks on stripe unit boundary.
* NOTE: ap->aeof is only set if the allocation length
* is >= the stripe unit and the allocation offset is
- * at the end of file.
- */
+ * at the end of file.
+ */
if (!ap->low && ap->aeof) {
if (!ap->off) {
args.alignment = mp->m_dalign;
/*
* Adjust for alignment
*/
- if (blen > args.alignment && blen <= ap->alen)
+ if (blen > args.alignment && blen <= ap->alen)
args.minlen = blen - args.alignment;
args.minalignslop = 0;
} else {
/*
- * First try an exact bno allocation.
+ * First try an exact bno allocation.
* If it fails then do a near or start bno
* allocation with alignment turned on.
- */
+ */
atype = args.type;
tryagain = 1;
args.type = XFS_ALLOCTYPE_THIS_BNO;
* of minlen+alignment+slop doesn't go up
* between the calls.
*/
- if (blen > mp->m_dalign && blen <= ap->alen)
+ if (blen > mp->m_dalign && blen <= ap->alen)
nextminlen = blen - mp->m_dalign;
else
nextminlen = args.minlen;
* Exact allocation failed. Now try with alignment
* turned on.
*/
- args.type = atype;
- args.fsbno = ap->rval;
- args.alignment = mp->m_dalign;
+ args.type = atype;
+ args.fsbno = ap->rval;
+ args.alignment = mp->m_dalign;
args.minlen = nextminlen;
args.minalignslop = 0;
isaligned = 1;
- if ((error = xfs_alloc_vextent(&args)))
- return error;
- }
+ if ((error = xfs_alloc_vextent(&args)))
+ return error;
+ }
if (isaligned && args.fsbno == NULLFSBLOCK) {
- /*
+ /*
* allocation failed, so turn off alignment and
* try again.
*/
if (ap->wasdel)
ap->ip->i_delayed_blks -= args.len;
/*
- * Adjust the disk quota also. This was reserved
+ * Adjust the disk quota also. This was reserved
* earlier.
*/
if (XFS_IS_QUOTA_ON(mp) &&
xfs_btree_cur_t *cur, /* btree cursor */
int *logflagsp, /* inode logging flags */
int whichfork, /* data or attr fork */
- int async) /* xaction can be async */
+ int async) /* xaction can be async */
{
/* REFERENCED */
xfs_bmbt_block_t *cblock;/* child btree block */
xfs_inode_t *ip, /* incore inode pointer */
xfs_trans_t *tp, /* current transaction pointer */
xfs_extnum_t idx, /* extent number to update/delete */
- xfs_bmap_free_t *flist, /* list of extents to be freed */
+ xfs_bmap_free_t *flist, /* list of extents to be freed */
xfs_btree_cur_t *cur, /* if null, not a btree */
xfs_bmbt_irec_t *del, /* data to remove from extent list */
- int iflags, /* input flags */
+ int iflags, /* input flags */
int *logflagsp, /* inode logging flags */
int whichfork, /* data or attr fork */
int rsvd) /* OK to allocate reserved blocks */
{
- xfs_filblks_t da_new; /* new delay-alloc indirect blocks */
- xfs_filblks_t da_old; /* old delay-alloc indirect blocks */
- xfs_fsblock_t del_endblock=0; /* first block past del */
+ xfs_filblks_t da_new; /* new delay-alloc indirect blocks */
+ xfs_filblks_t da_old; /* old delay-alloc indirect blocks */
+ xfs_fsblock_t del_endblock=0; /* first block past del */
xfs_fileoff_t del_endoff; /* first offset past del */
int delay; /* current block is delayed allocated */
int do_fx; /* free extent at end of routine */
xfs_bmbt_irec_t new; /* new record to be inserted */
/* REFERENCED */
xfs_extnum_t nextents; /* number of extents in list */
- uint qfield; /* quota field to update */
+ uint qfield; /* quota field to update */
xfs_filblks_t temp; /* for indirect length calculations */
xfs_filblks_t temp2; /* for indirect length calculations */
-
+
XFS_STATS_INC(xfsstats.xs_del_exlist);
- mp = ip->i_mount;
+ mp = ip->i_mount;
ifp = XFS_IFORK_PTR(ip, whichfork);
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
ASSERT(idx >= 0 && idx < nextents);
if (!delay) {
flags = XFS_ILOG_CORE;
/*
- * Realtime allocation. Free it and record di_nblocks update.
+ * Realtime allocation. Free it and record di_nblocks update.
*/
if (whichfork == XFS_DATA_FORK &&
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME)) {
got.br_state)))
goto done;
break;
-
+
case 0:
/*
* Deleting the middle of the extent.
* Fix up our state and return the error.
*/
if (error == ENOSPC) {
- /*
+ /*
* Reset the cursor, don't trust
* it after any insert operation.
*/
if (temp2) {
temp2--;
da_new--;
- new.br_startblock =
+ new.br_startblock =
NULLSTARTBLOCK((int)temp2);
}
}
* Nothing to do for disk quota accounting here.
*/
ASSERT(da_old >= da_new);
- if (da_old > da_new)
+ if (da_old > da_new)
xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, (int)(da_old - da_new),
rsvd);
done:
*/
STATIC void
xfs_bmap_del_free(
- xfs_bmap_free_t *flist, /* free item list header */
+ xfs_bmap_free_t *flist, /* free item list header */
xfs_bmap_free_item_t *prev, /* previous item on list, if any */
xfs_bmap_free_item_t *free) /* list item to be freed */
{
INT_SET(block->bb_level, ARCH_CONVERT, 1);
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLDFSBNO);
- INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
+ INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
/*
* Need a cursor. Can't allocate until bb_level is filled in.
*/
ASSERT(*firstblock == NULLFSBLOCK ||
args.agno == XFS_FSB_TO_AGNO(mp, *firstblock) ||
(flist->xbf_low &&
- args.agno > XFS_FSB_TO_AGNO(mp, *firstblock)));
+ args.agno > XFS_FSB_TO_AGNO(mp, *firstblock)));
*firstblock = cur->bc_private.b.firstblock = args.fsbno;
cur->bc_private.b.allocated++;
ip->i_d.di_nblocks++;
INT_ZERO(ablock->bb_level, ARCH_CONVERT);
INT_ZERO(ablock->bb_numrecs, ARCH_CONVERT);
INT_SET(ablock->bb_leftsib, ARCH_CONVERT, NULLDFSBNO);
- INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
+ INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
arp = XFS_BMAP_REC_IADDR(ablock, 1, cur);
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
for (ep = ifp->if_u1.if_extents, i = 0; i < nextents; i++, ep++) {
pp = XFS_BMAP_PTR_IADDR(block, 1, cur);
INT_SET(*pp, ARCH_CONVERT, args.fsbno);
/*
- * Do all this logging at the end so that
+ * Do all this logging at the end so that
* the root is at the right level.
*/
xfs_bmbt_log_block(cur, abp, XFS_BB_ALL_BITS);
xfs_inode_t *ip, /* incore inode pointer */
xfs_extnum_t idx, /* starting index of new items */
xfs_extnum_t count, /* number of inserted items */
- xfs_bmbt_irec_t *new, /* items to insert */
+ xfs_bmbt_irec_t *new, /* items to insert */
int whichfork) /* data or attr fork */
{
xfs_bmbt_rec_t *base; /* extent list base */
* We don't want to deal with the case of keeping inode data inline yet.
* So sending the data fork of a regular inode is illegal.
*/
- ASSERT(!((ip->i_d.di_mode & IFMT) == IFREG &&
+ ASSERT(!((ip->i_d.di_mode & IFMT) == IFREG &&
whichfork == XFS_DATA_FORK));
ifp = XFS_IFORK_PTR(ip, whichfork);
ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);
flags = 0;
error = 0;
if (ifp->if_bytes) {
- xfs_alloc_arg_t args; /* allocation arguments */
+ xfs_alloc_arg_t args; /* allocation arguments */
xfs_buf_t *bp; /* buffer for extent list block */
xfs_bmbt_rec_t *ep; /* extent list pointer */
args.minlen = args.maxlen = args.prod = 1;
if ((error = xfs_alloc_vextent(&args)))
goto done;
- /*
+ /*
* Can't fail, the space was reserved.
*/
ASSERT(args.fsbno != NULLFSBLOCK);
xfs_fileoff_t bno, /* block number searched for */
int *eofp, /* out: end of file found */
xfs_extnum_t *lastxp, /* out: last extent index */
- xfs_bmbt_irec_t *gotp, /* out: extent entry found */
- xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
+ xfs_bmbt_irec_t *gotp, /* out: extent entry found */
+ xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
{
xfs_bmbt_rec_t *ep; /* extent list entry pointer */
- xfs_bmbt_irec_t got; /* extent list entry, decoded */
+ xfs_bmbt_irec_t got; /* extent list entry, decoded */
int high; /* high index of binary search */
int low; /* low index of binary search */
* Else, *lastxp will be set to the index of the found
* entry; *gotp will contain the entry.
*/
-STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */
+STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */
xfs_bmap_search_extents(
- xfs_inode_t *ip, /* incore inode pointer */
- xfs_fileoff_t bno, /* block number searched for */
- int whichfork, /* data or attr fork */
- int *eofp, /* out: end of file found */
- xfs_extnum_t *lastxp, /* out: last extent index */
- xfs_bmbt_irec_t *gotp, /* out: extent entry found */
- xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
-{
+ xfs_inode_t *ip, /* incore inode pointer */
+ xfs_fileoff_t bno, /* block number searched for */
+ int whichfork, /* data or attr fork */
+ int *eofp, /* out: end of file found */
+ xfs_extnum_t *lastxp, /* out: last extent index */
+ xfs_bmbt_irec_t *gotp, /* out: extent entry found */
+ xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
+{
xfs_ifork_t *ifp; /* inode fork pointer */
- xfs_bmbt_rec_t *base; /* base of extent list */
- xfs_extnum_t lastx; /* last extent index used */
- xfs_extnum_t nextents; /* extent list size */
+ xfs_bmbt_rec_t *base; /* base of extent list */
+ xfs_extnum_t lastx; /* last extent index used */
+ xfs_extnum_t nextents; /* extent list size */
XFS_STATS_INC(xfsstats.xs_look_exlist);
ifp = XFS_IFORK_PTR(ip, whichfork);
flist->xbf_count++;
}
-/*
+/*
* Compute and fill in the value of the maximum depth of a bmap btree
- * in this filesystem. Done once, during mount.
+ * in this filesystem. Done once, during mount.
*/
void
xfs_bmap_compute_maxlevels(
int eof; /* hit end of file */
xfs_bmbt_rec_t *ep; /* pointer to last extent */
int error; /* error return value */
- xfs_bmbt_irec_t got; /* current extent value */
+ xfs_bmbt_irec_t got; /* current extent value */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_extnum_t lastx; /* last extent used */
- xfs_bmbt_irec_t prev; /* previous extent value */
+ xfs_bmbt_irec_t prev; /* previous extent value */
if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS &&
xfs_bmbt_rec_t *ep; /* ptr to fork's extent */
xfs_ifork_t *ifp; /* inode fork pointer */
int rval; /* return value */
- xfs_bmbt_irec_t s; /* internal version of extent */
+ xfs_bmbt_irec_t s; /* internal version of extent */
#ifndef DEBUG
if (whichfork == XFS_DATA_FORK)
xfs_inode_t *ip, /* incore inode */
int whichfork) /* data or attr fork */
{
- xfs_bmbt_block_t *block; /* current btree block */
+ xfs_bmbt_block_t *block; /* current btree block */
xfs_fsblock_t bno; /* block # of "block" */
xfs_buf_t *bp; /* buffer for "block" */
int error; /* error return value */
if (exntf == XFS_EXTFMT_NOSTATE) {
/*
* Check all attribute bmap btree records and
- * any "older" data bmap btree records for a
+ * any "older" data bmap btree records for a
* set bit in the "extent flag" position.
*/
if (xfs_check_nostate_extents(trp, num_recs)) {
xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */
xfs_extlen_t total, /* total blocks needed */
- xfs_bmbt_irec_t *mval, /* output: map values */
+ xfs_bmbt_irec_t *mval, /* output: map values */
int *nmap, /* i/o: mval size/count */
- xfs_bmap_free_t *flist) /* i/o: list extents to free */
+ xfs_bmap_free_t *flist) /* i/o: list extents to free */
{
xfs_fsblock_t abno; /* allocated block number */
xfs_extlen_t alen; /* allocated extent length */
xfs_fileoff_t aoff; /* allocated file offset */
xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */
char contig; /* allocation must be one extent */
- xfs_btree_cur_t *cur; /* bmap btree cursor */
+ xfs_btree_cur_t *cur; /* bmap btree cursor */
char delay; /* this request is for delayed alloc */
xfs_fileoff_t end; /* end of mapped file region */
int eof; /* we've hit the end of extent list */
xfs_bmbt_rec_t *ep; /* extent list entry pointer */
int error; /* error return */
char exact; /* don't do all of wasdelayed extent */
- xfs_bmbt_irec_t got; /* current extent list record */
+ xfs_bmbt_irec_t got; /* current extent list record */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_extlen_t indlen; /* indirect blocks length */
char inhole; /* current location is hole in file */
int nallocs; /* number of extents alloc\'d */
xfs_extnum_t nextents; /* number of extents in file */
xfs_fileoff_t obno; /* old block number (offset) */
- xfs_bmbt_irec_t prev; /* previous extent list record */
+ xfs_bmbt_irec_t prev; /* previous extent list record */
char stateless; /* ignore state flag set */
int tmp_logflags; /* temp flags holder */
char trim; /* output trimmed to match range */
xfs_fileoff_t orig_bno; /* original block number value */
int orig_flags; /* original flags arg value */
xfs_filblks_t orig_len; /* original value of len arg */
- xfs_bmbt_irec_t *orig_mval; /* original value of mval */
+ xfs_bmbt_irec_t *orig_mval; /* original value of mval */
int orig_nmap; /* original value of *nmap */
orig_bno = bno;
* when the caller does not wish to see the
* separation (which is the default).
*
- * This technique is also used when writing a
+ * This technique is also used when writing a
* buffer which has been partially written,
* (usually by being flushed during a chunkread),
* to ensure one write takes place. This also
obno = bno;
bma.ip = NULL;
while (bno < end && n < *nmap) {
- /*
+ /*
* Reading past eof, act as though there's a hole
* up to end.
*/
wasdelay = wr && !inhole && !delay &&
ISNULLSTARTBLOCK(got.br_startblock);
/*
- * First, deal with the hole before the allocated space
+ * First, deal with the hole before the allocated space
* that we found, if any.
*/
if (wr && (inhole || wasdelay)) {
* in the file, or just any user data.
*/
if (userdata) {
- bma.userdata = (aoff == 0) ?
- XFS_ALLOC_INITIAL_USER_DATA :
+ bma.userdata = (aoff == 0) ?
+ XFS_ALLOC_INITIAL_USER_DATA :
XFS_ALLOC_USERDATA;
}
/*
bma.minleft = minleft;
/*
* Only want to do the alignment at the
- * eof if it is userdata and allocation length
+ * eof if it is userdata and allocation length
* is larger than a stripe unit.
*/
if (mp->m_dalign && alen >= mp->m_dalign &&
XFS_FSB_TO_AGNO(ip->i_mount,
bma.firstblock) ||
(flist->xbf_low &&
- XFS_FSB_TO_AGNO(ip->i_mount,
+ XFS_FSB_TO_AGNO(ip->i_mount,
*firstblock) <
XFS_FSB_TO_AGNO(ip->i_mount,
bma.firstblock)));
got.br_state = XFS_EXT_NORM; /* assume normal */
/*
* Determine state of extent, and the filesystem.
- * A wasdelay extent has been initialized, so
+ * A wasdelay extent has been initialized, so
* shouldn't be flagged as unwritten.
*/
if (wr && XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) {
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
xfs_bmbt_get_all(ep, &got);
/*
- * We may have combined previously unwritten
- * space with written space, so generate
+ * We may have combined previously unwritten
+ * space with written space, so generate
* another request.
*/
if (mval->br_blockcount < len)
XFS_FSB_TO_AGNO(ip->i_mount,
cur->bc_private.b.firstblock) ||
(flist->xbf_low &&
- XFS_FSB_TO_AGNO(ip->i_mount, *firstblock) <
+ XFS_FSB_TO_AGNO(ip->i_mount, *firstblock) <
XFS_FSB_TO_AGNO(ip->i_mount,
cur->bc_private.b.firstblock)));
*firstblock = cur->bc_private.b.firstblock;
{
int eof; /* we've hit the end of extent list */
int error; /* error return */
- xfs_bmbt_irec_t got; /* current extent list record */
+ xfs_bmbt_irec_t got; /* current extent list record */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_extnum_t lastx; /* last useful extent number */
- xfs_bmbt_irec_t prev; /* previous extent list record */
+ xfs_bmbt_irec_t prev; /* previous extent list record */
ifp = XFS_IFORK_PTR(ip, whichfork);
if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
return error;
(void)xfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, &got,
&prev);
- /*
+ /*
* Reading past eof, act as though there's a hole
* up to end.
*/
/*
* Unmap (remove) blocks from a file.
* If nexts is nonzero then the number of extents to remove is limited to
- * that value. If not all extents in the block range can be removed then
+ * that value. If not all extents in the block range can be removed then
* *done is set.
*/
int /* error */
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t bno, /* starting offset to unmap */
xfs_filblks_t len, /* length to unmap in file */
- int flags, /* misc flags */
+ int flags, /* misc flags */
xfs_extnum_t nexts, /* number of extents max */
xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */
XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE) {
#ifdef __KERNEL__ /* additional, temporary, debugging code */
cmn_err(CE_NOTE,
- "EFSCORRUPTED returned from file %s line %d",
+ "EFSCORRUPTED returned from file %s line %d",
__FILE__, __LINE__);
#endif
return XFS_ERROR(EFSCORRUPTED);
ASSERT(ip->i_ino != mp->m_sb.sb_uquotino);
ASSERT(ip->i_ino != mp->m_sb.sb_gquotino);
if (!isrt)
- xfs_trans_unreserve_blkquota(NULL, ip,
+ xfs_trans_unreserve_blkquota(NULL, ip,
(long)del.br_blockcount);
else
xfs_trans_unreserve_rtblkquota(NULL, ip,
cur->bc_private.b.flags &= ~XFS_BTCUR_BPRV_WASDEL;
/*
* If it's the case where the directory code is running
- * with no block reservation, and the deleted block is in
+ * with no block reservation, and the deleted block is in
* the middle of its extent, and the resulting insert
* of an extent would cause transformation to btree format,
* then reject it. The calling code will then swap
XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS &&
XFS_IFORK_NEXTENTS(ip, whichfork) >= ifp->if_ext_max &&
del.br_startoff > got.br_startoff &&
- del.br_startoff + del.br_blockcount <
+ del.br_startoff + del.br_blockcount <
got.br_startoff + got.br_blockcount) {
error = XFS_ERROR(ENOSPC);
goto error0;
XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)
logflags &= ~XFS_ILOG_FBROOT(whichfork);
/*
- * Log inode even in the error case, if the transaction
+ * Log inode even in the error case, if the transaction
* is dirty we'll need to shut down the filesystem.
*/
if (logflags)
}
/*
- * Check the last inode extent to determine whether this allocation will result
- * in blocks being allocated at the end of the file. When we allocate new data
+ * Check the last inode extent to determine whether this allocation will result
+ * in blocks being allocated at the end of the file. When we allocate new data
* blocks at the end of the file which do not start at the previous data block,
* we will try to align the new blocks at stripe unit boundaries.
*/
int /* error */
xfs_bmap_isaeof(
xfs_inode_t *ip, /* incore inode pointer */
- xfs_fileoff_t off, /* file offset in fsblocks */
- int whichfork, /* data or attribute fork */
+ xfs_fileoff_t off, /* file offset in fsblocks */
+ int whichfork, /* data or attribute fork */
char *aeof) /* return value */
{
int error; /* error return value */
xfs_ifork_t *ifp; /* inode fork pointer */
xfs_bmbt_rec_t *lastrec; /* extent list entry pointer */
xfs_extnum_t nextents; /* size of extent list */
- xfs_bmbt_irec_t s; /* expanded extent list entry */
+ xfs_bmbt_irec_t s; /* expanded extent list entry */
ASSERT(whichfork == XFS_DATA_FORK);
ifp = XFS_IFORK_PTR(ip, whichfork);
/*
* Check we are allocating in the last extent (for delayed allocations)
* or past the last extent for non-delayed allocations.
- */
+ */
*aeof = (off >= s.br_startoff &&
off < s.br_startoff + s.br_blockcount &&
ISNULLSTARTBLOCK(s.br_startblock)) ||
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
if (XFS_IS_QUOTA_ON(mp) &&
cur->bc_private.b.ip->i_ino != mp->m_sb.sb_uquotino &&
cur->bc_private.b.ip->i_ino != mp->m_sb.sb_gquotino)
- xfs_trans_mod_dquot_byino(cur->bc_tp, cur->bc_private.b.ip,
+ xfs_trans_mod_dquot_byino(cur->bc_tp, cur->bc_private.b.ip,
XFS_TRANS_DQ_BCOUNT, -1L);
xfs_trans_binval(cur->bc_tp, rbp);
if (bp != lbp) {
*/
STATIC void
xfs_bmbt_log_keys(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
xfs_buf_t *bp,
int kfirst,
int klast)
*/
STATIC void
xfs_bmbt_log_ptrs(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
xfs_buf_t *bp,
int pfirst,
int plast)
*/
int /* error */
xfs_bmbt_delete(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
int async, /* deletion can be async */
int *stat) /* success/failure */
{
void
xfs_bmbt_get_all(
xfs_bmbt_rec_t *r,
- xfs_bmbt_irec_t *s)
+ xfs_bmbt_irec_t *s)
{
int ext_flag;
xfs_exntst_t st;
}
#endif /* XFS_BIG_FILES */
#if XFS_BIG_FILESYSTEMS
- s->br_startblock = (((xfs_fsblock_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) |
+ s->br_startblock = (((xfs_fsblock_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) |
(((xfs_fsblock_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21);
#else
#ifdef DEBUG
{
xfs_dfsbno_t b;
- b = (((xfs_dfsbno_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) |
+ b = (((xfs_dfsbno_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) |
(((xfs_dfsbno_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21);
ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
s->br_startblock = (xfs_fsblock_t)b;
#endif /* XFS_BIG_FILES */
#if XFS_BIG_FILESYSTEMS
s->br_startblock =
- (((xfs_fsblock_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
+ (((xfs_fsblock_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
(((xfs_fsblock_t)INT_GET(r->l2, ARCH_CONVERT)) << 11) |
(((xfs_fsblock_t)INT_GET(r->l3, ARCH_CONVERT)) >> 21);
#else
{
xfs_dfsbno_t b;
- b = (((xfs_dfsbno_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
+ b = (((xfs_dfsbno_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
(((xfs_dfsbno_t)INT_GET(r->l2, ARCH_CONVERT)) << 11) |
(((xfs_dfsbno_t)INT_GET(r->l3, ARCH_CONVERT)) >> 21);
ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
#endif /* XFS_BIG_FILESYSTEMS */
#else /* !BMBT_USE_64 */
#if XFS_BIG_FILESYSTEMS
- return (((xfs_fsblock_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
+ return (((xfs_fsblock_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
(((xfs_fsblock_t)INT_GET(r->l2, ARCH_CONVERT)) << 11) |
(((xfs_fsblock_t)INT_GET(r->l3, ARCH_CONVERT)) >> 21);
#else
#ifdef DEBUG
xfs_dfsbno_t b;
- b = (((xfs_dfsbno_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
+ b = (((xfs_dfsbno_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK32LO(9))) << 43) |
(((xfs_dfsbno_t)INT_GET(r->l2, ARCH_CONVERT)) << 11) |
(((xfs_dfsbno_t)INT_GET(r->l3, ARCH_CONVERT)) >> 21);
ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b));
xfs_exntst_t
xfs_bmbt_get_state(
- xfs_bmbt_rec_t *r)
+ xfs_bmbt_rec_t *r)
{
int ext_flag;
*/
int /* error */
xfs_bmbt_insert(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
int *stat) /* success/failure */
{
int error; /* error return value */
int i;
int level;
xfs_fsblock_t nbno;
- xfs_btree_cur_t *ncur;
+ xfs_btree_cur_t *ncur;
xfs_bmbt_rec_t nrec;
- xfs_btree_cur_t *pcur;
+ xfs_btree_cur_t *pcur;
XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
level = 0;
pcur->bc_private.b.allocated;
pcur->bc_private.b.allocated = 0;
ASSERT((cur->bc_private.b.firstblock != NULLFSBLOCK) ||
- (cur->bc_private.b.ip->i_d.di_flags &
+ (cur->bc_private.b.ip->i_d.di_flags &
XFS_DIFLAG_REALTIME));
cur->bc_private.b.firstblock =
pcur->bc_private.b.firstblock;
int /* error */
xfs_bmbt_lookup_eq(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
xfs_fileoff_t off,
xfs_fsblock_t bno,
xfs_filblks_t len,
int /* error */
xfs_bmbt_lookup_ge(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
xfs_fileoff_t off,
xfs_fsblock_t bno,
xfs_filblks_t len,
int /* error */
xfs_bmbt_lookup_le(
- xfs_btree_cur_t *cur,
+ xfs_btree_cur_t *cur,
xfs_fileoff_t off,
xfs_fsblock_t bno,
xfs_filblks_t len,
cur->bc_private.b.whichfork);
xfs_btree_setbuf(cur, level, bp);
/*
- * Do all this logging at the end so that
+ * Do all this logging at the end so that
* the root is at the right level.
*/
xfs_bmbt_log_block(cur, bp, XFS_BB_ALL_BITS);
void
xfs_bmbt_set_all(
xfs_bmbt_rec_t *r,
- xfs_bmbt_irec_t *s)
+ xfs_bmbt_irec_t *s)
{
int extent_flag;
#endif /* XFS_BIG_FILESYSTEMS */
#if BMBT_USE_64
#if XFS_BIG_FILESYSTEMS
- INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
+ INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
((xfs_bmbt_rec_base_t)s->br_startblock >> 43));
- INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
+ INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_FILESYSTEMS */
} else {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9));
- INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
+ INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
}
#endif /* XFS_BIG_FILESYSTEMS */
#if BMBT_USE_64
#if XFS_BIG_FILESYSTEMS
- INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
- ((xfs_bmbt_rec_base_t)o << 9) |
+ INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
+ ((xfs_bmbt_rec_base_t)o << 9) |
((xfs_bmbt_rec_base_t)b >> 43));
- INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
+ INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_FILESYSTEMS */
} else {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9));
- INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
+ INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
}
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
XFS_ABTB_MAGIC, XFS_ABTC_MAGIC, XFS_BMAP_MAGIC, XFS_IBT_MAGIC
};
-/*
+/*
* Prototypes for internal routines.
*/
STATIC int /* number of records fitting in block */
xfs_btree_maxrecs(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_block_t *block) /* generic btree block pointer */
+ xfs_btree_block_t *block) /* generic btree block pointer */
{
switch (cur->bc_btnum) {
case XFS_BTNUM_BNO:
void
xfs_btree_check_block(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_block_t *block, /* generic btree block pointer */
+ xfs_btree_block_t *block, /* generic btree block pointer */
int level, /* level of the btree block */
xfs_buf_t *bp) /* buffer containing block, if any */
{
{
switch (btnum) {
case XFS_BTNUM_BNO: {
- xfs_alloc_key_t *k1;
- xfs_alloc_key_t *k2;
+ xfs_alloc_key_t *k1;
+ xfs_alloc_key_t *k2;
k1 = ak1;
k2 = ak2;
break;
}
case XFS_BTNUM_CNT: {
- xfs_alloc_key_t *k1;
- xfs_alloc_key_t *k2;
+ xfs_alloc_key_t *k1;
+ xfs_alloc_key_t *k2;
k1 = ak1;
k2 = ak2;
xfs_bmbt_key_t *k1;
xfs_bmbt_key_t *k2;
- k1 = ak1;
+ k1 = ak1;
k2 = ak2;
ASSERT(INT_GET(k1->br_startoff, ARCH_CONVERT) < INT_GET(k2->br_startoff, ARCH_CONVERT));
break;
}
case XFS_BTNUM_INO: {
- xfs_inobt_key_t *k1;
- xfs_inobt_key_t *k2;
+ xfs_inobt_key_t *k1;
+ xfs_inobt_key_t *k2;
k1 = ak1;
k2 = ak2;
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_lblock(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_lblock_t *block, /* btree long form block pointer */
+ xfs_btree_lblock_t *block, /* btree long form block pointer */
int level, /* level of the btree block */
xfs_buf_t *bp) /* buffer for block, if any */
{
*/
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_lptr(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_dfsbno_t ptr, /* btree block disk address */
int level) /* btree block level */
{
{
switch (btnum) {
case XFS_BTNUM_BNO: {
- xfs_alloc_rec_t *r1;
- xfs_alloc_rec_t *r2;
+ xfs_alloc_rec_t *r1;
+ xfs_alloc_rec_t *r2;
r1 = ar1;
r2 = ar2;
break;
}
case XFS_BTNUM_CNT: {
- xfs_alloc_rec_t *r1;
- xfs_alloc_rec_t *r2;
-
+ xfs_alloc_rec_t *r1;
+ xfs_alloc_rec_t *r2;
+
r1 = ar1;
r2 = ar2;
ASSERT(INT_GET(r1->ar_blockcount, ARCH_CONVERT) < INT_GET(r2->ar_blockcount, ARCH_CONVERT) ||
break;
}
case XFS_BTNUM_INO: {
- xfs_inobt_rec_t *r1;
- xfs_inobt_rec_t *r2;
+ xfs_inobt_rec_t *r1;
+ xfs_inobt_rec_t *r2;
r1 = ar1;
r2 = ar2;
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_sblock(
xfs_btree_cur_t *cur, /* btree cursor */
- xfs_btree_sblock_t *block, /* btree short form block pointer */
+ xfs_btree_sblock_t *block, /* btree short form block pointer */
int level, /* level of the btree block */
xfs_buf_t *bp) /* buffer containing block */
{
xfs_buf_t *agbp; /* buffer for ag. freespace struct */
xfs_agf_t *agf; /* ag. freespace structure */
- xfs_agblock_t agflen; /* native ag. freespace length */
+ xfs_agblock_t agflen; /* native ag. freespace length */
int sblock_ok; /* block passes checks */
agbp = cur->bc_private.a.agbp;
*/
int /* error (0 or EFSCORRUPTED) */
xfs_btree_check_sptr(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agblock_t ptr, /* btree block disk address */
int level) /* btree block level */
{
*/
void
xfs_btree_del_cursor(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
int error) /* del because of error */
{
int i; /* btree level */
break;
}
/*
- * Can't free a bmap cursor without having dealt with the
+ * Can't free a bmap cursor without having dealt with the
* allocated indirect blocks' accounting.
*/
ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP ||
*/
int /* error */
xfs_btree_dup_cursor(
- xfs_btree_cur_t *cur, /* input cursor */
- xfs_btree_cur_t **ncur) /* output cursor */
+ xfs_btree_cur_t *cur, /* input cursor */
+ xfs_btree_cur_t **ncur) /* output cursor */
{
xfs_buf_t *bp; /* btree block's buffer pointer */
- int error; /* error return value */
+ int error; /* error return value */
int i; /* level number of btree block */
xfs_mount_t *mp; /* mount structure for filesystem */
- xfs_btree_cur_t *new; /* new cursor value */
+ xfs_btree_cur_t *new; /* new cursor value */
xfs_trans_t *tp; /* transaction pointer, can be NULL */
tp = cur->bc_tp;
xfs_btree_cur_t *cur, /* btree cursor */
int level) /* level to change */
{
- xfs_btree_block_t *block; /* generic btree block pointer */
+ xfs_btree_block_t *block; /* generic btree block pointer */
xfs_buf_t *bp; /* buffer containing block */
/*
return 1;
}
-/*
+/*
* Retrieve the block pointer from the cursor at the given level.
* This may be a bmap btree root or from a buffer.
*/
int level, /* level in btree */
xfs_buf_t **bpp) /* buffer containing the block */
{
- xfs_btree_block_t *block; /* return value */
+ xfs_btree_block_t *block; /* return value */
xfs_buf_t *bp; /* return buffer */
xfs_ifork_t *ifp; /* inode fork pointer */
int whichfork; /* data or attr fork */
{
xfs_agf_t *agf; /* (A) allocation group freespace */
xfs_agi_t *agi; /* (I) allocation group inodespace */
- xfs_btree_cur_t *cur; /* return value */
+ xfs_btree_cur_t *cur; /* return value */
xfs_ifork_t *ifp; /* (I) inode fork pointer */
int nlevels=0; /* number of levels in the btree */
* Allocate a new cursor.
*/
cur = kmem_zone_zalloc(xfs_btree_cur_zone, KM_SLEEP);
- /*
+ /*
* Deduce the number of btree levels from the arguments.
*/
switch (btnum) {
xfs_btree_cur_t *cur, /* btree cursor */
int level) /* level to check */
{
- xfs_btree_block_t *block; /* generic btree block pointer */
+ xfs_btree_block_t *block; /* generic btree block pointer */
xfs_buf_t *bp; /* buffer containing block */
block = xfs_btree_get_block(cur, level, &bp);
/*
* Change the cursor to point to the last record in the current block
- * at the given level. Other levels are unaffected.
+ * at the given level. Other levels are unaffected.
*/
int /* success=1, failure=0 */
xfs_btree_lastrec(
xfs_btree_cur_t *cur, /* btree cursor */
int level) /* level to change */
{
- xfs_btree_block_t *block; /* generic btree block pointer */
+ xfs_btree_block_t *block; /* generic btree block pointer */
xfs_buf_t *bp; /* buffer containing block */
/*
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
ASSERT(bp != NULL);
node = bp->data;
INT_ZERO(node->hdr.info.forw, ARCH_CONVERT);
- INT_ZERO(node->hdr.info.back, ARCH_CONVERT);
+ INT_ZERO(node->hdr.info.back, ARCH_CONVERT);
INT_SET(node->hdr.info.magic, ARCH_CONVERT, XFS_DA_NODE_MAGIC);
INT_ZERO(node->hdr.info.pad, ARCH_CONVERT);
INT_ZERO(node->hdr.count, ARCH_CONVERT);
error = xfs_da_grow_inode(state->args, &blkno);
if (error)
return(error); /* GROT: dir is inconsistent */
-
+
error = xfs_da_node_create(state->args, blkno, treelevel,
&newblk->bp, state->args->whichfork);
if (error)
}
/*
- * We have only one entry in the root. Copy the only remaining child of
+ * We have only one entry in the root. Copy the only remaining child of
* the old root to block 0 as the new root node.
*/
STATIC int
if (INT_GET(btree->hashval, ARCH_CONVERT) == lasthash)
break;
blk->hashval = lasthash;
- INT_SET(btree->hashval, ARCH_CONVERT, lasthash);
+ INT_SET(btree->hashval, ARCH_CONVERT, lasthash);
xfs_da_log_buf(state->args->trans, blk->bp,
XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
blkno = INT_GET(node->btree[ max-1 ].before, ARCH_CONVERT);
} else {
blk->index = probe;
- blkno = INT_GET(btree->before, ARCH_CONVERT);
+ blkno = INT_GET(btree->before, ARCH_CONVERT);
}
}
#ifdef __KERNEL__
break;
}
*result = retval;
- return(0);
+ return(0);
}
node2 = node2_bp->data;
ASSERT((INT_GET(node1->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC) &&
(INT_GET(node2->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC));
- if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
+ if ((INT_GET(node1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(node2->hdr.count, ARCH_CONVERT) > 0) &&
((INT_GET(node2->btree[ 0 ].hashval, ARCH_CONVERT) <
INT_GET(node1->btree[ 0 ].hashval, ARCH_CONVERT)) ||
(INT_GET(node2->btree[ INT_GET(node2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) <
{
xfs_dahash_t hash;
-#define ROTL(x,y) (((x) << (y)) | ((x) >> (32 - (y))))
+#define ROTL(x,y) (((x) << (y)) | ((x) >> (32 - (y))))
#ifdef SLOWVERSION
/*
* This is the old one-byte-at-a-time version.
{
xfs_fileoff_t bno, b;
xfs_bmbt_irec_t map;
- xfs_bmbt_irec_t *mapp;
+ xfs_bmbt_irec_t *mapp;
xfs_inode_t *dp;
int nmap, error, w, count, c, got, i, mapi;
xfs_fsize_t size;
}
/*
* If we didn't get it and the block might work if fragmented,
- * try without the CONTIG flag. Loop until we get it all.
+ * try without the CONTIG flag. Loop until we get it all.
*/
else if (nmap == 0 && count > 1) {
mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP);
/*
- * Ick. We need to always be able to remove a btree block, even
+ * Ick. We need to always be able to remove a btree block, even
* if there's no space reservation because the filesystem is full.
* This is called if xfs_bunmapi on a btree block fails due to ENOSPC.
* It swaps the target block with the last block in the file. The
STATIC int
xfs_da_map_covers_blocks(
int nmap,
- xfs_bmbt_irec_t *mapp,
+ xfs_bmbt_irec_t *mapp,
xfs_dablk_t bno,
int count)
{
xfs_buf_t **bplist;
int error=0;
int i;
- xfs_bmbt_irec_t map;
- xfs_bmbt_irec_t *mapp;
+ xfs_bmbt_irec_t map;
+ xfs_bmbt_irec_t *mapp;
xfs_daddr_t mappedbno;
xfs_mount_t *mp;
int nbplist=0;
continue;
if (caller == 1) {
if (whichfork == XFS_ATTR_FORK) {
- XFS_BUF_SET_VTYPE_REF(bp, B_FS_ATTR_BTREE,
+ XFS_BUF_SET_VTYPE_REF(bp, B_FS_ATTR_BTREE,
XFS_ATTR_BTREE_REF);
} else {
XFS_BUF_SET_VTYPE_REF(bp, B_FS_DIR_BTREE,
void
xfs_da_buf_done(xfs_dabuf_t *dabuf)
{
- ASSERT(dabuf);
+ ASSERT(dabuf);
ASSERT(dabuf->nbuf && dabuf->data && dabuf->bbcount && dabuf->bps[0]);
if (dabuf->dirty)
xfs_da_buf_clean(dabuf);
l = last;
if (f <= l)
xfs_trans_log_buf(tp, bp, f - off, l - off);
- /*
+ /*
* B_DONE is set by xfs_trans_log buf.
* If we don't set it on a new buffer (get not read)
* then if we don't put anything in the buffer it won't
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
leaf = bp->data;
entry = &leaf->entries[index];
namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT));
- /* XXX - replace assert? */
+ /* XXX - replace assert? */
XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT);
- xfs_da_log_buf(args->trans, bp,
+ xfs_da_log_buf(args->trans, bp,
XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber)));
xfs_da_buf_done(bp);
retval = 0;
retval = error;
}
- /*
+ /*
* If not in a transaction, we have to release all the buffers.
*/
for (i = 0; i < state->path.active; i++) {
leaf = bp->data;
entry = &leaf->entries[blk->index];
namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT));
- /* XXX - replace assert ? */
+ /* XXX - replace assert ? */
XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT);
xfs_da_log_buf(args->trans, bp,
XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber)));
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
int namelen, /* name length of entry to remove */
xfs_ino_t ino, /* inode number of entry to remove */
xfs_fsblock_t *first, /* bmap's firstblock */
- xfs_bmap_free_t *flist, /* bmap's freeblock list */
+ xfs_bmap_free_t *flist, /* bmap's freeblock list */
xfs_extlen_t total) /* bmap's total block count */
{
xfs_da_args_t args; /* operation arguments */
int namelen, /* name length of entry to replace */
xfs_ino_t inum, /* new inode number */
xfs_fsblock_t *first, /* bmap's firstblock */
- xfs_bmap_free_t *flist, /* bmap's freeblock list */
+ xfs_bmap_free_t *flist, /* bmap's freeblock list */
xfs_extlen_t total) /* bmap's total block count */
{
xfs_da_args_t args; /* operation arguments */
int error; /* error return value */
int got; /* blocks actually mapped */
int i; /* temp mapping index */
- xfs_bmbt_irec_t map; /* single structure for bmap */
+ xfs_bmbt_irec_t map; /* single structure for bmap */
int mapi; /* mapping index */
- xfs_bmbt_irec_t *mapp; /* bmap mapping structure(s) */
+ xfs_bmbt_irec_t *mapp; /* bmap mapping structure(s) */
xfs_mount_t *mp; /* filesystem mount point */
int nmap; /* number of bmap entries */
xfs_trans_t *tp; /* transaction pointer */
* and not binval it.
* So the block has to be in a consistent empty state
* and appropriately logged.
- * We don't free up the buffer, the caller can tell it
+ * We don't free up the buffer, the caller can tell it
* hasn't happened since it got an error back.
*/
return error;
/*
* If it's not a data block, we're done.
*/
- if (db >= XFS_DIR2_LEAF_FIRSTDB(mp))
+ if (db >= XFS_DIR2_LEAF_FIRSTDB(mp))
return 0;
/*
* If the block isn't the last one in the directory, we're done.
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
* Sort the leaf entries by hash value.
*/
qsort(blp, INT_GET(btp->count, ARCH_CONVERT), sizeof(*blp), xfs_dir2_block_sort);
- /*
+ /*
* Log the leaf entry area and tail.
* Already logged the header in data_init, ignore needlog.
*/
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
dup = (xfs_dir2_data_unused_t *)p;
/*
* If it's unused, look for the space in the bestfree table.
- * If we find it, account for that, else make sure it
+ * If we find it, account for that, else make sure it
* doesn't need to be there.
*/
if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) {
}
/*
* It's a real entry. Validate the fields.
- * If this is a block directory then make sure it's
+ * If this is a block directory then make sure it's
* in the leaf section of the block.
* The linear search is crude but this is DEBUG code.
*/
INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC);
#endif
dfp = d->hdr.bestfree;
- INT_COPY(new.length, dup->length, ARCH_CONVERT);
+ INT_COPY(new.length, dup->length, ARCH_CONVERT);
INT_SET(new.offset, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dup - (char *)d));
/*
* Insert at position 0, 1, or 2; or not at all.
/*
* Clear the 3rd entry, must be zero now.
*/
- INT_ZERO(d->hdr.bestfree[2].length, ARCH_CONVERT);
+ INT_ZERO(d->hdr.bestfree[2].length, ARCH_CONVERT);
INT_ZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT);
*loghead = 1;
}
int i; /* bestfree index */
xfs_mount_t *mp; /* filesystem mount point */
xfs_trans_t *tp; /* transaction pointer */
- int t; /* temp */
+ int t; /* temp */
dp = args->dp;
mp = dp->i_mount;
INT_SET(d->hdr.magic, ARCH_CONVERT, XFS_DIR2_DATA_MAGIC);
INT_SET(d->hdr.bestfree[0].offset, ARCH_CONVERT, (xfs_dir2_data_off_t)sizeof(d->hdr));
for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
- INT_ZERO(d->hdr.bestfree[i].length, ARCH_CONVERT);
+ INT_ZERO(d->hdr.bestfree[i].length, ARCH_CONVERT);
INT_ZERO(d->hdr.bestfree[i].offset, ARCH_CONVERT);
- }
+ }
/*
* Set up an unused entry for the block's body.
*/
dup = &d->u[0].unused;
INT_SET(dup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-
- t=mp->m_dirblksize - (uint)sizeof(d->hdr);
- INT_SET(d->hdr.bestfree[0].length, ARCH_CONVERT, t);
+
+ t=mp->m_dirblksize - (uint)sizeof(d->hdr);
+ INT_SET(d->hdr.bestfree[0].length, ARCH_CONVERT, t);
INT_SET(dup->length, ARCH_CONVERT, t);
INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT,
(xfs_dir2_data_off_t)((char *)dup - (char *)d));
d = bp->data;
ASSERT(INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_DATA_MAGIC ||
INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC);
- xfs_da_log_buf(tp, bp, (uint)((char *)&d->hdr - (char *)d),
+ xfs_da_log_buf(tp, bp, (uint)((char *)&d->hdr - (char *)d),
(uint)(sizeof(d->hdr) - 1));
}
endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
}
/*
- * If this isn't the start of the block, then back up to
+ * If this isn't the start of the block, then back up to
* the previous entry and see if it's free.
*/
if (offset > sizeof(d->hdr)) {
ASSERT(*needscanp == 0);
needscan = 0;
/*
- * Previous and following entries are both free,
+ * Previous and following entries are both free,
* merge everything into a single free entry.
*/
if (prevdup && postdup) {
xfs_dir2_data_log_unused(tp, bp, prevdup);
if (!needscan) {
/*
- * Has to be the case that entries 0 and 1 are
+ * Has to be the case that entries 0 and 1 are
* dfp and dfp2 (don't know which is which), and
* entry 2 is empty.
* Remove entry 1 first then entry 0.
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
xfs_dabuf_t *bp) /* leaf buffer */
{
int from; /* source leaf index */
- xfs_dir2_leaf_t *leaf; /* leaf structure */
+ xfs_dir2_leaf_t *leaf; /* leaf structure */
int loglow; /* first leaf entry to log */
int to; /* target leaf index */
int highstale; /* stale entry at/after index */
int index; /* insertion index */
int keepstale; /* source index of kept stale */
- xfs_dir2_leaf_t *leaf; /* leaf structure */
+ xfs_dir2_leaf_t *leaf; /* leaf structure */
int lowstale; /* stale entry before index */
int newindex=0; /* new insertion index */
int to; /* destination copy index */
*/
INT_SET(leaf->hdr.info.magic, ARCH_CONVERT, magic);
INT_ZERO(leaf->hdr.info.forw, ARCH_CONVERT);
- INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT);
+ INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT);
INT_ZERO(leaf->hdr.count, ARCH_CONVERT);
INT_ZERO(leaf->hdr.stale, ARCH_CONVERT);
xfs_dir2_leaf_log_header(tp, bp);
data = dbp->data;
ASSERT(INT_GET(data->hdr.magic, ARCH_CONVERT) == XFS_DIR2_DATA_MAGIC);
#endif
- /* this seems to be an error
+ /* this seems to be an error
* data is only valid if DEBUG is defined?
* RMC 09/08/1999
*/
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
ASSERT(index == 0 || INT_GET(leaf->ents[index - 1].hashval, ARCH_CONVERT) <= args->hashval);
ASSERT(index == INT_GET(leaf->hdr.count, ARCH_CONVERT) ||
INT_GET(leaf->ents[index].hashval, ARCH_CONVERT) >= args->hashval);
-
+
if (args->justcheck)
return 0;
xfs_dabuf_t *bp) /* leaf buffer */
{
int i; /* leaf index */
- xfs_dir2_leaf_t *leaf; /* leaf structure */
+ xfs_dir2_leaf_t *leaf; /* leaf structure */
xfs_mount_t *mp; /* filesystem mount point */
int stale; /* count of stale leaves */
if (i + 1 < INT_GET(leaf->hdr.count, ARCH_CONVERT)) {
ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <=
INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT));
- }
+ }
if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR)
stale++;
}
xfs_dabuf_t *bp, /* leaf buffer */
int *count) /* count of entries in leaf */
{
- xfs_dir2_leaf_t *leaf; /* leaf structure */
+ xfs_dir2_leaf_t *leaf; /* leaf structure */
leaf = bp->data;
ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
int start_d, /* destination leaf index */
int count) /* count of leaves to copy */
{
- xfs_dir2_leaf_t *leaf_d; /* destination leaf structure */
- xfs_dir2_leaf_t *leaf_s; /* source leaf structure */
+ xfs_dir2_leaf_t *leaf_d; /* destination leaf structure */
+ xfs_dir2_leaf_t *leaf_s; /* source leaf structure */
int stale; /* count stale leaves copied */
xfs_trans_t *tp; /* transaction pointer */
xfs_dabuf_t *leaf1_bp, /* leaf1 buffer */
xfs_dabuf_t *leaf2_bp) /* leaf2 buffer */
{
- xfs_dir2_leaf_t *leaf1; /* leaf1 structure */
- xfs_dir2_leaf_t *leaf2; /* leaf2 structure */
+ xfs_dir2_leaf_t *leaf1; /* leaf1 structure */
+ xfs_dir2_leaf_t *leaf2; /* leaf2 structure */
leaf1 = leaf1_bp->data;
leaf2 = leaf2_bp->data;
else
isleft = 1;
/*
- * Calculate moved entry count. Positive means left-to-right,
+ * Calculate moved entry count. Positive means left-to-right,
* negative means right-to-left. Then move the entries.
*/
count = INT_GET(leaf1->hdr.count, ARCH_CONVERT) - mid + (isleft == 0);
xfs_dabuf_t *fbp; /* freeblock buffer */
xfs_dir2_db_t fdb; /* freeblock block number */
int findex; /* index in freeblock entries */
- xfs_dir2_free_t *free; /* freeblock structure */
+ xfs_dir2_free_t *free; /* freeblock structure */
int logfree; /* need to log free entry */
/*
length = XFS_DIR2_DATA_ENTSIZE(args->namelen);
/*
* If we came in with a freespace block that means that lookup
- * found an entry with our hash value. This is the freespace
+ * found an entry with our hash value. This is the freespace
* block for that data entry.
*/
if (fblk) {
findex = 0;
}
/*
- * If we don't have a data block yet, we're going to scan the
+ * If we don't have a data block yet, we're going to scan the
* freespace blocks looking for one. Figure out what the
* highest freespace block number is.
*/
}
/*
* While we haven't identified a data block, search the freeblock
- * data for a good data block. If we find a null freeblock entry,
+ * data for a good data block. If we find a null freeblock entry,
* indicating a hole in the data blocks, remember that.
*/
while (dbno == -1) {
INT_SET(free->hdr.magic, ARCH_CONVERT, XFS_DIR2_FREE_MAGIC);
INT_SET(free->hdr.firstdb, ARCH_CONVERT, (fbno - XFS_DIR2_FREE_FIRSTDB(mp)) *
XFS_DIR2_MAX_FREE_BESTS(mp));
- INT_ZERO(free->hdr.nused, ARCH_CONVERT);
+ INT_ZERO(free->hdr.nused, ARCH_CONVERT);
INT_ZERO(free->hdr.nvalid, ARCH_CONVERT);
foundindex = 0;
foundbno = fbno;
* change again.
*/
data = dbp->data;
- INT_COPY(free->bests[findex], data->hdr.bestfree[0].length, ARCH_CONVERT);
+ INT_COPY(free->bests[findex], data->hdr.bestfree[0].length, ARCH_CONVERT);
logfree = 1;
}
/*
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
count = i8count = namelen = 0;
btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT);
-
+
/*
* Iterate over the block's data entries by using the leaf pointers.
*/
char *ptr; /* current data pointer */
xfs_dir2_sf_entry_t *sfep; /* shortform entry */
xfs_dir2_sf_t *sfp; /* shortform structure */
- xfs_ino_t temp;
-
+ xfs_ino_t temp;
+
xfs_dir2_trace_args_sb("block_to_sf", args, size, bp);
dp = args->dp;
mp = dp->i_mount;
(xfs_dir2_data_aoff_t)
((char *)dep - (char *)block), ARCH_CONVERT);
bcopy(dep->name, sfep->name, dep->namelen);
- temp=INT_GET(dep->inumber, ARCH_CONVERT);
+ temp=INT_GET(dep->inumber, ARCH_CONVERT);
XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &temp,
XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT);
sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
/*
* Add a name to a shortform directory.
- * There are two algorithms, "easy" and "hard" which we decide on
+ * There are two algorithms, "easy" and "hard" which we decide on
* before changing anything.
* Convert to block form if necessary, if the new entry won't fit.
*/
}
/*
* Get rid of the old directory, then allocate space for
- * the new one. We do this so xfs_idata_realloc won't copy
+ * the new one. We do this so xfs_idata_realloc won't copy
* the data.
*/
xfs_idata_realloc(dp, -old_isize, XFS_DATA_FORK);
offset = XFS_DIR2_DATA_FIRST_OFFSET;
ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT);
i8count = ino > XFS_DIR2_MAX_SHORT_INUM;
-
+
for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
i < sfp->hdr.count;
i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
}
#endif /* DEBUG */
-/*
+/*
* Create a new (shortform) directory.
*/
int /* error, always 0 */
ASSERT(dp != NULL);
ASSERT(dp->i_d.di_size == 0);
/*
- * If it's currently a zero-length extent file,
+ * If it's currently a zero-length extent file,
* convert it to local format.
*/
if (dp->i_d.di_format == XFS_DINODE_FMT_EXTENTS) {
*/
else {
for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
- i < sfp->hdr.count;
+ i < sfp->hdr.count;
i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
if (sfep->namelen == args->namelen &&
sfep->name[0] == args->name[0] &&
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
sf = (xfs_dir_shortform_t *)tmpbuffer;
XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &inumber, ARCH_CONVERT);
-
+
xfs_idata_realloc(dp, -size, XFS_DATA_FORK);
dp->i_d.di_size = 0;
xfs_trans_log_inode(iargs->trans, dp, XFS_ILOG_CORE);
sf = (xfs_dir_shortform_t *)dp->i_df.if_u1.if_data;
if (args->namelen == 2 &&
args->name[0] == '.' && args->name[1] == '.') {
- /* XXX - replace assert? */
+ /* XXX - replace assert? */
XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sf->hdr.parent, ARCH_CONVERT);
xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA);
return(0);
/*
* Compact the entries to coalesce free space.
- * Pass the justcheck flag so the checking pass can return
+ * Pass the justcheck flag so the checking pass can return
* an error, without changing anything, if it won't fit.
*/
error = xfs_dir_leaf_compact(args->trans, bp,
return(error);
/*
* After compaction, the block is guaranteed to have only one
- * free region, in freemap[0]. If it is not big enough, give up.
+ * free region, in freemap[0]. If it is not big enough, give up.
*/
if (INT_GET(hdr->freemap[0].size, ARCH_CONVERT) <
(entsize + (uint)sizeof(xfs_dir_leaf_entry_t)))
* below destroys the original.
*/
if (musthave || justcheck) {
- tmpbuffer2 = kmem_alloc(lbsize, KM_SLEEP);
+ tmpbuffer2 = kmem_alloc(lbsize, KM_SLEEP);
bcopy(bp->data, tmpbuffer2, lbsize);
- }
+ }
bzero(bp->data, lbsize);
/*
rval = XFS_ERROR(ENOSPC);
else
rval = 0;
-
+
if (justcheck || rval == ENOSPC) {
- ASSERT(tmpbuffer2);
+ ASSERT(tmpbuffer2);
bcopy(tmpbuffer2, bp->data, lbsize);
} else {
xfs_da_log_buf(trans, bp, 0, lbsize - 1);
kmem_free(tmpbuffer, lbsize);
if (musthave || justcheck)
- kmem_free(tmpbuffer2, lbsize);
+ kmem_free(tmpbuffer2, lbsize);
return(rval);
}
INT_MOD(map->size, ARCH_CONVERT, entsize);
} else {
map = &hdr->freemap[after];
- INT_COPY(map->base, entry->nameidx, ARCH_CONVERT);
+ INT_COPY(map->base, entry->nameidx, ARCH_CONVERT);
INT_MOD(map->size, ARCH_CONVERT, entsize);
}
} else {
*/
map = &hdr->freemap[smallest];
if (INT_GET(map->size, ARCH_CONVERT) < entsize) {
- INT_COPY(map->base, entry->nameidx, ARCH_CONVERT);
+ INT_COPY(map->base, entry->nameidx, ARCH_CONVERT);
INT_SET(map->size, ARCH_CONVERT, entsize);
}
}
bzero(tmpbuffer, state->blocksize);
tmp_leaf = (xfs_dir_leafblock_t *)tmpbuffer;
tmp_hdr = &tmp_leaf->hdr;
- tmp_hdr->info = save_hdr->info; /* struct copy */
+ tmp_hdr->info = save_hdr->info; /* struct copy */
INT_ZERO(tmp_hdr->count, ARCH_CONVERT);
INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize);
if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT))
tmp_leaf, INT_GET(tmp_leaf->hdr.count, ARCH_CONVERT),
(int)INT_GET(save_hdr->count, ARCH_CONVERT), mp);
} else {
- xfs_dir_leaf_moveents(save_leaf, 0, tmp_leaf, 0,
+ xfs_dir_leaf_moveents(save_leaf, 0, tmp_leaf, 0,
(int)INT_GET(save_hdr->count, ARCH_CONVERT), mp);
xfs_dir_leaf_moveents(drop_leaf, 0,
tmp_leaf, INT_GET(tmp_leaf->hdr.count, ARCH_CONVERT),
hdr_s = &leaf_s->hdr;
hdr_d = &leaf_d->hdr;
ASSERT((INT_GET(hdr_s->count, ARCH_CONVERT) > 0) && (INT_GET(hdr_s->count, ARCH_CONVERT) < (XFS_LBSIZE(mp)/8)));
- ASSERT(INT_GET(hdr_s->firstused, ARCH_CONVERT) >=
+ ASSERT(INT_GET(hdr_s->firstused, ARCH_CONVERT) >=
((INT_GET(hdr_s->count, ARCH_CONVERT)*sizeof(*entry_s))+sizeof(*hdr_s)));
ASSERT(INT_GET(hdr_d->count, ARCH_CONVERT) < (XFS_LBSIZE(mp)/8));
- ASSERT(INT_GET(hdr_d->firstused, ARCH_CONVERT) >=
+ ASSERT(INT_GET(hdr_d->firstused, ARCH_CONVERT) >=
((INT_GET(hdr_d->count, ARCH_CONVERT)*sizeof(*entry_d))+sizeof(*hdr_d)));
ASSERT(start_s < INT_GET(hdr_s->count, ARCH_CONVERT));
tmp = XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry_s);
INT_MOD(hdr_d->firstused, ARCH_CONVERT, -(tmp));
entry_d->hashval = entry_s->hashval; /* INT_: direct copy */
- INT_COPY(entry_d->nameidx, hdr_d->firstused, ARCH_CONVERT);
+ INT_COPY(entry_d->nameidx, hdr_d->firstused, ARCH_CONVERT);
entry_d->namelen = entry_s->namelen;
ASSERT(INT_GET(entry_d->nameidx, ARCH_CONVERT) + tmp <= XFS_LBSIZE(mp));
bcopy(XFS_DIR_LEAF_NAMESTRUCT(leaf_s, INT_GET(entry_s->nameidx, ARCH_CONVERT)),
leaf2 = leaf2_bp->data;
ASSERT((INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC) &&
(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC));
- if ((INT_GET(leaf1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0) &&
+ if ((INT_GET(leaf1->hdr.count, ARCH_CONVERT) > 0) && (INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0) &&
((INT_GET(leaf2->entries[ 0 ].hashval, ARCH_CONVERT) <
INT_GET(leaf1->entries[ 0 ].hashval, ARCH_CONVERT)) ||
(INT_GET(leaf2->entries[ INT_GET(leaf2->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT) <
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
offsetof(xfs_dinode_t, di_a),
sizeof(xfs_dinode_t)
};
-
+
ASSERT(offsetof(xfs_dinode_t, di_core) == 0);
ASSERT((fields & (XFS_DI_U|XFS_DI_A)) == 0);
int *alloc)
{
xfs_agi_t *agi; /* allocation group header */
- xfs_alloc_arg_t args; /* allocation argument structure */
+ xfs_alloc_arg_t args; /* allocation argument structure */
int blks_per_cluster; /* fs blocks per inode cluster */
- xfs_btree_cur_t *cur; /* inode btree cursor */
+ xfs_btree_cur_t *cur; /* inode btree cursor */
xfs_daddr_t d; /* disk addr of buffer */
int error;
xfs_buf_t *fbuf; /* new free inodes' buffer */
static xfs_timestamp_t ztime; /* zero xfs timestamp */
int isaligned; /* inode allocation at stripe unit */
/* boundary */
- xfs_dinode_core_t dic; /* a dinode_core to copy to new */
- /* inodes */
-
+ xfs_dinode_core_t dic; /* a dinode_core to copy to new */
+ /* inodes */
+
args.tp = tp;
args.mp = tp->t_mountp;
* Set the alignment for the allocation.
* If stripe alignment is turned on then align at stripe unit
* boundary.
- * If the cluster size is smaller than a filesystem block
+ * If the cluster size is smaller than a filesystem block
* then we're doing I/O for inodes in filesystem block size pieces,
* so don't need alignment anyway.
*/
args.alignment = args.mp->m_dalign;
isaligned = 1;
} else if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) &&
- args.mp->m_sb.sb_inoalignmt >=
+ args.mp->m_sb.sb_inoalignmt >=
XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp)))
args.alignment = args.mp->m_sb.sb_inoalignmt;
else
* Allocate a fixed-size extent of inodes.
*/
args.type = XFS_ALLOCTYPE_NEAR_BNO;
- args.mod = args.total = args.wasdel = args.isfl = args.userdata =
+ args.mod = args.total = args.wasdel = args.isfl = args.userdata =
args.minalignslop = 0;
args.prod = 1;
/*
args.fsbno = XFS_AGB_TO_FSB(args.mp,
INT_GET(agi->agi_seqno, ARCH_CONVERT), args.agbno);
if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) &&
- args.mp->m_sb.sb_inoalignmt >=
- XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp)))
+ args.mp->m_sb.sb_inoalignmt >=
+ XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp)))
args.alignment = args.mp->m_sb.sb_inoalignmt;
else
args.alignment = 1;
if ((error = xfs_alloc_vextent(&args)))
- return error;
+ return error;
}
-
+
if (args.fsbno == NULLFSBLOCK) {
*alloc = 0;
return 0;
ninodes = args.mp->m_sb.sb_inopblock;
} else {
blks_per_cluster = XFS_INODE_CLUSTER_SIZE(args.mp) /
- args.mp->m_sb.sb_blocksize;
+ args.mp->m_sb.sb_blocksize;
nbufs = (int)args.len / blks_per_cluster;
ninodes = blks_per_cluster * args.mp->m_sb.sb_inopblock;
}
args.mp->m_bsize * blks_per_cluster,
XFS_BUF_LOCK);
ASSERT(fbuf);
- ASSERT(!XFS_BUF_GETERROR(fbuf));
+ ASSERT(!XFS_BUF_GETERROR(fbuf));
/*
* Loop over the inodes in this buffer.
*/
bzero(&(dic.di_pad[0]),sizeof(dic.di_pad));
INT_SET(dic.di_atime.t_sec, ARCH_CONVERT, ztime.t_sec);
INT_SET(dic.di_atime.t_nsec, ARCH_CONVERT, ztime.t_nsec);
-
+
INT_SET(dic.di_mtime.t_sec, ARCH_CONVERT, ztime.t_sec);
INT_SET(dic.di_mtime.t_nsec, ARCH_CONVERT, ztime.t_nsec);
-
+
INT_SET(dic.di_ctime.t_sec, ARCH_CONVERT, ztime.t_sec);
INT_SET(dic.di_ctime.t_nsec, ARCH_CONVERT, ztime.t_nsec);
-
+
INT_ZERO(dic.di_size, ARCH_CONVERT);
INT_ZERO(dic.di_nblocks, ARCH_CONVERT);
INT_ZERO(dic.di_extsize, ARCH_CONVERT);
INT_ZERO(dic.di_dmstate, ARCH_CONVERT);
INT_ZERO(dic.di_flags, ARCH_CONVERT);
INT_ZERO(dic.di_gen, ARCH_CONVERT);
-
+
for (i = 0; i < ninodes; i++) {
free = XFS_MAKE_IPTR(args.mp, fbuf, i);
- bcopy (&dic, &(free->di_core), sizeof(xfs_dinode_core_t));
- INT_SET(free->di_next_unlinked, ARCH_CONVERT, NULLAGINO);
+ bcopy (&dic, &(free->di_core), sizeof(xfs_dinode_core_t));
+ INT_SET(free->di_next_unlinked, ARCH_CONVERT, NULLAGINO);
xfs_ialloc_log_di(tp, fbuf, i,
XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED);
}
/*
* Select an allocation group to look for a free inode in, based on the parent
- * inode and then mode. Return the allocation group buffer.
+ * inode and then mode. Return the allocation group buffer.
*/
STATIC xfs_buf_t * /* allocation group buffer */
xfs_ialloc_ag_select(
* Loop through allocation groups, looking for one with a little
* free space in it. Note we don't look for free inodes, exactly.
* Instead, we include whether there is a need to allocate inodes
- * to mean that blocks must be allocated for them,
+ * to mean that blocks must be allocated for them,
* if none are currently free.
*/
agno = pagno;
unlock_nextag:
if (agbp)
xfs_trans_brelse(tp, agbp);
-nextag:
- /*
+nextag:
+ /*
* No point in iterating over the rest, if we're shutting
* down.
*/
}
}
-/*
+/*
* Visible inode allocation functions.
*/
* The arguments IO_agbp and alloc_done are defined to work within
* the constraint of one allocation per transaction.
* xfs_dialloc() is designed to be called twice if it has to do an
- * allocation to make more free inodes. On the first call,
+ * allocation to make more free inodes. On the first call,
* IO_agbp should be set to NULL. If an inode is available,
* i.e., xfs_dialloc() did not need to do an allocation, an inode
- * number is returned. In this case, IO_agbp would be set to the
+ * number is returned. In this case, IO_agbp would be set to the
* current ag_buf and alloc_done set to false.
* If an allocation needed to be done, xfs_dialloc would return
* the current ag_buf in IO_agbp and set alloc_done to true.
* guaranteed to have a free inode available.
*
* Once we successfully pick an inode its number is returned and the
- * on-disk data structures are updated. The inode itself is not read
+ * on-disk data structures are updated. The inode itself is not read
* in, since doing so would break ordering constraints with xfs_reclaim.
*/
int
xfs_buf_t *agbp; /* allocation group header's buffer */
xfs_agnumber_t agno; /* allocation group number */
xfs_agi_t *agi; /* allocation group header structure */
- xfs_btree_cur_t *cur; /* inode allocation btree cursor */
+ xfs_btree_cur_t *cur; /* inode allocation btree cursor */
int error; /* error return value */
int i; /* result code */
int ialloced; /* inode allocation status */
int offset; /* index of inode in chunk */
xfs_agino_t pagino; /* parent's a.g. relative inode # */
xfs_agnumber_t pagno; /* parent's allocation group number */
- xfs_inobt_rec_t rec; /* inode allocation record */
+ xfs_inobt_rec_t rec; /* inode allocation record */
xfs_agnumber_t tagno; /* testing allocation group number */
- xfs_btree_cur_t *tcur; /* temp cursor */
- xfs_inobt_rec_t trec; /* temp inode allocation record */
+ xfs_btree_cur_t *tcur; /* temp cursor */
+ xfs_inobt_rec_t trec; /* temp inode allocation record */
if (*IO_agbp == NULL) {
*/
agbp = xfs_ialloc_ag_select(tp, parent, mode, okalloc);
/*
- * Couldn't find an allocation group satisfying the
+ * Couldn't find an allocation group satisfying the
* criteria, give up.
*/
if (!agbp) {
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
} else {
/*
- * Continue where we left off before. In this case, we
+ * Continue where we left off before. In this case, we
* know that the allocation group has free inodes.
*/
agbp = *IO_agbp;
*/
*alloc_done = B_FALSE;
while (INT_ISZERO(agi->agi_freecount, ARCH_CONVERT)) {
- /*
+ /*
* Don't do anything if we're not supposed to allocate
* any blocks, just go on to the next ag.
*/
goto error1;
XFS_WANT_CORRUPTED_GOTO(i == 1, error1);
}
- /*
+ /*
* Search right with cur, go forward 1 record.
*/
if ((error = xfs_inobt_increment(cur, 0, &i)))
xfs_fsblock_t *bno, /* output: block containing inode */
int *len, /* output: num blocks in inode cluster */
int *off, /* output: index in block of inode */
- uint flags) /* flags concerning inode lookup */
+ uint flags) /* flags concerning inode lookup */
{
xfs_agblock_t agbno; /* block number of inode in the alloc group */
xfs_buf_t *agbp; /* agi buffer */
__int32_t chunk_cnt; /* count of free inodes in chunk */
xfs_inofree_t chunk_free; /* mask of free inodes in chunk */
xfs_agblock_t cluster_agbno; /* first block in inode cluster */
- xfs_btree_cur_t *cur; /* inode btree cursor */
+ xfs_btree_cur_t *cur; /* inode btree cursor */
int error; /* error code */
int i; /* temp state */
- int offset; /* index of inode in its buffer */
+ int offset; /* index of inode in its buffer */
int offset_agbno; /* blks from chunk start to inode */
ASSERT(ino != NULLFSINO);
if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks ||
ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
#ifdef DEBUG
- if (agno >= mp->m_sb.sb_agcount) {
+ if (agno >= mp->m_sb.sb_agcount) {
xfs_fs_cmn_err(CE_ALERT, mp,
"xfs_dilocate: agno (%d) >= "
"mp->m_sb.sb_agcount (%d)",
error = XFS_ERROR(EINVAL);
}
xfs_trans_brelse(tp, agbp);
- xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
+ xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
if (error)
return error;
chunk_agbno = XFS_AGINO_TO_AGBNO(mp, chunk_agino);
/*
* Copyright (c) 2000-2001 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
int level, /* level to insert record at */
xfs_agblock_t *bnop, /* i/o: block number inserted */
xfs_inobt_rec_t *recp, /* i/o: record data inserted */
- xfs_btree_cur_t **curp, /* output: new cursor replacing cur */
+ xfs_btree_cur_t **curp, /* output: new cursor replacing cur */
int *stat) /* success/failure */
{
- xfs_inobt_block_t *block; /* btree block record/key lives in */
+ xfs_inobt_block_t *block; /* btree block record/key lives in */
xfs_buf_t *bp; /* buffer for block */
int error; /* error return value */
int i; /* loop index */
#ifdef DEBUG
if ((error = xfs_btree_check_sblock(cur, block, level, bp)))
return error;
- /*
+ /*
* Check that the new entry is being inserted in the right place.
*/
if (ptr <= INT_GET(block->bb_numrecs, ARCH_CONVERT)) {
xfs_inobt_log_block(
xfs_trans_t *tp, /* transaction pointer */
xfs_buf_t *bp, /* buffer containing btree block */
- int fields) /* mask of fields: XFS_BB_... */
+ int fields) /* mask of fields: XFS_BB_... */
{
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_inobt_log_keys(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int kfirst, /* index of first key to log */
+ int kfirst, /* index of first key to log */
int klast) /* index of last key to log */
{
- xfs_inobt_block_t *block; /* btree block to log from */
+ xfs_inobt_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
xfs_inobt_key_t *kp; /* key pointer in btree block */
int last; /* last byte offset logged */
xfs_inobt_log_ptrs(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int pfirst, /* index of first pointer to log */
+ int pfirst, /* index of first pointer to log */
int plast) /* index of last pointer to log */
{
- xfs_inobt_block_t *block; /* btree block to log from */
+ xfs_inobt_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_inobt_ptr_t *pp; /* block-pointer pointer in btree blk */
xfs_inobt_log_recs(
xfs_btree_cur_t *cur, /* btree cursor */
xfs_buf_t *bp, /* buffer containing btree block */
- int rfirst, /* index of first record to log */
+ int rfirst, /* index of first record to log */
int rlast) /* index of last record to log */
{
- xfs_inobt_block_t *block; /* btree block to log from */
+ xfs_inobt_block_t *block; /* btree block to log from */
int first; /* first byte offset logged */
int last; /* last byte offset logged */
xfs_inobt_rec_t *rp; /* record pointer for btree block */
bp = (xfs_buf_t *)0;
if (!bp) {
/*
- * Need to get a new buffer. Read it, then
+ * Need to get a new buffer. Read it, then
* set it in the cursor, releasing the old one.
*/
if ((error = xfs_btree_read_bufs(mp, cur->bc_tp,
*/
else {
int high; /* high entry number */
- xfs_inobt_key_t *kkbase=NULL;/* base of keys in block */
- xfs_inobt_rec_t *krbase=NULL;/* base of records in block */
+ xfs_inobt_key_t *kkbase=NULL;/* base of keys in block */
+ xfs_inobt_rec_t *krbase=NULL;/* base of records in block */
int low; /* low entry number */
/*
* Get startino.
*/
if (level > 0) {
- xfs_inobt_key_t *kkp;
+ xfs_inobt_key_t *kkp;
kkp = kkbase + keyno - 1;
startino = INT_GET(kkp->ir_startino, ARCH_CONVERT);
} else {
- xfs_inobt_rec_t *krp;
+ xfs_inobt_rec_t *krp;
krp = krbase + keyno - 1;
startino = INT_GET(krp->ir_startino, ARCH_CONVERT);
xfs_inobt_rec_t *lrp=NULL; /* record pointer for left block */
int nrec; /* new number of left block entries */
xfs_buf_t *rbp; /* buffer for right (current) block */
- xfs_inobt_block_t *right; /* right (current) btree block */
+ xfs_inobt_block_t *right; /* right (current) btree block */
xfs_inobt_key_t *rkp=NULL; /* key pointer for right block */
xfs_inobt_ptr_t *rpp=NULL; /* address pointer for right block */
xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */
return 0;
}
/*
- * If the cursor entry is the one that would be moved, don't
+ * If the cursor entry is the one that would be moved, don't
* do it... it's too complicated.
*/
if (cur->bc_ptrs[level] <= 1) {
{
xfs_agi_t *agi; /* a.g. inode header */
xfs_alloc_arg_t args; /* allocation argument structure */
- xfs_inobt_block_t *block; /* one half of the old root block */
+ xfs_inobt_block_t *block; /* one half of the old root block */
xfs_buf_t *bp; /* buffer containing block */
int error; /* error return value */
xfs_inobt_key_t *kp; /* btree key pointer */
xfs_inobt_ptr_t *pp; /* btree address pointer */
xfs_agblock_t rbno; /* right block number */
xfs_buf_t *rbp; /* right buffer pointer */
- xfs_inobt_block_t *right; /* right btree block */
+ xfs_inobt_block_t *right; /* right btree block */
xfs_inobt_rec_t *rp; /* btree record pointer */
ASSERT(cur->bc_nlevels < XFS_IN_MAXLEVELS(cur->bc_mp));
INT_SET(new->bb_level, ARCH_CONVERT, (__uint16_t)cur->bc_nlevels);
INT_SET(new->bb_numrecs, ARCH_CONVERT, 2);
INT_SET(new->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
- INT_SET(new->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
+ INT_SET(new->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
xfs_inobt_log_block(args.tp, nbp, XFS_BB_ALL_BITS);
ASSERT(lbno != NULLAGBLOCK && rbno != NULLAGBLOCK);
/*
xfs_inobt_ptr_t *lpp; /* address pointer for left block */
xfs_inobt_rec_t *lrp; /* record pointer for left block */
xfs_buf_t *rbp; /* buffer for right neighbor block */
- xfs_inobt_block_t *right; /* right neighbor btree block */
+ xfs_inobt_block_t *right; /* right neighbor btree block */
xfs_inobt_key_t *rkp; /* key pointer for right block */
xfs_inobt_ptr_t *rpp; /* address pointer for right block */
xfs_inobt_rec_t *rrp=NULL; /* record pointer for right block */
int level, /* level to split */
xfs_agblock_t *bnop, /* output: block number allocated */
xfs_inobt_key_t *keyp, /* output: first key of new block */
- xfs_btree_cur_t **curp, /* output: new cursor */
+ xfs_btree_cur_t **curp, /* output: new cursor */
int *stat) /* success/failure */
{
xfs_alloc_arg_t args; /* allocation argument structure */
xfs_inobt_ptr_t *lpp; /* left btree address pointer */
xfs_inobt_rec_t *lrp; /* left btree record pointer */
xfs_buf_t *rbp; /* buffer for right block */
- xfs_inobt_block_t *right; /* right (new) btree block */
+ xfs_inobt_block_t *right; /* right (new) btree block */
xfs_inobt_key_t *rkp; /* right btree key pointer */
xfs_inobt_ptr_t *rpp; /* right btree address pointer */
xfs_inobt_rec_t *rrp; /* right btree record pointer */
*/
for (ptr = 1; ptr == 1 && level < cur->bc_nlevels; level++) {
xfs_buf_t *bp; /* buffer for block */
- xfs_inobt_block_t *block; /* btree block */
+ xfs_inobt_block_t *block; /* btree block */
#ifdef DEBUG
int error; /* error return value */
#endif
int level, /* level in btree, 0 is leaf */
int *stat) /* success/failure */
{
- xfs_inobt_block_t *block; /* btree block */
+ xfs_inobt_block_t *block; /* btree block */
int error;
int lev; /* btree level */
return 0;
}
-/*
+/*
* Get the data from the pointed-to record.
*/
int /* error */
__int32_t *fcnt, /* output: number of free inodes */
xfs_inofree_t *free, /* output: free inode mask */
int *stat, /* output: success/failure */
- xfs_arch_t arch) /* input: architecture */
+ xfs_arch_t arch) /* input: architecture */
{
- xfs_inobt_block_t *block; /* btree block */
+ xfs_inobt_block_t *block; /* btree block */
xfs_buf_t *bp; /* buffer containing btree block */
#ifdef DEBUG
int error; /* error return value */
* Point to the record and extract its data.
*/
rec = XFS_INOBT_REC_ADDR(block, ptr, cur);
- ASSERT(arch == ARCH_NOCONVERT || arch == ARCH_CONVERT);
- if (arch == ARCH_NOCONVERT) {
+ ASSERT(arch == ARCH_NOCONVERT || arch == ARCH_CONVERT);
+ if (arch == ARCH_NOCONVERT) {
*ino = INT_GET(rec->ir_startino, ARCH_CONVERT);
*fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT);
*free = INT_GET(rec->ir_free, ARCH_CONVERT);
- } else {
+ } else {
INT_COPY(*ino, rec->ir_startino, ARCH_CONVERT);
INT_COPY(*fcnt, rec->ir_freecount, ARCH_CONVERT);
INT_COPY(*free, rec->ir_free, ARCH_CONVERT);
- }
+ }
*stat = 1;
return 0;
}
int level, /* level in btree, 0 is leaf */
int *stat) /* success/failure */
{
- xfs_inobt_block_t *block; /* btree block */
+ xfs_inobt_block_t *block; /* btree block */
xfs_buf_t *bp; /* buffer containing btree block */
int error; /* error return value */
int lev; /* btree level */
*/
int /* error */
xfs_inobt_insert(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
int *stat) /* success/failure */
{
int error; /* error return value */
int i; /* result value, 0 for failure */
int level; /* current level number in btree */
xfs_agblock_t nbno; /* new block number (split result) */
- xfs_btree_cur_t *ncur; /* new cursor (split result) */
- xfs_inobt_rec_t nrec; /* record being inserted this level */
- xfs_btree_cur_t *pcur; /* previous level's cursor */
+ xfs_btree_cur_t *ncur; /* new cursor (split result) */
+ xfs_inobt_rec_t nrec; /* record being inserted this level */
+ xfs_btree_cur_t *pcur; /* previous level's cursor */
level = 0;
nbno = NULLAGBLOCK;
*/
int /* error */
xfs_inobt_lookup_eq(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
*/
int /* error */
xfs_inobt_lookup_ge(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
*/
int /* error */
xfs_inobt_lookup_le(
- xfs_btree_cur_t *cur, /* btree cursor */
+ xfs_btree_cur_t *cur, /* btree cursor */
xfs_agino_t ino, /* starting inode of chunk */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free, /* free inode mask */
__int32_t fcnt, /* free inode count */
xfs_inofree_t free) /* free inode mask */
{
- xfs_inobt_block_t *block; /* btree block to update */
+ xfs_inobt_block_t *block; /* btree block to update */
xfs_buf_t *bp; /* buffer containing btree block */
int error; /* error return value */
int ptr; /* current record number (updating) */
* Updating first record in leaf. Pass new key value up to our parent.
*/
if (ptr == 1) {
- xfs_inobt_key_t key; /* key containing [ino] */
+ xfs_inobt_key_t key; /* key containing [ino] */
INT_SET(key.ir_startino, ARCH_CONVERT, ino);
if ((error = xfs_inobt_updkey(cur, &key, 1)))
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
i * mp->m_sb.sb_inodesize);
if (INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)) {
xfs_fs_cmn_err(CE_ALERT, mp,
- "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.",
+ "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.",
bp);
ASSERT(!INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT));
}
* to determine the size and location of the buffer to read from disk.
* If the inode has already been mapped to its buffer and read in once,
* then use the mapping information stored in the inode rather than
- * calling xfs_imap(). This allows us to avoid the overhead of looking
+ * calling xfs_imap(). This allows us to avoid the overhead of looking
* at the inode btree for small block file systems (see xfs_dilocate()).
* We can tell whether the inode has been mapped in before by comparing
- * its disk block address to 0. Only uninitialized inodes will have
+ * its disk block address to 0. Only uninitialized inodes will have
* 0 for the disk block address.
*/
int
xfs_itobp(
xfs_mount_t *mp,
xfs_trans_t *tp,
- xfs_inode_t *ip,
+ xfs_inode_t *ip,
xfs_dinode_t **dipp,
xfs_buf_t **bpp,
xfs_daddr_t bno)
ASSERT(bno == 0 || bno == imap.im_blkno);
/*
- * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will
+ * Read in the buffer. If tp is NULL, xfs_trans_read_buf() will
* default to just a read_buf() call.
*/
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno,
/*
* Move inode type and inode format specific information from the
- * on-disk inode to the in-core inode. For fifos, devs, and sockets
- * this means set if_rdev to the proper value. For files, directories,
+ * on-disk inode to the in-core inode. For fifos, devs, and sockets
+ * this means set if_rdev to the proper value. For files, directories,
* and symlinks this means to bring in the in-line data or extent
* pointers. For a file in B-tree format, only the root is immediately
* brought in-core. The rest will be in-lined in if_extents when it
xfs_attr_shortform_t *atp;
int size;
int error;
- xfs_fsize_t di_size;
+ xfs_fsize_t di_size;
ip->i_df.if_ext_max =
XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
error = 0;
- if (INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) +
- INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) >
+ if (INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) +
+ INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) >
INT_GET(dip->di_core.di_nblocks, ARCH_CONVERT)) {
xfs_fs_cmn_err(CE_WARN, ip->i_mount,
"corrupt dinode %Lu, extent total = %d, nblocks = %Lu."
}
if (error) {
return error;
- }
+ }
if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT))
return 0;
ASSERT(ip->i_afp == NULL);
* xfs_xlate_dinode_core - translate an xfs_inode_core_t between ondisk
* and native format
*
- * buf = on-disk representation
- * dip = native representation
- * dir = direction - +ve -> disk to native
- * -ve -> native to disk
+ * buf = on-disk representation
+ * dip = native representation
+ * dir = direction - +ve -> disk to native
+ * -ve -> native to disk
* arch = on-disk architecture
*/
-
-void
-xfs_xlate_dinode_core(xfs_caddr_t buf, xfs_dinode_core_t *dip,
+
+void
+xfs_xlate_dinode_core(xfs_caddr_t buf, xfs_dinode_core_t *dip,
int dir, xfs_arch_t arch)
{
- xfs_dinode_core_t *buf_core;
- xfs_dinode_core_t *mem_core;
-
+ xfs_dinode_core_t *buf_core;
+ xfs_dinode_core_t *mem_core;
+
ASSERT(dir);
-
+
buf_core=(xfs_dinode_core_t*)buf;
mem_core=(xfs_dinode_core_t*)dip;
-
+
if (arch == ARCH_NOCONVERT) {
- if (dir>0) {
- bcopy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, sizeof(xfs_dinode_core_t));
- } else {
- bcopy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, sizeof(xfs_dinode_core_t));
- }
- return;
+ if (dir>0) {
+ bcopy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, sizeof(xfs_dinode_core_t));
+ } else {
+ bcopy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, sizeof(xfs_dinode_core_t));
+ }
+ return;
}
-
- INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch);
- INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch);
- INT_XLATE(buf_core->di_version, mem_core->di_version, dir, arch);
- INT_XLATE(buf_core->di_format, mem_core->di_format, dir, arch);
- INT_XLATE(buf_core->di_onlink, mem_core->di_onlink, dir, arch);
- INT_XLATE(buf_core->di_uid, mem_core->di_uid, dir, arch);
- INT_XLATE(buf_core->di_gid, mem_core->di_gid, dir, arch);
- INT_XLATE(buf_core->di_nlink, mem_core->di_nlink, dir, arch);
- INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch);
-
+
+ INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch);
+ INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch);
+ INT_XLATE(buf_core->di_version, mem_core->di_version, dir, arch);
+ INT_XLATE(buf_core->di_format, mem_core->di_format, dir, arch);
+ INT_XLATE(buf_core->di_onlink, mem_core->di_onlink, dir, arch);
+ INT_XLATE(buf_core->di_uid, mem_core->di_uid, dir, arch);
+ INT_XLATE(buf_core->di_gid, mem_core->di_gid, dir, arch);
+ INT_XLATE(buf_core->di_nlink, mem_core->di_nlink, dir, arch);
+ INT_XLATE(buf_core->di_projid, mem_core->di_projid, dir, arch);
+
if (dir>0) {
- bcopy(buf_core->di_pad, mem_core->di_pad, sizeof(buf_core->di_pad));
+ bcopy(buf_core->di_pad, mem_core->di_pad, sizeof(buf_core->di_pad));
} else {
- bcopy(mem_core->di_pad, buf_core->di_pad, sizeof(buf_core->di_pad));
+ bcopy(mem_core->di_pad, buf_core->di_pad, sizeof(buf_core->di_pad));
}
-
+
INT_XLATE(buf_core->di_atime.t_sec, mem_core->di_atime.t_sec, dir, arch);
INT_XLATE(buf_core->di_atime.t_nsec,mem_core->di_atime.t_nsec, dir, arch);
-
+
INT_XLATE(buf_core->di_mtime.t_sec, mem_core->di_mtime.t_sec, dir, arch);
INT_XLATE(buf_core->di_mtime.t_nsec,mem_core->di_mtime.t_nsec, dir, arch);
-
+
INT_XLATE(buf_core->di_ctime.t_sec, mem_core->di_ctime.t_sec, dir, arch);
INT_XLATE(buf_core->di_ctime.t_nsec,mem_core->di_ctime.t_nsec, dir, arch);
-
- INT_XLATE(buf_core->di_size, mem_core->di_size, dir, arch);
- INT_XLATE(buf_core->di_nblocks, mem_core->di_nblocks, dir, arch);
- INT_XLATE(buf_core->di_extsize, mem_core->di_extsize, dir, arch);
-
- INT_XLATE(buf_core->di_nextents, mem_core->di_nextents, dir, arch);
- INT_XLATE(buf_core->di_anextents, mem_core->di_anextents, dir, arch);
- INT_XLATE(buf_core->di_forkoff, mem_core->di_forkoff, dir, arch);
- INT_XLATE(buf_core->di_aformat, mem_core->di_aformat, dir, arch);
- INT_XLATE(buf_core->di_dmevmask, mem_core->di_dmevmask, dir, arch);
- INT_XLATE(buf_core->di_dmstate, mem_core->di_dmstate, dir, arch);
- INT_XLATE(buf_core->di_flags, mem_core->di_flags, dir, arch);
- INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch);
-
+
+ INT_XLATE(buf_core->di_size, mem_core->di_size, dir, arch);
+ INT_XLATE(buf_core->di_nblocks, mem_core->di_nblocks, dir, arch);
+ INT_XLATE(buf_core->di_extsize, mem_core->di_extsize, dir, arch);
+
+ INT_XLATE(buf_core->di_nextents, mem_core->di_nextents, dir, arch);
+ INT_XLATE(buf_core->di_anextents, mem_core->di_anextents, dir, arch);
+ INT_XLATE(buf_core->di_forkoff, mem_core->di_forkoff, dir, arch);
+ INT_XLATE(buf_core->di_aformat, mem_core->di_aformat, dir, arch);
+ INT_XLATE(buf_core->di_dmevmask, mem_core->di_dmevmask, dir, arch);
+ INT_XLATE(buf_core->di_dmstate, mem_core->di_dmstate, dir, arch);
+ INT_XLATE(buf_core->di_flags, mem_core->di_flags, dir, arch);
+ INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch);
+
}
/*
* Given a mount structure and an inode number, return a pointer
* to a newly allocated in-core inode coresponding to the given
* inode number.
- *
+ *
* Initialize the inode's attributes and extent pointers if it
* already has them (it will not if the inode has no links).
*/
* Get pointer's to the on-disk inode and the buffer containing it.
* If the inode number refers to a block outside the file system
* then xfs_itobp() will return NULL. In this case we should
- * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will
+ * return NULL as well. Set i_blkno to 0 so that xfs_itobp() will
* know that this is a new incore inode.
*/
error = xfs_itobp(mp, tp, ip, &dip, &bp, bno);
* If we got something that isn't an inode it means someone
* (nfs or dmi) has a stale handle.
*/
- if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) {
+ if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) {
kmem_zone_free(xfs_inode_zone, ip);
xfs_trans_brelse(tp, bp);
#ifdef DEBUG
* Otherwise, just get the truly permanent information.
*/
if (!INT_ISZERO(dip->di_core.di_mode, ARCH_CONVERT)) {
- xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core,
- &(ip->i_d), 1, ARCH_CONVERT);
+ xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core,
+ &(ip->i_d), 1, ARCH_CONVERT);
error = xfs_iformat(ip, dip);
if (error) {
kmem_zone_free(xfs_inode_zone, ip);
ip->i_d.di_mode = 0;
/*
* Initialize the per-fork minima and maxima for a new
- * inode here. xfs_iformat will do it for old inodes.
+ * inode here. xfs_iformat will do it for old inodes.
*/
ip->i_df.if_ext_max =
XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
- }
+ }
/*
* The inode format changed when we moved the link count and
* made it 32 bits long. If this is an old format inode,
- * convert it in memory to look like a new one. If it gets
+ * convert it in memory to look like a new one. If it gets
* flushed to disk we will convert back before flushing or
- * logging it. We zero out the new projid field and the old link
- * count field. We'll handle clearing the pad field (the remains
+ * logging it. We zero out the new projid field and the old link
+ * count field. We'll handle clearing the pad field (the remains
* of the old uuid field) when we actually convert the inode to
* the new format. We don't change the version number so that we
* can distinguish this from a real new format inode.
/*
* Mark the buffer containing the inode as something to keep
- * around for a while. This helps to keep recently accessed
+ * around for a while. This helps to keep recently accessed
* meta-data in-core longer.
*/
XFS_BUF_SET_REF(bp, XFS_INO_REF);
* in xfs_itobp() above. If tp is NULL, this is just a normal
* brelse(). If we're within a transaction, then xfs_trans_brelse()
* will only release the buffer if it is not dirty within the
- * transaction. It will be OK to release the buffer in this case,
+ * transaction. It will be OK to release the buffer in this case,
* because inodes on disk are never destroyed and we will be
* locking the new in-core inode before putting it in the hash
* table where other processes can find it. Thus we don't have
* being added or deleted as indicated in rec_diff. Move the records
* and pointers in if_broot to fit the new size. When shrinking this
* will eliminate holes between the records and pointers created by
- * the caller. When growing this will create holes to be filled in
+ * the caller. When growing this will create holes to be filled in
* by the caller.
*
* The caller must not request to add more records than would fit in
* the on-disk inode root. If the if_broot is currently NULL, then
- * if we adding records one will be allocated. The caller must also
+ * if we adding records one will be allocated. The caller must also
* not request that the number of records go below zero, although
* it can go to zero.
*
*/
void
xfs_iroot_realloc(
- xfs_inode_t *ip,
- int rec_diff,
+ xfs_inode_t *ip,
+ int rec_diff,
int whichfork)
{
int cur_max;
cur_max = XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes);
new_max = cur_max + rec_diff;
new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max);
- ifp->if_broot = (xfs_bmbt_block_t *)
+ ifp->if_broot = (xfs_bmbt_block_t *)
kmem_realloc(ifp->if_broot,
new_size,
(size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */
ifp->if_broot_bytes);
np = (char *)XFS_BMAP_BROOT_REC_ADDR(new_broot, 1,
(int)new_size);
- bcopy(op, np, new_max * (uint)sizeof(xfs_bmbt_rec_t));
+ bcopy(op, np, new_max * (uint)sizeof(xfs_bmbt_rec_t));
/*
* Then copy the pointers.
* Stuck with malloc/realloc.
* For inline data, the underlying buffer must be
* a multiple of 4 bytes in size so that it can be
- * logged and stay on word boundaries. We enforce
+ * logged and stay on word boundaries. We enforce
* that here.
*/
real_size = roundup(new_size, 4);
/*
* If the format is local, then we can't have an extents
- * array so just look for an inline data array. If we're
+ * array so just look for an inline data array. If we're
* not local then we may or may not have an extents list,
* so check and free it up if we do.
*/
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) {
- if ((ifp->if_u1.if_data != ifp->if_u2.if_inline_data) &&
+ if ((ifp->if_u1.if_data != ifp->if_u2.if_inline_data) &&
(ifp->if_u1.if_data != NULL)) {
ASSERT(ifp->if_real_bytes != 0);
kmem_free(ifp->if_u1.if_data, ifp->if_real_bytes);
* returns the number of bytes copied into the buffer.
*
* If there are no delayed allocation extents, then we can just
- * bcopy() the extents into the buffer. Otherwise, we need to
+ * bcopy() the extents into the buffer. Otherwise, we need to
* examine each extent in turn and skip those which are delayed.
*/
int
ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork));
ASSERT(ifp->if_bytes ==
(XFS_IFORK_NEXTENTS(ip, whichfork) *
- (uint)sizeof(xfs_bmbt_rec_t)));
+ (uint)sizeof(xfs_bmbt_rec_t)));
bcopy(ifp->if_u1.if_extents, buffer, ifp->if_bytes);
xfs_validate_extents(buffer, nrecs, XFS_EXTFMT_INODE(ip));
return ifp->if_bytes;
INT_SET(dip->di_u.di_dev, ARCH_CONVERT, ip->i_df.if_u2.if_rdev);
}
break;
-
+
case XFS_DINODE_FMT_UUID:
if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) {
ASSERT(whichfork == XFS_DATA_FORK);
*
* 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
+ * 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.
static struct {
short offset;
- short type; /* 0 = integer
- * 1 = binary / string (no translation)
- */
+ short type; /* 0 = integer
+ * 1 = binary / string (no translation)
+ */
} xfs_sb_info[] = {
- { offsetof(xfs_sb_t, sb_magicnum), 0 },
- { offsetof(xfs_sb_t, sb_blocksize), 0 },
- { offsetof(xfs_sb_t, sb_dblocks), 0 },
- { offsetof(xfs_sb_t, sb_rblocks), 0 },
- { offsetof(xfs_sb_t, sb_rextents), 0 },
- { offsetof(xfs_sb_t, sb_uuid), 1 },
- { offsetof(xfs_sb_t, sb_logstart), 0 },
- { offsetof(xfs_sb_t, sb_rootino), 0 },
- { offsetof(xfs_sb_t, sb_rbmino), 0 },
- { offsetof(xfs_sb_t, sb_rsumino), 0 },
- { offsetof(xfs_sb_t, sb_rextsize), 0 },
- { offsetof(xfs_sb_t, sb_agblocks), 0 },
- { offsetof(xfs_sb_t, sb_agcount), 0 },
- { offsetof(xfs_sb_t, sb_rbmblocks), 0 },
- { offsetof(xfs_sb_t, sb_logblocks), 0 },
+ { offsetof(xfs_sb_t, sb_magicnum), 0 },
+ { offsetof(xfs_sb_t, sb_blocksize), 0 },
+ { offsetof(xfs_sb_t, sb_dblocks), 0 },
+ { offsetof(xfs_sb_t, sb_rblocks), 0 },
+ { offsetof(xfs_sb_t, sb_rextents), 0 },
+ { offsetof(xfs_sb_t, sb_uuid), 1 },
+ { offsetof(xfs_sb_t, sb_logstart), 0 },
+ { offsetof(xfs_sb_t, sb_rootino), 0 },
+ { offsetof(xfs_sb_t, sb_rbmino), 0 },
+ { offsetof(xfs_sb_t, sb_rsumino), 0 },
+ { offsetof(xfs_sb_t, sb_rextsize), 0 },
+ { offsetof(xfs_sb_t, sb_agblocks), 0 },
+ { offsetof(xfs_sb_t, sb_agcount), 0 },
+ { offsetof(xfs_sb_t, sb_rbmblocks), 0 },
+ { offsetof(xfs_sb_t, sb_logblocks), 0 },
{ offsetof(xfs_sb_t, sb_versionnum), 0 },
- { offsetof(xfs_sb_t, sb_sectsize), 0 },
- { offsetof(xfs_sb_t, sb_inodesize), 0 },
- { offsetof(xfs_sb_t, sb_inopblock), 0 },
- { offsetof(xfs_sb_t, sb_fname[0]), 1 },
- { offsetof(xfs_sb_t, sb_blocklog), 0 },
- { offsetof(xfs_sb_t, sb_sectlog), 0 },
- { offsetof(xfs_sb_t, sb_inodelog), 0 },
- { offsetof(xfs_sb_t, sb_inopblog), 0 },
- { offsetof(xfs_sb_t, sb_agblklog), 0 },
- { offsetof(xfs_sb_t, sb_rextslog), 0 },
+ { offsetof(xfs_sb_t, sb_sectsize), 0 },
+ { offsetof(xfs_sb_t, sb_inodesize), 0 },
+ { offsetof(xfs_sb_t, sb_inopblock), 0 },
+ { offsetof(xfs_sb_t, sb_fname[0]), 1 },
+ { offsetof(xfs_sb_t, sb_blocklog), 0 },
+ { offsetof(xfs_sb_t, sb_sectlog), 0 },
+ { offsetof(xfs_sb_t, sb_inodelog), 0 },
+ { offsetof(xfs_sb_t, sb_inopblog), 0 },
+ { offsetof(xfs_sb_t, sb_agblklog), 0 },
+ { offsetof(xfs_sb_t, sb_rextslog), 0 },
{ offsetof(xfs_sb_t, sb_inprogress), 0 },
- { offsetof(xfs_sb_t, sb_imax_pct), 0 },
- { offsetof(xfs_sb_t, sb_icount), 0 },
- { offsetof(xfs_sb_t, sb_ifree), 0 },
- { offsetof(xfs_sb_t, sb_fdblocks), 0 },
- { offsetof(xfs_sb_t, sb_frextents), 0 },
- { offsetof(xfs_sb_t, sb_uquotino), 0 },
- { offsetof(xfs_sb_t, sb_gquotino), 0 },
- { offsetof(xfs_sb_t, sb_qflags), 0 },
- { offsetof(xfs_sb_t, sb_flags), 0 },
- { offsetof(xfs_sb_t, sb_shared_vn), 0 },
+ { offsetof(xfs_sb_t, sb_imax_pct), 0 },
+ { offsetof(xfs_sb_t, sb_icount), 0 },
+ { offsetof(xfs_sb_t, sb_ifree), 0 },
+ { offsetof(xfs_sb_t, sb_fdblocks), 0 },
+ { offsetof(xfs_sb_t, sb_frextents), 0 },
+ { offsetof(xfs_sb_t, sb_uquotino), 0 },
+ { offsetof(xfs_sb_t, sb_gquotino), 0 },
+ { offsetof(xfs_sb_t, sb_qflags), 0 },
+ { offsetof(xfs_sb_t, sb_flags), 0 },
+ { offsetof(xfs_sb_t, sb_shared_vn), 0 },
{ offsetof(xfs_sb_t, sb_inoalignmt), 0 },
- { offsetof(xfs_sb_t, sb_unit), 0 },
- { offsetof(xfs_sb_t, sb_width), 0 },
- { offsetof(xfs_sb_t, sb_dirblklog), 0 },
- { offsetof(xfs_sb_t, sb_dummy), 1 },
- { offsetof(xfs_sb_t, sb_logsunit), 0 },
- { sizeof(xfs_sb_t), 0 }
+ { offsetof(xfs_sb_t, sb_unit), 0 },
+ { offsetof(xfs_sb_t, sb_width), 0 },
+ { offsetof(xfs_sb_t, sb_dirblklog), 0 },
+ { offsetof(xfs_sb_t, sb_dummy), 1 },
+ { offsetof(xfs_sb_t, sb_logsunit), 0 },
+ { sizeof(xfs_sb_t), 0 }
};
/*
* xfs_xlatesb
- * data - on disk version of sb
- * sb - a superblock
- * dir - conversion direction: <0 - convert sb to buf
- * >0 - convert buf to sb
- * arch - architecture to read/write from/to buf
- * fields - which fields to copy (bitmask)
+ * data - on disk version of sb
+ * sb - a superblock
+ * dir - conversion direction: <0 - convert sb to buf
+ * >0 - convert buf to sb
+ * arch - architecture to read/write from/to buf
+ * fields - which fields to copy (bitmask)
*/
void
-xfs_xlatesb(void *data, xfs_sb_t *sb, int dir, xfs_arch_t arch,
- __int64_t fields)
+xfs_xlatesb(void *data, xfs_sb_t *sb, int dir, xfs_arch_t arch,
+ __int64_t fields)
{
- xfs_caddr_t buf_ptr;
- xfs_caddr_t mem_ptr;
-
+ xfs_caddr_t buf_ptr;
+ xfs_caddr_t mem_ptr;
+
ASSERT(dir);
ASSERT(fields);
if (!fields)
- return;
-
+ return;
+
buf_ptr=(xfs_caddr_t)data;
mem_ptr=(xfs_caddr_t)sb;
-
+
while (fields) {
xfs_sb_field_t f;
int first;
f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
first = xfs_sb_info[f].offset;
size = xfs_sb_info[f + 1].offset - first;
-
- ASSERT(xfs_sb_info[f].type==0 || xfs_sb_info[f].type==1);
-
- if (arch == ARCH_NOCONVERT || size==1 || xfs_sb_info[f].type==1) {
- if (dir>0) {
- bcopy(buf_ptr + first, mem_ptr + first, size);
- } else {
- bcopy(mem_ptr + first, buf_ptr + first, size);
- }
- } else {
- switch (size) {
- case 2:
- INT_XLATE(*(__uint16_t*)(buf_ptr+first),
- *(__uint16_t*)(mem_ptr+first), dir, arch);
- break;
- case 4:
- INT_XLATE(*(__uint32_t*)(buf_ptr+first),
- *(__uint32_t*)(mem_ptr+first), dir, arch);
- break;
- case 8:
- INT_XLATE(*(__uint64_t*)(buf_ptr+first),
- *(__uint64_t*)(mem_ptr+first), dir, arch);
- break;
- default:
- ASSERT(0);
- }
- }
+
+ ASSERT(xfs_sb_info[f].type==0 || xfs_sb_info[f].type==1);
+
+ if (arch == ARCH_NOCONVERT || size==1 || xfs_sb_info[f].type==1) {
+ if (dir>0) {
+ bcopy(buf_ptr + first, mem_ptr + first, size);
+ } else {
+ bcopy(mem_ptr + first, buf_ptr + first, size);
+ }
+ } else {
+ switch (size) {
+ case 2:
+ INT_XLATE(*(__uint16_t*)(buf_ptr+first),
+ *(__uint16_t*)(mem_ptr+first), dir, arch);
+ break;
+ case 4:
+ INT_XLATE(*(__uint32_t*)(buf_ptr+first),
+ *(__uint32_t*)(mem_ptr+first), dir, arch);
+ break;
+ case 8:
+ INT_XLATE(*(__uint64_t*)(buf_ptr+first),
+ *(__uint64_t*)(mem_ptr+first), dir, arch);
+ break;
+ default:
+ ASSERT(0);
+ }
+ }
fields &= ~(1LL << f);
}
-
+
}
void
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
}
/*
- * Free an extent in the realtime subvolume. Length is expressed in
+ * Free an extent in the realtime subvolume. Length is expressed in
* realtime extents, as is the block number.
*/
int /* error */
*
* 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
+ * 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.
printf("* ERROR: mismatched uuid in log\n"
"* SB : %s\n* log: %s\n",
uu_sb, uu_log);
+
+ memcpy(&mp->m_sb.sb_uuid, head->h_fs_uuid, sizeof(uuid_t));
- return 1;
+ return 0;
}
int
/*
* Copyright (c) 2000-2002 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
* 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.
- *
+ *
* 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
+ * 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://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
/*
* This routine finds (to an approximation) the first block in the physical
- * log which contains the given cycle. It uses a binary search algorithm.
+ * log which contains the given cycle. It uses a binary search algorithm.
* Note that the algorithm can not be perfect because the disk will not
* necessarily be perfect.
*/
int
xlog_find_cycle_start(xlog_t *log,
- xfs_buf_t *bp,
+ xfs_buf_t *bp,
xfs_daddr_t first_blk,
xfs_daddr_t *last_blk,
uint cycle)
*/
STATIC int
-xlog_find_verify_cycle( xlog_t *log,
- xfs_daddr_t start_blk,
- int nbblks,
- uint stop_on_cycle_no,
+xlog_find_verify_cycle( xlog_t *log,
+ xfs_daddr_t start_blk,
+ int nbblks,
+ uint stop_on_cycle_no,
xfs_daddr_t *new_blk)
{
xfs_daddr_t i, j;
uint cycle;
- xfs_buf_t *bp;
- char *buf = NULL;
- int error = 0;
+ xfs_buf_t *bp;
+ char *buf = NULL;
+ int error = 0;
xfs_daddr_t bufblks;
bufblks = 1 << ffs(nbblks);
while (!(bp = xlog_get_bp(bufblks, log->l_mp))) {
- /* can't get enough memory to do everything in one big buffer */
+ /* can't get enough memory to do everything in one big buffer */
bufblks >>= 1;
- if (!bufblks)
- return ENOMEM;
- }
-
+ if (!bufblks)
+ return ENOMEM;
+ }
+
for (i = start_blk; i < start_blk + nbblks; i += bufblks) {
int bcount = min(bufblks, (start_blk + nbblks - i));
- if ((error = xlog_bread(log, i, bcount, bp)))
- goto out;
+ if ((error = xlog_bread(log, i, bcount, bp)))
+ goto out;
buf = XFS_BUF_PTR(bp);
for (j = 0; j < bcount; j++) {
*new_blk = i+j;
goto out;
}
-
- buf += BBSIZE;
+
+ buf += BBSIZE;
}
}
STATIC int
xlog_find_verify_log_record(xlog_t *log,
- xfs_daddr_t start_blk,
- xfs_daddr_t *last_blk,
+ xfs_daddr_t start_blk,
+ xfs_daddr_t *last_blk,
int extra_bblks)
{
- xfs_daddr_t i;
+ xfs_daddr_t i;
xfs_buf_t *bp;
- char *buf = NULL;
- xlog_rec_header_t *head = NULL;
- int error = 0;
- int smallmem = 0;
- int num_blks = *last_blk - start_blk;
+ char *buf = NULL;
+ xlog_rec_header_t *head = NULL;
+ int error = 0;
+ int smallmem = 0;
+ int num_blks = *last_blk - start_blk;
int xhdrs;
ASSERT(start_blk != 0 || *last_blk != start_blk);
if (!(bp = xlog_get_bp(num_blks, log->l_mp))) {
- if (!(bp = xlog_get_bp(1, log->l_mp)))
- return ENOMEM;
- smallmem = 1;
- buf = XFS_BUF_PTR(bp);
+ if (!(bp = xlog_get_bp(1, log->l_mp)))
+ return ENOMEM;
+ smallmem = 1;
+ buf = XFS_BUF_PTR(bp);
} else {
if ((error = xlog_bread(log, start_blk, num_blks, bp)))
goto out;
- buf = XFS_BUF_PTR(bp) + (num_blks - 1) * BBSIZE;
+ buf = XFS_BUF_PTR(bp) + (num_blks - 1) * BBSIZE;
}
-
+
for (i=(*last_blk)-1; i>=0; i--) {
if (i < start_blk) {
if (smallmem && (error = xlog_bread(log, i, 1, bp)))
goto out;
- head = (xlog_rec_header_t*)buf;
-
+ head = (xlog_rec_header_t*)buf;
+
if (INT_GET(head->h_magicno, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM)
break;
-
- if (!smallmem)
- buf -= BBSIZE;
+
+ if (!smallmem)
+ buf -= BBSIZE;
}
/*
* will be called again for the end of the physical log.
*/
if (i == -1) {
- error = -1;
+ error = -1;
goto out;
}
/* we have the final block of the good log (the first block
* of the log record _before_ the head. So we check the uuid.
*/
-
+
if ((error = xlog_header_check_mount(log->l_mp, head)))
- goto out;
-
+ goto out;
+
/*
* We may have found a log record header before we expected one.
* last_blk will be the 1st block # with a given cycle #. We may end
- * up reading an entire log record. In this case, we don't want to
- * reset last_blk. Only when last_blk points in the middle of a log
+ * up reading an entire log record. In this case, we don't want to
+ * reset last_blk. Only when last_blk points in the middle of a log
* record do we update last_blk.
*/
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
xhdrs = 1;
}
- if (*last_blk - i + extra_bblks
- != BTOBB(INT_GET(head->h_len, ARCH_CONVERT))+xhdrs)
+ if (*last_blk - i + extra_bblks
+ != BTOBB(INT_GET(head->h_len, ARCH_CONVERT))+xhdrs)
*last_blk = i;
out:
* Head is defined to be the point of the log where the next log write
* write could go. This means that incomplete LR writes at the end are
* eliminated when calculating the head. We aren't guaranteed that previous
- * LR have complete transactions. We only know that a cycle number of
+ * LR have complete transactions. We only know that a cycle number of
* current cycle number -1 won't be present in the log if we start writing
* from our current block number.
*
xlog_find_head(xlog_t *log,
xfs_daddr_t *return_head_blk)
{
- xfs_buf_t *bp;
+ xfs_buf_t *bp;
xfs_daddr_t new_blk, first_blk, start_blk, last_blk, head_blk;
- int num_scan_bblks;
+ int num_scan_bblks;
uint first_half_cycle, last_half_cycle;
uint stop_on_cycle;
- int error, log_bbnum = log->l_logBBsize;
+ int error, log_bbnum = log->l_logBBsize;
/* Is the end of the log device zeroed? */
if ((error = xlog_find_zeroed(log, &first_blk)) == -1) {
*return_head_blk = first_blk;
-
- /* is the whole lot zeroed? */
- if (!first_blk) {
- /* Linux XFS shouldn't generate totally zeroed logs -
- * mkfs etc write a dummy unmount record to a fresh
- * log so we can store the uuid in there
- */
- xlog_warn("XFS: totally zeroed log\n");
- }
-
+
+ /* is the whole lot zeroed? */
+ if (!first_blk) {
+ /* Linux XFS shouldn't generate totally zeroed logs -
+ * mkfs etc write a dummy unmount record to a fresh
+ * log so we can store the uuid in there
+ */
+ xlog_warn("XFS: totally zeroed log\n");
+ }
+
return 0;
} else if (error) {
- xlog_warn("XFS: empty log check failed");
+ xlog_warn("XFS: empty log check failed");
return error;
}
/*
* If the 1st half cycle number is equal to the last half cycle number,
* then the entire log is stamped with the same cycle number. In this
- * case, head_blk can't be set to zero (which makes sense). The below
+ * case, head_blk can't be set to zero (which makes sense). The below
* math doesn't work out properly with head_blk equal to zero. Instead,
* we set it to log_bbnum which is an illegal block number, but this
* value makes the math correct. If head_blk doesn't changed through
* all the tests below, *head_blk is set to zero at the very end rather
- * than log_bbnum. In a sense, log_bbnum and zero are the same block
+ * than log_bbnum. In a sense, log_bbnum and zero are the same block
* in a circular file.
*/
if (first_half_cycle == last_half_cycle) {
* In this case we believe that the entire log should have cycle
* number last_half_cycle. We need to scan backwards from the
* end verifying that there are no holes still containing
- * last_half_cycle - 1. If we find such a hole, then the start
+ * last_half_cycle - 1. If we find such a hole, then the start
* of that hole will be the new head. The simple case looks like
- * x | x ... | x - 1 | x
+ * x | x ... | x - 1 | x
* Another case that fits this picture would be
- * x | x + 1 | x ... | x
+ * x | x + 1 | x ... | x
* In this case the head really is somwhere at the end of the
* log, as one of the latest writes at the beginning was incomplete.
* One more case is
- * x | x + 1 | x ... | x - 1 | x
+ * x | x + 1 | x ... | x - 1 | x
* This is really the combination of the above two cases, and the
* head has to end up at the start of the x-1 hole at the end of
* the log.
- *
+ *
* In the 256k log case, we will read from the beginning to the
* end of the log and search for cycle numbers equal to x-1. We
* don't worry about the x+1 blocks that we encounter, because
* In this case we want to find the first block with cycle number
* matching last_half_cycle. We expect the log to be some
* variation on
- * x + 1 ... | x ...
+ * x + 1 ... | x ...
* The first block with cycle number x (last_half_cycle) will be
- * where the new head belongs. First we do a binary search for
+ * where the new head belongs. First we do a binary search for
* the first occurrence of last_half_cycle. The binary search
* may not be totally accurate, so then we scan back from there
* looking for occurrences of last_half_cycle before us. If
* that backwards scan wraps around the beginning of the log,
* then we look for occurrences of last_half_cycle - 1 at the
* end of the log. The cases we're looking for look like
- * x + 1 ... | x | x + 1 | x ...
- * ^ binary search stopped here
+ * x + 1 ... | x | x + 1 | x ...
+ * ^ binary search stopped here
* or
- * x + 1 ... | x ... | x - 1 | x
- * <---------> less than scan distance
+ * x + 1 ... | x ... | x - 1 | x
+ * <---------> less than scan distance
*/
stop_on_cycle = last_half_cycle;
if ((error = xlog_find_cycle_start(log, bp, first_blk,
}
/*
- * Now validate the answer. Scan back some number of maximum possible
+ * Now validate the answer. Scan back some number of maximum possible
* blocks and make sure each one has the expected cycle number. The
* maximum is determined by the total possible amount of buffering
* in the in-core log. The following number can be made tighter if
if (new_blk != -1)
head_blk = new_blk;
} else { /* need to read 2 parts of log */
- /*
+ /*
* We are going to scan backwards in the log in two parts. First
- * we scan the physical end of the log. In this part of the log,
+ * we scan the physical end of the log. In this part of the log,
* we are looking for blocks with cycle number last_half_cycle - 1.
* If we find one, then we know that the log starts there, as we've
* found a hole that didn't get written in going around the end
- * of the physical log. The simple case for this is
- * x + 1 ... | x ... | x - 1 | x
- * <---------> less than scan distance
+ * of the physical log. The simple case for this is
+ * x + 1 ... | x ... | x - 1 | x
+ * <---------> less than scan distance
* If all of the blocks at the end of the log have cycle number
* last_half_cycle, then we check the blocks at the start of the
* log looking for occurrences of last_half_cycle. If we find one,
* then our current estimate for the location of the first
* occurrence of last_half_cycle is wrong and we move back to the
* hole we've found. This case looks like
- * x + 1 ... | x | x + 1 | x ...
- * ^ binary search stopped here
+ * x + 1 ... | x | x + 1 | x ...
+ * ^ binary search stopped here
* Another case we need to handle that only occurs in 256k logs is
- * x + 1 ... | x ... | x+1 | x ...
- * ^ binary search stops here
+ * x + 1 ... | x ... | x+1 | x ...
+ * ^ binary search stops here
* In a 256k log, the scan at the end of the log will see the x+1
* blocks. We need to skip past those since that is certainly not
- * the head of the log. By searching for last_half_cycle-1 we
+ * the head of the log. By searching for last_half_cycle-1 we
* accomplish that.
*/
start_blk = log_bbnum - num_scan_bblks + head_blk;
if ((error = xlog_find_verify_cycle(log, start_blk,
num_scan_bblks-(int)head_blk, (stop_on_cycle - 1),
&new_blk)))
- goto bp_err;
+ goto bp_err;
if (new_blk != -1) {
head_blk = new_blk;
goto bad_blk;
*/
num_scan_bblks = BTOBB(XLOG_MAX_RECORD_BSIZE);
if (head_blk >= num_scan_bblks) {
- start_blk = head_blk - num_scan_bblks; /* don't read head_blk */
+ start_blk = head_blk - num_scan_bblks; /* don't read head_blk */
/* start ptr at last block ptr before head_blk */
if ((error = xlog_find_verify_log_record(log,
/*
* When returning here, we have a good block number. Bad block
* means that during a previous crash, we didn't have a clean break
- * from cycle number N to cycle number N-1. In this case, we need
+ * from cycle number N to cycle number N-1. In this case, we need
* to find the first block with cycle number N-1.
*/
return 0;
bp_err:
xlog_put_bp(bp);
- if (error)
- xlog_warn("XFS: failed to find log head");
-
+ if (error)
+ xlog_warn("XFS: failed to find log head");
+
return error;
} /* xlog_find_head */
* This will be the block number of the last record to have its
* associated buffers synced to disk. Every log record header has
* a sync lsn embedded in it. LSNs hold block numbers, so it is easy
- * to get a sync block number. The only concern is to figure out which
+ * to get a sync block number. The only concern is to figure out which
* log record header to believe.
*
* The following algorithm uses the log record header with the largest
- * lsn. The entire log record does not need to be valid. We only care
+ * lsn. The entire log record does not need to be valid. We only care
* that the header is valid.
*
* We could speed up search by using current head_blk buffer, but it is not
xfs_daddr_t after_umount_blk;
xfs_lsn_t tail_lsn;
int hblks;
-
+
found = error = 0;
/*
- * Find previous log record
+ * Find previous log record
*/
if ((error = xlog_find_head(log, head_blk)))
return error;
/*
* Look for unmount record. If we find it, then we know there
- * was a clean unmount. Since 'i' could be the last block in
+ * was a clean unmount. Since 'i' could be the last block in
* the physical log, we convert to a log block before comparing
* to the head_blk.
*
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
int h_size = INT_GET(rhead->h_size, ARCH_CONVERT);
int h_version = INT_GET(rhead->h_version, ARCH_CONVERT);
- if ((h_version && XLOG_VERSION_2) &&
+ if ((h_version && XLOG_VERSION_2) &&
(h_size > XLOG_HEADER_CYCLE_SIZE)) {
hblks = h_size / XLOG_HEADER_CYCLE_SIZE;
if (h_size % XLOG_HEADER_CYCLE_SIZE)
exit:
xlog_put_bp(bp);
- if (error)
- xlog_warn("XFS: failed to locate log tail");
+ if (error)
+ xlog_warn("XFS: failed to locate log tail");
return error;
} /* xlog_find_tail */
* Is the log zeroed at all?
*
* The last binary search should be changed to perform an X block read
- * once X becomes small enough. You can then search linearly through
+ * once X becomes small enough. You can then search linearly through
* the X blocks. This will cut down on the number of reads we need to do.
*
* If the log is partially zeroed, this routine will pass back the blkno
*/
int
xlog_find_zeroed(struct log *log,
- xfs_daddr_t *blk_no)
+ xfs_daddr_t *blk_no)
{
xfs_buf_t *bp;
- uint first_cycle, last_cycle;
+ uint first_cycle, last_cycle;
xfs_daddr_t new_blk, last_blk, start_blk;
- xfs_daddr_t num_scan_bblks;
- int error, log_bbnum = log->l_logBBsize;
+ xfs_daddr_t num_scan_bblks;
+ int error, log_bbnum = log->l_logBBsize;
error = 0;
/* check totally zeroed log */
} else if (first_cycle != 1) {
/*
* If the cycle of the last block is zero, the cycle of
- * the first block must be 1. If it's not, maybe we're
- * not looking at a log... Bail out.
+ * the first block must be 1. If it's not, maybe we're
+ * not looking at a log... Bail out.
*/
- xlog_warn("XFS: Log inconsistent or not a log (last==0, first!=1)");
+ xlog_warn("XFS: Log inconsistent or not a log (last==0, first!=1)");
return XFS_ERROR(EINVAL);
}
-
+
/* we have a partially zeroed log */
last_blk = log_bbnum-1;
if ((error = xlog_find_cycle_start(log, bp, 0, &last_blk, 0)))
goto bp_err;
/*
- * Validate the answer. Because there is no way to guarantee that
+ * Validate the answer. Because there is no way to guarantee that
* the entire log is made up of log records which are the same size,
* we scan over the defined maximum blocks. At this point, the maximum
* is not chosen to mean anything special. XXXmiken
*/
num_scan_bblks = XLOG_TOTAL_REC_SHIFT(log);
ASSERT(num_scan_bblks <= INT_MAX);
-
+
if (last_blk < num_scan_bblks)
num_scan_bblks = last_blk;
start_blk = last_blk - num_scan_bblks;
-
+
/*
* We search for any instances of cycle number 0 that occur before
* our current estimate of the head. What we're trying to detect is
- * 1 ... | 0 | 1 | 0...
- * ^ binary search ends here
+ * 1 ... | 0 | 1 | 0...
+ * ^ binary search ends here
*/
if ((error = xlog_find_verify_cycle(log, start_blk,
(int)num_scan_bblks, 0, &new_blk)))
* Potentially backup over partial log record write. We don't need
* to search the end of the log because we know it is zero.
*/
- if ((error = xlog_find_verify_log_record(log, start_blk,
+ if ((error = xlog_find_verify_log_record(log, start_blk,
&last_blk, 0)) == -1) {
error = XFS_ERROR(EIO);
goto bp_err;
if (!INT_ISZERO(rhead->h_chksum, ARCH_CONVERT) ||
((log->l_flags & XLOG_CHKSUM_MISMATCH) == 0)) {
cmn_err(CE_DEBUG,
- "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)",
+ "XFS: LogR chksum mismatch: was (0x%x) is (0x%x)",
INT_GET(rhead->h_chksum, ARCH_CONVERT), chksum);
cmn_err(CE_DEBUG,
"XFS: Disregard message if filesystem was created with non-DEBUG kernel");
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
- cmn_err(CE_DEBUG,
+ cmn_err(CE_DEBUG,
"XFS: LogR this is a LogV2 filesystem\n");
}
log->l_flags |= XLOG_CHKSUM_MISMATCH;
}
- }
+ }
#endif /* DEBUG && XFS_LOUD_RECOVERY */
} /* xlog_unpack_data */
* Remember that EFIs, EFDs, and IUNLINKs are handled later.
*/
STATIC void
-xlog_recover_free_trans(xlog_recover_t *trans)
+xlog_recover_free_trans(xlog_recover_t *trans)
{
xlog_recover_item_t *first_item, *item, *free_item;
int i;
xlog_recover_insert_item_backq(itemq, item);
} /* xlog_recover_add_item */
-/* The next region to add is the start of a new region. It could be
+/* The next region to add is the start of a new region. It could be
* a whole region or it could be the first part of a new region. Because
* of this, the assumption here is that the type and size fields of all
* format structures fit into the first 32 bits of the structure.
return 0;
ptr = kmem_zalloc(len, 0);
bcopy(dp, ptr, len);
-
+
in_f = (xfs_inode_log_format_t *)ptr;
item = trans->r_itemq;
if (item == 0) {
xlog_recover_item_t *item;
xfs_caddr_t ptr, old_ptr;
int old_len;
-
+
item = trans->r_itemq;
if (item == 0) {
/* finish copying rest of trans header */
old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
old_len = item->ri_buf[item->ri_cnt-1].i_len;
- ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0);
- bcopy(dp , &ptr[old_len], len); /* s, d, l */
+ ptr = kmem_realloc(old_ptr, len+old_len, old_len, 0);
+ bcopy(dp , &ptr[old_len], len); /* s, d, l */
item->ri_buf[item->ri_cnt-1].i_len += len;
item->ri_buf[item->ri_cnt-1].i_addr = ptr;
return 0;
int error;
unsigned long hash;
uint flags;
-
+
/* check the log format matches our own - else we can't recover */
if (xlog_header_check_recover(log->l_mp, rhead))
return (XFS_ERROR(EIO));
-
+
while ((dp < lp) && num_logops) {
ASSERT(dp + sizeof(xlog_op_header_t) <= lp);
ohead = (xlog_op_header_t *)dp;
xlog_warn("XFS: xlog_recover_process_data: bad clientid");
ASSERT(0);
return (XFS_ERROR(EIO));
- }
+ }
tid = INT_GET(ohead->oh_tid, ARCH_CONVERT);
hash = XLOG_RHASH(tid);
trans = xlog_recover_find_tid(rhash[hash], tid);
* Read the log from tail to head and process the log records found.
* Handle the two cases where the tail and head are in the same cycle
* and where the active portion of the log wraps around the end of
- * the physical log separately. The pass parameter is passed through
+ * the physical log separately. The pass parameter is passed through
* to the routines called to process the data and is not looked at
* here.
*/
xfs_caddr_t bufaddr;
xfs_buf_t *hbp, *dbp;
int error, h_size;
- int bblks, split_bblks;
- int hblks, split_hblks, wrapped_hblks;
+ int bblks, split_bblks;
+ int hblks, split_hblks, wrapped_hblks;
xlog_recover_t *rhash[XLOG_RHASH_SIZE];
error = 0;
/*
* Read the header of the tail block and get the iclog buffer size from
- * h_size. Use this to tell how many sectors make up the log header.
+ * h_size. Use this to tell how many sectors make up the log header.
*/
if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
/*
* When using variable length iclogs, read first sector of iclog
- * header and extract the header size from it. Get a new hbp that
+ * header and extract the header size from it. Get a new hbp that
* is the correct size.
*/
hbp = xlog_get_bp(1, log->l_mp);
}
} else {
/*
- * Perform recovery around the end of the physical log. When the head
+ * Perform recovery around the end of the physical log. When the head
* is not on the same cycle number as the tail, we can't do a sequential
* recovery as above.
*/
}
rhead = (xlog_rec_header_t *)XFS_BUF_PTR(hbp);
ASSERT(INT_GET(rhead->h_magicno, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM);
- ASSERT(BTOBB(INT_GET(rhead->h_len, ARCH_CONVERT) <= INT_MAX));
+ ASSERT(BTOBB(INT_GET(rhead->h_len, ARCH_CONVERT) <= INT_MAX));
bblks = (int) BTOBB(INT_GET(rhead->h_len, ARCH_CONVERT));
/* LR body must have data or it wouldn't have been written */
error = EFSCORRUPTED;
goto bread_err2;
}
-
+
/* Read in data for log record */
if (blk_no+bblks <= log->l_logBBsize) {
if ((error = xlog_bread(log, blk_no, bblks, dbp)))
pass)))
goto bread_err2;
blk_no += (bblks+hblks);
- }
+ }
}
bread_err2:
*/
#include "logprint.h"
+#include <sys/types.h>
+#include <sys/stat.h>
int print_data;
int print_only_data;
}
close (fd);
- /*
- * Conjure up a mount structure
- */
- libxfs_xlate_sb(buf, &(mp.m_sb), 1, ARCH_CONVERT, XFS_SB_ALL_BITS);
- sb = &(mp.m_sb);
- mp.m_blkbb_log = sb->sb_blocklog - BBSHIFT;
-
- x->logBBsize = XFS_FSB_TO_BB(&mp, sb->sb_logblocks);
- x->logBBstart = XFS_FSB_TO_DADDR(&mp, sb->sb_logstart);
-
- if (!x->logname && sb->sb_logstart == 0) {
- fprintf(stderr, " external log device not specified\n\n");
- usage();
- /*NOTREACHED*/
- }
+ if (!x->disfile) {
+ /*
+ * Conjure up a mount structure
+ */
+ libxfs_xlate_sb(buf, &(mp.m_sb), 1, ARCH_CONVERT, XFS_SB_ALL_BITS);
+ sb = &(mp.m_sb);
+ mp.m_blkbb_log = sb->sb_blocklog - BBSHIFT;
+
+ x->logBBsize = XFS_FSB_TO_BB(&mp, sb->sb_logblocks);
+ x->logBBstart = XFS_FSB_TO_DADDR(&mp, sb->sb_logstart);
+ if (!x->logname && sb->sb_logstart == 0) {
+ fprintf(stderr, " external log device not specified\n\n");
+ usage();
+ /*NOTREACHED*/
+ }
+ } else {
+ struct stat s;
+
+ stat(x->dname, &s);
+ x->logBBsize = s.st_size >> 9;
+ x->logBBstart = 0;
+ }
+
if (x->logname && *x->logname) { /* External log */
if ((fd = open(x->logname, O_RDONLY)) == -1) {