bitops.h   bitops.h 
skipping to change at line 31 skipping to change at line 31
} }
if (!(x & 0xf0000000u)) { if (!(x & 0xf0000000u)) {
x <<= 4; x <<= 4;
r -= 4; r -= 4;
} }
if (!(x & 0xc0000000u)) { if (!(x & 0xc0000000u)) {
x <<= 2; x <<= 2;
r -= 2; r -= 2;
} }
if (!(x & 0x80000000u)) { if (!(x & 0x80000000u)) {
x <<= 1;
r -= 1; r -= 1;
} }
return r; return r;
} }
static inline int fls64(__u64 x) static inline int fls64(__u64 x)
{ {
__u32 h = x >> 32; __u32 h = x >> 32;
if (h) if (h)
return fls(h) + 32; return fls(h) + 32;
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 cache.h   cache.h 
skipping to change at line 21 skipping to change at line 21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __CACHE_H__ #ifndef __CACHE_H__
#define __CACHE_H__ #define __CACHE_H__
/*
* initialisation flags
*/
/*
* xfs_db always writes changes immediately, and so we need to purge buffer
s
* when we get a buffer lookup mismatch due to reading the same block with
a
* different buffer configuration.
*/
#define CACHE_MISCOMPARE_PURGE (1 << 0)
/*
* cache object campare return values
*/
enum {
CACHE_HIT,
CACHE_MISS,
CACHE_PURGE,
};
#define HASH_CACHE_RATIO 8 #define HASH_CACHE_RATIO 8
/* /*
* Cache priorities range from BASE to MAX. * Cache priorities range from BASE to MAX.
* *
* For prefetch support, the top half of the range starts at * For prefetch support, the top half of the range starts at
* CACHE_PREFETCH_PRIORITY and everytime the buffer is fetched * CACHE_PREFETCH_PRIORITY and everytime the buffer is fetched
* and is at or above this priority level, it is reduced to * and is at or above this priority level, it is reduced to
* below this level (refer to libxfs_getbuf). * below this level (refer to libxfs_getbuf).
*/ */
skipping to change at line 50 skipping to change at line 69
struct cache; struct cache;
struct cache_node; struct cache_node;
typedef void *cache_key_t; typedef void *cache_key_t;
typedef void (*cache_walk_t)(struct cache_node *); typedef void (*cache_walk_t)(struct cache_node *);
typedef struct cache_node * (*cache_node_alloc_t)(cache_key_t); typedef struct cache_node * (*cache_node_alloc_t)(cache_key_t);
typedef void (*cache_node_flush_t)(struct cache_node *); typedef void (*cache_node_flush_t)(struct cache_node *);
typedef void (*cache_node_relse_t)(struct cache_node *); typedef void (*cache_node_relse_t)(struct cache_node *);
typedef unsigned int (*cache_node_hash_t)(cache_key_t, unsigned int); typedef unsigned int (*cache_node_hash_t)(cache_key_t, unsigned int,
unsigned int);
typedef int (*cache_node_compare_t)(struct cache_node *, cache_key_t); typedef int (*cache_node_compare_t)(struct cache_node *, cache_key_t);
typedef unsigned int (*cache_bulk_relse_t)(struct cache *, struct list_head *); typedef unsigned int (*cache_bulk_relse_t)(struct cache *, struct list_head *);
struct cache_operations { struct cache_operations {
cache_node_hash_t hash; cache_node_hash_t hash;
cache_node_alloc_t alloc; cache_node_alloc_t alloc;
cache_node_flush_t flush; cache_node_flush_t flush;
cache_node_relse_t relse; cache_node_relse_t relse;
cache_node_compare_t compare; cache_node_compare_t compare;
cache_bulk_relse_t bulkrelse; /* optional */ cache_bulk_relse_t bulkrelse; /* optional */
skipping to change at line 85 skipping to change at line 105
struct cache_node { struct cache_node {
struct list_head cn_hash; /* hash chain */ struct list_head cn_hash; /* hash chain */
struct list_head cn_mru; /* MRU chain */ struct list_head cn_mru; /* MRU chain */
unsigned int cn_count; /* reference count */ unsigned int cn_count; /* reference count */
unsigned int cn_hashidx; /* hash chain index */ unsigned int cn_hashidx; /* hash chain index */
int cn_priority; /* priority, -1 = free list */ int cn_priority; /* priority, -1 = free list */
pthread_mutex_t cn_mutex; /* node mutex */ pthread_mutex_t cn_mutex; /* node mutex */
}; };
struct cache { struct cache {
int c_flags; /* behavioural flags */
unsigned int c_maxcount; /* max cache nodes */ unsigned int c_maxcount; /* max cache nodes */
unsigned int c_count; /* count of nodes */ unsigned int c_count; /* count of nodes */
pthread_mutex_t c_mutex; /* node count mutex */ pthread_mutex_t c_mutex; /* node count mutex */
cache_node_hash_t hash; /* node hash function */ cache_node_hash_t hash; /* node hash function */
cache_node_alloc_t alloc; /* allocation function */ cache_node_alloc_t alloc; /* allocation function */
cache_node_flush_t flush; /* flush dirty data function */ cache_node_flush_t flush; /* flush dirty data function */
cache_node_relse_t relse; /* memory free function */ cache_node_relse_t relse; /* memory free function */
cache_node_compare_t compare; /* comparison routine */ cache_node_compare_t compare; /* comparison routine */
cache_bulk_relse_t bulkrelse; /* bulk release routine */ cache_bulk_relse_t bulkrelse; /* bulk release routine */
unsigned int c_hashsize; /* hash bucket count */ unsigned int c_hashsize; /* hash bucket count */
unsigned int c_hashshift; /* hash key shift */
struct cache_hash *c_hash; /* hash table buckets */ struct cache_hash *c_hash; /* hash table buckets */
struct cache_mru c_mrus[CACHE_MAX_PRIORITY + 1]; struct cache_mru c_mrus[CACHE_MAX_PRIORITY + 1];
unsigned long long c_misses; /* cache misses */ unsigned long long c_misses; /* cache misses */
unsigned long long c_hits; /* cache hits */ unsigned long long c_hits; /* cache hits */
unsigned int c_max; /* max nodes ever used */ unsigned int c_max; /* max nodes ever used */
}; };
struct cache *cache_init(unsigned int, struct cache_operations *); struct cache *cache_init(int, unsigned int, struct cache_operations *);
void cache_destroy(struct cache *); void cache_destroy(struct cache *);
void cache_walk(struct cache *, cache_walk_t); void cache_walk(struct cache *, cache_walk_t);
void cache_purge(struct cache *); void cache_purge(struct cache *);
void cache_flush(struct cache *); void cache_flush(struct cache *);
int cache_node_get(struct cache *, cache_key_t, struct cache_node **); int cache_node_get(struct cache *, cache_key_t, struct cache_node **);
void cache_node_put(struct cache *, struct cache_node *); void cache_node_put(struct cache *, struct cache_node *);
void cache_node_set_priority(struct cache *, struct cache_node *, int); void cache_node_set_priority(struct cache *, struct cache_node *, int);
int cache_node_get_priority(struct cache_node *); int cache_node_get_priority(struct cache_node *);
int cache_node_purge(struct cache *, cache_key_t, struct cache_node *); int cache_node_purge(struct cache *, cache_key_t, struct cache_node *);
 End of changes. 5 change blocks. 
2 lines changed or deleted 26 lines changed or added


 libxfs.h   libxfs.h 
skipping to change at line 36 skipping to change at line 36
#include <xfs/list.h> #include <xfs/list.h>
#include <xfs/hlist.h> #include <xfs/hlist.h>
#include <xfs/cache.h> #include <xfs/cache.h>
#include <xfs/bitops.h> #include <xfs/bitops.h>
#include <xfs/kmem.h> #include <xfs/kmem.h>
#include <xfs/radix-tree.h> #include <xfs/radix-tree.h>
#include <xfs/swab.h> #include <xfs/swab.h>
#include <xfs/atomic.h> #include <xfs/atomic.h>
#include <xfs/xfs_fs.h>
#include <xfs/xfs_types.h> #include <xfs/xfs_types.h>
#include <xfs/xfs_fs.h>
#include <xfs/xfs_arch.h> #include <xfs/xfs_arch.h>
#include <xfs/xfs_shared.h>
#include <xfs/xfs_format.h>
#include <xfs/xfs_log_format.h>
#include <xfs/xfs_quota_defs.h>
#include <xfs/xfs_trans_resv.h>
#include <xfs/xfs_bit.h> #include <xfs/xfs_bit.h>
#include <xfs/xfs_inum.h> #include <xfs/xfs_inum.h>
#include <xfs/xfs_sb.h> #include <xfs/xfs_sb.h>
#include <xfs/xfs_ag.h> #include <xfs/xfs_ag.h>
#include <xfs/xfs_dir2.h>
#include <xfs/xfs_mount.h>
#include <xfs/xfs_da_btree.h>
#include <xfs/xfs_bmap_btree.h> #include <xfs/xfs_bmap_btree.h>
#include <xfs/xfs_alloc_btree.h> #include <xfs/xfs_alloc_btree.h>
#include <xfs/xfs_ialloc_btree.h> #include <xfs/xfs_ialloc_btree.h>
#include <xfs/xfs_dir_sf.h>
#include <xfs/xfs_dir2_sf.h>
#include <xfs/xfs_attr_sf.h> #include <xfs/xfs_attr_sf.h>
#include <xfs/xfs_dinode.h> #include <xfs/xfs_dinode.h>
#include <xfs/xfs_inode.h> #include <xfs/xfs_inode_fork.h>
#include <xfs/xfs_buf_item.h> #include <xfs/xfs_inode_buf.h>
#include <xfs/xfs_inode_item.h>
#include <xfs/xfs_alloc.h> #include <xfs/xfs_alloc.h>
#include <xfs/xfs_btree.h> #include <xfs/xfs_btree.h>
#include <xfs/xfs_btree_trace.h> #include <xfs/xfs_btree_trace.h>
#include <xfs/xfs_bmap.h> #include <xfs/xfs_bmap.h>
#include <xfs/xfs_trace.h> #include <xfs/xfs_trace.h>
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif #endif
skipping to change at line 111 skipping to change at line 112
/* (blocks allocated for use as /* (blocks allocated for use as
* log is stored in mount structure) */ * log is stored in mount structure) */
long long logBBstart; /* start block of log subvolume (BBs ) */ long long logBBstart; /* start block of log subvolume (BBs ) */
long long rtsize; /* size of realtime subvolume (BBs) */ long long rtsize; /* size of realtime subvolume (BBs) */
int dbsize; /* data subvolume device blksize */ int dbsize; /* data subvolume device blksize */
int lbsize; /* log subvolume device blksize */ int lbsize; /* log subvolume device blksize */
int rtbsize; /* realtime subvolume device blksize */ int rtbsize; /* realtime subvolume device blksize */
int dfd; /* data subvolume file descriptor */ int dfd; /* data subvolume file descriptor */
int logfd; /* log subvolume file descriptor */ int logfd; /* log subvolume file descriptor */
int rtfd; /* realtime subvolume file descripto r */ int rtfd; /* realtime subvolume file descripto r */
int icache_flags; /* cache init flags */
int bcache_flags; /* cache init flags */
} libxfs_init_t; } libxfs_init_t;
#define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */ #define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails */
#define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems */ #define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems */
#define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro */ #define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro */
#define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro */ #define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro */
#define LIBXFS_EXCLUSIVELY 0x0010 /* disallow other accesses (O_EXCL) */ #define LIBXFS_EXCLUSIVELY 0x0010 /* disallow other accesses (O_EXCL) */
#define LIBXFS_DIRECT 0x0020 /* can use direct I/O, not buffered */ #define LIBXFS_DIRECT 0x0020 /* can use direct I/O, not buffered */
/*
* IO verifier callbacks need the xfs_mount pointer, so we have to behave
* somewhat like the kernel now for userspace IO in terms of having buftarg
* based devices...
*/
struct xfs_buftarg {
struct xfs_mount *bt_mount;
dev_t dev;
};
extern void libxfs_buftarg_init(struct xfs_mount *mp, dev_t ddev,
dev_t logdev, dev_t rtdev);
extern char *progname; extern char *progname;
extern int libxfs_init (libxfs_init_t *); extern int libxfs_init (libxfs_init_t *);
extern void libxfs_destroy (void); extern void libxfs_destroy (void);
extern int libxfs_device_to_fd (dev_t); extern int libxfs_device_to_fd (dev_t);
extern dev_t libxfs_device_open (char *, int, int, int); extern dev_t libxfs_device_open (char *, int, int, int);
extern void libxfs_device_zero (dev_t, xfs_daddr_t, uint); extern void libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint);
extern void libxfs_device_close (dev_t); extern void libxfs_device_close (dev_t);
extern int libxfs_device_alignment (void); extern int libxfs_device_alignment (void);
extern void libxfs_report(FILE *); extern void libxfs_report(FILE *);
extern void platform_findsizes(char *path, int fd, long long *sz, int *b sz); extern void platform_findsizes(char *path, int fd, long long *sz, int *b sz);
extern int platform_nproc(void);
/* check or write log footer: specify device, log size in blocks & uuid */ /* check or write log footer: specify device, log size in blocks & uuid */
typedef xfs_caddr_t (libxfs_get_block_t)(xfs_caddr_t, int, void *); typedef xfs_caddr_t (libxfs_get_block_t)(xfs_caddr_t, int, void *);
extern int libxfs_log_clear (dev_t, xfs_daddr_t, uint, uuid_t *, extern int libxfs_log_clear (struct xfs_buftarg *, xfs_daddr_t, uint,
int, int, int); uuid_t *, int, int, int);
extern int libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int, extern int libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int,
libxfs_get_block_t *, void *); libxfs_get_block_t *, void *);
/* /*
* Define a user-level mount structure with all we need * Define a user-level mount structure with all we need
* in order to make use of the numerous XFS_* macros. * in order to make use of the numerous XFS_* macros.
*/ */
typedef struct xfs_mount { typedef struct xfs_mount {
xfs_sb_t m_sb; /* copy of fs superblock */ xfs_sb_t m_sb; /* copy of fs superblock */
char *m_fsname; /* filesystem name */ char *m_fsname; /* filesystem name */
int m_bsize; /* fs logical block size */ int m_bsize; /* fs logical block size */
xfs_agnumber_t m_agfrotor; /* last ag where space found */ xfs_agnumber_t m_agfrotor; /* last ag where space found */
xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */
xfs_agnumber_t m_maxagi; /* highest inode alloc group */ xfs_agnumber_t m_maxagi; /* highest inode alloc group */
uint m_rsumlevels; /* rt summary levels */ uint m_rsumlevels; /* rt summary levels */
uint m_rsumsize; /* size of rt summary, bytes */ uint m_rsumsize; /* size of rt summary, bytes */
struct xfs_inode *m_rbmip; /* pointer to bitmap inode * / struct xfs_inode *m_rbmip; /* pointer to bitmap inode * /
struct xfs_inode *m_rsumip; /* pointer to summary inode */ struct xfs_inode *m_rsumip; /* pointer to summary inode */
struct xfs_inode *m_rootip; /* pointer to root directory struct xfs_buftarg *m_ddev_targp;
*/ struct xfs_buftarg *m_logdev_targp;
dev_t m_dev; struct xfs_buftarg *m_rtdev_targp;
dev_t m_logdev; #define m_dev m_ddev_targp
dev_t m_rtdev; #define m_logdev m_logdev_targp
#define m_rtdev m_rtdev_targp
__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_blkbit_log; /* blocklog + NBBY */
__uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */
__uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */ __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */
__uint8_t m_agno_log; /* log #ag's */ __uint8_t m_agno_log; /* log #ag's */
__uint8_t m_agino_log; /* #bits for agino in inum * / __uint8_t m_agino_log; /* #bits for agino in inum * /
__uint16_t m_inode_cluster_size;/* min inode buf size * / uint m_inode_cluster_size;/* min inode buf size * /
uint m_blockmask; /* sb_blocksize-1 */ uint m_blockmask; /* sb_blocksize-1 */
uint m_blockwsize; /* sb_blocksize in words */ uint m_blockwsize; /* sb_blocksize in words */
uint m_blockwmask; /* blockwsize-1 */ uint m_blockwmask; /* blockwsize-1 */
uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS * / uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS * /
uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS * / uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS * /
uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS * / uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS * /
uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS * / uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS * /
uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS * / uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS * /
uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS * / uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS * /
uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
skipping to change at line 187 skipping to change at line 206
struct radix_tree_root m_perag_tree; struct radix_tree_root m_perag_tree;
uint m_flags; /* global mount flags */ uint m_flags; /* global mount flags */
uint m_qflags; /* quota status flags */ uint m_qflags; /* quota status flags */
uint m_attroffset; /* inode attribute offset */ uint m_attroffset; /* inode attribute offset */
uint m_dir_node_ents; /* #entries in a dir danode */ uint m_dir_node_ents; /* #entries in a dir danode */
uint m_attr_node_ents; /* #entries in attr danode */ uint m_attr_node_ents; /* #entries in attr danode */
int m_ialloc_inos; /* inodes in inode allocatio n */ int m_ialloc_inos; /* inodes in inode allocatio n */
int m_ialloc_blks; /* blocks in inode allocatio n */ int m_ialloc_blks; /* blocks in inode allocatio n */
int m_litino; /* size of inode union area */ int m_litino; /* size of inode union area */
int m_inoalign_mask;/* mask sb_inoalignmt if use d */ int m_inoalign_mask;/* mask sb_inoalignmt if use d */
xfs_trans_reservations_t m_reservations;/* precomputed res values */ struct xfs_trans_resv m_resv; /* precomputed res values */
__uint64_t m_maxicount; /* maximum inode count */ __uint64_t m_maxicount; /* maximum inode count */
int m_dalign; /* stripe unit */ int m_dalign; /* stripe unit */
int m_swidth; /* stripe width */ int m_swidth; /* stripe width */
int m_sinoalign; /* stripe unit inode alignmn t */ int m_sinoalign; /* stripe unit inode alignmn t */
int m_attr_magicpct;/* 37% of the blocksize */ 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 */
const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */ const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */
int m_dirblksize; /* directory block sz--bytes */ int m_dirblksize; /* directory block sz--bytes */
int m_dirblkfsbs; /* directory block sz--fsbs */ int m_dirblkfsbs; /* directory block sz--fsbs */
xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */
xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v 2 */ xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v 2 */
xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v 2 */ xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v 2 */
/*
* anonymous struct to allow xfs_dquot_buf.c to compile.
* Pointer is always null in userspace, so code does not use it at a
ll
*/
struct {
int qi_dqperchunk;
} *m_quotainfo;
} xfs_mount_t; } xfs_mount_t;
#define LIBXFS_MOUNT_ROOTINOS 0x0001 /*
#define LIBXFS_MOUNT_DEBUGGER 0x0002 * Per-ag incore structure, copies of information in agf and agi,
#define LIBXFS_MOUNT_32BITINODES 0x0004 * to improve the performance of allocation group selection.
#define LIBXFS_MOUNT_32BITINOOPT 0x0008 */
#define LIBXFS_MOUNT_COMPAT_ATTR 0x0010 typedef struct xfs_perag {
#define LIBXFS_MOUNT_ATTR2 0x0020 struct xfs_mount *pag_mount; /* owner filesystem */
xfs_agnumber_t pag_agno; /* AG this structure belongs to */
atomic_t pag_ref; /* perag reference count */
char pagf_init; /* this agf's entry is initialized *
/
char pagi_init; /* this agi's entry is initialized *
/
char pagf_metadata; /* the agf is preferred to be metada
ta */
char pagi_inodeok; /* The agi is ok for inodes */
__uint8_t pagf_levels[XFS_BTNUM_AGF];
/* # of levels in bno & cnt btree */
__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 */
__uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
xfs_agino_t pagi_freecount; /* number of free inodes */
xfs_agino_t pagi_count; /* number of allocated inodes */
/*
* Inode allocation search lookup optimisation.
* If the pagino matches, the search for new inodes
* doesn't need to search the near ones again straight away
*/
xfs_agino_t pagl_pagino;
xfs_agino_t pagl_leftrec;
xfs_agino_t pagl_rightrec;
int pagb_count; /* pagb slots in use */
} xfs_perag_t;
#define LIBXFS_MOUNT_DEBUGGER 0x0001
#define LIBXFS_MOUNT_32BITINODES 0x0002
#define LIBXFS_MOUNT_32BITINOOPT 0x0004
#define LIBXFS_MOUNT_COMPAT_ATTR 0x0008
#define LIBXFS_MOUNT_ATTR2 0x0010
#define LIBXFS_IHASHSIZE(sbp) (1<<10)
#define LIBXFS_BHASHSIZE(sbp) (1<<10) #define LIBXFS_BHASHSIZE(sbp) (1<<10)
extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *,
dev_t, dev_t, dev_t, int); dev_t, dev_t, dev_t, int);
extern void libxfs_umount (xfs_mount_t *); extern void libxfs_umount (xfs_mount_t *);
extern void libxfs_rtmount_destroy (xfs_mount_t *); extern void libxfs_rtmount_destroy (xfs_mount_t *);
/* /*
* xfs/xfs_da_format.h needs struct xfs_mount to be defined
*/
#include <xfs/xfs_da_format.h>
#include <xfs/xfs_da_btree.h>
#include <xfs/xfs_dir2.h>
/*
* Simple I/O interface * Simple I/O interface
*/ */
#define XB_PAGES 2
struct xfs_buf_map {
xfs_daddr_t bm_bn; /* block number for I/O */
int bm_len; /* size of I/O */
};
#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \
struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
struct xfs_buf_ops {
void (*verify_read)(struct xfs_buf *);
void (*verify_write)(struct xfs_buf *);
};
typedef struct xfs_buf { typedef struct xfs_buf {
struct cache_node b_node; struct cache_node b_node;
unsigned int b_flags; unsigned int b_flags;
xfs_daddr_t b_blkno; xfs_daddr_t b_bn;
unsigned b_bcount; unsigned b_bcount;
dev_t b_dev; unsigned int b_length;
struct xfs_buftarg *b_target;
#define b_dev b_target->dev
pthread_mutex_t b_lock; pthread_mutex_t b_lock;
pthread_t b_holder; pthread_t b_holder;
unsigned int b_recur; unsigned int b_recur;
void *b_fsprivate; void *b_fspriv;
void *b_fsprivate2; void *b_fsprivate2;
void *b_fsprivate3; void *b_fsprivate3;
char *b_addr; void *b_addr;
int b_error; int b_error;
const struct xfs_buf_ops *b_ops;
struct xfs_perag *b_pag;
struct xfs_buf_map *b_map;
int b_nmaps;
#ifdef XFS_BUF_TRACING #ifdef XFS_BUF_TRACING
struct list_head b_lock_list; struct list_head b_lock_list;
const char *b_func; const char *b_func;
const char *b_file; const char *b_file;
int b_line; int b_line;
#endif #endif
} xfs_buf_t; } xfs_buf_t;
enum xfs_buf_flags_t { /* b_flags bits */ enum xfs_buf_flags_t { /* b_flags bits */
LIBXFS_B_EXIT = 0x0001, /* ==LIBXFS_EXIT_ON_FAILURE */ LIBXFS_B_EXIT = 0x0001, /* ==LIBXFS_EXIT_ON_FAILURE */
LIBXFS_B_DIRTY = 0x0002, /* buffer has been modified */ LIBXFS_B_DIRTY = 0x0002, /* buffer has been modified */
LIBXFS_B_STALE = 0x0004, /* buffer marked as invalid */ LIBXFS_B_STALE = 0x0004, /* buffer marked as invalid */
LIBXFS_B_UPTODATE = 0x0008 /* buffer is sync'd to disk LIBXFS_B_UPTODATE = 0x0008, /* buffer is sync'd to disk
*/ */
LIBXFS_B_DISCONTIG = 0x0010, /* discontiguous buffer */
LIBXFS_B_UNCHECKED = 0x0020, /* needs verification */
}; };
#define XFS_BUF_PTR(bp) ((bp)->b_addr) #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
#define XFS_BUF_PTR(bp) ((char *)(bp)->b_addr)
#define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset)) #define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset))
#define XFS_BUF_ADDR(bp) ((bp)->b_blkno) #define XFS_BUF_ADDR(bp) ((bp)->b_bn)
#define XFS_BUF_SIZE(bp) ((bp)->b_bcount) #define XFS_BUF_SIZE(bp) ((bp)->b_bcount)
#define XFS_BUF_COUNT(bp) ((bp)->b_bcount) #define XFS_BUF_COUNT(bp) ((bp)->b_bcount)
#define XFS_BUF_TARGET(bp) ((bp)->b_dev) #define XFS_BUF_TARGET(bp) ((bp)->b_dev)
#define XFS_BUF_SET_PTR(bp,p,cnt) ({ \ #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
(bp)->b_addr = (char *)(p); \ (bp)->b_addr = (char *)(p); \
XFS_BUF_SET_COUNT(bp,cnt); \ XFS_BUF_SET_COUNT(bp,cnt); \
}) })
#define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_blkno = (blk)) #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_bn = (blk))
#define XFS_BUF_SET_COUNT(bp,cnt) ((bp)->b_bcount = (cnt)) #define XFS_BUF_SET_COUNT(bp,cnt) ((bp)->b_bcount = (cnt))
#define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fsprivate) #define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fspriv)
#define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fsprivate = (void *)(val) #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fspriv = (void *)(val)
#define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2) #define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2)
#define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val) #define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val)
#define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3) #define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3)
#define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val) #define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val)
#define XFS_BUF_SET_PRIORITY(bp,pri) cache_node_set_priority( \ #define XFS_BUF_SET_PRIORITY(bp,pri) cache_node_set_priority( \
libxfs_bcache, \ libxfs_bcache, \
(struct cache_node *)(bp), \ (struct cache_node *)(bp), \
(pri)) (pri))
#define XFS_BUF_PRIORITY(bp) (cache_node_get_priority( \ #define XFS_BUF_PRIORITY(bp) (cache_node_get_priority( \
(struct cache_node *)(bp))) (struct cache_node *)(bp)))
#define xfs_buf_set_ref(bp,ref) ((void) 0)
#define xfs_buf_ioerror(bp,err) ((bp)->b_error = (err))
#define xfs_daddr_to_agno(mp,d) \
((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
#define xfs_daddr_to_agbno(mp,d) \
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
/* Buffer Cache Interfaces */ /* Buffer Cache Interfaces */
extern struct cache *libxfs_bcache; extern struct cache *libxfs_bcache;
extern struct cache_operations libxfs_bcache_operations; extern struct cache_operations libxfs_bcache_operations;
#define LIBXFS_GETBUF_TRYLOCK (1 << 0) #define LIBXFS_GETBUF_TRYLOCK (1 << 0)
#ifdef XFS_BUF_TRACING #ifdef XFS_BUF_TRACING
#define libxfs_readbuf(dev, daddr, len, flags) \ #define libxfs_readbuf(dev, daddr, len, flags, ops) \
libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \
(dev), (daddr), (len), (flags)) (dev), (daddr), (len), (flags), (ops))
#define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \
libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \
(dev), (map), (nmaps), (flags), (ops))
#define libxfs_writebuf(buf, flags) \ #define libxfs_writebuf(buf, flags) \
libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \
(buf), (flags)) (buf), (flags))
#define libxfs_getbuf(dev, daddr, len) \ #define libxfs_getbuf(dev, daddr, len) \
libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \
(dev), (daddr), (len)) (dev), (daddr), (len))
#define libxfs_getbuf_map(dev, map, nmaps, flags) \
libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \
(dev), (map), (nmaps), (flags))
#define libxfs_getbuf_flags(dev, daddr, len, flags) \ #define libxfs_getbuf_flags(dev, daddr, len, flags) \
libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \
(dev), (daddr), (len), (flags)) (dev), (daddr), (len), (flags))
#define libxfs_putbuf(buf) \ #define libxfs_putbuf(buf) \
libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf))
extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int,
dev_t, xfs_daddr_t, int, int); struct xfs_buftarg *, xfs_daddr_t, int, int,
const struct xfs_buf_ops *);
extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int,
struct xfs_buftarg *, struct xfs_buf_map *, int, int
,
const struct xfs_buf_ops *);
extern int libxfs_trace_writebuf(const char *, const char *, int, extern int libxfs_trace_writebuf(const char *, const char *, int,
xfs_buf_t *, int); xfs_buf_t *, int);
extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int, dev_ extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int,
t, xfs_daddr_t, int); struct xfs_buftarg *, xfs_daddr_t, int);
extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int,
struct xfs_buftarg *, struct xfs_buf_map *, int, int
);
extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int , extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int ,
dev_t, xfs_daddr_t, int, unsigned int); struct xfs_buftarg *, xfs_daddr_t, int, unsigned int );
extern void libxfs_trace_putbuf (const char *, const char *, int, extern void libxfs_trace_putbuf (const char *, const char *, int,
xfs_buf_t *); xfs_buf_t *);
#else #else
extern xfs_buf_t *libxfs_readbuf(dev_t, xfs_daddr_t, int, int); extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, in
t,
const struct xfs_buf_ops *);
extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_m
ap *,
int, int, const struct xfs_buf_ops *);
extern int libxfs_writebuf(xfs_buf_t *, int); extern int libxfs_writebuf(xfs_buf_t *, int);
extern xfs_buf_t *libxfs_getbuf(dev_t, xfs_daddr_t, int); extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int);
extern xfs_buf_t *libxfs_getbuf_flags(dev_t, xfs_daddr_t, int, unsigned int extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *,
); struct xfs_buf_map *, int, int);
extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t,
int, unsigned int);
extern void libxfs_putbuf (xfs_buf_t *); extern void libxfs_putbuf (xfs_buf_t *);
#endif #endif
extern void libxfs_readbuf_verify(struct xfs_buf *bp,
const struct xfs_buf_ops *ops);
extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int); extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int);
extern void libxfs_bcache_purge(void); extern void libxfs_bcache_purge(void);
extern void libxfs_bcache_flush(void); extern void libxfs_bcache_flush(void);
extern void libxfs_purgebuf(xfs_buf_t *); extern void libxfs_purgebuf(xfs_buf_t *);
extern int libxfs_bcache_overflowed(void); extern int libxfs_bcache_overflowed(void);
extern int libxfs_bcache_usage(void); extern int libxfs_bcache_usage(void);
/* Buffer (Raw) Interfaces */ /* Buffer (Raw) Interfaces */
extern xfs_buf_t *libxfs_getbufr(dev_t, xfs_daddr_t, int); extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int);
extern void libxfs_putbufr(xfs_buf_t *); extern void libxfs_putbufr(xfs_buf_t *);
extern int libxfs_writebuf_int(xfs_buf_t *, int); extern int libxfs_writebuf_int(xfs_buf_t *, int);
extern int libxfs_readbufr(dev_t, xfs_daddr_t, xfs_buf_t *, int, int); extern int libxfs_writebufr(struct xfs_buf *);
extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t
*, int, int);
extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *,
int);
extern int libxfs_bhash_size; extern int libxfs_bhash_size;
extern int libxfs_ihash_size;
#define LIBXFS_BREAD 0x1 #define LIBXFS_BREAD 0x1
#define LIBXFS_BWRITE 0x2 #define LIBXFS_BWRITE 0x2
#define LIBXFS_BZERO 0x4 #define LIBXFS_BZERO 0x4
extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int); extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int);
/* /*
* Transaction interface * Transaction interface
*/ */
typedef struct xfs_log_item { typedef struct xfs_log_item {
struct xfs_log_item_desc *li_desc; /* ptr to current de sc*/ struct xfs_log_item_desc *li_desc; /* ptr to current de sc*/
struct xfs_mount *li_mountp; /* ptr to fs mount * / struct xfs_mount *li_mountp; /* ptr to fs mount * /
uint li_type; /* item type */ uint li_type; /* item type */
xfs_lsn_t li_lsn;
} xfs_log_item_t; } xfs_log_item_t;
typedef struct xfs_inode_log_item { typedef struct xfs_inode_log_item {
xfs_log_item_t ili_item; /* common portion */ xfs_log_item_t ili_item; /* common portion */
struct xfs_inode *ili_inode; /* inode pointer */ struct xfs_inode *ili_inode; /* inode pointer */
unsigned short ili_flags; /* misc flags */ unsigned short ili_flags; /* misc flags */
unsigned int ili_fields; /* fields to be logg ed */
unsigned int ili_last_fields; /* fields when flush ed*/ unsigned int ili_last_fields; /* fields when flush ed*/
xfs_inode_log_format_t ili_format; /* logged structure */ xfs_inode_log_format_t ili_format; /* logged structure */
int ili_lock_flags; int ili_lock_flags;
} xfs_inode_log_item_t; } xfs_inode_log_item_t;
typedef struct xfs_buf_log_item { typedef struct xfs_buf_log_item {
xfs_log_item_t bli_item; /* common item structure */ xfs_log_item_t bli_item; /* common item structure */
struct xfs_buf *bli_buf; /* real buffer pointer */ struct xfs_buf *bli_buf; /* real buffer pointer */
unsigned int bli_flags; /* misc flags */ unsigned int bli_flags; /* misc flags */
unsigned int bli_recur; /* recursion count */ unsigned int bli_recur; /* recursion count */
xfs_buf_log_format_t bli_format; /* in-log header */ xfs_buf_log_format_t bli_format; /* in-log header */
} xfs_buf_log_item_t; } xfs_buf_log_item_t;
#include <xfs/xfs_trans.h> #define XFS_BLI_DIRTY (1<<0)
#define XFS_BLI_HOLD (1<<1)
#define XFS_BLI_STALE (1<<2)
#define XFS_BLI_INODE_ALLOC_BUF (1<<3)
typedef struct xfs_dq_logitem {
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 */
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 an
y */
xfs_qoff_logformat_t qql_format; /* logged structure */
} xfs_qoff_logitem_t;
typedef struct xfs_trans { typedef struct xfs_trans {
unsigned int t_type; /* transaction type */ unsigned int t_type; /* transaction type */
unsigned int t_log_res; /* amt of log space resvd */ unsigned int t_log_res; /* amt of log space resvd */
unsigned int t_log_count; /* count for perm log res */ unsigned int t_log_count; /* count for perm log res */
xfs_mount_t *t_mountp; /* ptr to fs mount struct */ xfs_mount_t *t_mountp; /* ptr to fs mount struct */
unsigned int t_flags; /* misc flags */ 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_ifree_delta; /* superblock ifree change * /
long t_fdblocks_delta; /* superblock fdblocks chg * / long t_fdblocks_delta; /* superblock fdblocks chg * /
long t_frextents_delta; /* superblock freextents chg */ long t_frextents_delta; /* superblock freextents chg */
struct list_head t_items; /* first log item desc chunk */ struct list_head t_items; /* first log item desc chunk */
} xfs_trans_t; } xfs_trans_t;
extern void xfs_trans_init(struct xfs_mount *);
extern int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int); extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int);
extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *);
extern int libxfs_trans_reserve (xfs_trans_t *, uint,uint,uint,uint,uin extern int libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_re
t); s *,
uint, uint);
extern int libxfs_trans_commit (xfs_trans_t *, uint); extern int libxfs_trans_commit (xfs_trans_t *, uint);
extern void libxfs_trans_cancel (xfs_trans_t *, int); extern void libxfs_trans_cancel (xfs_trans_t *, int);
extern void libxfs_mod_sb (xfs_trans_t *, __int64_t);
extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, i nt); extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, i nt);
extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
uint, uint, struct xfs_inode **); uint, uint, struct xfs_inode **);
extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint);
extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint) ; extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint) ;
extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *);
extern void libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, in t); extern void libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, in t);
extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *, extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *,
uint); uint);
extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *); extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *);
extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *); extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *);
extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *); extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *);
extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *); extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *);
extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *, extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *,
uint, uint); uint, uint);
/*
extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t, extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t,
xfs_daddr_t, int, uint); xfs_daddr_t, int, uint);
extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t, extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t,
xfs_daddr_t, int, uint, struct xfs_buf **); xfs_daddr_t, int, uint, struct xfs_buf **);
*/
struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
struct xfs_buftarg *btp,
struct xfs_buf_map *map, int nmaps,
uint flags);
static inline struct xfs_buf *
libxfs_trans_get_buf(
struct xfs_trans *tp,
struct xfs_buftarg *btp,
xfs_daddr_t blkno,
int numblks,
uint flags)
{
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags);
}
int libxfs_trans_read_buf_map(struct xfs_mount *mp,
struct xfs_trans *tp,
struct xfs_buftarg *btp,
struct xfs_buf_map *map, int nmaps,
uint flags, struct xfs_buf **bpp,
const struct xfs_buf_ops *ops);
static inline int
libxfs_trans_read_buf(
struct xfs_mount *mp,
struct xfs_trans *tp,
struct xfs_buftarg *btp,
xfs_daddr_t blkno,
int numblks,
uint flags,
struct xfs_buf **bpp,
const struct xfs_buf_ops *ops)
{
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1,
flags, bpp, ops);
}
/* /*
* Inode interface * Inode interface
*/ */
typedef struct xfs_inode { typedef struct xfs_inode {
struct cache_node i_node; struct cache_node i_node;
xfs_mount_t *i_mount; /* fs mount struct ptr */ xfs_mount_t *i_mount; /* fs mount struct ptr */
xfs_ino_t i_ino; /* inode number (agno/agino) */ xfs_ino_t i_ino; /* inode number (agno/agino) */
struct xfs_imap i_imap; /* location for xfs_imap() * / struct xfs_imap i_imap; /* location for xfs_imap() * /
dev_t i_dev; /* dev for this inode */ struct xfs_buftarg i_dev; /* dev for this inode */
xfs_ifork_t *i_afp; /* attribute fork pointer */ xfs_ifork_t *i_afp; /* attribute fork pointer */
xfs_ifork_t i_df; /* data fork */ xfs_ifork_t i_df; /* data fork */
xfs_trans_t *i_transp; /* ptr to owning transaction */ xfs_trans_t *i_transp; /* ptr to owning transaction */
xfs_inode_log_item_t *i_itemp; /* logging information */ xfs_inode_log_item_t *i_itemp; /* logging information */
unsigned int i_delayed_blks; /* count of delay alloc blks */ unsigned int i_delayed_blks; /* count of delay alloc blks */
xfs_icdinode_t i_d; /* most of ondisk inode */ xfs_icdinode_t i_d; /* most of ondisk inode */
xfs_fsize_t i_size; /* in-memory size */ xfs_fsize_t i_size; /* in-memory size */
} xfs_inode_t; } xfs_inode_t;
#define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */ #define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */
#define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace * / #define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace * /
#define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists * / #define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists * /
#define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists */ #define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists */
/*
* Project quota id helpers (previously projid was 16bit only and using two
* 16bit values to hold new 32bit projid was chosen to retain compatibility
with
* "old" filesystems).
*
* Copied here from xfs_inode.h because it has to be defined after the stru
ct
* xfs_inode...
*/
static inline prid_t
xfs_get_projid(struct xfs_icdinode *id)
{
return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo;
}
static inline void
xfs_set_projid(struct xfs_icdinode *id, prid_t projid)
{
id->di_projid_hi = (__uint16_t) (projid >> 16);
id->di_projid_lo = (__uint16_t) (projid & 0xffff);
}
typedef struct cred { typedef struct cred {
uid_t cr_uid; uid_t cr_uid;
gid_t cr_gid; gid_t cr_gid;
} cred_t; } cred_t;
extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t,
nlink_t, xfs_dev_t, struct cred *, nlink_t, xfs_dev_t, struct cred *,
struct fsxattr *, xfs_inode_t **); struct fsxattr *, xfs_inode_t **);
extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *);
extern void libxfs_trans_ichgtime(struct xfs_trans *, extern void libxfs_trans_ichgtime(struct xfs_trans *,
struct xfs_inode *, int); struct xfs_inode *, int);
extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *); extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *);
extern int libxfs_iread (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
xfs_inode_t *, xfs_daddr_t);
/* Inode Cache Interfaces */ /* Inode Cache Interfaces */
extern struct cache *libxfs_icache;
extern struct cache_operations libxfs_icache_operations;
extern void libxfs_icache_purge (void);
extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
uint, xfs_inode_t **, xfs_daddr_t); uint, xfs_inode_t **, xfs_daddr_t);
extern void libxfs_iput (xfs_inode_t *, uint); extern void libxfs_iput (xfs_inode_t *, uint);
extern int xfs_imap_to_bp(xfs_mount_t *mp, xfs_trans_t *tp, struct xfs_
imap *imap,
xfs_buf_t **bpp, uint buf_flags, uint iget_flags);
#include <xfs/xfs_dir_leaf.h> /* dirv1 support in db & repair */
#include <xfs/xfs_dir2_data.h>
#include <xfs/xfs_dir2_leaf.h>
#include <xfs/xfs_dir2_block.h>
#include <xfs/xfs_dir2_node.h>
/* Shared utility routines */ /* Shared utility routines */
extern unsigned int libxfs_log2_roundup(unsigned int i); extern unsigned int libxfs_log2_roundup(unsigned int i);
extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t,
xfs_off_t, int, int); xfs_off_t, int, int);
extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *) ; extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *) ;
extern void libxfs_da_bjoin (xfs_trans_t *, xfs_dabuf_t *);
extern void libxfs_da_bhold (xfs_trans_t *, xfs_dabuf_t *);
extern int libxfs_da_read_bufr(xfs_trans_t *, xfs_inode_t *, xfs_dablk_
t,
xfs_daddr_t, xfs_dabuf_t **, int);
extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, .. .); extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, .. .);
extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...); extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...);
extern void cmn_err(int, char *, ...); extern void cmn_err(int, char *, ...);
enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC };
#define LIBXFS_BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT) #define LIBXFS_BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT)
extern int libxfs_nproc(void); extern int libxfs_nproc(void);
extern unsigned long libxfs_physmem(void); /* in kilobytes */ extern unsigned long libxfs_physmem(void); /* in kilobytes */
#include <xfs/xfs_ialloc.h> #include <xfs/xfs_ialloc.h>
#include <xfs/xfs_rtalloc.h>
#include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_leaf.h>
#include <xfs/xfs_quota.h> #include <xfs/xfs_attr_remote.h>
#include <xfs/xfs_trans_space.h> #include <xfs/xfs_trans_space.h>
#include <xfs/xfs_log.h>
#include <xfs/xfs_log_priv.h>
#define XFS_INOBT_IS_FREE_DISK(rp,i) \ #define XFS_INOBT_IS_FREE_DISK(rp,i) \
((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0) ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
/* /*
* public xfs kernel routines to be called as libxfs_* * public xfs kernel routines to be called as libxfs_*
*/ */
/* xfs_alloc.c */ /* xfs_alloc.c */
int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int); int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int);
skipping to change at line 521 skipping to change at line 702
/* xfs_attr.c */ /* xfs_attr.c */
int libxfs_attr_get(struct xfs_inode *, const unsigned char *, int libxfs_attr_get(struct xfs_inode *, const unsigned char *,
unsigned char *, int *, int); unsigned char *, int *, int);
int libxfs_attr_set(struct xfs_inode *, const unsigned char *, int libxfs_attr_set(struct xfs_inode *, const unsigned char *,
unsigned char *, int, int); unsigned char *, int, int);
int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int); int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int);
/* xfs_bmap.c */ /* xfs_bmap.c */
xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t, xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t,
int, int *, xfs_extnum_t *, xfs_bmbt_irec_t *, int, int *, xfs_extnum_t *, xfs_bmbt_irec_t *,
xfs_bmbt_irec_t *); xfs_bmbt_irec_t *);
void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
/* xfs_attr_leaf.h */ /* xfs_attr_leaf.h */
#define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize #define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize
/* xfs_bit.h */ /* xfs_bit.h */
#define libxfs_highbit32 xfs_highbit32 #define libxfs_highbit32 xfs_highbit32
#define libxfs_highbit64 xfs_highbit64 #define libxfs_highbit64 xfs_highbit64
/* xfs_bmap.h */ /* xfs_bmap.h */
#define libxfs_bmap_cancel xfs_bmap_cancel #define libxfs_bmap_cancel xfs_bmap_cancel
#define libxfs_bmap_last_offset xfs_bmap_last_offset #define libxfs_bmap_last_offset xfs_bmap_last_offset
#define libxfs_bmapi xfs_bmapi #define libxfs_bmapi_write xfs_bmapi_write
#define libxfs_bmapi_read xfs_bmapi_read
#define libxfs_bunmapi xfs_bunmapi #define libxfs_bunmapi xfs_bunmapi
/* xfs_bmap_btree.h */ /* xfs_bmap_btree.h */
#define libxfs_bmbt_disk_get_all xfs_bmbt_disk_get_all #define libxfs_bmbt_disk_get_all xfs_bmbt_disk_get_all
/* xfs_da_btree.h */ /* xfs_da_btree.h */
#define libxfs_da_brelse xfs_da_brelse #define libxfs_da_brelse xfs_da_brelse
#define libxfs_da_hashname xfs_da_hashname #define libxfs_da_hashname xfs_da_hashname
#define libxfs_da_shrink_inode xfs_da_shrink_inode #define libxfs_da_shrink_inode xfs_da_shrink_inode
#define libxfs_da_read_buf xfs_da_read_buf
/* xfs_dir2.h */ /* xfs_dir2.h */
#define libxfs_dir_createname xfs_dir_createname #define libxfs_dir_createname xfs_dir_createname
#define libxfs_dir_init xfs_dir_init #define libxfs_dir_init xfs_dir_init
#define libxfs_dir_lookup xfs_dir_lookup #define libxfs_dir_lookup xfs_dir_lookup
#define libxfs_dir_replace xfs_dir_replace #define libxfs_dir_replace xfs_dir_replace
#define libxfs_dir2_isblock xfs_dir2_isblock #define libxfs_dir2_isblock xfs_dir2_isblock
#define libxfs_dir2_isleaf xfs_dir2_isleaf #define libxfs_dir2_isleaf xfs_dir2_isleaf
/* xfs_dir2_data.h */ /* xfs_dir2_data.h */
#define libxfs_dir2_data_freescan xfs_dir2_data_freescan #define libxfs_dir2_data_freescan xfs_dir2_data_freescan
#define libxfs_dir2_data_log_entry xfs_dir2_data_log_entry #define libxfs_dir2_data_log_entry xfs_dir2_data_log_entry
#define libxfs_dir2_data_log_header xfs_dir2_data_log_header #define libxfs_dir2_data_log_header xfs_dir2_data_log_header
#define libxfs_dir2_data_make_free xfs_dir2_data_make_free #define libxfs_dir2_data_make_free xfs_dir2_data_make_free
#define libxfs_dir2_data_use_free xfs_dir2_data_use_free #define libxfs_dir2_data_use_free xfs_dir2_data_use_free
#define libxfs_dir2_shrink_inode xfs_dir2_shrink_inode #define libxfs_dir2_shrink_inode xfs_dir2_shrink_inode
/* xfs_inode.h */ /* xfs_inode.h */
#define libxfs_dinode_from_disk xfs_dinode_from_disk #define libxfs_dinode_from_disk xfs_dinode_from_disk
#define libxfs_dinode_to_disk xfs_dinode_to_disk #define libxfs_dinode_to_disk xfs_dinode_to_disk
void xfs_dinode_from_disk(struct xfs_icdinode *,
struct xfs_dinode *);
#define libxfs_dinode_calc_crc xfs_dinode_calc_crc
#define libxfs_idata_realloc xfs_idata_realloc #define libxfs_idata_realloc xfs_idata_realloc
#define libxfs_idestroy_fork xfs_idestroy_fork #define libxfs_idestroy_fork xfs_idestroy_fork
/* xfs_mount.h */ #define libxfs_dinode_verify xfs_dinode_verify
bool xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
struct xfs_dinode *dip);
/* xfs_sb.h */
#define libxfs_mod_sb xfs_mod_sb #define libxfs_mod_sb xfs_mod_sb
#define libxfs_sb_from_disk xfs_sb_from_disk #define libxfs_sb_from_disk xfs_sb_from_disk
#define libxfs_sb_to_disk xfs_sb_to_disk #define libxfs_sb_to_disk xfs_sb_to_disk
/* xfs_symlink.h */
#define libxfs_symlink_blocks xfs_symlink_blocks
#define libxfs_symlink_hdr_ok xfs_symlink_hdr_ok
/* xfs_trans_resv.h */
#define libxfs_trans_resv_calc xfs_trans_resv_calc
/* xfs_rtalloc.c */ /* xfs_rtalloc.c */
int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t);
/* CRC wrappers */
extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len);
extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len)
;
#define crc32(c,p,l) crc32_le((c),(unsigned char const *)(p),(l))
#define crc32c(c,p,l) crc32c_le((c),(unsigned char const *)(p),(l))
#include <xfs/xfs_cksum.h>
static inline int
xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
{
return xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),
cksum_offset);
}
static inline void
xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)
{
xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length),
cksum_offset);
}
#define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args
)
#define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args
)
#define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## arg
s)
#define xfs_hex_dump(d,n) ((void) 0)
#endif /* __LIBXFS_H__ */ #endif /* __LIBXFS_H__ */
 End of changes. 67 change blocks. 
