mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
![Dave Chinner](/assets/img/avatar_default.png)
The struct xfs_buf_log_format wants to think the dirty bitmap is variable sized. In fact, it is variable size on disk simply due to the way we map it from the in-memory structure, but we still just use a fixed size memory allocation for the in-memory structure. Hence it makes no sense to set the function up as a variable sized structure when we already know it's maximum size, and we always allocate it as such. Simplify the structure by making the dirty bitmap a fixed sized array and just using the size of the structure for the allocation size. This will make it much simpler to allocate and manipulate an array of format structures for discontiguous buffer support. The previous struct xfs_buf_log_item size according to /proc/slabinfo was 224 bytes. pahole doesn't give the same size because of the variable size definition. With this modification, pahole reports the same as /proc/slabinfo: /* size: 224, cachelines: 4, members: 6 */ Because the xfs_buf_log_item size is now determined by the maximum supported block size we introduce a dependency on xfs_alloc_btree.h. Avoid this dependency by moving the idefines for the maximum block sizes supported to xfs_types.h with all the other max/min type defines to avoid any new dependencies. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
175 lines
5.9 KiB
C
175 lines
5.9 KiB
C
/*
|
|
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it would be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
#ifndef __XFS_TYPES_H__
|
|
#define __XFS_TYPES_H__
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
/*
|
|
* Additional type declarations for XFS
|
|
*/
|
|
typedef signed char __int8_t;
|
|
typedef unsigned char __uint8_t;
|
|
typedef signed short int __int16_t;
|
|
typedef unsigned short int __uint16_t;
|
|
typedef signed int __int32_t;
|
|
typedef unsigned int __uint32_t;
|
|
typedef signed long long int __int64_t;
|
|
typedef unsigned long long int __uint64_t;
|
|
|
|
typedef enum { B_FALSE,B_TRUE } boolean_t;
|
|
typedef __uint32_t prid_t; /* project ID */
|
|
typedef __uint32_t inst_t; /* an instruction */
|
|
|
|
typedef __s64 xfs_off_t; /* <file offset> type */
|
|
typedef unsigned long long xfs_ino_t; /* <inode> type */
|
|
typedef __s64 xfs_daddr_t; /* <disk address> type */
|
|
typedef char * xfs_caddr_t; /* <core address> type */
|
|
typedef __u32 xfs_dev_t;
|
|
typedef __u32 xfs_nlink_t;
|
|
|
|
/* __psint_t is the same size as a pointer */
|
|
#if (BITS_PER_LONG == 32)
|
|
typedef __int32_t __psint_t;
|
|
typedef __uint32_t __psunsigned_t;
|
|
#elif (BITS_PER_LONG == 64)
|
|
typedef __int64_t __psint_t;
|
|
typedef __uint64_t __psunsigned_t;
|
|
#else
|
|
#error BITS_PER_LONG must be 32 or 64
|
|
#endif
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
|
|
typedef __uint32_t xfs_agino_t; /* inode # within allocation grp */
|
|
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 __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 __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 */
|
|
|
|
/*
|
|
* These types are 64 bits on disk but are either 32 or 64 bits in memory.
|
|
* Disk based types:
|
|
*/
|
|
typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
|
|
typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
|
|
typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
|
|
typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
|
|
typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
|
|
|
|
/*
|
|
* Memory based types are conditional.
|
|
*/
|
|
#if XFS_BIG_BLKNOS
|
|
typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
|
|
typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
|
|
typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
|
|
typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
|
|
#else
|
|
typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
|
|
typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
|
|
typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
|
|
typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
|
|
#endif
|
|
typedef __uint64_t xfs_fileoff_t; /* block number in a file */
|
|
typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
|
|
typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
|
|
|
|
|
|
/*
|
|
* Null values for the types.
|
|
*/
|
|
#define NULLDFSBNO ((xfs_dfsbno_t)-1)
|
|
#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
|
|
#define NULLDRTBNO ((xfs_drtbno_t)-1)
|
|
#define NULLDFILOFF ((xfs_dfiloff_t)-1)
|
|
|
|
#define NULLFSBLOCK ((xfs_fsblock_t)-1)
|
|
#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
|
|
#define NULLRTBLOCK ((xfs_rtblock_t)-1)
|
|
#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 NULLCOMMITLSN ((xfs_lsn_t)-1)
|
|
|
|
#define NULLFSINO ((xfs_ino_t)-1)
|
|
#define NULLAGINO ((xfs_agino_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 */
|
|
|
|
/*
|
|
* Minimum and maximum blocksize and sectorsize.
|
|
* The blocksize upper limit is pretty much arbitrary.
|
|
* The sectorsize upper limit is due to sizeof(sb_sectsize).
|
|
*/
|
|
#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_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
|
|
#define XFS_MAX_SECTORSIZE_LOG 15 /* i.e. 32768 bytes */
|
|
#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
|
|
#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
|
|
|
|
/*
|
|
* Min numbers of data/attr fork btree root pointers.
|
|
*/
|
|
#define MINDBTPTRS 3
|
|
#define MINABTPTRS 2
|
|
|
|
/*
|
|
* MAXNAMELEN is the length (including the terminating null) of
|
|
* the longest permissible file (component) name.
|
|
*/
|
|
#define MAXNAMELEN 256
|
|
|
|
typedef enum {
|
|
XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
|
|
} xfs_lookup_t;
|
|
|
|
typedef enum {
|
|
XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
|
|
XFS_BTNUM_MAX
|
|
} xfs_btnum_t;
|
|
|
|
struct xfs_name {
|
|
const unsigned char *name;
|
|
int len;
|
|
};
|
|
|
|
#endif /* __XFS_TYPES_H__ */
|