84 lines changed or deleted 322 lines changed or added


 libxlog.h   libxlog.h 
skipping to change at line 27 skipping to change at line 27
#ifndef LIBXLOG_H #ifndef LIBXLOG_H
#define LIBXLOG_H #define LIBXLOG_H
#include <xfs/libxfs.h> #include <xfs/libxfs.h>
/* /*
* define the userlevel xlog_t to be the subset of the kernel's * define the userlevel xlog_t to be the subset of the kernel's
* xlog_t that we actually need to get our work done, avoiding * xlog_t that we actually need to get our work done, avoiding
* the need to define any exotic kernel types in userland. * the need to define any exotic kernel types in userland.
*/ */
typedef struct log { struct xlog {
xfs_lsn_t l_tail_lsn; /* lsn of 1st LR w/ unflush buffers */ 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 */ xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */
xfs_mount_t *l_mp; /* mount point */ xfs_mount_t *l_mp; /* mount point */
dev_t l_dev; /* dev_t of log */ struct xfs_buftarg *l_dev; /* dev_t of log */
xfs_daddr_t l_logBBstart; /* start block of log */ xfs_daddr_t l_logBBstart; /* start block of log */
int l_logsize; /* size of log in bytes */ int l_logsize; /* size of log in bytes */
int l_logBBsize; /* size of log in 512 byte chunks */ int l_logBBsize; /* size of log in 512 byte chunks */
int l_curr_cycle; /* Cycle number of log writes */ int l_curr_cycle; /* Cycle number of log writes */
int l_prev_cycle; /* Cycle # b4 last block increment * / int l_prev_cycle; /* Cycle # b4 last block increment * /
int l_curr_block; /* current logical block of log */ int l_curr_block; /* current logical block of log */
int l_prev_block; /* previous 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; /* size of log in bytes */
int l_iclog_size_log;/* log power size of log */ int l_iclog_size_log;/* log power size of log */
int l_iclog_bufs; /* number of iclog buffers */ int l_iclog_bufs; /* number of iclog buffers */
atomic64_t l_grant_reserve_head; atomic64_t l_grant_reserve_head;
atomic64_t l_grant_write_head; atomic64_t l_grant_write_head;
uint l_sectbb_log; /* log2 of sector size in bbs */ uint l_sectbb_log; /* log2 of sector size in bbs */
uint l_sectbb_mask; /* sector size (in BBs) uint l_sectbb_mask; /* sector size (in BBs)
* alignment mask */ * alignment mask */
int l_sectBBsize; /* size of log sector in 512 byte ch unks */ int l_sectBBsize; /* size of log sector in 512 byte ch unks */
} xlog_t; };
#include <xfs/xfs_log_recover.h> #include <xfs/xfs_log_recover.h>
#include <xfs/xfs_buf_item.h>
#include <xfs/xfs_inode_item.h>
#include <xfs/xfs_extfree_item.h>
typedef union {
xlog_rec_header_t hic_header;
xlog_rec_ext_header_t hic_xheader;
char hic_sector[XLOG_HEADER_SIZE];
} xlog_in_core_2_t;
/* /*
* macros mapping kernel code to user code * macros mapping kernel code to user code
*/ */
#ifndef EFSCORRUPTED #ifndef EFSCORRUPTED
#define EFSCORRUPTED 990 #define EFSCORRUPTED 990
#endif #endif
#define STATIC static #define STATIC static
#define XFS_ERROR(e) (e) #define XFS_ERROR(e) (e)
#ifdef DEBUG #ifdef DEBUG
#define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e) #define XFS_ERROR_REPORT(e,l,mp) fprintf(stderr, "ERROR: %s\n", e)
#else #else
#define XFS_ERROR_REPORT(e,l,mp) ((void) 0) #define XFS_ERROR_REPORT(e,l,mp) ((void) 0)
#endif #endif
#define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0) #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0)
#define XFS_MOUNT_WAS_CLEAN 0x1 #define XFS_MOUNT_WAS_CLEAN 0x1
#define unlikely(x) (x) #define unlikely(x) (x)
#define min(a,b) ((a) < (b) ? (a) : (b))
extern void xlog_warn(char *fmt,...); extern void xlog_warn(char *fmt,...);
extern void xlog_exit(char *fmt,...); extern void xlog_exit(char *fmt,...);
extern void xlog_panic(char *fmt,...); extern void xlog_panic(char *fmt,...);
/* exports */ /* exports */
extern int print_exit; extern int print_exit;
extern int print_skip_uuid; extern int print_skip_uuid;
extern int print_record_header; extern int print_record_header;
/* libxfs parameters */ /* libxfs parameters */
extern libxfs_init_t x; extern libxfs_init_t x;
extern struct xfs_buf *xlog_get_bp(xlog_t *, int); extern struct xfs_buf *xlog_get_bp(struct xlog *, int);
extern void xlog_put_bp(struct xfs_buf *); extern void xlog_put_bp(struct xfs_buf *);
extern int xlog_bread(xlog_t *log, xfs_daddr_t blk_no, int nbblks, extern int xlog_bread(struct xlog *log, xfs_daddr_t blk_no, int nbblks,
xfs_buf_t *bp, xfs_caddr_t *offset); xfs_buf_t *bp, xfs_caddr_t *offset);
extern int xlog_bread_noalign(xlog_t *log, xfs_daddr_t blk_no, int nbbl extern int xlog_bread_noalign(struct xlog *log, xfs_daddr_t blk_no,
ks, int nbblks, xfs_buf_t *bp);
xfs_buf_t *bp);
extern int xlog_find_zeroed(xlog_t *log, xfs_daddr_t *blk_no); extern int xlog_find_zeroed(struct xlog *log, xfs_daddr_t *blk_no);
extern int xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp, extern int xlog_find_cycle_start(struct xlog *log, xfs_buf_t *bp,
xfs_daddr_t first_blk, xfs_daddr_t *last_blk , xfs_daddr_t first_blk, xfs_daddr_t *last_blk ,
uint cycle); uint cycle);
extern int xlog_find_tail(xlog_t *log, xfs_daddr_t *head_blk, extern int xlog_find_tail(struct xlog *log, xfs_daddr_t *head_blk,
xfs_daddr_t *tail_blk); xfs_daddr_t *tail_blk);
extern int xlog_test_footer(xlog_t *log); extern int xlog_test_footer(struct xlog *log);
extern int xlog_recover(xlog_t *log, int readonly); extern int xlog_recover(struct xlog *log, int readonly);
extern void xlog_recover_print_data(xfs_caddr_t p, int len); extern void xlog_recover_print_data(xfs_caddr_t p, int len);
extern void xlog_recover_print_logitem(xlog_recover_item_t *item); extern void xlog_recover_print_logitem(xlog_recover_item_t *item);
extern void xlog_recover_print_trans_head(xlog_recover_t *tr); extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
extern int xlog_print_find_oldest(xlog_t *log, xfs_daddr_t *last_blk); extern int xlog_print_find_oldest(struct xlog *log, xfs_daddr_t *last_b lk);
/* for transactional view */ /* for transactional view */
extern void xlog_recover_print_trans_head(xlog_recover_t *tr); extern void xlog_recover_print_trans_head(xlog_recover_t *tr);
extern void xlog_recover_print_trans(xlog_recover_t *trans, extern void xlog_recover_print_trans(xlog_recover_t *trans,
struct list_head *itemq, int print); struct list_head *itemq, int print);
extern int xlog_do_recovery_pass(xlog_t *log, xfs_daddr_t head_blk, extern int xlog_do_recovery_pass(struct xlog *log, xfs_daddr_t head_blk ,
xfs_daddr_t tail_blk, int pass); xfs_daddr_t tail_blk, int pass);
extern int xlog_recover_do_trans(xlog_t *log, xlog_recover_t *trans, extern int xlog_recover_do_trans(struct xlog *log, xlog_recover_t *tran s,
int pass); int pass);
extern int xlog_header_check_recover(xfs_mount_t *mp, extern int xlog_header_check_recover(xfs_mount_t *mp,
xlog_rec_header_t *head); xlog_rec_header_t *head);
extern int xlog_header_check_mount(xfs_mount_t *mp, extern int xlog_header_check_mount(xfs_mount_t *mp,
xlog_rec_header_t *head); xlog_rec_header_t *head);
#define xlog_assign_atomic_lsn(l,a,b) ((void) 0) #define xlog_assign_atomic_lsn(l,a,b) ((void) 0)
#define xlog_assign_grant_head(l,a,b) ((void) 0) #define xlog_assign_grant_head(l,a,b) ((void) 0)
#endif /* LIBXLOG_H */ #endif /* LIBXLOG_H */
 End of changes. 14 change blocks. 
26 lines changed or deleted 15 lines changed or added


 linux.h   linux.h 
skipping to change at line 30 skipping to change at line 30
#include <uuid/uuid.h> #include <uuid/uuid.h>
#include <sys/vfs.h> #include <sys/vfs.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <inttypes.h> #include <inttypes.h>
#include <malloc.h> #include <malloc.h>
#include <getopt.h> #include <getopt.h>
#include <endian.h> #include <endian.h>
#include <stdbool.h>
static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p) static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
{ {
return ioctl(fd, cmd, p); return ioctl(fd, cmd, p);
} }
/*
* platform_test_xfs_*() implies that xfsctl will succeed on the file;
* on Linux, at least, special files don't get xfs file ops,
* so return 0 for those
*/
static __inline__ int platform_test_xfs_fd(int fd) static __inline__ int platform_test_xfs_fd(int fd)
{ {
struct statfs buf; struct statfs statfsbuf;
if (fstatfs(fd, &buf) < 0) struct stat statbuf;
if (fstatfs(fd, &statfsbuf) < 0)
return 0;
if (fstat(fd, &statbuf) < 0)
return 0;
if (!S_ISREG(statbuf.st_mode) && !S_ISDIR(statbuf.st_mode))
return 0; return 0;
return (buf.f_type == 0x58465342); /* XFSB */ return (statfsbuf.f_type == 0x58465342); /* XFSB */
} }
static __inline__ int platform_test_xfs_path(const char *path) static __inline__ int platform_test_xfs_path(const char *path)
{ {
struct statfs buf; struct statfs statfsbuf;
if (statfs(path, &buf) < 0) struct stat statbuf;
if (statfs(path, &statfsbuf) < 0)
return 0;
if (stat(path, &statbuf) < 0)
return 0;
if (!S_ISREG(statbuf.st_mode) && !S_ISDIR(statbuf.st_mode))
return 0; return 0;
return (buf.f_type == 0x58465342); /* XFSB */ return (statfsbuf.f_type == 0x58465342); /* XFSB */
} }
static __inline__ int platform_fstatfs(int fd, struct statfs *buf) static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
{ {
return fstatfs(fd, buf); return fstatfs(fd, buf);
} }
static __inline__ void platform_getoptreset(void) static __inline__ void platform_getoptreset(void)
{ {
extern int optind; extern int optind;
skipping to change at line 120 skipping to change at line 139
} }
#if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1)) #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
# define constpp const char * const * # define constpp const char * const *
#else #else
# define constpp char * const * # define constpp char * const *
#endif #endif
#define ENOATTR ENODATA /* Attribute not found */ #define ENOATTR ENODATA /* Attribute not found */
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
#define EFSBADCRC EBADMSG /* Bad CRC detected */
typedef loff_t xfs_off_t; typedef loff_t xfs_off_t;
typedef __uint64_t xfs_ino_t; typedef __uint64_t xfs_ino_t;
typedef __uint32_t xfs_dev_t; typedef __uint32_t xfs_dev_t;
typedef __int64_t xfs_daddr_t; typedef __int64_t xfs_daddr_t;
typedef char* xfs_caddr_t; typedef char* xfs_caddr_t;
#ifndef _UCHAR_T_DEFINED #ifndef _UCHAR_T_DEFINED
typedef unsigned char uchar_t; typedef unsigned char uchar_t;
#define _UCHAR_T_DEFINED 1 #define _UCHAR_T_DEFINED 1
 End of changes. 7 change blocks. 
6 lines changed or deleted 26 lines changed or added


 platform_defs.h   platform_defs.h 
skipping to change at line 38 skipping to change at line 38
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <pthread.h> #include <pthread.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
#include <limits.h> #include <limits.h>
#include <stdbool.h>
#define HAVE___U32 1 #define HAVE___U32 1
#ifdef HAVE___U32 #ifdef HAVE___U32
#include <asm/types.h> #include <asm/types.h>
#else #else
typedef unsigned char __u8; typedef unsigned char __u8;
typedef signed char __s8; typedef signed char __s8;
typedef unsigned short __u16; typedef unsigned short __u16;
typedef signed short __s16; typedef signed short __s16;
typedef unsigned int __u32; typedef unsigned int __u32;
skipping to change at line 61 skipping to change at line 62
#endif #endif
#ifdef __CHECKER__ #ifdef __CHECKER__
#define __bitwise __attribute__((bitwise)) #define __bitwise __attribute__((bitwise))
#define __force __attribute__((force)) #define __force __attribute__((force))
#else #else
#define __bitwise #define __bitwise
#define __force #define __force
#endif #endif
typedef __u16 __bitwise __le16;
typedef __u32 __bitwise __le32;
typedef __u64 __bitwise __le64;
typedef __u16 __bitwise __be16; typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __be32; typedef __u32 __bitwise __be32;
typedef __u64 __bitwise __be64; typedef __u64 __bitwise __be64;
typedef struct filldir filldir_t; typedef struct filldir filldir_t;
#if defined(__linux__) #if defined(__linux__)
#include <xfs/linux.h> #include <xfs/linux.h>
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#include <xfs/freebsd.h> #include <xfs/freebsd.h>
skipping to change at line 122 skipping to change at line 127
# else # else
/* This is a very strange architecture, which has 64 bit pointers but */ /* This is a very strange architecture, which has 64 bit pointers but */
/* not 64 bit longs. So, just punt here and assume long long is OK. */ /* not 64 bit longs. So, just punt here and assume long long is OK. */
typedef unsigned long long __psunsigned_t; typedef unsigned long long __psunsigned_t;
# endif # endif
# else # else
# error Unknown pointer size # error Unknown pointer size
# endif # endif
#endif #endif
/* Check whether to define umode_t ourselves. */
#ifndef HAVE_UMODE_T
typedef unsigned short umode_t;
#endif
/* Define if you want gettext (I18N) support */ /* Define if you want gettext (I18N) support */
/* #undef ENABLE_GETTEXT */ /* #undef ENABLE_GETTEXT */
#ifdef ENABLE_GETTEXT #ifdef ENABLE_GETTEXT
# include <libintl.h> # include <libintl.h>
# define _(x) gettext(x) # define _(x) gettext(x)
# define N_(x) x # define N_(x) x
#else #else
# define _(x) (x) # define _(x) (x)
# define N_(x) x # define N_(x) x
# define textdomain(d) do { } while (0) # define textdomain(d) do { } while (0)
skipping to change at line 167 skipping to change at line 177
| (minor&IRIX_DEV_MAXMIN))) | (minor&IRIX_DEV_MAXMIN)))
#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(d ev)) #define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(d ev))
/* ARM old ABI has some weird alignment/padding */ /* ARM old ABI has some weird alignment/padding */
#if defined(__arm__) && !defined(__ARM_EABI__) #if defined(__arm__) && !defined(__ARM_EABI__)
#define __arch_pack __attribute__((packed)) #define __arch_pack __attribute__((packed))
#else #else
#define __arch_pack #define __arch_pack
#endif #endif
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#endif
#endif /* __XFS_PLATFORM_DEFS_H__ */ #endif /* __XFS_PLATFORM_DEFS_H__ */
 End of changes. 4 change blocks. 
0 lines changed or deleted 15 lines changed or added


 swab.h   swab.h 
skipping to change at line 98 skipping to change at line 98
#endif #endif
#ifndef __arch__swab64s #ifndef __arch__swab64s
# define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0) # define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0)
#endif #endif
/* /*
* Allow constant folding * Allow constant folding
*/ */
# define __swab16(x) \ # define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \ (__builtin_constant_p((__u16)(x)) ? \
___swab16((x)) : \ ___constant_swab16((x)) : \
__fswab16((x))) __fswab16((x)))
# define __swab32(x) \ # define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \ (__builtin_constant_p((__u32)(x)) ? \
___swab32((x)) : \ ___constant_swab32((x)) : \
__fswab32((x))) __fswab32((x)))
# define __swab64(x) \ # define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \ (__builtin_constant_p((__u64)(x)) ? \
___swab64((x)) : \ ___constant_swab64((x)) : \
__fswab64((x))) __fswab64((x)))
static __inline__ __u16 __fswab16(__u16 x) static __inline__ __u16 __fswab16(__u16 x)
{ {
return (__extension__ __arch__swab16(x)); return (__extension__ __arch__swab16(x));
} }
static __inline__ __u16 __swab16p(__u16 *x) static __inline__ __u16 __swab16p(__u16 *x)
{ {
return (__extension__ __arch__swab16p(x)); return (__extension__ __arch__swab16p(x));
} }
skipping to change at line 154 skipping to change at line 154
} }
static __inline__ __u64 __swab64p(__u64 *x) static __inline__ __u64 __swab64p(__u64 *x)
{ {
return (__extension__ __arch__swab64p(x)); return (__extension__ __arch__swab64p(x));
} }
static __inline__ void __swab64s(__u64 *addr) static __inline__ void __swab64s(__u64 *addr)
{ {
(__extension__ ({__arch__swab64s(addr);})); (__extension__ ({__arch__swab64s(addr);}));
} }
static inline __uint16_t get_unaligned_be16(void *p)
{
__uint8_t *__p = p;
return __p[0] << 8 | __p[1];
}
static inline __uint32_t get_unaligned_be32(void *p)
{
__uint8_t *__p = p;
return __p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3];
}
static inline __uint64_t get_unaligned_be64(void *p)
{
return (__uint64_t)get_unaligned_be32(p) << 32 |
get_unaligned_be32(p + 4);
}
static inline void put_unaligned_be16(__uint16_t val, void *p)
{
__uint8_t *__p = p;
*__p++ = val >> 8;
*__p++ = val;
}
static inline void put_unaligned_be32(__uint32_t val, void *p)
{
__uint8_t *__p = p;
put_unaligned_be16(val >> 16, __p);
put_unaligned_be16(val, __p + 2);
}
static inline void put_unaligned_be64(__uint64_t val, void *p)
{
put_unaligned_be32(val >> 32, p);
put_unaligned_be32(val, p + 4);
}
#endif /* SWAB_H */ #endif /* SWAB_H */
 End of changes. 4 change blocks. 
3 lines changed or deleted 41 lines changed or added


 xfs.h   xfs.h 
skipping to change at line 37 skipping to change at line 37
* http://www.sgi.com * http://www.sgi.com
* *
* For further information regarding this notice, see: * For further information regarding this notice, see:
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef __XFS_H__ #ifndef __XFS_H__
#define __XFS_H__ #define __XFS_H__
#include <xfs/platform_defs.h> #include <xfs/platform_defs.h>
#include <xfs/xfs_types.h>
#include <xfs/xfs_fs.h> #include <xfs/xfs_fs.h>
#endif /* __XFS_H__ */ #endif /* __XFS_H__ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 xfs_ag.h   xfs_ag.h 
skipping to change at line 33 skipping to change at line 33
* 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). * buffers after a copy of the superblock (also in a 512-byte buffer).
*/ */
struct xfs_buf; struct xfs_buf;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ #define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ #define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
#define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */
#define XFS_AGF_VERSION 1 #define XFS_AGF_VERSION 1
#define XFS_AGI_VERSION 1 #define XFS_AGI_VERSION 1
#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION) #define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION) #define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
/* /*
* Btree number 0 is bno, 1 is cnt. This value gives the size of the * Btree number 0 is bno, 1 is cnt. This value gives the size of the
* arrays below. * arrays below.
*/ */
skipping to change at line 66 skipping to change at line 67
__be32 agf_versionnum; /* header version == XFS_AGF_VERSION */ __be32 agf_versionnum; /* header version == XFS_AGF_VERSION */
__be32 agf_seqno; /* sequence # starting from 0 */ __be32 agf_seqno; /* sequence # starting from 0 */
__be32 agf_length; /* size in blocks of a.g. */ __be32 agf_length; /* size in blocks of a.g. */
/* /*
* Freespace information * Freespace information
*/ */
__be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */ __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */
__be32 agf_spare0; /* spare field */ __be32 agf_spare0; /* spare field */
__be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */ __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */
__be32 agf_spare1; /* spare field */ __be32 agf_spare1; /* spare field */
__be32 agf_flfirst; /* first freelist block's index */ __be32 agf_flfirst; /* first freelist block's index */
__be32 agf_fllast; /* last freelist block's index */ __be32 agf_fllast; /* last freelist block's index */
__be32 agf_flcount; /* count of blocks in freelist */ __be32 agf_flcount; /* count of blocks in freelist */
__be32 agf_freeblks; /* total free blocks */ __be32 agf_freeblks; /* total free blocks */
__be32 agf_longest; /* longest free space */ __be32 agf_longest; /* longest free space */
__be32 agf_btreeblks; /* # of blocks held in AGF btrees */ __be32 agf_btreeblks; /* # of blocks held in AGF btrees */
uuid_t agf_uuid; /* uuid of filesystem */
/*
* reserve some contiguous space for future logged fields before we
add
* the unlogged fields. This makes the range logging via flags and
* structure offsets much simpler.
*/
__be64 agf_spare64[16];
/* unlogged fields, written during buffer writeback. */
__be64 agf_lsn; /* last write sequence */
__be32 agf_crc; /* crc of agf sector */
__be32 agf_spare2;
/* structure must be padded to 64 bit alignment */
} xfs_agf_t; } xfs_agf_t;
#define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)
#define XFS_AGF_MAGICNUM 0x00000001 #define XFS_AGF_MAGICNUM 0x00000001
#define XFS_AGF_VERSIONNUM 0x00000002 #define XFS_AGF_VERSIONNUM 0x00000002
#define XFS_AGF_SEQNO 0x00000004 #define XFS_AGF_SEQNO 0x00000004
#define XFS_AGF_LENGTH 0x00000008 #define XFS_AGF_LENGTH 0x00000008
#define XFS_AGF_ROOTS 0x00000010 #define XFS_AGF_ROOTS 0x00000010
#define XFS_AGF_LEVELS 0x00000020 #define XFS_AGF_LEVELS 0x00000020
#define XFS_AGF_FLFIRST 0x00000040 #define XFS_AGF_FLFIRST 0x00000040
#define XFS_AGF_FLLAST 0x00000080 #define XFS_AGF_FLLAST 0x00000080
#define XFS_AGF_FLCOUNT 0x00000100 #define XFS_AGF_FLCOUNT 0x00000100
#define XFS_AGF_FREEBLKS 0x00000200 #define XFS_AGF_FREEBLKS 0x00000200
#define XFS_AGF_LONGEST 0x00000400 #define XFS_AGF_LONGEST 0x00000400
#define XFS_AGF_BTREEBLKS 0x00000800 #define XFS_AGF_BTREEBLKS 0x00000800
#define XFS_AGF_NUM_BITS 12 #define XFS_AGF_UUID 0x00001000
#define XFS_AGF_NUM_BITS 13
#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) #define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
#define XFS_AGF_FLAGS \ #define XFS_AGF_FLAGS \
{ XFS_AGF_MAGICNUM, "MAGICNUM" }, \ { XFS_AGF_MAGICNUM, "MAGICNUM" }, \
{ XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \ { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \
{ XFS_AGF_SEQNO, "SEQNO" }, \ { XFS_AGF_SEQNO, "SEQNO" }, \
{ XFS_AGF_LENGTH, "LENGTH" }, \ { XFS_AGF_LENGTH, "LENGTH" }, \
{ XFS_AGF_ROOTS, "ROOTS" }, \ { XFS_AGF_ROOTS, "ROOTS" }, \
{ XFS_AGF_LEVELS, "LEVELS" }, \ { XFS_AGF_LEVELS, "LEVELS" }, \
{ XFS_AGF_FLFIRST, "FLFIRST" }, \ { XFS_AGF_FLFIRST, "FLFIRST" }, \
{ XFS_AGF_FLLAST, "FLLAST" }, \ { XFS_AGF_FLLAST, "FLLAST" }, \
{ XFS_AGF_FLCOUNT, "FLCOUNT" }, \ { XFS_AGF_FLCOUNT, "FLCOUNT" }, \
{ XFS_AGF_FREEBLKS, "FREEBLKS" }, \ { XFS_AGF_FREEBLKS, "FREEBLKS" }, \
{ XFS_AGF_LONGEST, "LONGEST" }, \ { XFS_AGF_LONGEST, "LONGEST" }, \
{ XFS_AGF_BTREEBLKS, "BTREEBLKS" } { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \
{ XFS_AGF_UUID, "UUID" }
/* disk block (xfs_daddr_t) in the AG */ /* disk block (xfs_daddr_t) in the AG */
#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr))
extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp, extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
xfs_agnumber_t agno, int flags, struct xfs_buf **bpp ); xfs_agnumber_t agno, int flags, struct xfs_buf **bpp );
/* /*
* Size of the unlinked inode hash table in the agi. * 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 { typedef struct xfs_agi {
skipping to change at line 133 skipping to change at line 155
__be32 agi_length; /* size in blocks of a.g. */ __be32 agi_length; /* size in blocks of a.g. */
/* /*
* Inode information * Inode information
* Inodes are mapped by interpreting the inode number, so no * Inodes are mapped by interpreting the inode number, so no
* mapping data is needed here. * mapping data is needed here.
*/ */
__be32 agi_count; /* count of allocated inodes */ __be32 agi_count; /* count of allocated inodes */
__be32 agi_root; /* root of inode btree */ __be32 agi_root; /* root of inode btree */
__be32 agi_level; /* levels in inode btree */ __be32 agi_level; /* levels in inode btree */
__be32 agi_freecount; /* number of free inodes */ __be32 agi_freecount; /* number of free inodes */
__be32 agi_newino; /* new inode just allocated */ __be32 agi_newino; /* new inode just allocated */
__be32 agi_dirino; /* last directory inode chunk */ __be32 agi_dirino; /* last directory inode chunk */
/* /*
* Hash table of inodes which have been unlinked but are * Hash table of inodes which have been unlinked but are
* still being referenced. * still being referenced.
*/ */
__be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS]; __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
uuid_t agi_uuid; /* uuid of filesystem */
__be32 agi_crc; /* crc of agi sector */
__be32 agi_pad32;
__be64 agi_lsn; /* last write sequence */
/* structure must be padded to 64 bit alignment */
} xfs_agi_t; } xfs_agi_t;
#define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)
#define XFS_AGI_MAGICNUM 0x00000001 #define XFS_AGI_MAGICNUM 0x00000001
#define XFS_AGI_VERSIONNUM 0x00000002 #define XFS_AGI_VERSIONNUM 0x00000002
#define XFS_AGI_SEQNO 0x00000004 #define XFS_AGI_SEQNO 0x00000004
#define XFS_AGI_LENGTH 0x00000008 #define XFS_AGI_LENGTH 0x00000008
#define XFS_AGI_COUNT 0x00000010 #define XFS_AGI_COUNT 0x00000010
#define XFS_AGI_ROOT 0x00000020 #define XFS_AGI_ROOT 0x00000020
#define XFS_AGI_LEVEL 0x00000040 #define XFS_AGI_LEVEL 0x00000040
#define XFS_AGI_FREECOUNT 0x00000080 #define XFS_AGI_FREECOUNT 0x00000080
#define XFS_AGI_NEWINO 0x00000100 #define XFS_AGI_NEWINO 0x00000100
#define XFS_AGI_DIRINO 0x00000200 #define XFS_AGI_DIRINO 0x00000200
#define XFS_AGI_UNLINKED 0x00000400 #define XFS_AGI_UNLINKED 0x00000400
#define XFS_AGI_NUM_BITS 11 #define XFS_AGI_NUM_BITS 11
#define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1) #define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1)
/* disk block (xfs_daddr_t) in the AG */ /* disk block (xfs_daddr_t) in the AG */
#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr))
extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp, extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
xfs_agnumber_t agno, struct xfs_buf **bpp); xfs_agnumber_t agno, struct xfs_buf **bpp);
/* /*
* 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. * of block pointers to blocks owned by the allocation btree code.
*/ */
#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp) ) #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp) )
#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
_t))
#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_AGFL_BNO(mp, bp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
&(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
(__be32 *)(bp)->b_addr)
/*
* Size of the AGFL. For CRC-enabled filesystes we steal a couple of
* slots in the beginning of the block for a proper header with the
* location information and CRC.
*/
#define XFS_AGFL_SIZE(mp) \
(((mp)->m_sb.sb_sectsize - \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
sizeof(struct xfs_agfl) : 0)) / \
sizeof(xfs_agblock_t))
typedef struct xfs_agfl { typedef struct xfs_agfl {
__be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ __be32 agfl_magicnum;
__be32 agfl_seqno;
uuid_t agfl_uuid;
__be64 agfl_lsn;
__be32 agfl_crc;
__be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
} xfs_agfl_t; } xfs_agfl_t;
/* #define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc)
* Busy block/extent entry. Indexed by a rbtree in perag to mark blocks th
at
* have been freed but whose transactions aren't committed to disk yet.
*
* Note that we use the transaction ID to record the transaction, not the
* transaction structure itself. See xfs_alloc_busy_insert() for details.
*/
struct xfs_busy_extent {
#ifdef __KERNEL__
struct rb_node rb_node; /* ag by-bno indexed search tree */
#endif
struct list_head list; /* transaction busy extent list */
xfs_agnumber_t agno;
xfs_agblock_t bno;
xfs_extlen_t length;
xlog_tid_t tid; /* transaction that created this */
};
/*
* Per-ag incore structure, copies of information in agf and agi,
* to improve the performance of allocation group selection.
*/
#define XFS_PAGB_NUM_SLOTS 128
typedef struct xfs_perag {
struct xfs_mount *pag_mount; /* owner filesystem */
xfs_agnumber_t pag_agno; /* AG this structure belongs to */
atomic_t pag_ref; /* perag reference count */
char pagf_init; /* this agf's entry is initialized *
/
char pagi_init; /* this agi's entry is initialized *
/
char pagf_metadata; /* the agf is preferred to be metada
ta */
char pagi_inodeok; /* The agi is ok for inodes */
__uint8_t pagf_levels[XFS_BTNUM_AGF];
/* # of levels in bno & cnt btree */
__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 */
__uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
xfs_agino_t pagi_freecount; /* number of free inodes */
xfs_agino_t pagi_count; /* number of allocated inodes */
/*
* Inode allocation search lookup optimisation.
* If the pagino matches, the search for new inodes
* doesn't need to search the near ones again straight away
*/
xfs_agino_t pagl_pagino;
xfs_agino_t pagl_leftrec;
xfs_agino_t pagl_rightrec;
#ifdef __KERNEL__
spinlock_t pagb_lock; /* lock for pagb_tree */
struct rb_root pagb_tree; /* ordered tree of busy extents */
atomic_t pagf_fstrms; /* # of filestreams active in this A
G */
spinlock_t pag_ici_lock; /* incore inode cache lock */
struct radix_tree_root pag_ici_root; /* incore inode cache root *
/
int pag_ici_reclaimable; /* reclaimable inodes */
struct mutex pag_ici_reclaim_lock; /* serialisation point */
unsigned long pag_ici_reclaim_cursor; /* reclaim restart point */
/* buffer cache index */
spinlock_t pag_buf_lock; /* lock for pag_buf_tree */
struct rb_root pag_buf_tree; /* ordered tree of active buffers */
/* for rcu-safe freeing */
struct rcu_head rcu_head;
#endif
int pagb_count; /* pagb slots in use */
} xfs_perag_t;
/* /*
* tags for inode radix tree * tags for inode radix tree
*/ */
#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged look up #define XFS_ICI_NO_TAG (-1) /* special flag for an untagged look up
in xfs_inode_ag_iterator */ in xfs_inode_ag_iterator */
#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */ #define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */
#define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */
#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) #define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
#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 ))) (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp )))
#define XFS_MIN_FREELIST(a,mp) \ #define XFS_MIN_FREELIST(a,mp) \
(XFS_MIN_FREELIST_RAW( \ (XFS_MIN_FREELIST_RAW( \
be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \ be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp)) be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
#define XFS_MIN_FREELIST_PAG(pag,mp) \ #define XFS_MIN_FREELIST_PAG(pag,mp) \
(XFS_MIN_FREELIST_RAW( \ (XFS_MIN_FREELIST_RAW( \
 End of changes. 16 change blocks. 
84 lines changed or deleted 62 lines changed or added


 xfs_alloc.h   xfs_alloc.h 
skipping to change at line 22 skipping to change at line 22
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_ALLOC_H__ #ifndef __XFS_ALLOC_H__
#define __XFS_ALLOC_H__ #define __XFS_ALLOC_H__
struct xfs_buf; struct xfs_buf;
struct xfs_btree_cur;
struct xfs_mount; struct xfs_mount;
struct xfs_perag; struct xfs_perag;
struct xfs_trans; struct xfs_trans;
struct xfs_busy_extent;
extern struct workqueue_struct *xfs_alloc_wq;
/* /*
* Freespace allocation types. Argument to xfs_alloc_[v]extent. * Freespace allocation types. Argument to xfs_alloc_[v]extent.
*/ */
#define XFS_ALLOCTYPE_ANY_AG 0x01 /* allocate anywhere, use rotor */ #define XFS_ALLOCTYPE_ANY_AG 0x01 /* allocate anywhere, use rotor */
#define XFS_ALLOCTYPE_FIRST_AG 0x02 /* ... start at ag 0 */ #define XFS_ALLOCTYPE_FIRST_AG 0x02 /* ... start at ag 0 */
#define XFS_ALLOCTYPE_START_AG 0x04 /* anywhere, start in this a.g. */ #define XFS_ALLOCTYPE_START_AG 0x04 /* anywhere, start in this a.g. */
#define XFS_ALLOCTYPE_THIS_AG 0x08 /* anywhere in this a.g. */ #define XFS_ALLOCTYPE_THIS_AG 0x08 /* anywhere in this a.g. */
#define XFS_ALLOCTYPE_START_BNO 0x10 /* near this block else anyw here */ #define XFS_ALLOCTYPE_START_BNO 0x10 /* near this block else anyw here */
#define XFS_ALLOCTYPE_NEAR_BNO 0x20 /* in this a.g. and near this block */ #define XFS_ALLOCTYPE_NEAR_BNO 0x20 /* in this a.g. and near this block */
skipping to change at line 77 skipping to change at line 79
* all delayed extents need to be actually allocated. To get around * all delayed extents need to be actually allocated. To get around
* this, we explicitly set aside a few blocks which will not be * this, we explicitly set aside a few blocks which will not be
* reserved in delayed allocation. Considering the minimum number of * reserved in delayed allocation. Considering the minimum number of
* needed freelist blocks is 4 fsbs _per AG_, a potential split of file's b map * needed freelist blocks is 4 fsbs _per AG_, a potential split of file's b map
* btree requires 1 fsb, so we set the number of set-aside blocks * btree requires 1 fsb, so we set the number of set-aside blocks
* to 4 + 4*agcount. * to 4 + 4*agcount.
*/ */
#define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4)) #define XFS_ALLOC_SET_ASIDE(mp) (4 + ((mp)->m_sb.sb_agcount * 4))
/* /*
* When deciding how much space to allocate out of an AG, we limit the
* allocation maximum size to the size the AG. However, we cannot use all t
he
* blocks in the AG - some are permanently used by metadata. These
* blocks are generally:
* - the AG superblock, AGF, AGI and AGFL
* - the AGF (bno and cnt) and AGI btree root blocks
* - 4 blocks on the AGFL according to XFS_ALLOC_SET_ASIDE() limits
*
* The AG headers are sector sized, so the amount of space they take up is
* dependent on filesystem geometry. The others are all single blocks.
*/
#define XFS_ALLOC_AG_MAX_USABLE(mp) \
((mp)->m_sb.sb_agblocks - XFS_BB_TO_FSB(mp, XFS_FSS_TO_BB(mp, 4)) -
7)
/*
* Argument structure for xfs_alloc routines. * Argument structure for xfs_alloc routines.
* This is turned into a structure to avoid having 20 arguments passed * This is turned into a structure to avoid having 20 arguments passed
* down several levels of the stack. * down several levels of the stack.
*/ */
typedef struct xfs_alloc_arg { typedef struct xfs_alloc_arg {
struct xfs_trans *tp; /* transaction pointer */ struct xfs_trans *tp; /* transaction pointer */
struct xfs_mount *mp; /* file system mount point */ struct xfs_mount *mp; /* file system mount point */
struct xfs_buf *agbp; /* buffer for a.g. freelist header * / struct xfs_buf *agbp; /* buffer for a.g. freelist header * /
struct xfs_perag *pag; /* per-ag struct for this agno */ struct xfs_perag *pag; /* per-ag struct for this agno */
xfs_fsblock_t fsbno; /* file system block number */ xfs_fsblock_t fsbno; /* file system block number */
skipping to change at line 120 skipping to change at line 137
#define XFS_ALLOC_USERDATA 1 /* allocation is for user da ta*/ #define XFS_ALLOC_USERDATA 1 /* allocation is for user da ta*/
#define XFS_ALLOC_INITIAL_USER_DATA 2 /* special case start of fil e */ #define XFS_ALLOC_INITIAL_USER_DATA 2 /* special case start of fil e */
/* /*
* Find the length of the longest extent in an AG. * Find the length of the longest extent in an AG.
*/ */
xfs_extlen_t xfs_extlen_t
xfs_alloc_longest_free_extent(struct xfs_mount *mp, xfs_alloc_longest_free_extent(struct xfs_mount *mp,
struct xfs_perag *pag); struct xfs_perag *pag);
#ifdef __KERNEL__
void
xfs_alloc_busy_insert(xfs_trans_t *tp,
xfs_agnumber_t agno,
xfs_agblock_t bno,
xfs_extlen_t len);
void
xfs_alloc_busy_clear(struct xfs_mount *mp, struct xfs_busy_extent *busyp);
#endif /* __KERNEL__ */
/* /*
* Compute and fill in value of m_ag_maxlevels. * Compute and fill in value of m_ag_maxlevels.
*/ */
void void
xfs_alloc_compute_maxlevels( xfs_alloc_compute_maxlevels(
struct xfs_mount *mp); /* file system mount structure */ struct xfs_mount *mp); /* file system mount structure */
/* /*
* Get a block from the freelist. * Get a block from the freelist.
* Returns with the buffer for the block gotten. * Returns with the buffer for the block gotten.
skipping to change at line 208 skipping to change at line 212
/* /*
* Free an extent. * Free an extent.
*/ */
int /* error */ int /* error */
xfs_free_extent( xfs_free_extent(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_fsblock_t bno, /* starting block number of extent */ xfs_fsblock_t bno, /* starting block number of extent */
xfs_extlen_t len); /* length of extent */ xfs_extlen_t len); /* length of extent */
int /* error */
xfs_alloc_lookup_le(
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 /* error */
xfs_alloc_lookup_ge(
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 /* error */
xfs_alloc_get_rec(
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 */
#endif /* __XFS_ALLOC_H__ */ #endif /* __XFS_ALLOC_H__ */
 End of changes. 5 change blocks. 
14 lines changed or deleted 42 lines changed or added


 xfs_alloc_btree.h   xfs_alloc_btree.h 
skipping to change at line 30 skipping to change at line 30
/* /*
* Freespace on-disk structures * Freespace on-disk structures
*/ */
struct xfs_buf; struct xfs_buf;
struct xfs_btree_cur; struct xfs_btree_cur;
struct xfs_mount; struct xfs_mount;
/* /*
* There are two on-disk btrees, one sorted by blockno and one sorted
* 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 */
/*
* Data record/key structure
*/
typedef struct xfs_alloc_rec {
__be32 ar_startblock; /* starting block number */
__be32 ar_blockcount; /* count of free blocks */
} xfs_alloc_rec_t, xfs_alloc_key_t;
typedef struct xfs_alloc_rec_incore {
xfs_agblock_t ar_startblock; /* starting block number */
xfs_extlen_t ar_blockcount; /* count of free blocks */
} xfs_alloc_rec_incore_t;
/* btree pointer type */
typedef __be32 xfs_alloc_ptr_t;
/*
* 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)
/*
* Block numbers in the AG:
* SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3.
*/
#define XFS_BNO_BLOCK(mp) ((xfs_agblock_t)(XFS_AGFL_BLOCK(mp)
+ 1))
#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) +
1))
/*
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*
* (not quite yet, but soon)
*/ */
#define XFS_ALLOC_BLOCK_LEN(mp) XFS_BTREE_SBLOCK_LEN #define XFS_ALLOC_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
/* /*
* Record, key, and pointer address macros for btree blocks. * Record, key, and pointer address macros for btree blocks.
* *
* (note that some of these may appear unused, but they are used in userspa ce) * (note that some of these may appear unused, but they are used in userspa ce)
*/ */
#define XFS_ALLOC_REC_ADDR(mp, block, index) \ #define XFS_ALLOC_REC_ADDR(mp, block, index) \
((xfs_alloc_rec_t *) \ ((xfs_alloc_rec_t *) \
((char *)(block) + \ ((char *)(block) + \
XFS_ALLOC_BLOCK_LEN(mp) + \ XFS_ALLOC_BLOCK_LEN(mp) + \
 End of changes. 3 change blocks. 
50 lines changed or deleted 3 lines changed or added


 xfs_arch.h   xfs_arch.h 
skipping to change at line 50 skipping to change at line 50
#undef XFS_NATIVE_HOST #undef XFS_NATIVE_HOST
#endif #endif
#ifdef XFS_NATIVE_HOST #ifdef XFS_NATIVE_HOST
#define cpu_to_be16(val) ((__force __be16)(__u16)(val)) #define cpu_to_be16(val) ((__force __be16)(__u16)(val))
#define cpu_to_be32(val) ((__force __be32)(__u32)(val)) #define cpu_to_be32(val) ((__force __be32)(__u32)(val))
#define cpu_to_be64(val) ((__force __be64)(__u64)(val)) #define cpu_to_be64(val) ((__force __be64)(__u64)(val))
#define be16_to_cpu(val) ((__force __u16)(__be16)(val)) #define be16_to_cpu(val) ((__force __u16)(__be16)(val))
#define be32_to_cpu(val) ((__force __u32)(__be32)(val)) #define be32_to_cpu(val) ((__force __u32)(__be32)(val))
#define be64_to_cpu(val) ((__force __u64)(__be64)(val)) #define be64_to_cpu(val) ((__force __u64)(__be64)(val))
#define cpu_to_le32(val) ((__force __be32)__swab32((__u32)(val)))
#define le32_to_cpu(val) (__swab32((__force __u32)(__le32)(val)))
#define __constant_cpu_to_le32(val) \
((__force __le32)___constant_swab32((__u32)(val)))
#define __constant_cpu_to_be32(val) \
((__force __be32)(__u32)(val))
#else #else
#define cpu_to_be16(val) ((__force __be16)__swab16((__u16)(val))) #define cpu_to_be16(val) ((__force __be16)__swab16((__u16)(val)))
#define cpu_to_be32(val) ((__force __be32)__swab32((__u32)(val))) #define cpu_to_be32(val) ((__force __be32)__swab32((__u32)(val)))
#define cpu_to_be64(val) ((__force __be64)__swab64((__u64)(val))) #define cpu_to_be64(val) ((__force __be64)__swab64((__u64)(val)))
#define be16_to_cpu(val) (__swab16((__force __u16)(__be16)(val))) #define be16_to_cpu(val) (__swab16((__force __u16)(__be16)(val)))
#define be32_to_cpu(val) (__swab32((__force __u32)(__be32)(val))) #define be32_to_cpu(val) (__swab32((__force __u32)(__be32)(val)))
#define be64_to_cpu(val) (__swab64((__force __u64)(__be64)(val))) #define be64_to_cpu(val) (__swab64((__force __u64)(__be64)(val)))
#define cpu_to_le32(val) ((__force __le32)(__u32)(val))
#define le32_to_cpu(val) ((__force __u32)(__le32)(val))
#define __constant_cpu_to_le32(val) \
((__force __le32)(__u32)(val))
#define __constant_cpu_to_be32(val) \
((__force __be32)___constant_swab32((__u32)(val)))
#endif #endif
static inline void be16_add_cpu(__be16 *a, __s16 b) static inline void be16_add_cpu(__be16 *a, __s16 b)
{ {
*a = cpu_to_be16(be16_to_cpu(*a) + b); *a = cpu_to_be16(be16_to_cpu(*a) + b);
} }
static inline void be32_add_cpu(__be32 *a, __s32 b) static inline void be32_add_cpu(__be32 *a, __s32 b)
{ {
*a = cpu_to_be32(be32_to_cpu(*a) + b); *a = cpu_to_be32(be32_to_cpu(*a) + b);
 End of changes. 2 change blocks. 
0 lines changed or deleted 16 lines changed or added


 xfs_attr_leaf.h   xfs_attr_leaf.h 
/* /*
* Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it would be useful, * This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_ATTR_LEAF_H__ #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
* internal links in the Btree are logical block offsets into the file.
*/
struct attrlist; struct attrlist;
struct attrlist_cursor_kern; struct attrlist_cursor_kern;
struct xfs_attr_list_context; struct xfs_attr_list_context;
struct xfs_dabuf;
struct xfs_da_args; struct xfs_da_args;
struct xfs_da_state; struct xfs_da_state;
struct xfs_da_state_blk; struct xfs_da_state_blk;
struct xfs_inode; struct xfs_inode;
struct xfs_trans; struct xfs_trans;
/*========================================================================
* Attribute structure when equal to XFS_LBSIZE(mp) bytes.
*========================================================================*
/
/*
* 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
* bottom but are not packed. The freemap contains run-length-encoded entr
ies
* 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 name/value area and try again. If we
* still don't have enough space, then we have to split the block. The
* name/value structs (both local and remote versions) must be 32bit aligne
d.
*
* Since we have duplicate hash keys, for each key that matches, compare
* the actual name string. The root and intermediate node search always
* takes the first-in-the-block key match found, so we should only have
* to work "forw"ard. If none matches, continue with the "forw"ard leaf
* nodes until the hash key changes or the attribute name is found.
*
* We store the fact that an attribute is a ROOT/USER/SECURE attribute in
* the leaf_entry. The namespaces are independent only because we also loo
k
* at the namespace bit when we are looking for a matching attribute name.
*
* We also store an "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
* 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.
*/
#define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */
typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */
__be16 base; /* base of free region */
__be16 size; /* length of free region */
} xfs_attr_leaf_map_t;
typedef struct xfs_attr_leaf_hdr { /* constant-structure header block *
/
xfs_da_blkinfo_t info; /* block type, links, etc. */
__be16 count; /* count of active leaf_entry's */
__be16 usedbytes; /* num bytes of names/values stored
*/
__be16 firstused; /* first used byte in name area */
__u8 holes; /* != 0 if blk needs compaction */
__u8 pad1;
xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE];
/* N largest free regions */
} xfs_attr_leaf_hdr_t;
typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */
__be32 hashval; /* hash value of name */
__be16 nameidx; /* index into buffer of name/value *
/
__u8 flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag
*/
__u8 pad2; /* unused pad byte */
} xfs_attr_leaf_entry_t;
typedef struct xfs_attr_leaf_name_local {
__be16 valuelen; /* number of bytes in value */
__u8 namelen; /* length of name bytes */
__u8 nameval[1]; /* name/value bytes */
} xfs_attr_leaf_name_local_t;
typedef struct xfs_attr_leaf_name_remote {
__be32 valueblk; /* block number of value bytes */
__be32 valuelen; /* number of bytes in value */
__u8 namelen; /* length of name bytes */
__u8 name[1]; /* name bytes */
} xfs_attr_leaf_name_remote_t;
typedef struct xfs_attr_leafblock {
xfs_attr_leaf_hdr_t hdr; /* constant-structure header block *
/
xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name *
/
xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf
*/
xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf
*/
} xfs_attr_leafblock_t;
/*
* Flags used in the leaf_entry[i].flags field.
* 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 trusted a
ttrs */
#define XFS_ATTR_SECURE_BIT 2 /* limit access to secure at
trs */
#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_SECURE (1 << XFS_ATTR_SECURE_BIT)
#define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT)
/*
* Conversion macros for converting namespace bits from argument flags
* to ondisk flags.
*/
#define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE)
#define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE)
#define XFS_ATTR_NSP_ONDISK(flags) ((flags) & XFS_ATTR_NSP_ONDISK_MASK)
#define XFS_ATTR_NSP_ARGS(flags) ((flags) & XFS_ATTR_NSP_ARGS_MASK)
#define XFS_ATTR_NSP_ARGS_TO_ONDISK(x) (((x) & ATTR_ROOT ? XFS_ATTR_ROOT :
0) |\
((x) & ATTR_SECURE ? XFS_ATTR_SECUR
E : 0))
#define XFS_ATTR_NSP_ONDISK_TO_ARGS(x) (((x) & XFS_ATTR_ROOT ? ATTR_ROOT :
0) |\
((x) & XFS_ATTR_SECURE ? ATTR_SECUR
E : 0))
/*
* 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))
/*
* Cast typed pointers for "local" and "remote" name/value structs.
*/
static inline xfs_attr_leaf_name_remote_t *
xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
{
return (xfs_attr_leaf_name_remote_t *)
&((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
}
static inline xfs_attr_leaf_name_local_t *
xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
{
return (xfs_attr_leaf_name_local_t *)
&((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
}
static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx
)
{
return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
}
/*
* Calculate total bytes used (including trailing pad for alignment) for
* a "local" name/value structure, a "remote" name/value structure, and
* a pointer which might be either.
*/
static inline int xfs_attr_leaf_entsize_remote(int nlen)
{
return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN -
1);
}
static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen)
{
return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vle
n) +
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN -
1);
}
static inline int xfs_attr_leaf_entsize_local_max(int bsize)
{
return (((bsize) >> 1) + ((bsize) >> 2));
}
/* /*
* Used to keep a list of "remote value" extents when unlinking an inode. * Used to keep a list of "remote value" extents when unlinking an inode.
*/ */
typedef struct xfs_attr_inactive_list { typedef struct xfs_attr_inactive_list {
xfs_dablk_t valueblk; /* block number of value bytes */ xfs_dablk_t valueblk; /* block number of value bytes */
int valuelen; /* number of bytes in value */ int valuelen; /* number of bytes in value */
} xfs_attr_inactive_list_t; } xfs_attr_inactive_list_t;
/*======================================================================== /*========================================================================
* Function prototypes for the kernel. * Function prototypes for the kernel.
skipping to change at line 217 skipping to change at line 53
/* /*
* Internal routines when attribute fork size < XFS_LITINO(mp). * Internal routines when attribute fork size < XFS_LITINO(mp).
*/ */
void xfs_attr_shortform_create(struct xfs_da_args *args); void xfs_attr_shortform_create(struct xfs_da_args *args);
void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
int xfs_attr_shortform_lookup(struct xfs_da_args *args); int xfs_attr_shortform_lookup(struct xfs_da_args *args);
int xfs_attr_shortform_getvalue(struct xfs_da_args *args); int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
int xfs_attr_shortform_remove(struct xfs_da_args *args); int xfs_attr_shortform_remove(struct xfs_da_args *args);
int xfs_attr_shortform_list(struct xfs_attr_list_context *context); int xfs_attr_shortform_list(struct xfs_attr_list_context *context);
int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp ); int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
/* /*
* Internal routines when attribute fork size == XFS_LBSIZE(mp). * Internal routines when attribute fork size == XFS_LBSIZE(mp).
*/ */
int xfs_attr_leaf_to_node(struct xfs_da_args *args); int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp, int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
struct xfs_da_args *args, int forkoff); struct xfs_da_args *args, int forkoff);
int xfs_attr_leaf_clearflag(struct xfs_da_args *args); int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
int xfs_attr_leaf_setflag(struct xfs_da_args *args); int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
int xfs_attr_leaf_flipflags(xfs_da_args_t *args); int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
/* /*
* Routines used for growing the Btree. * Routines used for growing the Btree.
*/ */
int xfs_attr_leaf_split(struct xfs_da_state *state, int xfs_attr3_leaf_split(struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *oldblk,
struct xfs_da_state_blk *newblk); struct xfs_da_state_blk *newblk);
int xfs_attr_leaf_lookup_int(struct xfs_dabuf *leaf, int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_getvalue(struct xfs_dabuf *bp, struct xfs_da_args *arg int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args
s); );
int xfs_attr_leaf_add(struct xfs_dabuf *leaf_buffer, int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_remove(struct xfs_dabuf *leaf_buffer, int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_list_int(struct xfs_dabuf *bp, int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
struct xfs_attr_list_context *context) ; struct xfs_attr_list_context *context) ;
/* /*
* Routines used for shrinking the Btree. * Routines used for shrinking the Btree.
*/ */
int xfs_attr_leaf_toosmall(struct xfs_da_state *state, int *retval); int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
void xfs_attr_leaf_unbalance(struct xfs_da_state *state, void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
struct xfs_da_state_blk *drop_blk, struct xfs_da_state_blk *drop_blk,
struct xfs_da_state_blk *save_blk); struct xfs_da_state_blk *save_blk);
int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *d p); int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode * dp);
/* /*
* Utility routines. * Utility routines.
*/ */
xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
struct xfs_dabuf *leaf2_bp); struct xfs_buf *leaf2_bp);
int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize,
int *local); int *local);
int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bpp);
void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to,
struct xfs_attr_leafblock *from);
void xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to,
struct xfs_attr3_icleaf_hdr *from);
#endif /* __XFS_ATTR_LEAF_H__ */ #endif /* __XFS_ATTR_LEAF_H__ */
 End of changes. 16 change blocks. 
208 lines changed or deleted 28 lines changed or added


 xfs_bmap.h   xfs_bmap.h 
skipping to change at line 65 skipping to change at line 65
typedef struct xfs_bmap_free typedef struct xfs_bmap_free
{ {
xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extent s */ xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extent s */
int xbf_count; /* count of items on list */ int xbf_count; /* count of items on list */
int xbf_low; /* alloc in low mode */ int xbf_low; /* alloc in low mode */
} xfs_bmap_free_t; } xfs_bmap_free_t;
#define XFS_BMAP_MAX_NMAP 4 #define XFS_BMAP_MAX_NMAP 4
/* /*
* Flags for xfs_bmapi * Flags for xfs_bmapi_*
*/ */
#define XFS_BMAPI_WRITE 0x001 /* write operation: allocate #define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed
space */ */
#define XFS_BMAPI_DELAY 0x002 /* delayed write operation * #define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */
/ #define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */
#define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed #define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space
*/ */
#define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */ #define XFS_BMAPI_IGSTATE 0x010 /* Ignore state - */
#define XFS_BMAPI_ATTRFORK 0x010 /* use attribute fork not data */
#define XFS_BMAPI_RSVBLOCKS 0x020 /* OK to alloc. reserved data blocks
*/
#define XFS_BMAPI_PREALLOC 0x040 /* preallocation op: unwritt
en space */
#define XFS_BMAPI_IGSTATE 0x080 /* Ignore state - */
/* combine contig. space */ /* combine contig. space */
#define XFS_BMAPI_CONTIG 0x100 /* must allocate only one ex tent */ #define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */
/* /*
* unwritten extent conversion - this needs write cache flushing and no add itional * unwritten extent conversion - this needs write cache flushing and no add itional
* allocation alignments. When specified with XFS_BMAPI_PREALLOC it convert s * allocation alignments. When specified with XFS_BMAPI_PREALLOC it convert s
* from written to unwritten, otherwise convert from unwritten to written. * from written to unwritten, otherwise convert from unwritten to written.
*/ */
#define XFS_BMAPI_CONVERT 0x200 #define XFS_BMAPI_CONVERT 0x040
#define XFS_BMAPI_STACK_SWITCH 0x080
#define XFS_BMAPI_FLAGS \ #define XFS_BMAPI_FLAGS \
{ XFS_BMAPI_WRITE, "WRITE" }, \
{ XFS_BMAPI_DELAY, "DELAY" }, \
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \ { XFS_BMAPI_ENTIRE, "ENTIRE" }, \
{ XFS_BMAPI_METADATA, "METADATA" }, \ { XFS_BMAPI_METADATA, "METADATA" }, \
{ XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \ { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \
{ XFS_BMAPI_RSVBLOCKS, "RSVBLOCKS" }, \
{ XFS_BMAPI_PREALLOC, "PREALLOC" }, \ { XFS_BMAPI_PREALLOC, "PREALLOC" }, \
{ XFS_BMAPI_IGSTATE, "IGSTATE" }, \ { XFS_BMAPI_IGSTATE, "IGSTATE" }, \
{ XFS_BMAPI_CONTIG, "CONTIG" }, \ { XFS_BMAPI_CONTIG, "CONTIG" }, \
{ XFS_BMAPI_CONVERT, "CONVERT" } { XFS_BMAPI_CONVERT, "CONVERT" }, \
{ XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" }
static inline int xfs_bmapi_aflag(int w) static inline int xfs_bmapi_aflag(int w)
{ {
return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0); return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0);
} }
/* /*
* Special values for xfs_bmbt_irec_t br_startblock field. * Special values for xfs_bmbt_irec_t br_startblock field.
*/ */
#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
{ {
((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
(flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK); (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK);
} }
/* /*
* Argument structure for xfs_bmap_alloc.
*/
typedef struct xfs_bmalloca {
xfs_fsblock_t firstblock; /* i/o first block allocated */
xfs_fsblock_t rval; /* starting block of new extent */
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 *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; /* minimum allocation size (blocks)
*/
xfs_extlen_t minleft; /* amount must be left after alloc
*/
char eof; /* set if allocating past last exten
t */
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 conv; /* overwriting unwritten extents */
} xfs_bmalloca_t;
/*
* Flags for xfs_bmap_add_extent*. * Flags for xfs_bmap_add_extent*.
*/ */
#define BMAP_LEFT_CONTIG (1 << 0) #define BMAP_LEFT_CONTIG (1 << 0)
#define BMAP_RIGHT_CONTIG (1 << 1) #define BMAP_RIGHT_CONTIG (1 << 1)
#define BMAP_LEFT_FILLING (1 << 2) #define BMAP_LEFT_FILLING (1 << 2)
#define BMAP_RIGHT_FILLING (1 << 3) #define BMAP_RIGHT_FILLING (1 << 3)
#define BMAP_LEFT_DELAY (1 << 4) #define BMAP_LEFT_DELAY (1 << 4)
#define BMAP_RIGHT_DELAY (1 << 5) #define BMAP_RIGHT_DELAY (1 << 5)
#define BMAP_LEFT_VALID (1 << 6) #define BMAP_LEFT_VALID (1 << 6)
#define BMAP_RIGHT_VALID (1 << 7) #define BMAP_RIGHT_VALID (1 << 7)
#define BMAP_ATTRFORK (1 << 8) #define BMAP_ATTRFORK (1 << 8)
#define XFS_BMAP_EXT_FLAGS \ #define XFS_BMAP_EXT_FLAGS \
{ BMAP_LEFT_CONTIG, "LC" }, \ { BMAP_LEFT_CONTIG, "LC" }, \
{ BMAP_RIGHT_CONTIG, "RC" }, \ { BMAP_RIGHT_CONTIG, "RC" }, \
{ BMAP_LEFT_FILLING, "LF" }, \ { BMAP_LEFT_FILLING, "LF" }, \
{ BMAP_RIGHT_FILLING, "RF" }, \ { BMAP_RIGHT_FILLING, "RF" }, \
{ BMAP_ATTRFORK, "ATTR" } { BMAP_ATTRFORK, "ATTR" }
/* #ifdef DEBUG
* Add bmap trace insert entries for all the contents of the extent list. void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,
* int whichfork, unsigned long caller_ip);
* Quite excessive tracing. Only do this for debug builds.
*/
#if defined(__KERNEL) && defined(DEBUG)
void
xfs_bmap_trace_exlist(
struct xfs_inode *ip, /* incore inode pointer */
xfs_extnum_t cnt, /* count of entries in list
*/
int whichfork,
unsigned long caller_ip); /* data or attr fork */
#define XFS_BMAP_TRACE_EXLIST(ip,c,w) \ #define XFS_BMAP_TRACE_EXLIST(ip,c,w) \
xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_) xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_)
#else #else
#define XFS_BMAP_TRACE_EXLIST(ip,c,w) #define XFS_BMAP_TRACE_EXLIST(ip,c,w)
#endif #endif
/* int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
* Convert inode from non-attributed to attributed. void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork)
* Must not be in a transaction, ip must not be locked. ;
*/ void xfs_bmap_add_free(xfs_fsblock_t bno, xfs_filblks_t len,
int /* error code */ struct xfs_bmap_free *flist, struct xfs_mount *mp);
xfs_bmap_add_attrfork( void xfs_bmap_cancel(struct xfs_bmap_free *flist);
struct xfs_inode *ip, /* incore inode pointer */ void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
int size, /* space needed for new attribute */ int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
int rsvd); /* flag for reserved block allocatio xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
n */ int xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_fileoff_t *last_block, int whichfork);
/* int xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip,
* Add the extent to the list of extents to be free at transaction end. xfs_fileoff_t *unused, int whichfork);
* The list is maintained sorted (by block number). int xfs_bmap_one_block(struct xfs_inode *ip, int whichfork);
*/ int xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip,
void int whichfork);
xfs_bmap_add_free( int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
xfs_fsblock_t bno, /* fs block number of extent xfs_filblks_t len, struct xfs_bmbt_irec *mval,
*/ int *nmap, int flags);
xfs_filblks_t len, /* length of extent */ int xfs_bmapi_delay(struct xfs_inode *ip, xfs_fileoff_t bno,
xfs_bmap_free_t *flist, /* list of extents */ xfs_filblks_t len, struct xfs_bmbt_irec *mval,
struct xfs_mount *mp); /* mount point structure */ int *nmap, int flags);
int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
/* xfs_fileoff_t bno, xfs_filblks_t len, int flags,
* Routine to clean up the free list data structure when xfs_fsblock_t *firstblock, xfs_extlen_t total,
* an error occurs during a transaction. struct xfs_bmbt_irec *mval, int *nmap,
*/ struct xfs_bmap_free *flist);
void int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_bmap_cancel( xfs_fileoff_t bno, xfs_filblks_t len, int flags,
xfs_bmap_free_t *flist); /* free list to clean up */ xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
struct xfs_bmap_free *flist, int *done);
/* int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,
* Compute and fill in the value of the maximum depth of a bmap btree xfs_extnum_t num);
* in this filesystem. Done once, during mount. uint xfs_default_attroffset(struct xfs_inode *ip);
*/
void
xfs_bmap_compute_maxlevels(
struct xfs_mount *mp, /* file system mount structure */
int whichfork); /* data or attr fork */
/*
* Returns the file-relative block number of the first unused block in the
file.
* This is the lowest-address hole if the file has holes, else the first bl
ock
* past the end of file.
*/
int /* error */
xfs_bmap_first_unused(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
xfs_extlen_t len, /* size of hole to find */
xfs_fileoff_t *unused, /* unused block num */
int whichfork); /* data or attr fork */
/*
* Returns the file-relative block number of the last block + 1 before
* last_block (input value) in the file.
* This is not based on i_size, it is based on the extent list.
* Returns 0 for local files, as they do not have an extent list.
*/
int /* error */
xfs_bmap_last_before(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t *last_block, /* last block */
int whichfork); /* data or attr fork */
/*
* Returns the file-relative block number of the first block past eof in
* the file. This is not based on i_size, it is based on the extent list.
* Returns 0 for local files, as they do not have an extent list.
*/
int /* error */
xfs_bmap_last_offset(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t *unused, /* last block num */
int whichfork); /* data or attr fork */
/*
* Returns whether the selected fork of the inode has exactly one
* block or not. For the data fork we check this matches di_size,
* implying the file's range is 0..bsize-1.
*/
int
xfs_bmap_one_block(
struct xfs_inode *ip, /* incore inode */
int whichfork); /* data or attr fork */
/*
* Read in the extents to iu_extents.
* All inode fields are set up by caller, we just traverse the btree
* and copy the records in.
*/
int /* error */
xfs_bmap_read_extents(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
int whichfork); /* data or attr fork */
/*
* Map file blocks to filesystem blocks.
* File range is given by the bno/len pair.
* Adds blocks to file if a write ("flags & XFS_BMAPI_WRITE" set)
* into a hole or past eof.
* Only allocates blocks from a single allocation group,
* to avoid locking problems.
* The returned value in "firstblock" from the first call in a transaction
* 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").
*/
int /* error */
xfs_bmapi(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t bno, /* starting file offs. mappe
d */
xfs_filblks_t len, /* length to map in file */
int flags, /* XFS_BMAPI_... */
xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs
*/
xfs_extlen_t total, /* total blocks needed */
struct xfs_bmbt_irec *mval, /* output: map values */
int *nmap, /* i/o: mval size/count */
xfs_bmap_free_t *flist); /* i/o: list extents to free
*/
/*
* Map file blocks to filesystem blocks, simple version.
* One block only, read-only.
* For flags, only the XFS_BMAPI_ATTRFORK flag is examined.
* For the other flag values, the effect is as if XFS_BMAPI_METADATA
* was set and all the others were clear.
*/
int /* error */
xfs_bmapi_single(
struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */
int whichfork, /* data or attr fork */
xfs_fsblock_t *fsb, /* output: mapped block */
xfs_fileoff_t bno); /* starting file offs. mappe
d */
/*
* 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
* *done is set.
*/
int /* error */
xfs_bunmapi(
struct xfs_trans *tp, /* transaction pointer */
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, /* XFS_BMAPI_... */
xfs_extnum_t nexts, /* number of extents max */
xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs
*/
xfs_bmap_free_t *flist, /* i/o: list extents to free
*/
int *done); /* set if not done yet */
/*
* Check an extent list, which has just been read, for
* any bit in the extent flag field.
*/
int
xfs_check_nostate_extents(
struct xfs_ifork *ifp,
xfs_extnum_t idx,
xfs_extnum_t num);
uint
xfs_default_attroffset(
struct xfs_inode *ip);
#ifdef __KERNEL__
/*
* 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.
*
* Return 1 if the given transaction was committed and a new one allocated,
* and 0 otherwise.
*/
int /* error */
xfs_bmap_finish(
struct xfs_trans **tp, /* transaction pointer addr
*/
xfs_bmap_free_t *flist, /* i/o: list extents to free
*/
int *committed); /* xact committed or not */
/* bmap to userspace formatter - copy to user & advance pointer */
typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *);
/*
* Get inode's extents as described in bmv, and format for output.
*/
int /* error code */
xfs_getbmap(
xfs_inode_t *ip,
struct getbmapx *bmv, /* user bmap structure */
xfs_bmap_format_t formatter, /* format to user */
void *arg); /* formatter arg */
/*
* Check if the endoff is outside the last extent. If so the caller will gr
ow
* the allocation to a stripe unit boundary
*/
int
xfs_bmap_eof(
struct xfs_inode *ip,
xfs_fileoff_t endoff,
int whichfork,
int *eof);
/*
* Count fsblocks of the given fork.
*/
int
xfs_bmap_count_blocks(
xfs_trans_t *tp,
struct xfs_inode *ip,
int whichfork,
int *count);
int
xfs_bmap_punch_delalloc_range(
struct xfs_inode *ip,
xfs_fileoff_t start_fsb,
xfs_fileoff_t length);
#endif /* __KERNEL__ */
#endif /* __XFS_BMAP_H__ */ #endif /* __XFS_BMAP_H__ */
 End of changes. 10 change blocks. 
303 lines changed or deleted 50 lines changed or added


 xfs_bmap_btree.h   xfs_bmap_btree.h 
skipping to change at line 21 skipping to change at line 21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_BMAP_BTREE_H__ #ifndef __XFS_BMAP_BTREE_H__
#define __XFS_BMAP_BTREE_H__ #define __XFS_BMAP_BTREE_H__
#define XFS_BMAP_MAGIC 0x424d4150 /* 'BMAP' */
struct xfs_btree_cur; struct xfs_btree_cur;
struct xfs_btree_block; struct xfs_btree_block;
struct xfs_mount; struct xfs_mount;
struct xfs_inode; struct xfs_inode;
struct xfs_trans; struct xfs_trans;
/* /*
* Bmap root header, on-disk form only.
*/
typedef struct xfs_bmdr_block {
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
} xfs_bmdr_block_t;
/*
* Bmap btree record and extent descriptor.
* l0:63 is an extent flag (value 1 indicates non-normal).
* l0:9-62 are startoff.
* l0:0-8 and l1:21-63 are startblock.
* l1:0-20 are blockcount.
*/
#define BMBT_EXNTFLAG_BITLEN 1
#define BMBT_STARTOFF_BITLEN 54
#define BMBT_STARTBLOCK_BITLEN 52
#define BMBT_BLOCKCOUNT_BITLEN 21
typedef struct xfs_bmbt_rec {
__be64 l0, l1;
} xfs_bmbt_rec_t;
typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
typedef xfs_bmbt_rec_t xfs_bmdr_rec_t;
typedef struct xfs_bmbt_rec_host {
__uint64_t l0, l1;
} xfs_bmbt_rec_host_t;
/*
* Values and macros for delayed-allocation startblock fields.
*/
#define STARTBLOCKVALBITS 17
#define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20)
#define DSTARTBLOCKMASKBITS (15 + 20)
#define STARTBLOCKMASK \
(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI
TS)
#define DSTARTBLOCKMASK \
(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI
TS)
static inline int isnullstartblock(xfs_fsblock_t x)
{
return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
}
static inline int isnulldstartblock(xfs_dfsbno_t x)
{
return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
}
static inline xfs_fsblock_t nullstartblock(int k)
{
ASSERT(k < (1 << STARTBLOCKVALBITS));
return STARTBLOCKMASK | (k);
}
static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
{
return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
}
/*
* Possible extent formats.
*/
typedef enum {
XFS_EXTFMT_NOSTATE = 0,
XFS_EXTFMT_HASSTATE
} xfs_exntfmt_t;
/*
* Possible extent states.
*/
typedef enum {
XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
XFS_EXT_DMAPI_OFFLINE, XFS_EXT_INVALID
} xfs_exntst_t;
/*
* Extent state and extent format macros. * Extent state and extent format macros.
*/ */
#define XFS_EXTFMT_INODE(x) \ #define XFS_EXTFMT_INODE(x) \
(xfs_sb_version_hasextflgbit(&((x)->i_mount->m_sb)) ? \ (xfs_sb_version_hasextflgbit(&((x)->i_mount->m_sb)) ? \
XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE) XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
/* /*
* Incore version of above.
*/
typedef struct xfs_bmbt_irec
{
xfs_fileoff_t br_startoff; /* starting file offset */
xfs_fsblock_t br_startblock; /* starting block number */
xfs_filblks_t br_blockcount; /* number of blocks */
xfs_exntst_t br_state; /* extent state */
} xfs_bmbt_irec_t;
/*
* Key structure for non-leaf levels of the tree.
*/
typedef struct xfs_bmbt_key {
__be64 br_startoff; /* starting file offset */
} xfs_bmbt_key_t, xfs_bmdr_key_t;
/* btree pointer type */
typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;
/*
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*
* (not quite yet, but soon)
*/ */
#define XFS_BMBT_BLOCK_LEN(mp) XFS_BTREE_LBLOCK_LEN #define XFS_BMBT_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN)
#define XFS_BMBT_REC_ADDR(mp, block, index) \ #define XFS_BMBT_REC_ADDR(mp, block, index) \
((xfs_bmbt_rec_t *) \ ((xfs_bmbt_rec_t *) \
((char *)(block) + \ ((char *)(block) + \
XFS_BMBT_BLOCK_LEN(mp) + \ XFS_BMBT_BLOCK_LEN(mp) + \
((index) - 1) * sizeof(xfs_bmbt_rec_t))) ((index) - 1) * sizeof(xfs_bmbt_rec_t)))
#define XFS_BMBT_KEY_ADDR(mp, block, index) \ #define XFS_BMBT_KEY_ADDR(mp, block, index) \
((xfs_bmbt_key_t *) \ ((xfs_bmbt_key_t *) \
((char *)(block) + \ ((char *)(block) + \
skipping to change at line 189 skipping to change at line 87
(maxrecs) * sizeof(xfs_bmdr_key_t) + \ (maxrecs) * sizeof(xfs_bmdr_key_t) + \
((index) - 1) * sizeof(xfs_bmdr_ptr_t))) ((index) - 1) * sizeof(xfs_bmdr_ptr_t)))
/* /*
* These are to be used when we know the size of the block and * These are to be used when we know the size of the block and
* we don't have a cursor. * we don't have a cursor.
*/ */
#define XFS_BMAP_BROOT_PTR_ADDR(mp, bb, i, sz) \ #define XFS_BMAP_BROOT_PTR_ADDR(mp, bb, i, sz) \
XFS_BMBT_PTR_ADDR(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0)) XFS_BMBT_PTR_ADDR(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0))
#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ #define XFS_BMAP_BROOT_SPACE_CALC(mp, nrecs) \
(int)(XFS_BTREE_LBLOCK_LEN + \ (int)(XFS_BMBT_BLOCK_LEN(mp) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))) ) ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))) )
#define XFS_BMAP_BROOT_SPACE(bb) \ #define XFS_BMAP_BROOT_SPACE(mp, bb) \
(XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs))) (XFS_BMAP_BROOT_SPACE_CALC(mp, be16_to_cpu((bb)->bb_numrecs)))
#define XFS_BMDR_SPACE_CALC(nrecs) \ #define XFS_BMDR_SPACE_CALC(nrecs) \
(int)(sizeof(xfs_bmdr_block_t) + \ (int)(sizeof(xfs_bmdr_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))) ) ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))) )
#define XFS_BMAP_BMDR_SPACE(bb) \
(XFS_BMDR_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
/* /*
* Maximum number of bmap btree levels. * Maximum number of bmap btree levels.
*/ */
#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)]) #define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
/* /*
* Prototypes for xfs_bmap.c to call. * Prototypes for xfs_bmap.c to call.
*/ */
extern void xfs_bmdr_to_bmbt(struct xfs_mount *, xfs_bmdr_block_t *, int, extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int,
struct xfs_btree_block *, int); struct xfs_btree_block *, int);
extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r);
extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);
extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r); extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r);
extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r); extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r);
extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
skipping to change at line 236 skipping to change at line 136
extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int, extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
xfs_bmdr_block_t *, int); xfs_bmdr_block_t *, int);
extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level); extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level);
extern int xfs_bmdr_maxrecs(struct xfs_mount *, int blocklen, int leaf); extern int xfs_bmdr_maxrecs(struct xfs_mount *, int blocklen, int leaf);
extern int xfs_bmbt_maxrecs(struct xfs_mount *, int blocklen, int leaf); extern int xfs_bmbt_maxrecs(struct xfs_mount *, int blocklen, int leaf);
extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip
,
int whichfork, xfs_ino_t new_owner,
struct list_head *buffer_list);
extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *, extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
struct xfs_trans *, struct xfs_inode *, int); struct xfs_trans *, struct xfs_inode *, int);
#endif /* __XFS_BMAP_BTREE_H__ */ #endif /* __XFS_BMAP_BTREE_H__ */
 End of changes. 10 change blocks. 
112 lines changed or deleted 15 lines changed or added


 xfs_btree.h   xfs_btree.h 
skipping to change at line 42 skipping to change at line 42
#define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi) #define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi)
#define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi) #define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi)
#define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi) #define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi)
#define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi) #define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi)
#define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi) #define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi)
#define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi) #define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi)
#define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) #define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi)
/* /*
* Generic btree header.
*
* This is a combination of the actual format used on disk for short and lo
ng
* format btrees. The first three fields are shared by both format, but
* the pointers are different and should be used with care.
*
* To get the size of the actual short or long form headers please use
* the size macros below. Never use sizeof(xfs_btree_block).
*/
struct xfs_btree_block {
__be32 bb_magic; /* magic number for block type */
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
union {
struct {
__be32 bb_leftsib;
__be32 bb_rightsib;
} s; /* short form pointers */
struct {
__be64 bb_leftsib;
__be64 bb_rightsib;
} l; /* long form pointers */
} bb_u; /* rest */
};
#define XFS_BTREE_SBLOCK_LEN 16 /* size of a short form block */
#define XFS_BTREE_LBLOCK_LEN 24 /* size of a long form block */
/*
* Generic key, ptr and record wrapper structures.
*
* These are disk format structures, and are converted where necessary
* by the btree specific code that needs to interpret them.
*/
union xfs_btree_ptr {
__be32 s; /* short form ptr */
__be64 l; /* long form ptr */
};
union xfs_btree_key {
xfs_bmbt_key_t bmbt;
xfs_bmdr_key_t bmbr; /* bmbt root block */
xfs_alloc_key_t alloc;
xfs_inobt_key_t inobt;
};
union xfs_btree_rec {
xfs_bmbt_rec_t bmbt;
xfs_bmdr_rec_t bmbr; /* bmbt root block */
xfs_alloc_rec_t alloc;
xfs_inobt_rec_t inobt;
};
/*
* For logging record fields. * For logging record fields.
*/ */
#define XFS_BB_MAGIC 0x01 #define XFS_BB_MAGIC (1 << 0)
#define XFS_BB_LEVEL 0x02 #define XFS_BB_LEVEL (1 << 1)
#define XFS_BB_NUMRECS 0x04 #define XFS_BB_NUMRECS (1 << 2)
#define XFS_BB_LEFTSIB 0x08 #define XFS_BB_LEFTSIB (1 << 3)
#define XFS_BB_RIGHTSIB 0x10 #define XFS_BB_RIGHTSIB (1 << 4)
#define XFS_BB_BLKNO (1 << 5)
#define XFS_BB_LSN (1 << 6)
#define XFS_BB_UUID (1 << 7)
#define XFS_BB_OWNER (1 << 8)
#define XFS_BB_NUM_BITS 5 #define XFS_BB_NUM_BITS 5
#define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) #define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
#define XFS_BB_NUM_BITS_CRC 9
/* #define XFS_BB_ALL_BITS_CRC ((1 << XFS_BB_NUM_BITS_CRC) - 1)
* Magic numbers for btree blocks.
*/
extern const __uint32_t xfs_magics[];
/* /*
* Generic stats interface * Generic stats interface
*/ */
#define __XFS_BTREE_STATS_INC(type, stat) \ #define __XFS_BTREE_STATS_INC(type, stat) \
XFS_STATS_INC(xs_ ## type ## _2_ ## stat) XFS_STATS_INC(xs_ ## type ## _2_ ## stat)
#define XFS_BTREE_STATS_INC(cur, stat) \ #define XFS_BTREE_STATS_INC(cur, stat) \
do { \ do { \
switch (cur->bc_btnum) { \ switch (cur->bc_btnum) { \
case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \ case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \
skipping to change at line 190 skipping to change at line 137
union xfs_btree_rec *rec); union xfs_btree_rec *rec);
void (*init_rec_from_cur)(struct xfs_btree_cur *cur, void (*init_rec_from_cur)(struct xfs_btree_cur *cur,
union xfs_btree_rec *rec); union xfs_btree_rec *rec);
void (*init_ptr_from_cur)(struct xfs_btree_cur *cur, void (*init_ptr_from_cur)(struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr); union xfs_btree_ptr *ptr);
/* difference between key value and cursor value */ /* difference between key value and cursor value */
__int64_t (*key_diff)(struct xfs_btree_cur *cur, __int64_t (*key_diff)(struct xfs_btree_cur *cur,
union xfs_btree_key *key); union xfs_btree_key *key);
#ifdef DEBUG const struct xfs_buf_ops *buf_ops;
#if defined(DEBUG) || defined(XFS_WARN)
/* check that k1 is lower than k2 */ /* check that k1 is lower than k2 */
int (*keys_inorder)(struct xfs_btree_cur *cur, int (*keys_inorder)(struct xfs_btree_cur *cur,
union xfs_btree_key *k1, union xfs_btree_key *k1,
union xfs_btree_key *k2); union xfs_btree_key *k2);
/* check that r1 is lower than r2 */ /* check that r1 is lower than r2 */
int (*recs_inorder)(struct xfs_btree_cur *cur, int (*recs_inorder)(struct xfs_btree_cur *cur,
union xfs_btree_rec *r1, union xfs_btree_rec *r1,
union xfs_btree_rec *r2); union xfs_btree_rec *r2);
#endif #endif
skipping to change at line 274 skipping to change at line 223
char flags; /* flags */ char flags; /* flags */
#define XFS_BTCUR_BPRV_WASDEL 1 /* was delay ed */ #define XFS_BTCUR_BPRV_WASDEL 1 /* was delay ed */
} b; } b;
} bc_private; /* per-btree type data */ } bc_private; /* per-btree type data */
} xfs_btree_cur_t; } xfs_btree_cur_t;
/* cursor flags */ /* cursor flags */
#define XFS_BTREE_LONG_PTRS (1<<0) /* pointers are 64bits long */ #define XFS_BTREE_LONG_PTRS (1<<0) /* pointers are 64bits long */
#define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be varia ble size */ #define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be varia ble size */
#define XFS_BTREE_LASTREC_UPDATE (1<<2) /* track last rec externally */ #define XFS_BTREE_LASTREC_UPDATE (1<<2) /* track last rec externally */
#define XFS_BTREE_CRC_BLOCKS (1<<3) /* uses extended btree block s */
#define XFS_BTREE_NOERROR 0 #define XFS_BTREE_NOERROR 0
#define XFS_BTREE_ERROR 1 #define XFS_BTREE_ERROR 1
/* /*
* Convert from buffer to btree block header. * Convert from buffer to btree block header.
*/ */
#define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)XFS_BUF_P TR(bp)) #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)((bp)->b_ addr))
/* /*
* Check that block header is ok. * Check that block header is ok.
*/ */
int int
xfs_btree_check_block( xfs_btree_check_block(
struct xfs_btree_cur *cur, /* btree cursor */ struct xfs_btree_cur *cur, /* btree cursor */
struct xfs_btree_block *block, /* generic btree block pointer */ struct xfs_btree_block *block, /* generic btree block pointer */
int level, /* level of the btree block */ int level, /* level of the btree block */
struct xfs_buf *bp); /* buffer containing block, if any * / struct xfs_buf *bp); /* buffer containing block, if any * /
skipping to change at line 373 skipping to change at line 323
* Get a buffer for the block, return it read in. * Get a buffer for the block, return it read in.
* Long-form addressing. * Long-form addressing.
*/ */
int /* error */ int /* error */
xfs_btree_read_bufl( xfs_btree_read_bufl(
struct xfs_mount *mp, /* file system mount point */ struct xfs_mount *mp, /* file system mount point */
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_fsblock_t fsbno, /* file system block number */ xfs_fsblock_t fsbno, /* file system block number */
uint lock, /* lock flags for read_buf */ uint lock, /* lock flags for read_buf */
struct xfs_buf **bpp, /* buffer for fsbno */ struct xfs_buf **bpp, /* buffer for fsbno */
int refval);/* ref count value for buffer */ int refval, /* ref count value for buffer */
const struct xfs_buf_ops *ops);
/* /*
* Read-ahead the block, don't wait for it, don't return a buffer. * Read-ahead the block, don't wait for it, don't return a buffer.
* Long-form addressing. * Long-form addressing.
*/ */
void /* error */ void /* error */
xfs_btree_reada_bufl( xfs_btree_reada_bufl(
struct xfs_mount *mp, /* file system mount point */ struct xfs_mount *mp, /* file system mount point */
xfs_fsblock_t fsbno, /* file system block number */ xfs_fsblock_t fsbno, /* file system block number */
xfs_extlen_t count); /* count of filesystem blocks */ xfs_extlen_t count, /* count of filesystem blocks */
const struct xfs_buf_ops *ops);
/* /*
* Read-ahead the block, don't wait for it, don't return a buffer. * Read-ahead the block, don't wait for it, don't return a buffer.
* Short-form addressing. * Short-form addressing.
*/ */
void /* error */ void /* error */
xfs_btree_reada_bufs( xfs_btree_reada_bufs(
struct xfs_mount *mp, /* file system mount point */ struct xfs_mount *mp, /* file system mount point */
xfs_agnumber_t agno, /* allocation group number */ xfs_agnumber_t agno, /* allocation group number */
xfs_agblock_t agbno, /* allocation group block 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 */
const struct xfs_buf_ops *ops);
/*
* Initialise a new btree block header
*/
void
xfs_btree_init_block(
struct xfs_mount *mp,
struct xfs_buf *bp,
__u32 magic,
__u16 level,
__u16 numrecs,
__u64 owner,
unsigned int flags);
void
xfs_btree_init_block_int(
struct xfs_mount *mp,
struct xfs_btree_block *buf,
xfs_daddr_t blkno,
__u32 magic,
__u16 level,
__u16 numrecs,
__u64 owner,
unsigned int flags);
/* /*
* Common btree core entry points. * Common btree core entry points.
*/ */
int xfs_btree_increment(struct xfs_btree_cur *, int, int *); int xfs_btree_increment(struct xfs_btree_cur *, int, int *);
int xfs_btree_decrement(struct xfs_btree_cur *, int, int *); int xfs_btree_decrement(struct xfs_btree_cur *, int, int *);
int xfs_btree_lookup(struct xfs_btree_cur *, xfs_lookup_t, int *); int xfs_btree_lookup(struct xfs_btree_cur *, xfs_lookup_t, int *);
int xfs_btree_update(struct xfs_btree_cur *, union xfs_btree_rec *); int xfs_btree_update(struct xfs_btree_cur *, union xfs_btree_rec *);
int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *); int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *);
int xfs_btree_insert(struct xfs_btree_cur *, int *); int xfs_btree_insert(struct xfs_btree_cur *, int *);
int xfs_btree_delete(struct xfs_btree_cur *, int *); int xfs_btree_delete(struct xfs_btree_cur *, int *);
int xfs_btree_get_rec(struct xfs_btree_cur *, union xfs_btree_rec **, int * ); int xfs_btree_get_rec(struct xfs_btree_cur *, union xfs_btree_rec **, int * );
int xfs_btree_change_owner(struct xfs_btree_cur *cur, __uint64_t new_owner,
struct list_head *buffer_list);
/*
* btree block CRC helpers
*/
void xfs_btree_lblock_calc_crc(struct xfs_buf *);
bool xfs_btree_lblock_verify_crc(struct xfs_buf *);
void xfs_btree_sblock_calc_crc(struct xfs_buf *);
bool xfs_btree_sblock_verify_crc(struct xfs_buf *);
/* /*
* Internal btree helpers also used by xfs_bmap.c. * Internal btree helpers also used by xfs_bmap.c.
*/ */
void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int); void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int);
void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int) ; void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int) ;
/* /*
* Helpers. * Helpers.
*/ */
 End of changes. 10 change blocks. 
70 lines changed or deleted 56 lines changed or added


 xfs_da_btree.h   xfs_da_btree.h 
/* /*
* Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* This program is distributed in the hope that it would be useful, * This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_DA_BTREE_H__ #ifndef __XFS_DA_BTREE_H__
#define __XFS_DA_BTREE_H__ #define __XFS_DA_BTREE_H__
struct xfs_buf;
struct xfs_bmap_free; struct xfs_bmap_free;
struct xfs_inode; struct xfs_inode;
struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct zone; struct zone;
/*======================================================================== /*========================================================================
* Directory Structure when greater than XFS_LBSIZE(mp) bytes.
*========================================================================*
/
/*
* This structure is common to both leaf nodes and non-leaf nodes in the Bt
ree.
*
* Is is used to manage a doubly linked list of all blocks at the same
* level in the Btree, and to identify which type of block this is.
*/
#define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */
#define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks
*/
#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf si
ngle blks */
#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf mu
lti blks */
typedef struct xfs_da_blkinfo {
__be32 forw; /* previous block in list */
__be32 back; /* following block in list *
/
__be16 magic; /* validity check on block *
/
__be16 pad; /* unused */
} xfs_da_blkinfo_t;
/*
* This is the structure of the root and intermediate nodes in the Btree.
* The leaf nodes are defined above.
*
* Entries are not packed.
*
* 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 */
typedef struct xfs_da_intnode {
struct xfs_da_node_hdr { /* constant-structure header block *
/
xfs_da_blkinfo_t info; /* block type, links, etc. */
__be16 count; /* count of active entries */
__be16 level; /* level above leaves (leaf == 0) */
} hdr;
struct xfs_da_node_entry {
__be32 hashval; /* hash value for this descendant */
__be32 before; /* Btree block before this key */
} btree[1]; /* variable sized array of keys */
} xfs_da_intnode_t;
typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
typedef struct xfs_da_node_entry xfs_da_node_entry_t;
#define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize
/*========================================================================
* Btree searching and modification structure definitions. * Btree searching and modification structure definitions.
*========================================================================* / *========================================================================* /
/* /*
* Search comparison results * Search comparison results
*/ */
enum xfs_dacmp { enum xfs_dacmp {
XFS_CMP_DIFFERENT, /* names are completely different */ XFS_CMP_DIFFERENT, /* names are completely different */
XFS_CMP_EXACT, /* names are exactly the same */ XFS_CMP_EXACT, /* names are exactly the same */
XFS_CMP_CASE /* names are same but differ in case */ XFS_CMP_CASE /* names are same but differ in case */
}; };
/* /*
* Structure to ease passing around component names. * Structure to ease passing around component names.
*/ */
typedef struct xfs_da_args { typedef struct xfs_da_args {
const __uint8_t *name; /* string (maybe not NULL terminated ) */ const __uint8_t *name; /* string (maybe not NULL terminated ) */
int namelen; /* length of string (maybe no NULL) */ int namelen; /* length of string (maybe no NULL) */
__uint8_t filetype; /* filetype of inode for directories */
__uint8_t *value; /* set of bytes (maybe contain NULLs ) */ __uint8_t *value; /* set of bytes (maybe contain NULLs ) */
int valuelen; /* length of value */ int valuelen; /* length of value */
int flags; /* argument flags (eg: ATTR_NOCREATE ) */ int flags; /* argument flags (eg: ATTR_NOCREATE ) */
xfs_dahash_t hashval; /* hash value of name */ xfs_dahash_t hashval; /* hash value of name */
xfs_ino_t inumber; /* input/output inode number */ xfs_ino_t inumber; /* input/output inode number */
struct xfs_inode *dp; /* directory inode to manipulate */ struct xfs_inode *dp; /* directory inode to manipulate */
xfs_fsblock_t *firstblock; /* ptr to firstblock for bmap calls */ xfs_fsblock_t *firstblock; /* ptr to firstblock for bmap calls */
struct xfs_bmap_free *flist; /* ptr to freelist for bmap_finish * / struct xfs_bmap_free *flist; /* ptr to freelist for bmap_finish * /
struct xfs_trans *trans; /* current trans (changes over time) */ struct xfs_trans *trans; /* current trans (changes over time) */
xfs_extlen_t total; /* total blocks needed, for 1st bmap */ xfs_extlen_t total; /* total blocks needed, for 1st bmap */
skipping to change at line 136 skipping to change at line 87
#define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */ #define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
#define XFS_DA_OP_FLAGS \ #define XFS_DA_OP_FLAGS \
{ XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
{ XFS_DA_OP_RENAME, "RENAME" }, \ { XFS_DA_OP_RENAME, "RENAME" }, \
{ XFS_DA_OP_ADDNAME, "ADDNAME" }, \ { XFS_DA_OP_ADDNAME, "ADDNAME" }, \
{ XFS_DA_OP_OKNOENT, "OKNOENT" }, \ { XFS_DA_OP_OKNOENT, "OKNOENT" }, \
{ XFS_DA_OP_CILOOKUP, "CILOOKUP" } { XFS_DA_OP_CILOOKUP, "CILOOKUP" }
/* /*
* Structure to describe buffer(s) for a block.
* 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
* same place as the b_addr field for the buffer, else to kmem_alloced memo
ry.
*/
typedef struct xfs_dabuf {
int nbuf; /* number of buffer pointers present
*/
short dirty; /* data needs to be copied back */
short bbcount; /* how large is data in bbs */
void *data; /* pointer for buffers' data */
#ifdef XFS_DABUF_DEBUG
inst_t *ra; /* return address of caller to make
*/
struct xfs_dabuf *next; /* next in global chain */
struct xfs_dabuf *prev; /* previous in global chain */
struct xfs_buftarg *target; /* device for buffer */
xfs_daddr_t blkno; /* daddr first in bps[0] */
#endif
struct xfs_buf *bps[1]; /* actually nbuf of these */
} xfs_dabuf_t;
#define XFS_DA_BUF_SIZE(n) \
(sizeof(xfs_dabuf_t) + sizeof(struct xfs_buf *) * ((n) - 1))
#ifdef XFS_DABUF_DEBUG
extern xfs_dabuf_t *xfs_dabuf_global_list;
#endif
/*
* Storage for holding state during Btree searches and split/join ops. * Storage for holding state during Btree searches and split/join ops.
* *
* Only need space for 5 intermediate nodes. With a minimum of 62-way * Only need space for 5 intermediate nodes. With a minimum of 62-way
* fanout to the Btree, we can support over 900 million directory blocks, * fanout to the Btree, we can support over 900 million directory blocks,
* which is slightly more than enough. * which is slightly more than enough.
*/ */
typedef struct xfs_da_state_blk { typedef struct xfs_da_state_blk {
xfs_dabuf_t *bp; /* buffer containing block */ struct xfs_buf *bp; /* buffer containing block */
xfs_dablk_t blkno; /* filesystem blkno of buffer */ xfs_dablk_t blkno; /* filesystem blkno of buffer */
xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */ xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
int index; /* relevant index into block */ int index; /* relevant index into block */
xfs_dahash_t hashval; /* last hash value in block */ xfs_dahash_t hashval; /* last hash value in block */
int magic; /* blk's magic number, ie: blk type */ int magic; /* blk's magic number, ie: blk type */
} xfs_da_state_blk_t; } xfs_da_state_blk_t;
typedef struct xfs_da_state_path { typedef struct xfs_da_state_path {
int active; /* number of active levels * / int active; /* number of active levels * /
xfs_da_state_blk_t blk[XFS_DA_NODE_MAXDEPTH]; xfs_da_state_blk_t blk[XFS_DA_NODE_MAXDEPTH];
skipping to change at line 223 skipping to change at line 145
const unsigned char *, int); const unsigned char *, int);
}; };
/*======================================================================== /*========================================================================
* Function prototypes. * Function prototypes.
*========================================================================* / *========================================================================* /
/* /*
* Routines used for growing the Btree. * Routines used for growing the Btree.
*/ */
int xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level int xfs_da3_node_create(struct xfs_da_args *args, xfs_dablk_t blkno,
, int level, struct xfs_buf **bpp, int whichfork);
xfs_dabuf_t **bpp, int whichfork); int xfs_da3_split(xfs_da_state_t *state);
int xfs_da_split(xfs_da_state_t *state);
/* /*
* Routines used for shrinking the Btree. * Routines used for shrinking the Btree.
*/ */
int xfs_da_join(xfs_da_state_t *state); int xfs_da3_join(xfs_da_state_t *state);
void xfs_da_fixhashpath(xfs_da_state_t *state, void xfs_da3_fixhashpath(struct xfs_da_state *state,
xfs_da_state_path_t *path_to_to_fi struct xfs_da_state_path *path_to_to_fix);
x);
/* /*
* Routines used for finding things in the Btree. * Routines used for finding things in the Btree.
*/ */
int xfs_da_node_lookup_int(xfs_da_state_t *state, int *result); int xfs_da3_node_lookup_int(xfs_da_state_t *state, int *result);
int xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, int xfs_da3_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
int forward, int release, int *resu lt); int forward, int release, int *resu lt);
/* /*
* Utility routines. * Utility routines.
*/ */
int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, int xfs_da3_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
xfs_da_state_blk_t *new_blk); xfs_da_state_blk_t *new_blk);
int xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bpp, int which_fork);
/* /*
* Utility routines. * Utility routines.
*/ */
int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno); int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
int count);
int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp, int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
xfs_dabuf_t **bp, int whichfork); struct xfs_buf **bp, int whichfork);
int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
xfs_dabuf_t **bpp, int whichfork); struct xfs_buf **bpp, int whichfork,
const struct xfs_buf_ops *ops);
xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode * dp, xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode * dp,
xfs_dablk_t bno, int whichfork); xfs_dablk_t bno, xfs_daddr_t mapped_bno,
int whichfork, const struct xfs_buf_ops *ops
);
int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
xfs_dabuf_t *dead_buf); struct xfs_buf *dead_buf);
uint xfs_da_hashname(const __uint8_t *name_string, int name_length); uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args, enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
const unsigned char *name, int len); const unsigned char *name, int len);
xfs_da_state_t *xfs_da_state_alloc(void); xfs_da_state_t *xfs_da_state_alloc(void);
void xfs_da_state_free(xfs_da_state_t *state); void xfs_da_state_free(xfs_da_state_t *state);
void xfs_da_buf_done(xfs_dabuf_t *dabuf);
void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
uint last);
void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
void xfs_da_binval(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);
extern struct kmem_zone *xfs_da_state_zone; extern struct kmem_zone *xfs_da_state_zone;
extern struct kmem_zone *xfs_dabuf_zone;
extern const struct xfs_nameops xfs_default_nameops; extern const struct xfs_nameops xfs_default_nameops;
#endif /* __XFS_DA_BTREE_H__ */ #endif /* __XFS_DA_BTREE_H__ */
 End of changes. 19 change blocks. 
115 lines changed or deleted 24 lines changed or added


 xfs_dinode.h   xfs_dinode.h 
skipping to change at line 22 skipping to change at line 22
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_DINODE_H__ #ifndef __XFS_DINODE_H__
#define __XFS_DINODE_H__ #define __XFS_DINODE_H__
#define XFS_DINODE_MAGIC 0x494e /* 'IN' */ #define XFS_DINODE_MAGIC 0x494e /* 'IN' */
#define XFS_DINODE_GOOD_VERSION(v) (((v) == 1 || (v) == 2)) #define XFS_DINODE_GOOD_VERSION(v) ((v) >= 1 && (v) <= 3)
typedef struct xfs_timestamp { typedef struct xfs_timestamp {
__be32 t_sec; /* timestamp seconds */ __be32 t_sec; /* timestamp seconds */
__be32 t_nsec; /* timestamp nanoseconds */ __be32 t_nsec; /* timestamp nanoseconds */
} xfs_timestamp_t; } xfs_timestamp_t;
/* /*
* On-disk inode structure. * On-disk inode structure.
* *
* This is just the header or "dinode core", the inode is expanded to fill a * This is just the header or "dinode core", the inode is expanded to fill a
* variable size the leftover area split into a data and an attribute fork. * variable size the leftover area split into a data and an attribute fork.
* The format of the data and attribute fork depends on the format of the * The format of the data and attribute fork depends on the format of the
* inode as indicated by di_format and di_aformat. To access the data and * inode as indicated by di_format and di_aformat. To access the data and
* attribute use the XFS_DFORK_PTR, XFS_DFORK_DPTR, and XFS_DFORK_PTR macro s * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macr os
* below. * below.
* *
* There is a very similar struct icdinode in xfs_inode which matches the * There is a very similar struct icdinode in xfs_inode which matches the
* layout of the first 96 bytes of this structure, but is kept in native * layout of the first 96 bytes of this structure, but is kept in native
* format instead of big endian. * format instead of big endian.
*
* Note: di_flushiter is only used by v1/2 inodes - it's effectively a zero
ed
* padding field for v3 inodes.
*/ */
typedef struct xfs_dinode { typedef struct xfs_dinode {
__be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */ __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
__be16 di_mode; /* mode and type of file */ __be16 di_mode; /* mode and type of file */
__u8 di_version; /* inode version */ __u8 di_version; /* inode version */
__u8 di_format; /* format of di_c data */ __u8 di_format; /* format of di_c data */
__be16 di_onlink; /* old number of links to file */ __be16 di_onlink; /* old number of links to file */
__be32 di_uid; /* owner's user id */ __be32 di_uid; /* owner's user id */
__be32 di_gid; /* owner's group id */ __be32 di_gid; /* owner's group id */
__be32 di_nlink; /* number of links to file */ __be32 di_nlink; /* number of links to file */
skipping to change at line 73 skipping to change at line 76
__be16 di_anextents; /* number of extents in attribute fo rk*/ __be16 di_anextents; /* number of extents in attribute fo rk*/
__u8 di_forkoff; /* attr fork offs, <<3 for 64b align */ __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
__s8 di_aformat; /* format of attr fork's data */ __s8 di_aformat; /* format of attr fork's data */
__be32 di_dmevmask; /* DMIG event mask */ __be32 di_dmevmask; /* DMIG event mask */
__be16 di_dmstate; /* DMIG state info */ __be16 di_dmstate; /* DMIG state info */
__be16 di_flags; /* random flags, XFS_DIFLAG_... */ __be16 di_flags; /* random flags, XFS_DIFLAG_... */
__be32 di_gen; /* generation number */ __be32 di_gen; /* generation number */
/* di_next_unlinked is the only non-core field in the old dinode */ /* di_next_unlinked is the only non-core field in the old dinode */
__be32 di_next_unlinked;/* agi unlinked list ptr */ __be32 di_next_unlinked;/* agi unlinked list ptr */
} __attribute__((packed)) xfs_dinode_t;
/* start of the extended dinode, writable fields */
__le32 di_crc; /* CRC of the inode */
__be64 di_changecount; /* number of attribute changes */
__be64 di_lsn; /* flush sequence */
__be64 di_flags2; /* more random flags */
__u8 di_pad2[16]; /* more padding for future expansion
*/
/* fields only written to during inode creation */
xfs_timestamp_t di_crtime; /* time created */
__be64 di_ino; /* inode number */
uuid_t di_uuid; /* UUID of the filesystem */
/* structure must be padded to 64 bit alignment */
} xfs_dinode_t;
#define XFS_DINODE_CRC_OFF offsetof(struct xfs_dinode, di_crc)
#define DI_MAX_FLUSH 0xffff #define DI_MAX_FLUSH 0xffff
/* /*
* Size of the core inode on disk. Version 1 and 2 inodes have
* the same size, but version 3 has grown a few additional fields.
*/
static inline uint xfs_dinode_size(int version)
{
if (version == 3)
return sizeof(struct xfs_dinode);
return offsetof(struct xfs_dinode, di_crc);
}
/*
* The 32 bit link count in the inode theoretically maxes out at UINT_MAX. * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
* Since the pathconf interface is signed, we use 2^31 - 1 instead. * 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_MA X. * The old inode format had a 16 bit link count, so its maximum is USHRT_MA X.
*/ */
#define XFS_MAXLINK ((1U << 31) - 1U) #define XFS_MAXLINK ((1U << 31) - 1U)
#define XFS_MAXLINK_1 65535U #define XFS_MAXLINK_1 65535U
/* /*
* Values for di_format * Values for di_format
*/ */
skipping to change at line 107 skipping to change at line 137
* Inode minimum and maximum sizes. * Inode minimum and maximum sizes.
*/ */
#define XFS_DINODE_MIN_LOG 8 #define XFS_DINODE_MIN_LOG 8
#define XFS_DINODE_MAX_LOG 11 #define XFS_DINODE_MAX_LOG 11
#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG) #define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)
#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG) #define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)
/* /*
* Inode size for given fs. * Inode size for given fs.
*/ */
#define XFS_LITINO(mp) \ #define XFS_LITINO(mp, version) \
((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode))) ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))
#define XFS_BROOT_SIZE_ADJ \
(XFS_BTREE_LBLOCK_LEN - sizeof(xfs_bmdr_block_t))
/* /*
* Inode data & attribute fork sizes, per inode. * Inode data & attribute fork sizes, per inode.
*/ */
#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0) #define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0)
#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3)) #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3))
#define XFS_DFORK_DSIZE(dip,mp) \ #define XFS_DFORK_DSIZE(dip,mp) \
(XFS_DFORK_Q(dip) ? \ (XFS_DFORK_Q(dip) ? \
XFS_DFORK_BOFF(dip) : \ XFS_DFORK_BOFF(dip) : \
XFS_LITINO(mp)) XFS_LITINO(mp, (dip)->di_version))
#define XFS_DFORK_ASIZE(dip,mp) \ #define XFS_DFORK_ASIZE(dip,mp) \
(XFS_DFORK_Q(dip) ? \ (XFS_DFORK_Q(dip) ? \
XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \ XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
0) 0)
#define XFS_DFORK_SIZE(dip,mp,w) \ #define XFS_DFORK_SIZE(dip,mp,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
XFS_DFORK_DSIZE(dip, mp) : \ XFS_DFORK_DSIZE(dip, mp) : \
XFS_DFORK_ASIZE(dip, mp)) XFS_DFORK_ASIZE(dip, mp))
/* /*
* Return pointers to the data or attribute forks. * Return pointers to the data or attribute forks.
*/ */
#define XFS_DFORK_DPTR(dip) \ #define XFS_DFORK_DPTR(dip) \
((char *)(dip) + sizeof(struct xfs_dinode)) ((char *)dip + xfs_dinode_size(dip->di_version))
#define XFS_DFORK_APTR(dip) \ #define XFS_DFORK_APTR(dip) \
(XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip)) (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))
#define XFS_DFORK_PTR(dip,w) \ #define XFS_DFORK_PTR(dip,w) \
((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
#define XFS_DFORK_FORMAT(dip,w) \ #define XFS_DFORK_FORMAT(dip,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
(dip)->di_format : \ (dip)->di_format : \
(dip)->di_aformat) (dip)->di_aformat)
#define XFS_DFORK_NEXTENTS(dip,w) \ #define XFS_DFORK_NEXTENTS(dip,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
be32_to_cpu((dip)->di_nextents) : \ be32_to_cpu((dip)->di_nextents) : \
be16_to_cpu((dip)->di_anextents)) be16_to_cpu((dip)->di_anextents))
#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr))
/* /*
* For block and character special files the 32bit dev_t is stored at the * For block and character special files the 32bit dev_t is stored at the
* beginning of the data fork. * beginning of the data fork.
*/ */
static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip) static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
{ {
return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip)); return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
} }
 End of changes. 10 change blocks. 
12 lines changed or deleted 41 lines changed or added


 xfs_dir2.h   xfs_dir2.h 
skipping to change at line 19 skipping to change at line 19
* This program is distributed in the hope that it would be useful, * This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_DIR2_H__ #ifndef __XFS_DIR2_H__
#define __XFS_DIR2_H__ #define __XFS_DIR2_H__
struct uio;
struct xfs_dabuf;
struct xfs_da_args;
struct xfs_dir2_put_args;
struct xfs_bmap_free; struct xfs_bmap_free;
struct xfs_da_args;
struct xfs_inode; struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct xfs_dir2_sf_hdr;
/* struct xfs_dir2_sf_entry;
* Directory version 2. struct xfs_dir2_data_hdr;
* There are 4 possible formats: struct xfs_dir2_data_entry;
* shortform struct xfs_dir2_data_unused;
* single block - data with embedded leaf at the end
* multiple data blocks, single leaf+freeindex block
* data blocks, node&leaf blocks (btree), freeindex blocks
*
* The shortform format is in xfs_dir2_sf.h.
* The single block format is in xfs_dir2_block.h.
* The data block format is in xfs_dir2_data.h.
* The leaf and freeindex block formats are in xfs_dir2_leaf.h.
* Node blocks are the same as the other version, in xfs_da_btree.h.
*/
/*
* Byte offset in data block and shortform entry.
*/
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;
/*
* Byte offset in a directory.
*/
typedef xfs_off_t xfs_dir2_off_t;
extern struct xfs_name xfs_name_dotdot; extern struct xfs_name xfs_name_dotdot;
/* /*
* Generic directory interface routines * Generic directory interface routines
*/ */
extern void xfs_dir_startup(void); extern void xfs_dir_startup(void);
extern void xfs_dir_mount(struct xfs_mount *mp); extern void xfs_dir_mount(struct xfs_mount *mp);
extern int xfs_dir_isempty(struct xfs_inode *dp); extern int xfs_dir_isempty(struct xfs_inode *dp);
extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
skipping to change at line 89 skipping to change at line 59
extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
struct xfs_name *name, xfs_ino_t ino, struct xfs_name *name, xfs_ino_t ino,
xfs_fsblock_t *first, xfs_fsblock_t *first,
struct xfs_bmap_free *flist, xfs_extlen_t to t); struct xfs_bmap_free *flist, xfs_extlen_t to t);
extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
struct xfs_name *name, xfs_ino_t inum, struct xfs_name *name, xfs_ino_t inum,
xfs_fsblock_t *first, xfs_fsblock_t *first,
struct xfs_bmap_free *flist, xfs_extlen_t to t); struct xfs_bmap_free *flist, xfs_extlen_t to t);
extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
struct xfs_name *name, uint resblks); struct xfs_name *name, uint resblks);
extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
#define S_SHIFT 12
extern const unsigned char xfs_mode_to_ftype[];
/* /*
* Utility routines for v2 directories. * Direct call from the bmap code, bypassing the generic directory layer.
*/ */
extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space, extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
xfs_dir2_db_t *dbp);
extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, /*
int *vp); * Interface routines used by userspace utilities
extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, */
int *vp); extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
xfs_ino_t ino);
extern xfs_ino_t xfs_dir3_sfe_get_ino(struct xfs_mount *mp,
struct xfs_dir2_sf_hdr *sfp, struct xfs_dir2_sf_entry *sfep)
;
extern void xfs_dir3_sfe_put_ino(struct xfs_mount *mp,
struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,
xfs_ino_t ino);
extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int
*r);
extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int
*r);
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db , extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db ,
struct xfs_dabuf *bp); struct xfs_buf *bp);
extern int xfs_dir_cilookup_result(struct xfs_da_args *args, extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
const unsigned char *name, int len); struct xfs_dir2_data_hdr *hdr, int *loghead);
extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *b
p,
struct xfs_dir2_data_entry *dep);
extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
struct xfs_buf *bp);
extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *
bp,
struct xfs_dir2_data_unused *dup);
extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *b
p,
xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
int *needlogp, int *needscanp);
extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp
,
struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offse
t,
xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *
dup);
extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_data_buf_ops;
#endif /* __XFS_DIR2_H__ */ #endif /* __XFS_DIR2_H__ */
 End of changes. 9 change blocks. 
48 lines changed or deleted 60 lines changed or added


 xfs_fs.h   xfs_fs.h 
skipping to change at line 236 skipping to change at line 236
#define XFS_FSOP_GEOM_FLAGS_NLINK 0x0002 /* 32-bit nlink values */ #define XFS_FSOP_GEOM_FLAGS_NLINK 0x0002 /* 32-bit nlink values */
#define XFS_FSOP_GEOM_FLAGS_QUOTA 0x0004 /* quotas enabled */ #define XFS_FSOP_GEOM_FLAGS_QUOTA 0x0004 /* quotas enabled */
#define XFS_FSOP_GEOM_FLAGS_IALIGN 0x0008 /* inode alignment */ #define XFS_FSOP_GEOM_FLAGS_IALIGN 0x0008 /* inode alignment */
#define XFS_FSOP_GEOM_FLAGS_DALIGN 0x0010 /* large data alignment */ #define XFS_FSOP_GEOM_FLAGS_DALIGN 0x0010 /* large data alignment */
#define XFS_FSOP_GEOM_FLAGS_SHARED 0x0020 /* read-only shared */ #define XFS_FSOP_GEOM_FLAGS_SHARED 0x0020 /* read-only shared */
#define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x0040 /* special extent flag */ #define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x0040 /* special extent flag */
#define XFS_FSOP_GEOM_FLAGS_DIRV2 0x0080 /* directory version 2 */ #define XFS_FSOP_GEOM_FLAGS_DIRV2 0x0080 /* directory version 2 */
#define XFS_FSOP_GEOM_FLAGS_LOGV2 0x0100 /* log format version 2 */ #define XFS_FSOP_GEOM_FLAGS_LOGV2 0x0100 /* log format version 2 */
#define XFS_FSOP_GEOM_FLAGS_SECTOR 0x0200 /* sector sizes >1BB */ #define XFS_FSOP_GEOM_FLAGS_SECTOR 0x0200 /* sector sizes >1BB */
#define XFS_FSOP_GEOM_FLAGS_ATTR2 0x0400 /* inline attributes rework */ #define XFS_FSOP_GEOM_FLAGS_ATTR2 0x0400 /* inline attributes rework */
#define XFS_FSOP_GEOM_FLAGS_DIRV2CI 0x1000 /* ASCII only CI names */ #define XFS_FSOP_GEOM_FLAGS_PROJID32 0x0800 /* 32-bit project IDs */
#define XFS_FSOP_GEOM_FLAGS_DIRV2CI 0x1000 /* ASCII only CI names */
#define XFS_FSOP_GEOM_FLAGS_LAZYSB 0x4000 /* lazy superblock counters */ #define XFS_FSOP_GEOM_FLAGS_LAZYSB 0x4000 /* lazy superblock counters */
#define XFS_FSOP_GEOM_FLAGS_V5SB 0x8000 /* version 5 superblock */
#define XFS_FSOP_GEOM_FLAGS_FTYPE 0x10000 /* inode directory types */
/* /*
* Minimum and maximum sizes need for growth checks * Minimum and maximum sizes need for growth checks.
*
* Block counts are in units of filesystem blocks, not basic blocks.
*/ */
#define XFS_MIN_AG_BLOCKS 64 #define XFS_MIN_AG_BLOCKS 64
#define XFS_MIN_LOG_BLOCKS 512ULL #define XFS_MIN_LOG_BLOCKS 512ULL
#define XFS_MAX_LOG_BLOCKS (1024 * 1024ULL) #define XFS_MAX_LOG_BLOCKS (1024 * 1024ULL)
#define XFS_MIN_LOG_BYTES (10 * 1024 * 1024ULL) #define XFS_MIN_LOG_BYTES (10 * 1024 * 1024ULL)
/* keep the maximum size under 2^31 by a small amount */ /* keep the maximum size under 2^31 by a small amount */
#define XFS_MAX_LOG_BYTES \ #define XFS_MAX_LOG_BYTES \
((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES) ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES)
/* Used for sanity checks on superblock */
#define XFS_MAX_DBLOCKS(s) ((xfs_drfsbno_t)(s)->sb_agcount * (s)->sb_agbloc
ks)
#define XFS_MIN_DBLOCKS(s) ((xfs_drfsbno_t)((s)->sb_agcount - 1) * \
(s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
/* /*
* Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGRO WFSRT * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGRO WFSRT
*/ */
typedef struct xfs_growfs_data { typedef struct xfs_growfs_data {
__u64 newblocks; /* new data subvol size, fsblocks */ __u64 newblocks; /* new data subvol size, fsblocks */
__u32 imaxpct; /* new inode space percentage limit */ __u32 imaxpct; /* new inode space percentage limit */
} xfs_growfs_data_t; } xfs_growfs_data_t;
typedef struct xfs_growfs_log { typedef struct xfs_growfs_log {
__u32 newblocks; /* new log size, fsblocks */ __u32 newblocks; /* new log size, fsblocks */
skipping to change at line 305 skipping to change at line 315
#define bs_projid bs_projid_lo /* (previously just bs_proji d) */ #define bs_projid bs_projid_lo /* (previously just bs_proji d) */
__u16 bs_forkoff; /* inode fork offset in bytes */ __u16 bs_forkoff; /* inode fork offset in bytes */
__u16 bs_projid_hi; /* higher part of project id */ __u16 bs_projid_hi; /* higher part of project id */
unsigned char bs_pad[10]; /* pad space, unused */ unsigned char bs_pad[10]; /* pad space, unused */
__u32 bs_dmevmask; /* DMIG event mask */ __u32 bs_dmevmask; /* DMIG event mask */
__u16 bs_dmstate; /* DMIG state info */ __u16 bs_dmstate; /* DMIG state info */
__u16 bs_aextents; /* attribute number of extents */ __u16 bs_aextents; /* attribute number of extents */
} xfs_bstat_t; } xfs_bstat_t;
/* /*
* Project quota id helpers (previously projid was 16bit only
* and using two 16bit values to hold new 32bit projid was choosen
* to retain compatibility with "old" filesystems).
*/
static inline __uint32_t
bstat_get_projid(struct xfs_bstat *bs)
{
return (__uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
}
/*
* The user-level BulkStat Request interface structure. * The user-level BulkStat Request interface structure.
*/ */
typedef struct xfs_fsop_bulkreq { typedef struct xfs_fsop_bulkreq {
__u64 __user *lastip; /* last inode # pointer */ __u64 __user *lastip; /* last inode # pointer */
__s32 icount; /* count of entries in buffer */ __s32 icount; /* count of entries in buffer */
void __user *ubuffer;/* user buffer for inode desc. */ void __user *ubuffer;/* user buffer for inode desc. */
__s32 __user *ocount; /* output count pointer */ __s32 __user *ocount; /* output count pointer */
} xfs_fsop_bulkreq_t; } xfs_fsop_bulkreq_t;
/* /*
skipping to change at line 332 skipping to change at line 353
/* /*
* Error injection. * Error injection.
*/ */
typedef struct xfs_error_injection { typedef struct xfs_error_injection {
__s32 fd; __s32 fd;
__s32 errtag; __s32 errtag;
} xfs_error_injection_t; } xfs_error_injection_t;
/* /*
* Speculative preallocation trimming.
*/
#define XFS_EOFBLOCKS_VERSION 1
struct xfs_fs_eofblocks {
__u32 eof_version;
__u32 eof_flags;
uid_t eof_uid;
gid_t eof_gid;
prid_t eof_prid;
__u32 pad32;
__u64 eof_min_file_size;
__u64 pad64[12];
};
/* eof_flags values */
#define XFS_EOF_FLAGS_SYNC (1 << 0) /* sync/wait mode scan */
#define XFS_EOF_FLAGS_UID (1 << 1) /* filter by uid */
#define XFS_EOF_FLAGS_GID (1 << 2) /* filter by gid */
#define XFS_EOF_FLAGS_PRID (1 << 3) /* filter by project id */
#define XFS_EOF_FLAGS_MINFILESIZE (1 << 4) /* filter by min file size
*/
#define XFS_EOF_FLAGS_VALID \
(XFS_EOF_FLAGS_SYNC | \
XFS_EOF_FLAGS_UID | \
XFS_EOF_FLAGS_GID | \
XFS_EOF_FLAGS_PRID | \
XFS_EOF_FLAGS_MINFILESIZE)
/*
* The user-level Handle Request interface structure. * The user-level Handle Request interface structure.
*/ */
typedef struct xfs_fsop_handlereq { typedef struct xfs_fsop_handlereq {
__u32 fd; /* fd for FD_TO_HANDLE */ __u32 fd; /* fd for FD_TO_HANDLE */
void __user *path; /* user pathname */ void __user *path; /* user pathname */
__u32 oflags; /* open flags */ __u32 oflags; /* open flags */
void __user *ihandle;/* user supplied handle */ void __user *ihandle;/* user supplied handle */
__u32 ihandlen; /* user supplied length */ __u32 ihandlen; /* user supplied length */
void __user *ohandle;/* user buffer for handle */ void __user *ohandle;/* user buffer for handle */
__u32 __user *ohandlen;/* user buffer length */ __u32 __user *ohandlen;/* user buffer length */
skipping to change at line 412 skipping to change at line 461
} ha_u; } 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; } xfs_handle_t;
#define ha_fsid ha_u._ha_fsid #define ha_fsid ha_u._ha_fsid
#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \ #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \
- (char *) &(handle)) \ - (char *) &(handle)) \
+ (handle).ha_fid.fid_len) + (handle).ha_fid.fid_len)
/* /*
* Structure passed to XFS_IOC_SWAPEXT
*/
typedef struct xfs_swapext
{
__int64_t sx_version; /* version */
#define XFS_SX_VERSION 0
__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 */
char sx_pad[16]; /* pad space, unused */
xfs_bstat_t sx_stat; /* stat of target b4 copy */
} xfs_swapext_t;
/*
* Flags for going down operation * Flags for going down operation
*/ */
#define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */
#define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */ #define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */
#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flu sh log nor data */ #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flu sh log nor data */
/* /*
* ioctl commands that are used by Linux filesystems * ioctl commands that are used by Linux filesystems
*/ */
#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
skipping to change at line 449 skipping to change at line 513
#define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64) #define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64)
#define XFS_IOC_UNRESVSP _IOW ('X', 41, 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_RESVSP64 _IOW ('X', 42, struct xfs_flock64)
#define XFS_IOC_UNRESVSP64 _IOW ('X', 43, 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_GETBMAPA _IOWR('X', 44, struct getbmap)
#define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr) #define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr)
/* XFS_IOC_SETBIOSIZE ---- deprecated 46 */ /* XFS_IOC_SETBIOSIZE ---- deprecated 46 */
/* XFS_IOC_GETBIOSIZE ---- deprecated 47 */ /* XFS_IOC_GETBIOSIZE ---- deprecated 47 */
#define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) #define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap)
#define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64) #define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64)
#define XFS_IOC_FREE_EOFBLOCKS _IOR ('X', 58, struct xfs_fs_eofblocks)
/* /*
* ioctl commands that replace IRIX syssgi()'s * ioctl commands that replace IRIX syssgi()'s
*/ */
#define XFS_IOC_FSGEOMETRY_V1 _IOR ('X', 100, struct xfs_fsop_geom_v1 ) #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 _IOWR('X', 101, struct xfs_fsop_bulkreq )
#define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkre q) #define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkre q)
#define XFS_IOC_FSINUMBERS _IOWR('X', 103, 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_handle req) #define XFS_IOC_PATH_TO_FSHANDLE _IOWR('X', 104, struct xfs_fsop_handle req)
#define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handler eq) #define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handler eq)
skipping to change at line 472 skipping to change at line 537
#define XFS_IOC_SWAPEXT _IOWR('X', 109, struct xfs_swap ext) #define XFS_IOC_SWAPEXT _IOWR('X', 109, struct xfs_swap ext)
#define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data) #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_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log)
#define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt) #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_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts)
#define XFS_IOC_SET_RESBLKS _IOWR('X', 114, struct xfs_fsop_resblks ) #define XFS_IOC_SET_RESBLKS _IOWR('X', 114, struct xfs_fsop_resblks )
#define XFS_IOC_GET_RESBLKS _IOR ('X', 115, 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_erro r_injection) #define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_erro r_injection)
#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_inject ion) #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_inject ion)
/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ /* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */
/* XFS_IOC_FREEZE -- FIFREEZE 119 */ /* XFS_IOC_FREEZE -- FIFREEZE 119 */
/* XFS_IOC_THAW -- FITHAW 120 */ /* XFS_IOC_THAW -- FITHAW 120 */
#ifndef FIFREEZE
#define XFS_IOC_FREEZE _IOWR('X', 119, int) #define XFS_IOC_FREEZE _IOWR('X', 119, int)
#define XFS_IOC_THAW _IOWR('X', 120, int) #define XFS_IOC_THAW _IOWR('X', 120, int)
#endif
#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_ handlereq) #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_attrli st_handlereq) #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrli st_handlereq)
#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmu lti_handlereq) #define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmu lti_handlereq)
#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom) #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t) #define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)
/* XFS_IOC_GETFSUUID ---------- deprecated 140 */ /* XFS_IOC_GETFSUUID ---------- deprecated 140 */
#ifndef HAVE_BBMACROS #ifndef HAVE_BBMACROS
/* /*
* 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
skipping to change at line 497 skipping to change at line 566
* routines are in BB's. * routines are in BB's.
*/ */
#define BBSHIFT 9 #define BBSHIFT 9
#define BBSIZE (1<<BBSHIFT) #define BBSIZE (1<<BBSHIFT)
#define BBMASK (BBSIZE-1) #define BBMASK (BBSIZE-1)
#define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) #define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT)
#define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
#define BBTOB(bbs) ((bbs) << BBSHIFT) #define BBTOB(bbs) ((bbs) << BBSHIFT)
#endif #endif
/*
* Project quota id helpers (previously projid was 16bit only
* and using two 16bit values to hold new 32bit projid was choosen
* to retain compatibility with "old" filesystems).
*/
static inline __uint32_t
bstat_get_projid(struct xfs_bstat *bs)
{
return (__uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo;
}
#endif /* __XFS_FS_H__ */ #endif /* __XFS_FS_H__ */
 End of changes. 12 change blocks. 
13 lines changed or deleted 73 lines changed or added


 xfs_ialloc.h   xfs_ialloc.h 
skipping to change at line 26 skipping to change at line 26
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_IALLOC_H__ #ifndef __XFS_IALLOC_H__
#define __XFS_IALLOC_H__ #define __XFS_IALLOC_H__
struct xfs_buf; struct xfs_buf;
struct xfs_dinode; struct xfs_dinode;
struct xfs_imap; struct xfs_imap;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct xfs_btree_cur;
/* /*
* Allocation parameters for inode allocation. * Allocation parameters for inode allocation.
*/ */
#define XFS_IALLOC_INODES(mp) (mp)->m_ialloc_inos #define XFS_IALLOC_INODES(mp) (mp)->m_ialloc_inos
#define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks #define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks
/* /*
* Move inodes in clusters of this size. * Move inodes in clusters of this size.
*/ */
#define XFS_INODE_BIG_CLUSTER_SIZE 8192 #define XFS_INODE_BIG_CLUSTER_SIZE 8192
#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size #define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size
/* /*
* Make an inode pointer out of the buffer/offset. * Make an inode pointer out of the buffer/offset.
*/ */
static inline struct xfs_dinode * static inline struct xfs_dinode *
xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
{ {
return (xfs_dinode_t *) return (struct xfs_dinode *)
(xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog)); (xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog));
} }
/* /*
* Find a free (set) bit in the inode bitmask.
*/
static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
{
return xfs_lowbit64(*fp);
}
/*
* Allocate an inode on disk. * Allocate an inode on disk.
* Mode is used to tell whether the new inode will need space, and whether * Mode is used to tell whether the new inode will need space, and whether
* it is a directory. * it is a directory.
* *
* To work within the constraint of one allocation per transaction, * To work within the constraint of one allocation per transaction,
* xfs_dialloc() is designed to be called twice if it has to do an * 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 * available without an allocation, agbp would be set to the current
* agbp and alloc_done set to false. * agbp and alloc_done set to false.
* If an allocation needed to be done, agbp would be set to the * If an allocation needed to be done, agbp would be set to the
skipping to change at line 83 skipping to change at line 76
* Once we successfully pick an inode its number is returned and the * 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. * 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. * *agbp should be set to NULL on the first call, *alloc_done set to FALSE.
*/ */
int /* error */ int /* error */
xfs_dialloc( xfs_dialloc(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_ino_t parent, /* parent inode (directory) */ xfs_ino_t parent, /* parent inode (directory) */
mode_t mode, /* mode bits for new inode */ umode_t mode, /* mode bits for new inode */
int okalloc, /* ok to allocate more space */ int okalloc, /* ok to allocate more space */
struct xfs_buf **agbp, /* buf for a.g. inode header */ struct xfs_buf **agbp, /* buf for a.g. inode header */
boolean_t *alloc_done, /* an allocation was done to repleni
sh
the free inodes */
xfs_ino_t *inop); /* inode number allocated */ xfs_ino_t *inop); /* inode number allocated */
/* /*
* Free disk inode. Carefully avoids touching the incore inode, all * Free disk inode. Carefully avoids touching the incore inode, all
* manipulations incore are the caller's responsibility. * manipulations incore are the caller's responsibility.
* The on-disk inode is not changed by this operation, only the * The on-disk inode is not changed by this operation, only the
* btree (free inode mask) is changed. * btree (free inode mask) is changed.
*/ */
int /* error */ int /* error */
xfs_difree( xfs_difree(
skipping to change at line 160 skipping to change at line 151
/* /*
* Lookup a record by ino in the btree given by cur. * Lookup a record by ino in the btree given by cur.
*/ */
int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino, int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,
xfs_lookup_t dir, int *stat); xfs_lookup_t dir, int *stat);
/* /*
* Get the data from the pointed-to record. * Get the data from the pointed-to record.
*/ */
extern int xfs_inobt_get_rec(struct xfs_btree_cur *cur, int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
xfs_inobt_rec_incore_t *rec, int *stat); xfs_inobt_rec_incore_t *rec, int *stat);
/*
* Inode chunk initialisation routine
*/
int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
struct list_head *buffer_list,
xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_agblock_t length, unsigned int gen);
#endif /* __XFS_IALLOC_H__ */ #endif /* __XFS_IALLOC_H__ */
 End of changes. 7 change blocks. 
14 lines changed or deleted 12 lines changed or added


 xfs_ialloc_btree.h   xfs_ialloc_btree.h 
skipping to change at line 30 skipping to change at line 30
/* /*
* Inode map on-disk structures * Inode map on-disk structures
*/ */
struct xfs_buf; struct xfs_buf;
struct xfs_btree_cur; struct xfs_btree_cur;
struct xfs_mount; struct xfs_mount;
/* /*
* There is a btree for the inode map per allocation group.
*/
#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)
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
{
return ((n >= XFS_INODES_PER_CHUNK ? 0 : XFS_INOBT_MASK(n)) - 1) <<
i;
}
/*
* Data record structure
*/
typedef struct xfs_inobt_rec {
__be32 ir_startino; /* starting inode number */
__be32 ir_freecount; /* count of free inodes (set bits) *
/
__be64 ir_free; /* free inode mask */
} xfs_inobt_rec_t;
typedef struct xfs_inobt_rec_incore {
xfs_agino_t ir_startino; /* starting inode number */
__int32_t ir_freecount; /* count of free inodes (set bits) *
/
xfs_inofree_t ir_free; /* free inode mask */
} xfs_inobt_rec_incore_t;
/*
* Key structure
*/
typedef struct xfs_inobt_key {
__be32 ir_startino; /* starting inode number */
} xfs_inobt_key_t;
/* btree pointer type */
typedef __be32 xfs_inobt_ptr_t;
/*
* block numbers in the AG.
*/
#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLO
CK(mp) + 1))
#define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLO
CK(mp) + 1))
/*
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*
* (not quite yet, but soon)
*/ */
#define XFS_INOBT_BLOCK_LEN(mp) XFS_BTREE_SBLOCK_LEN #define XFS_INOBT_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
/* /*
* Record, key, and pointer address macros for btree blocks. * Record, key, and pointer address macros for btree blocks.
* *
* (note that some of these may appear unused, but they are used in userspa ce) * (note that some of these may appear unused, but they are used in userspa ce)
*/ */
#define XFS_INOBT_REC_ADDR(mp, block, index) \ #define XFS_INOBT_REC_ADDR(mp, block, index) \
((xfs_inobt_rec_t *) \ ((xfs_inobt_rec_t *) \
((char *)(block) + \ ((char *)(block) + \
XFS_INOBT_BLOCK_LEN(mp) + \ XFS_INOBT_BLOCK_LEN(mp) + \
 End of changes. 3 change blocks. 
56 lines changed or deleted 3 lines changed or added


 xfs_inum.h   xfs_inum.h 
skipping to change at line 29 skipping to change at line 29
#define __XFS_INUM_H__ #define __XFS_INUM_H__
/* /*
* Inode number format: * Inode number format:
* low inopblog bits - offset in block * low inopblog bits - offset in block
* next agblklog bits - block number in ag * next agblklog bits - block number in ag
* next agno_log bits - ag number * next agno_log bits - ag number
* high agno_log-agblklog-inopblog bits - 0 * high agno_log-agblklog-inopblog bits - 0
*/ */
typedef __uint32_t xfs_agino_t; /* within allocation grp ino
de number */
/*
* Useful inode bits for this kernel.
* Used in some places where having 64-bits in the 32-bit kernels
* costs too much.
*/
#if XFS_BIG_INUMS
typedef xfs_ino_t xfs_intino_t;
#else
typedef __uint32_t xfs_intino_t;
#endif
#define NULLFSINO ((xfs_ino_t)-1)
#define NULLAGINO ((xfs_agino_t)-1)
struct xfs_mount; struct xfs_mount;
#define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1) #define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)
#define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog #define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog
#define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog #define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog
#define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log #define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log
#define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log #define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log
#define XFS_INO_BITS(mp) \ #define XFS_INO_BITS(mp) \
XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp) XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
#define XFS_INO_TO_AGNO(mp,i) \ #define XFS_INO_TO_AGNO(mp,i) \
 End of changes. 1 change blocks. 
17 lines changed or deleted 0 lines changed or added


 xfs_sb.h   xfs_sb.h 
skipping to change at line 29 skipping to change at line 29
#define __XFS_SB_H__ #define __XFS_SB_H__
/* /*
* Super block * Super block
* Fits into a sector-sized buffer at address 0 of each allocation group. * Fits into a sector-sized buffer at address 0 of each allocation group.
* Only the first of these is ever updated except during growfs. * Only the first of these is ever updated except during growfs.
*/ */
struct xfs_buf; struct xfs_buf;
struct xfs_mount; struct xfs_mount;
struct xfs_trans;
#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ #define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */
#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 * / #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_2 2 /* 6.2 - attributes */
#define XFS_SB_VERSION_3 3 /* 6.2 - new inode v ersion */ #define XFS_SB_VERSION_3 3 /* 6.2 - new inode v ersion */
#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask ve rsion */ #define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask ve rsion */
#define XFS_SB_VERSION_5 5 /* CRC enabled files ystem */
#define XFS_SB_VERSION_NUMBITS 0x000f #define XFS_SB_VERSION_NUMBITS 0x000f
#define XFS_SB_VERSION_ALLFBITS 0xfff0 #define XFS_SB_VERSION_ALLFBITS 0xfff0
#define XFS_SB_VERSION_SASHFBITS 0xf000 #define XFS_SB_VERSION_SASHFBITS 0xf000
#define XFS_SB_VERSION_REALFBITS 0x0ff0 #define XFS_SB_VERSION_REALFBITS 0x0ff0
#define XFS_SB_VERSION_ATTRBIT 0x0010 #define XFS_SB_VERSION_ATTRBIT 0x0010
#define XFS_SB_VERSION_NLINKBIT 0x0020 #define XFS_SB_VERSION_NLINKBIT 0x0020
#define XFS_SB_VERSION_QUOTABIT 0x0040 #define XFS_SB_VERSION_QUOTABIT 0x0040
#define XFS_SB_VERSION_ALIGNBIT 0x0080 #define XFS_SB_VERSION_ALIGNBIT 0x0080
#define XFS_SB_VERSION_DALIGNBIT 0x0100 #define XFS_SB_VERSION_DALIGNBIT 0x0100
#define XFS_SB_VERSION_SHAREDBIT 0x0200 #define XFS_SB_VERSION_SHAREDBIT 0x0200
skipping to change at line 84 skipping to change at line 86
* *
* These defines represent bits in sb_features2. * These defines represent bits in sb_features2.
*/ */
#define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ #define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */
#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001
#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ #define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */
#define XFS_SB_VERSION2_RESERVED4BIT 0x00000004 #define XFS_SB_VERSION2_RESERVED4BIT 0x00000004
#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rewor k */ #define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rewor k */
#define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers * / #define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers * /
#define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id */ #define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id */
#define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */
#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir
*/
#define XFS_SB_VERSION2_OKREALFBITS \ #define XFS_SB_VERSION2_OKREALFBITS \
(XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
XFS_SB_VERSION2_ATTR2BIT | \ XFS_SB_VERSION2_ATTR2BIT | \
XFS_SB_VERSION2_PROJID32BIT) XFS_SB_VERSION2_PROJID32BIT | \
XFS_SB_VERSION2_FTYPE)
#define XFS_SB_VERSION2_OKSASHFBITS \ #define XFS_SB_VERSION2_OKSASHFBITS \
(0) (0)
#define XFS_SB_VERSION2_OKREALBITS \ #define XFS_SB_VERSION2_OKREALBITS \
(XFS_SB_VERSION2_OKREALFBITS | \ (XFS_SB_VERSION2_OKREALFBITS | \
XFS_SB_VERSION2_OKSASHFBITS ) XFS_SB_VERSION2_OKSASHFBITS )
/* /*
* Superblock - in core version. Must match the ondisk version below. * Superblock - in core version. Must match the ondisk version below.
* Must be padded to 64 bit alignment. * Must be padded to 64 bit alignment.
*/ */
skipping to change at line 163 skipping to change at line 168
__uint32_t sb_features2; /* additional feature bits */ __uint32_t sb_features2; /* additional feature bits */
/* /*
* bad features2 field as a result of failing to pad the sb * bad features2 field as a result of failing to pad the sb
* structure to 64 bits. Some machines will be using this field * structure to 64 bits. Some machines will be using this field
* for features2 bits. Easiest just to mark it bad and not use * for features2 bits. Easiest just to mark it bad and not use
* it for anything else. * it for anything else.
*/ */
__uint32_t sb_bad_features2; __uint32_t sb_bad_features2;
/* version 5 superblock fields start here */
/* feature masks */
__uint32_t sb_features_compat;
__uint32_t sb_features_ro_compat;
__uint32_t sb_features_incompat;
__uint32_t sb_features_log_incompat;
__uint32_t sb_crc; /* superblock crc */
__uint32_t sb_pad;
xfs_ino_t sb_pquotino; /* project quota inode */
xfs_lsn_t sb_lsn; /* last write sequence */
/* must be padded to 64 bit alignment */ /* must be padded to 64 bit alignment */
} xfs_sb_t; } xfs_sb_t;
#define XFS_SB_CRC_OFF offsetof(struct xfs_sb, sb_crc)
/* /*
* Superblock - on disk version. Must match the in core version above. * Superblock - on disk version. Must match the in core version above.
* Must be padded to 64 bit alignment. * Must be padded to 64 bit alignment.
*/ */
typedef struct xfs_dsb { typedef struct xfs_dsb {
__be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
__be32 sb_blocksize; /* logical block size, bytes */ __be32 sb_blocksize; /* logical block size, bytes */
__be64 sb_dblocks; /* number of data blocks */ __be64 sb_dblocks; /* number of data blocks */
__be64 sb_rblocks; /* number of realtime blocks */ __be64 sb_rblocks; /* number of realtime blocks */
__be64 sb_rextents; /* number of realtime extents */ __be64 sb_rextents; /* number of realtime extents */
skipping to change at line 231 skipping to change at line 252
__u8 sb_logsectlog; /* log2 of the log sector size */ __u8 sb_logsectlog; /* log2 of the log sector size */
__be16 sb_logsectsize; /* sector size for the log, bytes */ __be16 sb_logsectsize; /* sector size for the log, bytes */
__be32 sb_logsunit; /* stripe unit size for the log */ __be32 sb_logsunit; /* stripe unit size for the log */
__be32 sb_features2; /* additional feature bits */ __be32 sb_features2; /* additional feature bits */
/* /*
* bad features2 field as a result of failing to pad the sb * bad features2 field as a result of failing to pad the sb
* structure to 64 bits. Some machines will be using this field * structure to 64 bits. Some machines will be using this field
* for features2 bits. Easiest just to mark it bad and not use * for features2 bits. Easiest just to mark it bad and not use
* it for anything else. * it for anything else.
*/ */
__be32 sb_bad_features2; __be32 sb_bad_features2;
/* version 5 superblock fields start here */
/* feature masks */
__be32 sb_features_compat;
__be32 sb_features_ro_compat;
__be32 sb_features_incompat;
__be32 sb_features_log_incompat;
__le32 sb_crc; /* superblock crc */
__be32 sb_pad;
__be64 sb_pquotino; /* project quota inode */
__be64 sb_lsn; /* last write sequence */
/* must be padded to 64 bit alignment */ /* must be padded to 64 bit alignment */
} xfs_dsb_t; } xfs_dsb_t;
/* /*
* Sequence number values for the fields. * Sequence number values for the fields.
*/ */
typedef enum { typedef enum {
XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCK S, XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCK S,
XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO, XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS, XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS, XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE, XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG, XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLO G, XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLO G,
XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOU NT, XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOU NT,
XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO , 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_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_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT, XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
XFS_SBS_PQUOTINO, XFS_SBS_LSN,
XFS_SBS_FIELDCOUNT XFS_SBS_FIELDCOUNT
} xfs_sb_field_t; } xfs_sb_field_t;
/* /*
* Mask values, defined based on the xfs_sb_field_t values. * Mask values, defined based on the xfs_sb_field_t values.
* Only define the ones we're using. * Only define the ones we're using.
*/ */
#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x) #define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x)
#define XFS_SB_UUID XFS_SB_MVAL(UUID) #define XFS_SB_UUID XFS_SB_MVAL(UUID)
#define XFS_SB_FNAME XFS_SB_MVAL(FNAME) #define XFS_SB_FNAME XFS_SB_MVAL(FNAME)
skipping to change at line 278 skipping to change at line 316
#define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO) #define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO)
#define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS) #define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS)
#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) #define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
#define XFS_SB_UNIT XFS_SB_MVAL(UNIT) #define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) #define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT) #define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT)
#define XFS_SB_IFREE XFS_SB_MVAL(IFREE) #define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS) #define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2) #define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2) #define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2)
#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
#define XFS_SB_CRC XFS_SB_MVAL(CRC)
#define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO)
#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) #define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) #define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
#define XFS_SB_MOD_BITS \ #define XFS_SB_MOD_BITS \
(XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \ XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \ XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
XFS_SB_BAD_FEATURES2) XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \
XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \
XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO)
/* /*
* Misc. Flags - warning - these will be cleared by xfs_repair unless * Misc. Flags - warning - these will be cleared by xfs_repair unless
* a feature bit is set when the flag is used. * a feature bit is set when the flag is used.
*/ */
#define XFS_SBF_NOFLAGS 0x00 /* no flags set */ #define XFS_SBF_NOFLAGS 0x00 /* no flags set */
#define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */ #define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */
/* /*
* define max. shared version we can interoperate with * define max. shared version we can interoperate with
skipping to change at line 315 skipping to change at line 361
sbp->sb_versionnum <= XFS_SB_VERSION_3) sbp->sb_versionnum <= XFS_SB_VERSION_3)
return 1; return 1;
/* We support version 4 if all feature bits are supported */ /* We support version 4 if all feature bits are supported */
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) { if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) {
if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) ||
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
return 0; return 0;
#ifdef __KERNEL__
if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN) if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
return 0; return 0;
#else
if ((sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) &&
sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
return 0;
#endif
return 1; return 1;
} }
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
return 1;
return 0; return 0;
} }
/* /*
* Detect a mismatched features2 field. Older kernels read/wrote * Detect a mismatched features2 field. Older kernels read/wrote
* this into the wrong slot, so to be safe we keep them in sync. * this into the wrong slot, so to be safe we keep them in sync.
*/ */
static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp) static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp)
{ {
skipping to change at line 366 skipping to change at line 407
return XFS_SB_VERSION_3; return XFS_SB_VERSION_3;
if (v & XFS_SB_VERSION_ATTRBIT) if (v & XFS_SB_VERSION_ATTRBIT)
return XFS_SB_VERSION_2; return XFS_SB_VERSION_2;
return XFS_SB_VERSION_1; return XFS_SB_VERSION_1;
} }
static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp) static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
{ {
return sbp->sb_versionnum == XFS_SB_VERSION_2 || return sbp->sb_versionnum == XFS_SB_VERSION_2 ||
sbp->sb_versionnum == XFS_SB_VERSION_3 || sbp->sb_versionnum == XFS_SB_VERSION_3 ||
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT)); (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
} }
static inline void xfs_sb_version_addattr(xfs_sb_t *sbp) static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
{ {
if (sbp->sb_versionnum == XFS_SB_VERSION_1) if (sbp->sb_versionnum == XFS_SB_VERSION_1)
sbp->sb_versionnum = XFS_SB_VERSION_2; sbp->sb_versionnum = XFS_SB_VERSION_2;
else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) else if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4)
sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT; sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT;
else else
sbp->sb_versionnum = XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRB IT; sbp->sb_versionnum = XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRB IT;
} }
static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp) static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
{ {
return sbp->sb_versionnum == XFS_SB_VERSION_3 || return sbp->sb_versionnum == XFS_SB_VERSION_3 ||
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)); (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
} }
static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp) static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
{ {
if (sbp->sb_versionnum <= XFS_SB_VERSION_2) if (sbp->sb_versionnum <= XFS_SB_VERSION_2)
sbp->sb_versionnum = XFS_SB_VERSION_3; sbp->sb_versionnum = XFS_SB_VERSION_3;
else else
sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT; sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT;
} }
static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp) static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT); (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
} }
static inline void xfs_sb_version_addquota(xfs_sb_t *sbp) static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
{ {
if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4)
sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT; sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
else else
sbp->sb_versionnum = xfs_sb_version_tonew(sbp->sb_versionnum ) | sbp->sb_versionnum = xfs_sb_version_tonew(sbp->sb_versionnum ) |
XFS_SB_VERSION_QUOTABIT; XFS_SB_VERSION_QUOTABIT;
} }
static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp) static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT); (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT));
} }
static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp) static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
} }
static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp) static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT); (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
} }
static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp) static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT); (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT));
} }
static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp) static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT); (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT));
} }
static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp) static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT); (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT));
} }
static inline int xfs_sb_version_hassector(xfs_sb_t *sbp) static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT); (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
} }
static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp) static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT); (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
} }
static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp) static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT); (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 &&
(sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT));
} }
/* /*
* sb_features2 bit version macros. * sb_features2 bit version macros.
* *
* For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro: * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro:
* *
* SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp)
* ((xfs_sb_version_hasmorebits(sbp) && * ((xfs_sb_version_hasmorebits(sbp) &&
* ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
*/ */
static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp) static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp)
{ {
return xfs_sb_version_hasmorebits(sbp) && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT); (xfs_sb_version_hasmorebits(sbp) &&
(sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
} }
static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp) static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
{ {
return xfs_sb_version_hasmorebits(sbp) && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT); (xfs_sb_version_hasmorebits(sbp) &&
(sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT));
} }
static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
{ {
sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
} }
static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp) static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp)
{ {
sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
if (!sbp->sb_features2) if (!sbp->sb_features2)
sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT; sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
} }
static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp)
{ {
return xfs_sb_version_hasmorebits(sbp) && return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT); (xfs_sb_version_hasmorebits(sbp) &&
(sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
} }
static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp)
{ {
sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
} }
/* /*
* Extended v5 superblock feature masks. These are to be used for new v5
* superblock features only.
*
* Compat features are new features that old kernels will not notice or aff
ect
* and so can mount read-write without issues.
*
* RO-Compat (read only) are features that old kernels can read but will br
eak
* if they write. Hence only read-only mounts of such filesystems are allow
ed on
* kernels that don't support the feature bit.
*
* InCompat features are features which old kernels will not understand and
so
* must not mount.
*
* Log-InCompat features are for changes to log formats or new transactions
that
* can't be replayed on older kernels. The fields are set when the filesyst
em is
* mounted, and a clean unmount clears the fields.
*/
#define XFS_SB_FEAT_COMPAT_ALL 0
#define XFS_SB_FEAT_COMPAT_UNKNOWN ~XFS_SB_FEAT_COMPAT_ALL
static inline bool
xfs_sb_has_compat_feature(
struct xfs_sb *sbp,
__uint32_t feature)
{
return (sbp->sb_features_compat & feature) != 0;
}
#define XFS_SB_FEAT_RO_COMPAT_ALL 0
#define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL
static inline bool
xfs_sb_has_ro_compat_feature(
struct xfs_sb *sbp,
__uint32_t feature)
{
return (sbp->sb_features_ro_compat & feature) != 0;
}
#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in diren
t */
#define XFS_SB_FEAT_INCOMPAT_ALL \
(XFS_SB_FEAT_INCOMPAT_FTYPE)
#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL
static inline bool
xfs_sb_has_incompat_feature(
struct xfs_sb *sbp,
__uint32_t feature)
{
return (sbp->sb_features_incompat & feature) != 0;
}
#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0
#define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_LOG_AL
L
static inline bool
xfs_sb_has_incompat_log_feature(
struct xfs_sb *sbp,
__uint32_t feature)
{
return (sbp->sb_features_log_incompat & feature) != 0;
}
/*
* V5 superblock specific feature checks
*/
static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp)
{
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
}
static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp)
{
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
}
static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)
) ||
(xfs_sb_version_hasmorebits(sbp) &&
(sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
}
/*
* end of superblock version macros * end of superblock version macros
*/ */
static inline bool
xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
{
return (ino == sbp->sb_uquotino ||
ino == sbp->sb_gquotino ||
ino == sbp->sb_pquotino);
}
#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag * / #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag * /
#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr))
#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d) ) #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d) )
#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d)) xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \ #define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno )) XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno ))
/* /*
* File system sector to basic block conversions. * File system sector to basic block conversions.
*/ */
#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log) #define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
/* /*
* File system block to basic block conversions. * File system block to basic block conversions.
*/ */
#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log) #define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
#define XFS_BB_TO_FSB(mp,bb) \ #define XFS_BB_TO_FSB(mp,bb) \
(((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log) (((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_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. * File system block to byte conversions.
*/ */
#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_block log) #define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_block log)
#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) ((((__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_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_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
/*
* perag get/put wrappers for ref counting
*/
extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t);
extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber
_t,
int tag);
extern void xfs_perag_put(struct xfs_perag *pag);
extern int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t
);
extern void xfs_sb_calc_crc(struct xfs_buf *);
extern void xfs_mod_sb(struct xfs_trans *, __int64_t);
extern void xfs_sb_mount_common(struct xfs_mount *, struct xfs_sb *);
extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t)
;
extern void xfs_sb_quota_from_disk(struct xfs_sb *sbp);
#endif /* __XFS_SB_H__ */ #endif /* __XFS_SB_H__ */
 End of changes. 34 change blocks. 
37 lines changed or deleted 204 lines changed or added


 xfs_trace.h   xfs_trace.h 
skipping to change at line 29 skipping to change at line 29
#define __TRACE_H__ #define __TRACE_H__
#define trace_xfs_alloc_exact_done(a) ((void) 0) #define trace_xfs_alloc_exact_done(a) ((void) 0)
#define trace_xfs_alloc_exact_notfound(a) ((void) 0) #define trace_xfs_alloc_exact_notfound(a) ((void) 0)
#define trace_xfs_alloc_exact_error(a) ((void) 0) #define trace_xfs_alloc_exact_error(a) ((void) 0)
#define trace_xfs_alloc_near_nominleft(a) ((void) 0) #define trace_xfs_alloc_near_nominleft(a) ((void) 0)
#define trace_xfs_alloc_near_first(a) ((void) 0) #define trace_xfs_alloc_near_first(a) ((void) 0)
#define trace_xfs_alloc_near_greater(a) ((void) 0) #define trace_xfs_alloc_near_greater(a) ((void) 0)
#define trace_xfs_alloc_near_lesser(a) ((void) 0) #define trace_xfs_alloc_near_lesser(a) ((void) 0)
#define trace_xfs_alloc_near_error(a) ((void) 0) #define trace_xfs_alloc_near_error(a) ((void) 0)
#define trace_xfs_alloc_near_noentry(a) ((void) 0)
#define trace_xfs_alloc_near_busy(a) ((void) 0)
#define trace_xfs_alloc_size_neither(a) ((void) 0) #define trace_xfs_alloc_size_neither(a) ((void) 0)
#define trace_xfs_alloc_size_noentry(a) ((void) 0) #define trace_xfs_alloc_size_noentry(a) ((void) 0)
#define trace_xfs_alloc_size_nominleft(a) ((void) 0) #define trace_xfs_alloc_size_nominleft(a) ((void) 0)
#define trace_xfs_alloc_size_done(a) ((void) 0) #define trace_xfs_alloc_size_done(a) ((void) 0)
#define trace_xfs_alloc_size_error(a) ((void) 0) #define trace_xfs_alloc_size_error(a) ((void) 0)
#define trace_xfs_alloc_size_busy(a) ((void) 0)
#define trace_xfs_alloc_small_freelist(a) ((void) 0) #define trace_xfs_alloc_small_freelist(a) ((void) 0)
#define trace_xfs_alloc_small_notenough(a) ((void) 0) #define trace_xfs_alloc_small_notenough(a) ((void) 0)
#define trace_xfs_alloc_small_done(a) ((void) 0) #define trace_xfs_alloc_small_done(a) ((void) 0)
#define trace_xfs_alloc_small_error(a) ((void) 0) #define trace_xfs_alloc_small_error(a) ((void) 0)
#define trace_xfs_alloc_vextent_badargs(a) ((void) 0) #define trace_xfs_alloc_vextent_badargs(a) ((void) 0)
#define trace_xfs_alloc_vextent_nofix(a) ((void) 0) #define trace_xfs_alloc_vextent_nofix(a) ((void) 0)
#define trace_xfs_alloc_vextent_noagbp(a) ((void) 0) #define trace_xfs_alloc_vextent_noagbp(a) ((void) 0)
#define trace_xfs_alloc_vextent_loopfailed(a) ((void) 0) #define trace_xfs_alloc_vextent_loopfailed(a) ((void) 0)
#define trace_xfs_alloc_vextent_allfailed(a) ((void) 0) #define trace_xfs_alloc_vextent_allfailed(a) ((void) 0)
skipping to change at line 94 skipping to change at line 97
#define trace_xfs_dir2_sf_to_block(a) ((void) 0) #define trace_xfs_dir2_sf_to_block(a) ((void) 0)
#define trace_xfs_dir2_sf_addname(a) ((void) 0) #define trace_xfs_dir2_sf_addname(a) ((void) 0)
#define trace_xfs_dir2_sf_create(a) ((void) 0) #define trace_xfs_dir2_sf_create(a) ((void) 0)
#define trace_xfs_dir2_sf_lookup(a) ((void) 0) #define trace_xfs_dir2_sf_lookup(a) ((void) 0)
#define trace_xfs_dir2_sf_removename(a) ((void) 0) #define trace_xfs_dir2_sf_removename(a) ((void) 0)
#define trace_xfs_dir2_sf_replace(a) ((void) 0) #define trace_xfs_dir2_sf_replace(a) ((void) 0)
#define trace_xfs_dir2_sf_toino4(a) ((void) 0) #define trace_xfs_dir2_sf_toino4(a) ((void) 0)
#define trace_xfs_dir2_sf_toino8(a) ((void) 0) #define trace_xfs_dir2_sf_toino8(a) ((void) 0)
#define trace_xfs_da_node_create(a) ((void) 0)
#define trace_xfs_da_split(a) ((void) 0)
#define trace_xfs_attr_leaf_split_before(a) ((void) 0)
#define trace_xfs_attr_leaf_split_after(a) ((void) 0)
#define trace_xfs_da_root_split(a) ((void) 0)
#define trace_xfs_da_node_split(a) ((void) 0)
#define trace_xfs_da_node_rebalance(a) ((void) 0)
#define trace_xfs_da_node_add(a) ((void) 0)
#define trace_xfs_da_join(a) ((void) 0)
#define trace_xfs_da_root_join(a) ((void) 0)
#define trace_xfs_da_node_toosmall(a) ((void) 0)
#define trace_xfs_da_fixhashpath(a) ((void) 0)
#define trace_xfs_da_node_remove(a) ((void) 0)
#define trace_xfs_da_node_unbalance(a) ((void) 0)
#define trace_xfs_da_link_before(a) ((void) 0)
#define trace_xfs_da_link_after(a) ((void) 0)
#define trace_xfs_da_unlink_back(a) ((void) 0)
#define trace_xfs_da_unlink_forward(a) ((void) 0)
#define trace_xfs_da_path_shift(a) ((void) 0)
#define trace_xfs_da_grow_inode(a) ((void) 0)
#define trace_xfs_da_swap_lastblock(a) ((void) 0)
#define trace_xfs_da_shrink_inode(a) ((void) 0)
#define trace_xfs_attr_sf_create(a) ((void) 0)
#define trace_xfs_attr_sf_add(a) ((void) 0)
#define trace_xfs_attr_sf_remove(a) ((void) 0)
#define trace_xfs_attr_sf_lookup(a) ((void) 0)
#define trace_xfs_attr_sf_to_leaf(a) ((void) 0)
#define trace_xfs_attr_leaf_to_sf(a) ((void) 0)
#define trace_xfs_attr_leaf_to_node(a) ((void) 0)
#define trace_xfs_attr_leaf_create(a) ((void) 0)
#define trace_xfs_attr_leaf_split(a) ((void) 0)
#define trace_xfs_attr_leaf_add_old(a) ((void) 0)
#define trace_xfs_attr_leaf_add_new(a) ((void) 0)
#define trace_xfs_attr_leaf_add(a) ((void) 0)
#define trace_xfs_attr_leaf_add_work(a) ((void) 0)
#define trace_xfs_attr_leaf_compact(a) ((void) 0)
#define trace_xfs_attr_leaf_rebalance(a) ((void) 0)
#define trace_xfs_attr_leaf_toosmall(a) ((void) 0)
#define trace_xfs_attr_leaf_remove(a) ((void) 0)
#define trace_xfs_attr_leaf_unbalance(a) ((void) 0)
#define trace_xfs_attr_leaf_lookup(a) ((void) 0)
#define trace_xfs_attr_leaf_clearflag(a) ((void) 0)
#define trace_xfs_attr_leaf_setflag(a) ((void) 0)
#define trace_xfs_attr_leaf_flipflags(a) ((void) 0)
#define trace_xfs_attr_sf_addname(a) ((void) 0)
#define trace_xfs_attr_leaf_addname(a) ((void) 0)
#define trace_xfs_attr_leaf_replace(a) ((void) 0)
#define trace_xfs_attr_leaf_removename(a) ((void) 0)
#define trace_xfs_attr_leaf_get(a) ((void) 0)
#define trace_xfs_attr_node_addname(a) ((void) 0)
#define trace_xfs_attr_node_replace(a) ((void) 0)
#define trace_xfs_attr_node_removename(a) ((void) 0)
#define trace_xfs_attr_fillstate(a) ((void) 0)
#define trace_xfs_attr_refillstate(a) ((void) 0)
#define trace_xfs_attr_node_get(a) ((void) 0)
#define trace_xfs_attr_rmtval_get(a) ((void) 0)
#define trace_xfs_attr_rmtval_set(a) ((void) 0)
#define trace_xfs_attr_rmtval_remove(a) ((void) 0)
#define trace_xfs_bmap_pre_update(a,b,c,d) ((void) 0) #define trace_xfs_bmap_pre_update(a,b,c,d) ((void) 0)
#define trace_xfs_bmap_post_update(a,b,c,d) ((void) 0) #define trace_xfs_bmap_post_update(a,b,c,d) ((void) 0)
#define trace_xfs_extlist(a,b,c,d) ((void) 0) #define trace_xfs_extlist(a,b,c,d) ((void) 0)
#define trace_xfs_bunmap(a,b,c,d,e) ((void) 0) #define trace_xfs_bunmap(a,b,c,d,e) ((void) 0)
#define trace_xfs_perag_get(a,b,c,d) ((void) 0) /* set c = c to avoid unused var warnings */
#define trace_xfs_perag_put(a,b,c,d) ((void) 0) #define trace_xfs_perag_get(a,b,c,d) ((c) = (c))
#define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c))
#define trace_xfs_perag_put(a,b,c,d) ((c) = (c))
#endif /* __TRACE_H__ */ #endif /* __TRACE_H__ */
 End of changes. 4 change blocks. 
2 lines changed or deleted 68 lines changed or added


 xfs_types.h   xfs_types.h 
skipping to change at line 21 skipping to change at line 21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_TYPES_H__ #ifndef __XFS_TYPES_H__
#define __XFS_TYPES_H__ #define __XFS_TYPES_H__
#ifdef __KERNEL__ typedef __uint32_t prid_t; /* project ID */
/*
* 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_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_extlen_t; /* extent length in blocks * /
typedef __uint32_t xfs_agnumber_t; /* allocation group number * / typedef __uint32_t xfs_agnumber_t; /* allocation group number * /
typedef __int32_t xfs_extnum_t; /* # of extents in a file */ typedef __int32_t xfs_extnum_t; /* # of extents in a file */
typedef __int16_t xfs_aextnum_t; /* # extents in an attribute fork */ 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 __uint64_t xfs_ufsize_t; /* unsigned bytes in a file */
typedef __int32_t xfs_suminfo_t; /* type of bitmap summary in fo */ typedef __int32_t xfs_suminfo_t; /* type of bitmap summary in fo */
typedef __int32_t xfs_rtword_t; /* word type for bitmap mani pulations */ typedef __int32_t xfs_rtword_t; /* word type for bitmap mani pulations */
typedef __int64_t xfs_lsn_t; /* log sequence number */ typedef __int64_t xfs_lsn_t; /* log sequence number */
typedef __int32_t xfs_tid_t; /* transaction identifier */ typedef __int32_t xfs_tid_t; /* transaction identifier */
typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ 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_dahash_t; /* dir/attr hash value */
typedef __uint32_t xlog_tid_t; /* transaction ID type */
/* /*
* These types are 64 bits on disk but are either 32 or 64 bits in memory. * These types are 64 bits on disk but are either 32 or 64 bits in memory.
* Disk based types: * Disk based types:
*/ */
typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno ) */ 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_drfsbno_t; /* blockno in filesystem (raw) */
typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtim e area */ typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtim e area */
typedef __uint64_t xfs_dfiloff_t; /* block number in a file */ typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a fil e */ typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a fil e */
skipping to change at line 125 skipping to change at line 88
#define NULLRFSBLOCK ((xfs_rfsblock_t)-1) #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
#define NULLRTBLOCK ((xfs_rtblock_t)-1) #define NULLRTBLOCK ((xfs_rtblock_t)-1)
#define NULLFILEOFF ((xfs_fileoff_t)-1) #define NULLFILEOFF ((xfs_fileoff_t)-1)
#define NULLAGBLOCK ((xfs_agblock_t)-1) #define NULLAGBLOCK ((xfs_agblock_t)-1)
#define NULLAGNUMBER ((xfs_agnumber_t)-1) #define NULLAGNUMBER ((xfs_agnumber_t)-1)
#define NULLEXTNUM ((xfs_extnum_t)-1) #define NULLEXTNUM ((xfs_extnum_t)-1)
#define NULLCOMMITLSN ((xfs_lsn_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. * Max values for extlen, extnum, aextnum.
*/ */
#define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits * / #define MAXEXTLEN ((xfs_extlen_t)0x001fffff) /* 21 bits * /
#define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed in t */ #define MAXEXTNUM ((xfs_extnum_t)0x7fffffff) /* signed in t */
#define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed sh ort */ #define MAXAEXTNUM ((xfs_aextnum_t)0x7fff) /* signed sh ort */
/* /*
* 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)
/*
* Inode fork identifiers.
*/
#define XFS_DATA_FORK 0
#define XFS_ATTR_FORK 1
/*
* Min numbers of data/attr fork btree root pointers. * Min numbers of data/attr fork btree root pointers.
*/ */
#define MINDBTPTRS 3 #define MINDBTPTRS 3
#define MINABTPTRS 2 #define MINABTPTRS 2
/* /*
* MAXNAMELEN is the length (including the terminating null) of * MAXNAMELEN is the length (including the terminating null) of
* the longest permissible file (component) name. * the longest permissible file (component) name.
*/ */
#define MAXNAMELEN 256 #define MAXNAMELEN 256
skipping to change at line 156 skipping to change at line 142
} xfs_lookup_t; } xfs_lookup_t;
typedef enum { typedef enum {
XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi, XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_BMAPi, XFS_BTNUM_INOi,
XFS_BTNUM_MAX XFS_BTNUM_MAX
} xfs_btnum_t; } xfs_btnum_t;
struct xfs_name { struct xfs_name {
const unsigned char *name; const unsigned char *name;
int len; int len;
int type;
}; };
/*
* uid_t and gid_t are hard-coded to 32 bits in the inode.
* Hence, an 'id' in a dquot is 32 bits..
*/
typedef __uint32_t xfs_dqid_t;
/*
* 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)
#endif /* __XFS_TYPES_H__ */ #endif /* __XFS_TYPES_H__ */
 End of changes. 7 change blocks. 
39 lines changed or deleted 42 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/