libxfs.h   libxfs.h 
skipping to change at line 28 skipping to change at line 28
#ifndef __LIBXFS_H__ #ifndef __LIBXFS_H__
#define __LIBXFS_H__ #define __LIBXFS_H__
#define XFS_BIG_INUMS 1 #define XFS_BIG_INUMS 1
#define XFS_BIG_BLKNOS 1 #define XFS_BIG_BLKNOS 1
#include <xfs/platform_defs.h> #include <xfs/platform_defs.h>
#include <xfs/list.h> #include <xfs/list.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/swab.h> #include <xfs/swab.h>
#include <xfs/atomic.h>
#include <xfs/xfs_fs.h> #include <xfs/xfs_fs.h>
#include <xfs/xfs_types.h> #include <xfs/xfs_types.h>
#include <xfs/xfs_arch.h> #include <xfs/xfs_arch.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_dir2.h>
#include <xfs/xfs_mount.h> #include <xfs/xfs_mount.h>
skipping to change at line 57 skipping to change at line 60
#include <xfs/xfs_dir2_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.h>
#include <xfs/xfs_buf_item.h> #include <xfs/xfs_buf_item.h>
#include <xfs/xfs_inode_item.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>
#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
#ifndef XFS_SUPER_MAGIC #ifndef XFS_SUPER_MAGIC
#define XFS_SUPER_MAGIC 0x58465342 #define XFS_SUPER_MAGIC 0x58465342
#endif #endif
#define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a)) *NBBY)))) #define xfs_isset(a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a)) *NBBY))))
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
#define round_down(x, y) ((x) & ~__round_mask(x, y))
/* /*
* Argument structure for libxfs_init(). * Argument structure for libxfs_init().
*/ */
typedef struct { typedef struct {
/* input parameters */ /* input parameters */
char *volname; /* pathname of volume */ char *volname; /* pathname of volume */
char *dname; /* pathname of data "subvolume" */ char *dname; /* pathname of data "subvolume" */
char *logname; /* pathname of log "subvolume" */ char *logname; /* pathname of log "subvolume" */
char *rtname; /* pathname of realtime "subvolume" */ char *rtname; /* pathname of realtime "subvolume" */
int isreadonly; /* filesystem is only read in applic */ int isreadonly; /* filesystem is only read in applic */
skipping to change at line 169 skipping to change at line 177
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 */
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
xfs_perag_t *m_perag; /* per-ag accounting info */ 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 */ xfs_trans_reservations_t m_reservations;/* precomputed res values */
skipping to change at line 223 skipping to change at line 231
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_blkno;
unsigned b_bcount; unsigned b_bcount;
dev_t b_dev; dev_t b_dev;
pthread_mutex_t b_lock; pthread_mutex_t b_lock;
void *b_fsprivate; void *b_fsprivate;
void *b_fsprivate2; void *b_fsprivate2;
void *b_fsprivate3; void *b_fsprivate3;
char *b_addr; char *b_addr;
int b_error;
#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 */
skipping to change at line 244 skipping to change at line 253
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 */
}; };
#define XFS_BUF_PTR(bp) ((bp)->b_addr) #define XFS_BUF_PTR(bp) ((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_blkno)
#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) ((bp)->b_addr = (char *)(p)); \ #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
XFS_BUF_SET_COUNT(bp,cnt) (bp)->b_addr = (char *)(p); \
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_blkno = (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_fsprivate)
#define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fsprivate = (void *)(val) #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fsprivate = (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)
skipping to change at line 332 skipping to change at line 344
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_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_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;
} 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;
skipping to change at line 354 skipping to change at line 367
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 */
unsigned int t_items_free; /* log item descs free */ struct list_head t_items; /* first log item desc chunk
xfs_log_item_chunk_t t_items; /* first log item desc chunk */
*/
} xfs_trans_t; } xfs_trans_t;
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 t); extern int libxfs_trans_reserve (xfs_trans_t *, uint,uint,uint,uint,uin t);
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 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_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,
skipping to change at line 392 skipping to change at line 405
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 **);
/* /*
* 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) */
xfs_daddr_t i_blkno; /* blkno of inode buffer */ struct xfs_imap i_imap; /* location for xfs_imap() * /
dev_t i_dev; /* dev for this inode */ dev_t i_dev; /* dev for this inode */
ushort i_len; /* len of inode buffer */
ushort i_boffset; /* off of inode in buffer */
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 */
skipping to change at line 420 skipping to change at line 431
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_ichgtime (xfs_inode_t *, int); extern void libxfs_trans_ichgtime(struct xfs_trans *,
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, extern int libxfs_iread (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
xfs_inode_t *, xfs_daddr_t); xfs_inode_t *, xfs_daddr_t);
/* Inode Cache Interfaces */ /* Inode Cache Interfaces */
extern struct cache *libxfs_icache; extern struct cache *libxfs_icache;
extern struct cache_operations libxfs_icache_operations; extern struct cache_operations libxfs_icache_operations;
extern void libxfs_icache_purge (void); 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_dir_leaf.h> /* dirv1 support in db & repair */
#include <xfs/xfs_dir2_data.h> #include <xfs/xfs_dir2_data.h>
#include <xfs/xfs_dir2_leaf.h> #include <xfs/xfs_dir2_leaf.h>
#include <xfs/xfs_dir2_block.h> #include <xfs/xfs_dir2_block.h>
#include <xfs/xfs_dir2_node.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,
skipping to change at line 467 skipping to change at line 482
#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_rtalloc.h>
#include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_attr_leaf.h>
#include <xfs/xfs_quota.h> #include <xfs/xfs_quota.h>
#include <xfs/xfs_trans_space.h> #include <xfs/xfs_trans_space.h>
#include <xfs/xfs_imap.h>
#include <xfs/xfs_log.h> #include <xfs/xfs_log.h>
#include <xfs/xfs_log_priv.h> #include <xfs/xfs_log_priv.h>
#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)
)
#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))
#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);
/* xfs_attr.c */ /* xfs_attr.c */
int libxfs_attr_get(struct xfs_inode *, const char *, char *, int *, int); int libxfs_attr_get(struct xfs_inode *, const unsigned char *,
int libxfs_attr_set(struct xfs_inode *, const char *, char *, int, int); unsigned char *, int *, int);
int libxfs_attr_remove(struct xfs_inode *, const char *, int); int libxfs_attr_set(struct xfs_inode *, const unsigned char *,
unsigned char *, int, 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);
/* 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
 End of changes. 20 change blocks. 
14 lines changed or deleted 36 lines changed or added


 libxlog.h   libxlog.h 
skipping to change at line 42 skipping to change at line 42
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 */
int l_grant_reserve_cycle; /* */ atomic64_t l_grant_reserve_head;
int l_grant_reserve_bytes; /* */ atomic64_t l_grant_write_head;
int l_grant_write_cycle; /* */
int l_grant_write_bytes; /* */
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 */
} xlog_t; } xlog_t;
#include <xfs/xfs_log_recover.h> #include <xfs/xfs_log_recover.h>
#include <xfs/xfs_buf_item.h> #include <xfs/xfs_buf_item.h>
#include <xfs/xfs_inode_item.h> #include <xfs/xfs_inode_item.h>
#include <xfs/xfs_extfree_item.h> #include <xfs/xfs_extfree_item.h>
typedef union { typedef union {
xlog_rec_header_t hic_header; xlog_rec_header_t hic_header;
xlog_rec_ext_header_t hic_xheader; xlog_rec_ext_header_t hic_xheader;
skipping to change at line 94 skipping to change at line 93
/* 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(xlog_t *, int);
extern void xlog_put_bp(struct xfs_buf *); extern void xlog_put_bp(struct xfs_buf *);
extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); extern int xlog_bread(xlog_t *log, xfs_daddr_t blk_no, int nbblks,
xfs_buf_t *bp, xfs_caddr_t *offset);
extern int xlog_bread_noalign(xlog_t *log, xfs_daddr_t blk_no, int nbbl
ks,
xfs_buf_t *bp);
extern int xlog_find_zeroed(xlog_t *log, xfs_daddr_t *blk_no); extern int xlog_find_zeroed(xlog_t *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(xlog_t *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(xlog_t *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(xlog_t *log);
extern int xlog_recover(xlog_t *log, int readonly); extern int xlog_recover(xlog_t *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(xlog_t *log, xfs_daddr_t *last_blk);
/* 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,
xlog_recover_item_t *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(xlog_t *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(xlog_t *log, xlog_recover_t *trans,
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_grant_head(l,a,b) ((void) 0)
#endif /* LIBXLOG_H */ #endif /* LIBXLOG_H */
 End of changes. 5 change blocks. 
6 lines changed or deleted 11 lines changed or added


 linux.h   linux.h 
skipping to change at line 26 skipping to change at line 26
*/ */
#ifndef __XFS_LINUX_H__ #ifndef __XFS_LINUX_H__
#define __XFS_LINUX_H__ #define __XFS_LINUX_H__
#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 <malloc.h> #include <malloc.h>
#include <getopt.h> #include <getopt.h>
#include <endian.h> #include <endian.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);
} }
static __inline__ int platform_test_xfs_fd(int fd) static __inline__ int platform_test_xfs_fd(int fd)
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 list.h   list.h 
skipping to change at line 30 skipping to change at line 30
/* /*
* Simple, generic doubly-linked list implementation. * Simple, generic doubly-linked list implementation.
*/ */
struct list_head { struct list_head {
struct list_head *next; struct list_head *next;
struct list_head *prev; struct list_head *prev;
}; };
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(list) list_head_init(list)
static inline void list_head_init(struct list_head *list) static inline void list_head_init(struct list_head *list)
{ {
list->next = list->prev = list; list->next = list->prev = list;
} }
static inline void list_head_destroy(struct list_head *list) static inline void list_head_destroy(struct list_head *list)
{ {
list->next = list->prev = NULL; list->next = list->prev = NULL;
} }
skipping to change at line 71 skipping to change at line 77
next->prev = prev; next->prev = prev;
prev->next = next; prev->next = next;
} }
static inline void list_del_init(struct list_head *entry) static inline void list_del_init(struct list_head *entry)
{ {
__list_del(entry->prev, entry->next); __list_del(entry->prev, entry->next);
list_head_init(entry); list_head_init(entry);
} }
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
}
static inline void list_move(struct list_head *list, struct list_head *head ) static inline void list_move(struct list_head *list, struct list_head *head )
{ {
__list_del(list->prev, list->next); __list_del(list->prev, list->next);
list_add(list, head); list_add(list, head);
} }
static inline void list_move_tail(struct list_head *list, struct list_head *head) static inline void list_move_tail(struct list_head *list, struct list_head *head)
{ {
__list_del(list->prev, list->next); __list_del(list->prev, list->next);
list_add_tail(list, head); list_add_tail(list, head);
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added


 xfs_ag.h   xfs_ag.h 
skipping to change at line 89 skipping to change at line 89
#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_NUM_BITS 12
#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 \
{ XFS_AGF_MAGICNUM, "MAGICNUM" }, \
{ XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \
{ XFS_AGF_SEQNO, "SEQNO" }, \
{ XFS_AGF_LENGTH, "LENGTH" }, \
{ XFS_AGF_ROOTS, "ROOTS" }, \
{ XFS_AGF_LEVELS, "LEVELS" }, \
{ XFS_AGF_FLFIRST, "FLFIRST" }, \
{ XFS_AGF_FLLAST, "FLLAST" }, \
{ XFS_AGF_FLCOUNT, "FLCOUNT" }, \
{ XFS_AGF_FREEBLKS, "FREEBLKS" }, \
{ XFS_AGF_LONGEST, "LONGEST" }, \
{ XFS_AGF_BTREEBLKS, "BTREEBLKS" }
/* 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 *)XFS_BUF_PTR(bp))
extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
xfs_agnumber_t agno, int flags, struct xfs_buf **bpp
);
/* /*
* Size of the unlinked inode hash table in the agi. * 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 {
/* /*
* Common allocation group header information * Common allocation group header information
*/ */
__be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */ __be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */
skipping to change at line 144 skipping to change at line 161
#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 *)XFS_BUF_PTR(bp))
extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
xfs_agnumber_t agno, struct xfs_buf **bpp);
/* /*
* The third a.g. block contains the a.g. freelist, an array * 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 _t)) #define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock _t))
#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp))
typedef struct xfs_agfl { typedef struct xfs_agfl {
__be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */
} xfs_agfl_t; } xfs_agfl_t;
/* /*
* Busy block/extent entry. Used in perag to mark blocks that have been fr * Busy block/extent entry. Indexed by a rbtree in perag to mark blocks th
eed at
* but whose transactions aren't committed to disk yet. * 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.
*/ */
typedef struct xfs_perag_busy { struct xfs_busy_extent {
xfs_agblock_t busy_start; #ifdef __KERNEL__
xfs_extlen_t busy_length; struct rb_node rb_node; /* ag by-bno indexed search tree */
struct xfs_trans *busy_tp; /* transaction that did the free */ #endif
} xfs_perag_busy_t; 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, * Per-ag incore structure, copies of information in agf and agi,
* to improve the performance of allocation group selection. * to improve the performance of allocation group selection.
*
* pick sizes which fit in allocation buckets well
*/ */
#if (BITS_PER_LONG == 32)
#define XFS_PAGB_NUM_SLOTS 84
#elif (BITS_PER_LONG == 64)
#define XFS_PAGB_NUM_SLOTS 128 #define XFS_PAGB_NUM_SLOTS 128
#endif
typedef struct xfs_perag 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 pagf_init; /* this agf's entry is initialized * /
char pagi_init; /* this agi'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 pagf_metadata; /* the agf is preferred to be metada ta */
char pagi_inodeok; /* The agi is ok for inodes */ char pagi_inodeok; /* The agi is ok for inodes */
__uint8_t pagf_levels[XFS_BTNUM_AGF]; __uint8_t pagf_levels[XFS_BTNUM_AGF];
/* # of levels in bno & cnt btree */ /* # of levels in bno & cnt btree */
__uint32_t pagf_flcount; /* count of blocks in freelist */ __uint32_t pagf_flcount; /* count of blocks in freelist */
xfs_extlen_t pagf_freeblks; /* total free blocks */ xfs_extlen_t pagf_freeblks; /* total free blocks */
xfs_extlen_t pagf_longest; /* longest free space */ xfs_extlen_t pagf_longest; /* longest free space */
__uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */ __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
xfs_agino_t pagi_freecount; /* number of free inodes */ xfs_agino_t pagi_freecount; /* number of free inodes */
xfs_agino_t pagi_count; /* number of allocated inodes */ xfs_agino_t pagi_count; /* number of allocated inodes */
int pagb_count; /* pagb slots in use */
xfs_perag_busy_t *pagb_list; /* unstable blocks */ /*
* 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__ #ifdef __KERNEL__
spinlock_t pagb_lock; /* lock for pagb_list */ 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 */ atomic_t pagf_fstrms; /* # of filestreams active in this A G */
int pag_ici_init; /* incore inode cache initialised */ spinlock_t pag_ici_lock; /* incore inode cache lock */
rwlock_t pag_ici_lock; /* incore inode lock */
struct radix_tree_root pag_ici_root; /* incore inode cache root * / 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 #endif
int pagb_count; /* pagb slots in use */
} xfs_perag_t; } xfs_perag_t;
/*
* tags for inode radix tree
*/
#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged look
up
in xfs_inode_ag_iterator */
#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */
#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( \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \ (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp)) (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
#define XFS_AGB_TO_FSB(mp,agno,agbno) \ #define XFS_AGB_TO_FSB(mp,agno,agbno) \
(((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno)) (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
#define XFS_FSB_TO_AGNO(mp,fsbno) \ #define XFS_FSB_TO_AGNO(mp,fsbno) \
((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog)) ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
#define XFS_FSB_TO_AGBNO(mp,fsbno) \ #define XFS_FSB_TO_AGBNO(mp,fsbno) \
((xfs_agblock_t)((fsbno) & XFS_MASK32LO((mp)->m_sb.sb_agblklog))) ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
#define XFS_AGB_TO_DADDR(mp,agno,agbno) \ #define XFS_AGB_TO_DADDR(mp,agno,agbno) \
((xfs_daddr_t)XFS_FSB_TO_BB(mp, \ ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
(xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno))) (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d)) #define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
/* /*
* For checking for bad ranges of xfs_daddr_t's, covering multiple * For checking for bad ranges of xfs_daddr_t's, covering multiple
* allocation groups or a single xfs_daddr_t that's a superblock copy. * allocation groups or a single xfs_daddr_t that's a superblock copy.
*/ */
#define XFS_AG_CHECK_DADDR(mp,d,len) \ #define XFS_AG_CHECK_DADDR(mp,d,len) \
((len) == 1 ? \ ((len) == 1 ? \
ASSERT((d) == XFS_SB_DADDR || \ ASSERT((d) == XFS_SB_DADDR || \
XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \ ASSERT(xfs_daddr_to_agno(mp, d) == \
XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1))) xfs_daddr_to_agno(mp, (d) + (len) - 1)))
#endif /* __XFS_AG_H__ */ #endif /* __XFS_AG_H__ */
 End of changes. 18 change blocks. 
27 lines changed or deleted 78 lines changed or added


 xfs_alloc.h   xfs_alloc.h 
skipping to change at line 25 skipping to change at line 25
* 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_mount; struct xfs_mount;
struct xfs_perag; struct xfs_perag;
struct xfs_trans; struct xfs_trans;
struct xfs_busy_extent;
/* /*
* Freespace allocation types. Argument to xfs_alloc_[v]extent. * Freespace allocation types. Argument to xfs_alloc_[v]extent.
*/ */
typedef enum xfs_alloctype #define XFS_ALLOCTYPE_ANY_AG 0x01 /* allocate anywhere, use rotor */
{ #define XFS_ALLOCTYPE_FIRST_AG 0x02 /* ... start at ag 0 */
XFS_ALLOCTYPE_ANY_AG, /* allocate anywhere, use rotor */ #define XFS_ALLOCTYPE_START_AG 0x04 /* anywhere, start in this a.g. */
XFS_ALLOCTYPE_FIRST_AG, /* ... start at ag 0 */ #define XFS_ALLOCTYPE_THIS_AG 0x08 /* anywhere in this a.g. */
XFS_ALLOCTYPE_START_AG, /* anywhere, start in this a.g. */ #define XFS_ALLOCTYPE_START_BNO 0x10 /* near this block else anyw
XFS_ALLOCTYPE_THIS_AG, /* anywhere in this a.g. */ here */
XFS_ALLOCTYPE_START_BNO, /* near this block else anywhere */ #define XFS_ALLOCTYPE_NEAR_BNO 0x20 /* in this a.g. and near this block
XFS_ALLOCTYPE_NEAR_BNO, /* in this a.g. and near this block */
*/ #define XFS_ALLOCTYPE_THIS_BNO 0x40 /* at exactly this block */
XFS_ALLOCTYPE_THIS_BNO /* at exactly this block */
} xfs_alloctype_t; /* this should become an enum again when the tracing code is fixed */
typedef unsigned int xfs_alloctype_t;
#define XFS_ALLOC_TYPES \
{ XFS_ALLOCTYPE_ANY_AG, "ANY_AG" }, \
{ XFS_ALLOCTYPE_FIRST_AG, "FIRST_AG" }, \
{ XFS_ALLOCTYPE_START_AG, "START_AG" }, \
{ XFS_ALLOCTYPE_THIS_AG, "THIS_AG" }, \
{ XFS_ALLOCTYPE_START_BNO, "START_BNO" }, \
{ XFS_ALLOCTYPE_NEAR_BNO, "NEAR_BNO" }, \
{ XFS_ALLOCTYPE_THIS_BNO, "THIS_BNO" }
/* /*
* Flags for xfs_alloc_fix_freelist. * Flags for xfs_alloc_fix_freelist.
*/ */
#define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffe r locking */ #define XFS_ALLOC_FLAG_TRYLOCK 0x00000001 /* use trylock for buffe r locking */
#define XFS_ALLOC_FLAG_FREEING 0x00000002 /* indicate caller is fr eeing extents*/ #define XFS_ALLOC_FLAG_FREEING 0x00000002 /* indicate caller is fr eeing extents*/
/* /*
* In order to avoid ENOSPC-related deadlock caused by * In order to avoid ENOSPC-related deadlock caused by
* out-of-order locking of AGF buffer (PV 947395), we place * out-of-order locking of AGF buffer (PV 947395), we place
skipping to change at line 103 skipping to change at line 113
char userdata; /* set if this is user data */ char userdata; /* set if this is user data */
xfs_fsblock_t firstblock; /* io first block allocated */ xfs_fsblock_t firstblock; /* io first block allocated */
} xfs_alloc_arg_t; } xfs_alloc_arg_t;
/* /*
* Defines for userdata * Defines for userdata
*/ */
#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 */
#ifdef __KERNEL__
#if defined(XFS_ALLOC_TRACE)
/* /*
* Allocation tracing buffer size. * Find the length of the longest extent in an AG.
*/ */
#define XFS_ALLOC_TRACE_SIZE 4096 xfs_extlen_t
extern ktrace_t *xfs_alloc_trace_buf; xfs_alloc_longest_free_extent(struct xfs_mount *mp,
struct xfs_perag *pag);
/* #ifdef __KERNEL__
* Types for alloc tracing.
*/
#define XFS_ALLOC_KTRACE_ALLOC 1
#define XFS_ALLOC_KTRACE_FREE 2
#define XFS_ALLOC_KTRACE_MODAGF 3
#define XFS_ALLOC_KTRACE_BUSY 4
#define XFS_ALLOC_KTRACE_UNBUSY 5
#define XFS_ALLOC_KTRACE_BUSYSEARCH 6
#endif
void void
xfs_alloc_mark_busy(xfs_trans_t *tp, xfs_alloc_busy_insert(xfs_trans_t *tp,
xfs_agnumber_t agno, xfs_agnumber_t agno,
xfs_agblock_t bno, xfs_agblock_t bno,
xfs_extlen_t len); xfs_extlen_t len);
void void
xfs_alloc_clear_busy(xfs_trans_t *tp, xfs_alloc_busy_clear(struct xfs_mount *mp, struct xfs_busy_extent *busyp);
xfs_agnumber_t ag,
int idx);
#endif /* __KERNEL__ */ #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 */
 End of changes. 8 change blocks. 
31 lines changed or deleted 29 lines changed or added


 xfs_arch.h   xfs_arch.h 
skipping to change at line 76 skipping to change at line 76
*a = cpu_to_be32(be32_to_cpu(*a) + b); *a = cpu_to_be32(be32_to_cpu(*a) + b);
} }
static inline void be64_add_cpu(__be64 *a, __s64 b) static inline void be64_add_cpu(__be64 *a, __s64 b)
{ {
*a = cpu_to_be64(be64_to_cpu(*a) + b); *a = cpu_to_be64(be64_to_cpu(*a) + b);
} }
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* do we need conversion? */
#define ARCH_NOCONVERT 1
#ifdef XFS_NATIVE_HOST
# define ARCH_CONVERT ARCH_NOCONVERT
#else
# define ARCH_CONVERT 0
#endif
/* generic swapping macros */
#ifndef HAVE_SWABMACROS
#define INT_SWAP16(type,var) ((typeof(type))(__swab16((__u16)(var))))
#define INT_SWAP32(type,var) ((typeof(type))(__swab32((__u32)(var))))
#define INT_SWAP64(type,var) ((typeof(type))(__swab64((__u64)(var))))
#endif
#define INT_SWAP(type, var) \
((sizeof(type) == 8) ? INT_SWAP64(type,var) : \
((sizeof(type) == 4) ? INT_SWAP32(type,var) : \
((sizeof(type) == 2) ? INT_SWAP16(type,var) : \
(var))))
/* /*
* get and set integers from potentially unaligned locations * get and set integers from potentially unaligned locations
*/ */
#define INT_GET_UNALIGNED_16_BE(pointer) \ #define INT_GET_UNALIGNED_16_BE(pointer) \
((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1]))) ((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1])))
#define INT_SET_UNALIGNED_16_BE(pointer,value) \ #define INT_SET_UNALIGNED_16_BE(pointer,value) \
{ \ { \
((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \ ((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \
((__u8*)(pointer))[1] = (((value) ) & 0xff); \ ((__u8*)(pointer))[1] = (((value) ) & 0xff); \
} }
/* does not return a value */
#define INT_SET(reference,arch,valueref) \
(__builtin_constant_p(valueref) ? \
(void)( (reference) = ( ((arch) != ARCH_NOCONVERT) ? (INT_SWAP((refe
rence),(valueref))) : (valueref)) ) : \
(void)( \
((reference) = (valueref)), \
( ((arch) != ARCH_NOCONVERT) ? (reference) = INT_SWAP((reference
),(reference)) : 0 ) \
) \
)
/* /*
* In directories inode numbers are stored as unaligned arrays of unsigned * In directories inode numbers are stored as unaligned arrays of unsigned
* 8bit integers on disk. * 8bit integers on disk.
* *
* For v1 directories or v2 directories that contain inode numbers that * For v1 directories or v2 directories that contain inode numbers that
* do not fit into 32bit the array has eight members, but the first member * do not fit into 32bit the array has eight members, but the first member
* is always zero: * is always zero:
* *
* |unused|48-55|40-47|32-39|24-31|16-23| 8-15| 0- 7| * |unused|48-55|40-47|32-39|24-31|16-23| 8-15| 0- 7|
* *
 End of changes. 2 change blocks. 
34 lines changed or deleted 0 lines changed or added


 xfs_attr_leaf.h   xfs_attr_leaf.h 
skipping to change at line 154 skipping to change at line 154
/* /*
* Alignment for namelist and valuelist entries (since they are mixed * Alignment for namelist and valuelist entries (since they are mixed
* there can be only one alignment value) * there can be only one alignment value)
*/ */
#define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t)) #define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t))
/* /*
* Cast typed pointers for "local" and "remote" name/value structs. * Cast typed pointers for "local" and "remote" name/value structs.
*/ */
#define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \
xfs_attr_leaf_name_remote(leafp,idx)
static inline xfs_attr_leaf_name_remote_t * static inline xfs_attr_leaf_name_remote_t *
xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx)
{ {
return (xfs_attr_leaf_name_remote_t *) return (xfs_attr_leaf_name_remote_t *)
&((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
} }
#define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \
xfs_attr_leaf_name_local(leafp,idx)
static inline xfs_attr_leaf_name_local_t * static inline xfs_attr_leaf_name_local_t *
xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx)
{ {
return (xfs_attr_leaf_name_local_t *) return (xfs_attr_leaf_name_local_t *)
&((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
} }
#define XFS_ATTR_LEAF_NAME(leafp,idx) \
xfs_attr_leaf_name(leafp,idx)
static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx ) static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx )
{ {
return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)];
} }
/* /*
* Calculate total bytes used (including trailing pad for alignment) for * Calculate total bytes used (including trailing pad for alignment) for
* a "local" name/value structure, a "remote" name/value structure, and * a "local" name/value structure, a "remote" name/value structure, and
* a pointer which might be either. * a pointer which might be either.
*/ */
#define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \
xfs_attr_leaf_entsize_remote(nlen)
static inline int xfs_attr_leaf_entsize_remote(int nlen) static inline int xfs_attr_leaf_entsize_remote(int nlen)
{ {
return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \
XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
} }
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \
xfs_attr_leaf_entsize_local(nlen,vlen)
static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) 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) + 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); XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1);
} }
#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \
xfs_attr_leaf_entsize_local_max(bsize)
static inline int xfs_attr_leaf_entsize_local_max(int bsize) static inline int xfs_attr_leaf_entsize_local_max(int bsize)
{ {
return (((bsize) >> 1) + ((bsize) >> 2)); 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 */
 End of changes. 6 change blocks. 
12 lines changed or deleted 0 lines changed or added


 xfs_attr_sf.h   xfs_attr_sf.h 
skipping to change at line 28 skipping to change at line 28
#ifndef __XFS_ATTR_SF_H__ #ifndef __XFS_ATTR_SF_H__
#define __XFS_ATTR_SF_H__ #define __XFS_ATTR_SF_H__
/* /*
* Attribute storage when stored inside the inode. * Attribute storage when stored inside the inode.
* *
* Small attribute lists are packed as tightly as possible so as * Small attribute lists are packed as tightly as possible so as
* to fit into the literal area of the inode. * to fit into the literal area of the inode.
*/ */
struct xfs_inode;
/* /*
* Entries are packed toward the top as tight as possible. * Entries are packed toward the top as tight as possible.
*/ */
typedef struct xfs_attr_shortform { typedef struct xfs_attr_shortform {
struct xfs_attr_sf_hdr { /* constant-structure header block * / struct xfs_attr_sf_hdr { /* constant-structure header block * /
__be16 totsize; /* total bytes in shortform list */ __be16 totsize; /* total bytes in shortform list */
__u8 count; /* count of active entries */ __u8 count; /* count of active entries */
} hdr; } hdr;
struct xfs_attr_sf_entry { struct xfs_attr_sf_entry {
__uint8_t namelen; /* actual length of name (no NULL) * / __uint8_t namelen; /* actual length of name (no NULL) * /
skipping to change at line 57 skipping to change at line 55
/* /*
* We generate this then sort it, attr_list() must return things in hash-or der. * We generate this then sort it, attr_list() must return things in hash-or der.
*/ */
typedef struct xfs_attr_sf_sort { typedef struct xfs_attr_sf_sort {
__uint8_t entno; /* entry number in original list */ __uint8_t entno; /* entry number in original list */
__uint8_t namelen; /* length of name value (no null) */ __uint8_t namelen; /* length of name value (no null) */
__uint8_t valuelen; /* length of value */ __uint8_t valuelen; /* length of value */
__uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */ __uint8_t flags; /* flags bits (see xfs_attr_leaf.h) */
xfs_dahash_t hash; /* this entry's hash value */ xfs_dahash_t hash; /* this entry's hash value */
char *name; /* name value, pointer into buffer * / unsigned char *name; /* name value, pointer into buffer * /
} xfs_attr_sf_sort_t; } xfs_attr_sf_sort_t;
#define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \ #define XFS_ATTR_SF_ENTSIZE_BYNAME(nlen,vlen) /* space name/value uses */ \
(((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen))) (((int)sizeof(xfs_attr_sf_entry_t)-1 + (nlen)+(vlen)))
#define XFS_ATTR_SF_ENTSIZE_MAX /* max space for nam e&value */ \ #define XFS_ATTR_SF_ENTSIZE_MAX /* max space for nam e&value */ \
((1 << (NBBY*(int)sizeof(__uint8_t))) - 1) ((1 << (NBBY*(int)sizeof(__uint8_t))) - 1)
#define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \ #define XFS_ATTR_SF_ENTSIZE(sfep) /* space an entry uses */ \
((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuel en) ((int)sizeof(xfs_attr_sf_entry_t)-1 + (sfep)->namelen+(sfep)->valuel en)
#define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ #define XFS_ATTR_SF_NEXTENTRY(sfep) /* next entry in struct */ \
((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)) ) ((xfs_attr_sf_entry_t *)((char *)(sfep) + XFS_ATTR_SF_ENTSIZE(sfep)) )
#define XFS_ATTR_SF_TOTSIZE(dp) /* total space in us e */ \ #define XFS_ATTR_SF_TOTSIZE(dp) /* total space in us e */ \
(be16_to_cpu(((xfs_attr_shortform_t *) \ (be16_to_cpu(((xfs_attr_shortform_t *) \
((dp)->i_afp->if_u1.if_data))->hdr.totsize)) ((dp)->i_afp->if_u1.if_data))->hdr.totsize))
#if defined(XFS_ATTR_TRACE)
/*
* Kernel tracing support for attribute lists
*/
struct xfs_attr_list_context;
struct xfs_da_intnode;
struct xfs_da_node_entry;
struct xfs_attr_leafblock;
#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buff
er */
extern ktrace_t *xfs_attr_trace_buf;
/*
* Trace record types.
*/
#define XFS_ATTR_KTRACE_L_C 1 /* context */
#define XFS_ATTR_KTRACE_L_CN 2 /* context, node */
#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
void xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context)
;
void xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context
,
struct xfs_da_intnode *node);
void xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context
,
struct xfs_da_node_entry *btree);
void xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context
,
struct xfs_attr_leafblock *leaf);
void xfs_attr_trace_enter(int type, char *where,
struct xfs_attr_list_context *context,
__psunsigned_t a13, __psunsigned_t a14,
__psunsigned_t a15);
#else
#define xfs_attr_trace_l_c(w,c)
#define xfs_attr_trace_l_cn(w,c,n)
#define xfs_attr_trace_l_cb(w,c,b)
#define xfs_attr_trace_l_cl(w,c,l)
#endif /* XFS_ATTR_TRACE */
#endif /* __XFS_ATTR_SF_H__ */ #endif /* __XFS_ATTR_SF_H__ */
 End of changes. 3 change blocks. 
46 lines changed or deleted 1 lines changed or added


 xfs_bit.h   xfs_bit.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_BIT_H__ #ifndef __XFS_BIT_H__
#define __XFS_BIT_H__ #define __XFS_BIT_H__
/* /*
* XFS bit manipulation routines. * XFS bit manipulation routines.
*/ */
/* /*
* masks with n high/low bits set, 32-bit values & 64-bit values * masks with n high/low bits set, 64-bit values
*/ */
#define XFS_MASK32HI(n) xfs_mask32hi(n)
static inline __uint32_t xfs_mask32hi(int n)
{
return (__uint32_t)-1 << (32 - (n));
}
#define XFS_MASK64HI(n) xfs_mask64hi(n)
static inline __uint64_t xfs_mask64hi(int n) static inline __uint64_t xfs_mask64hi(int n)
{ {
return (__uint64_t)-1 << (64 - (n)); return (__uint64_t)-1 << (64 - (n));
} }
#define XFS_MASK32LO(n) xfs_mask32lo(n)
static inline __uint32_t xfs_mask32lo(int n) static inline __uint32_t xfs_mask32lo(int n)
{ {
return ((__uint32_t)1 << (n)) - 1; return ((__uint32_t)1 << (n)) - 1;
} }
#define XFS_MASK64LO(n) xfs_mask64lo(n)
static inline __uint64_t xfs_mask64lo(int n) static inline __uint64_t xfs_mask64lo(int n)
{ {
return ((__uint64_t)1 << (n)) - 1; return ((__uint64_t)1 << (n)) - 1;
} }
/* Get high bit set out of 32-bit argument, -1 if none set */ /* Get high bit set out of 32-bit argument, -1 if none set */
static inline int xfs_highbit32(__uint32_t v) static inline int xfs_highbit32(__uint32_t v)
{ {
return fls(v) - 1; return fls(v) - 1;
} }
 End of changes. 4 change blocks. 
9 lines changed or deleted 1 lines changed or added


 xfs_bmap.h   xfs_bmap.h 
skipping to change at line 31 skipping to change at line 31
struct getbmap; struct getbmap;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct xfs_ifork; struct xfs_ifork;
struct xfs_inode; struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
extern kmem_zone_t *xfs_bmap_free_item_zone; extern kmem_zone_t *xfs_bmap_free_item_zone;
/* /*
* DELTA: describe a change to the in-core extent list.
*
* Internally the use of xed_blockount is somewhat funky.
* xed_blockcount contains an offset much of the time because this
* makes merging changes easier. (xfs_fileoff_t and xfs_filblks_t are
* the same underlying type).
*/
typedef struct xfs_extdelta
{
xfs_fileoff_t xed_startoff; /* offset of range */
xfs_filblks_t xed_blockcount; /* blocks in range */
} xfs_extdelta_t;
/*
* List of extents to be free "later". * List of extents to be free "later".
* The list is kept sorted on xbf_startblock. * The list is kept sorted on xbf_startblock.
*/ */
typedef struct xfs_bmap_free_item typedef struct xfs_bmap_free_item
{ {
xfs_fsblock_t xbfi_startblock;/* starting fs block number */ xfs_fsblock_t xbfi_startblock;/* starting fs block number */
xfs_extlen_t xbfi_blockcount;/* number of blocks in exten t */ xfs_extlen_t xbfi_blockcount;/* number of blocks in exten t */
struct xfs_bmap_free_item *xbfi_next; /* link to next entry */ struct xfs_bmap_free_item *xbfi_next; /* link to next entry */
} xfs_bmap_free_item_t; } xfs_bmap_free_item_t;
skipping to change at line 85 skipping to change at line 71
#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 space */ #define XFS_BMAPI_WRITE 0x001 /* write operation: allocate space */
#define XFS_BMAPI_DELAY 0x002 /* delayed write operation * / #define XFS_BMAPI_DELAY 0x002 /* delayed write operation * /
#define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */ #define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed */
#define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */ #define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */
#define XFS_BMAPI_EXACT 0x010 /* allocate only to spec'd b #define XFS_BMAPI_ATTRFORK 0x010 /* use attribute fork not data */
ounds */ #define XFS_BMAPI_RSVBLOCKS 0x020 /* OK to alloc. reserved data blocks
#define XFS_BMAPI_ATTRFORK 0x020 /* use attribute fork not data */ */
#define XFS_BMAPI_ASYNC 0x040 /* bunmapi xactions can be a #define XFS_BMAPI_PREALLOC 0x040 /* preallocation op: unwritt
sync */ en space */
#define XFS_BMAPI_RSVBLOCKS 0x080 /* OK to alloc. reserved data blocks #define XFS_BMAPI_IGSTATE 0x080 /* Ignore state - */
*/
#define XFS_BMAPI_PREALLOC 0x100 /* preallocation op: unwritt
en space */
#define XFS_BMAPI_IGSTATE 0x200 /* Ignore state - */
/* combine contig. space */ /* combine contig. space */
#define XFS_BMAPI_CONTIG 0x400 /* must allocate only one ex #define XFS_BMAPI_CONTIG 0x100 /* must allocate only one ex
tent */ tent */
/* XFS_BMAPI_DIRECT_IO 0x800 */ /*
#define XFS_BMAPI_CONVERT 0x1000 /* unwritten extent conversion - */ * unwritten extent conversion - this needs write cache flushing and no add
/* need write cache flushing and no itional
*/ * allocation alignments. When specified with XFS_BMAPI_PREALLOC it convert
/* additional allocation alignments s
*/ * from written to unwritten, otherwise convert from unwritten to written.
*/
#define XFS_BMAPI_CONVERT 0x200
#define XFS_BMAPI_FLAGS \
{ XFS_BMAPI_WRITE, "WRITE" }, \
{ XFS_BMAPI_DELAY, "DELAY" }, \
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \
{ XFS_BMAPI_METADATA, "METADATA" }, \
{ XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \
{ XFS_BMAPI_RSVBLOCKS, "RSVBLOCKS" }, \
{ XFS_BMAPI_PREALLOC, "PREALLOC" }, \
{ XFS_BMAPI_IGSTATE, "IGSTATE" }, \
{ XFS_BMAPI_CONTIG, "CONTIG" }, \
{ XFS_BMAPI_CONVERT, "CONVERT" }
#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
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)
#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
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. * Argument structure for xfs_bmap_alloc.
*/ */
typedef struct xfs_bmalloca { typedef struct xfs_bmalloca {
xfs_fsblock_t firstblock; /* i/o first block allocated */ xfs_fsblock_t firstblock; /* i/o first block allocated */
xfs_fsblock_t rval; /* starting block of new extent */ xfs_fsblock_t rval; /* starting block of new extent */
xfs_fileoff_t off; /* offset in file filling in */ xfs_fileoff_t off; /* offset in file filling in */
struct xfs_trans *tp; /* transaction pointer */ struct xfs_trans *tp; /* transaction pointer */
struct xfs_inode *ip; /* incore inode pointer */ struct xfs_inode *ip; /* incore inode pointer */
struct xfs_bmbt_irec *prevp; /* extent before the new one */ struct xfs_bmbt_irec *prevp; /* extent before the new one */
struct xfs_bmbt_irec *gotp; /* extent after, or delayed */ struct xfs_bmbt_irec *gotp; /* extent after, or delayed */
xfs_extlen_t alen; /* i/o length asked/allocated */ xfs_extlen_t alen; /* i/o length asked/allocated */
xfs_extlen_t total; /* total blocks needed for xaction * / xfs_extlen_t total; /* total blocks needed for xaction * /
xfs_extlen_t minlen; /* mininum allocation size (blocks) */ xfs_extlen_t minlen; /* minimum allocation size (blocks) */
xfs_extlen_t minleft; /* amount must be left after alloc */ xfs_extlen_t minleft; /* amount must be left after alloc */
char eof; /* set if allocating past last exten t */ char eof; /* set if allocating past last exten t */
char wasdel; /* replacing a delayed allocation */ char wasdel; /* replacing a delayed allocation */
char userdata;/* set if is user data */ char userdata;/* set if is user data */
char low; /* low on space, using seq'l ags */ char low; /* low on space, using seq'l ags */
char aeof; /* allocated space at eof */ char aeof; /* allocated space at eof */
char conv; /* overwriting unwritten extents */ char conv; /* overwriting unwritten extents */
} xfs_bmalloca_t; } xfs_bmalloca_t;
#if defined(__KERNEL__) && defined(XFS_BMAP_TRACE)
/* /*
* Trace operations for bmap extent tracing * Flags for xfs_bmap_add_extent*.
*/ */
#define XFS_BMAP_KTRACE_DELETE 1 #define BMAP_LEFT_CONTIG (1 << 0)
#define XFS_BMAP_KTRACE_INSERT 2 #define BMAP_RIGHT_CONTIG (1 << 1)
#define XFS_BMAP_KTRACE_PRE_UP 3 #define BMAP_LEFT_FILLING (1 << 2)
#define XFS_BMAP_KTRACE_POST_UP 4 #define BMAP_RIGHT_FILLING (1 << 3)
#define BMAP_LEFT_DELAY (1 << 4)
#define XFS_BMAP_TRACE_SIZE 4096 /* size of global trace buff #define BMAP_RIGHT_DELAY (1 << 5)
er */ #define BMAP_LEFT_VALID (1 << 6)
#define XFS_BMAP_KTRACE_SIZE 32 /* size of per-inode trace b #define BMAP_RIGHT_VALID (1 << 7)
uffer */ #define BMAP_ATTRFORK (1 << 8)
extern ktrace_t *xfs_bmap_trace_buf;
#define XFS_BMAP_EXT_FLAGS \
{ BMAP_LEFT_CONTIG, "LC" }, \
{ BMAP_RIGHT_CONTIG, "RC" }, \
{ BMAP_LEFT_FILLING, "LF" }, \
{ BMAP_RIGHT_FILLING, "RF" }, \
{ BMAP_ATTRFORK, "ATTR" }
/* /*
* Add bmap trace insert entries for all the contents of the extent list. * Add bmap trace insert entries for all the contents of the extent list.
*
* Quite excessive tracing. Only do this for debug builds.
*/ */
#if defined(__KERNEL) && defined(DEBUG)
void void
xfs_bmap_trace_exlist( xfs_bmap_trace_exlist(
const char *fname, /* function name */
struct xfs_inode *ip, /* incore inode pointer */ struct xfs_inode *ip, /* incore inode pointer */
xfs_extnum_t cnt, /* count of entries in list */ xfs_extnum_t cnt, /* count of entries in list */
int whichfork); /* data or attr fork */ 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(__func__,ip,c,w) xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_)
#else
#else /* __KERNEL__ && XFS_BMAP_TRACE */
#define XFS_BMAP_TRACE_EXLIST(ip,c,w) #define XFS_BMAP_TRACE_EXLIST(ip,c,w)
#endif
#endif /* __KERNEL__ && XFS_BMAP_TRACE */
/* /*
* Convert inode from non-attributed to attributed. * Convert inode from non-attributed to attributed.
* Must not be in a transaction, ip must not be locked. * Must not be in a transaction, ip must not be locked.
*/ */
int /* error code */ int /* error code */
xfs_bmap_add_attrfork( xfs_bmap_add_attrfork(
struct xfs_inode *ip, /* incore inode pointer */ struct xfs_inode *ip, /* incore inode pointer */
int size, /* space needed for new attribute */ int size, /* space needed for new attribute */
int rsvd); /* flag for reserved block allocatio n */ int rsvd); /* flag for reserved block allocatio n */
skipping to change at line 293 skipping to change at line 296
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */ struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t bno, /* starting file offs. mappe d */ xfs_fileoff_t bno, /* starting file offs. mappe d */
xfs_filblks_t len, /* length to map in file */ xfs_filblks_t len, /* length to map in file */
int flags, /* XFS_BMAPI_... */ int flags, /* XFS_BMAPI_... */
xfs_fsblock_t *firstblock, /* first allocated block xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */ controls a.g. for allocs */
xfs_extlen_t total, /* total blocks needed */ xfs_extlen_t total, /* total blocks needed */
struct xfs_bmbt_irec *mval, /* output: map values */ struct xfs_bmbt_irec *mval, /* output: map values */
int *nmap, /* i/o: mval size/count */ int *nmap, /* i/o: mval size/count */
xfs_bmap_free_t *flist, /* i/o: list extents to free xfs_bmap_free_t *flist); /* i/o: list extents to free
*/ */
xfs_extdelta_t *delta); /* o: change made to incore
extents */
/* /*
* Map file blocks to filesystem blocks, simple version. * Map file blocks to filesystem blocks, simple version.
* One block only, read-only. * One block only, read-only.
* For flags, only the XFS_BMAPI_ATTRFORK flag is examined. * For flags, only the XFS_BMAPI_ATTRFORK flag is examined.
* For the other flag values, the effect is as if XFS_BMAPI_METADATA * For the other flag values, the effect is as if XFS_BMAPI_METADATA
* was set and all the others were clear. * was set and all the others were clear.
*/ */
int /* error */ int /* error */
xfs_bmapi_single( xfs_bmapi_single(
skipping to change at line 329 skipping to change at line 330
xfs_bunmapi( xfs_bunmapi(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
struct xfs_inode *ip, /* incore inode */ struct xfs_inode *ip, /* incore inode */
xfs_fileoff_t bno, /* starting offset to unmap */ xfs_fileoff_t bno, /* starting offset to unmap */
xfs_filblks_t len, /* length to unmap in file * / xfs_filblks_t len, /* length to unmap in file * /
int flags, /* XFS_BMAPI_... */ int flags, /* XFS_BMAPI_... */
xfs_extnum_t nexts, /* number of extents max */ xfs_extnum_t nexts, /* number of extents max */
xfs_fsblock_t *firstblock, /* first allocated block xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */ controls a.g. for allocs */
xfs_bmap_free_t *flist, /* i/o: list extents to free */ xfs_bmap_free_t *flist, /* i/o: list extents to free */
xfs_extdelta_t *delta, /* o: change made to incore
extents */
int *done); /* set if not done yet */ int *done); /* set if not done yet */
/* /*
* Check an extent list, which has just been read, for * Check an extent list, which has just been read, for
* any bit in the extent flag field. * any bit in the extent flag field.
*/ */
int int
xfs_check_nostate_extents( xfs_check_nostate_extents(
struct xfs_ifork *ifp, struct xfs_ifork *ifp,
xfs_extnum_t idx, xfs_extnum_t idx,
xfs_extnum_t num); xfs_extnum_t num);
uint
xfs_default_attroffset(
struct xfs_inode *ip);
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi
* caller. Frees all the extents that need freeing, which must be done * caller. Frees all the extents that need freeing, which must be done
* last due to locking considerations. * last due to locking considerations.
* *
* Return 1 if the given transaction was committed and a new one allocated, * Return 1 if the given transaction was committed and a new one allocated,
* and 0 otherwise. * and 0 otherwise.
*/ */
int /* error */ int /* error */
xfs_bmap_finish( xfs_bmap_finish(
struct xfs_trans **tp, /* transaction pointer addr */ struct xfs_trans **tp, /* transaction pointer addr */
xfs_bmap_free_t *flist, /* i/o: list extents to free */ xfs_bmap_free_t *flist, /* i/o: list extents to free */
int *committed); /* xact committed or not */ 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 *);
/* /*
* Fcntl interface to xfs_bmapi. * Get inode's extents as described in bmv, and format for output.
*/ */
int /* error code */ int /* error code */
xfs_getbmap( xfs_getbmap(
xfs_inode_t *ip, xfs_inode_t *ip,
struct getbmap *bmv, /* user bmap structure */ struct getbmapx *bmv, /* user bmap structure */
void __user *ap, /* pointer to user's array * xfs_bmap_format_t formatter, /* format to user */
/ void *arg); /* formatter arg */
int iflags); /* interface flags */
/* /*
* Check if the endoff is outside the last extent. If so the caller will gr ow * Check if the endoff is outside the last extent. If so the caller will gr ow
* the allocation to a stripe unit boundary * the allocation to a stripe unit boundary
*/ */
int int
xfs_bmap_eof( xfs_bmap_eof(
struct xfs_inode *ip, struct xfs_inode *ip,
xfs_fileoff_t endoff, xfs_fileoff_t endoff,
int whichfork, int whichfork,
skipping to change at line 390 skipping to change at line 396
/* /*
* Count fsblocks of the given fork. * Count fsblocks of the given fork.
*/ */
int int
xfs_bmap_count_blocks( xfs_bmap_count_blocks(
xfs_trans_t *tp, xfs_trans_t *tp,
struct xfs_inode *ip, struct xfs_inode *ip,
int whichfork, int whichfork,
int *count); int *count);
/* int
* Search the extent records for the entry containing block bno. xfs_bmap_punch_delalloc_range(
* If bno lies in a hole, point to the next entry. If bno lies struct xfs_inode *ip,
* past eof, *eofp will be set, and *prevp will contain the last xfs_fileoff_t start_fsb,
* entry (null if none). Else, *lastxp will be set to the index xfs_fileoff_t length);
* of the found entry; *gotp will contain the entry.
*/
xfs_bmbt_rec_host_t *
xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *,
xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *
);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_BMAP_H__ */ #endif /* __XFS_BMAP_H__ */
 End of changes. 22 change blocks. 
78 lines changed or deleted 72 lines changed or added


 xfs_bmap_btree.h   xfs_bmap_btree.h 
skipping to change at line 49 skipping to change at line 49
* l0:63 is an extent flag (value 1 indicates non-normal). * l0:63 is an extent flag (value 1 indicates non-normal).
* l0:9-62 are startoff. * l0:9-62 are startoff.
* l0:0-8 and l1:21-63 are startblock. * l0:0-8 and l1:21-63 are startblock.
* l1:0-20 are blockcount. * l1:0-20 are blockcount.
*/ */
#define BMBT_EXNTFLAG_BITLEN 1 #define BMBT_EXNTFLAG_BITLEN 1
#define BMBT_STARTOFF_BITLEN 54 #define BMBT_STARTOFF_BITLEN 54
#define BMBT_STARTBLOCK_BITLEN 52 #define BMBT_STARTBLOCK_BITLEN 52
#define BMBT_BLOCKCOUNT_BITLEN 21 #define BMBT_BLOCKCOUNT_BITLEN 21
#define BMBT_USE_64 1 typedef struct xfs_bmbt_rec {
typedef struct xfs_bmbt_rec_32
{
__uint32_t l0, l1, l2, l3;
} xfs_bmbt_rec_32_t;
typedef struct xfs_bmbt_rec_64
{
__be64 l0, l1; __be64 l0, l1;
} xfs_bmbt_rec_64_t; } xfs_bmbt_rec_t;
typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; typedef xfs_bmbt_rec_t xfs_bmdr_rec_t;
typedef struct xfs_bmbt_rec_host { typedef struct xfs_bmbt_rec_host {
__uint64_t l0, l1; __uint64_t l0, l1;
} xfs_bmbt_rec_host_t; } xfs_bmbt_rec_host_t;
/* /*
* Values and macros for delayed-allocation startblock fields. * Values and macros for delayed-allocation startblock fields.
*/ */
#define STARTBLOCKVALBITS 17 #define STARTBLOCKVALBITS 17
#define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20) #define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20)
#define DSTARTBLOCKMASKBITS (15 + 20) #define DSTARTBLOCKMASKBITS (15 + 20)
#define STARTBLOCKMASK \ #define STARTBLOCKMASK \
(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI TS) (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI TS)
#define DSTARTBLOCKMASK \ #define DSTARTBLOCKMASK \
(((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI TS) (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBI TS)
#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
static inline int isnullstartblock(xfs_fsblock_t x) static inline int isnullstartblock(xfs_fsblock_t x)
{ {
return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
} }
#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
static inline int isnulldstartblock(xfs_dfsbno_t x) static inline int isnulldstartblock(xfs_dfsbno_t x)
{ {
return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK; return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
} }
#define NULLSTARTBLOCK(k) nullstartblock(k)
static inline xfs_fsblock_t nullstartblock(int k) static inline xfs_fsblock_t nullstartblock(int k)
{ {
ASSERT(k < (1 << STARTBLOCKVALBITS)); ASSERT(k < (1 << STARTBLOCKVALBITS));
return STARTBLOCKMASK | (k); return STARTBLOCKMASK | (k);
} }
#define STARTBLOCKVAL(x) startblockval(x)
static inline xfs_filblks_t startblockval(xfs_fsblock_t x) static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
{ {
return (xfs_filblks_t)((x) & ~STARTBLOCKMASK); return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
} }
/* /*
* Possible extent formats. * Possible extent formats.
*/ */
typedef enum { typedef enum {
XFS_EXTFMT_NOSTATE = 0, XFS_EXTFMT_NOSTATE = 0,
skipping to change at line 226 skipping to change at line 215
* 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_mount *, 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 void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
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);
extern void xfs_bmbt_set_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); extern void xfs_bmbt_set_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
extern void xfs_bmbt_set_allf(xfs_bmbt_rec_host_t *r, xfs_fileoff_t o, extern void xfs_bmbt_set_allf(xfs_bmbt_rec_host_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_set_blockcount(xfs_bmbt_rec_host_t *r, xfs_filblks_t v ); extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_host_t *r, xfs_filblks_t v );
extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v ); extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v );
extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v); extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v);
extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v); extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v);
extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
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);
 End of changes. 9 change blocks. 
16 lines changed or deleted 3 lines changed or added


 xfs_btree.h   xfs_btree.h 
skipping to change at line 44 skipping to change at line 44
#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. * Generic btree header.
* *
* This is a comination of the actual format used on disk for short and lon g * 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 * format btrees. The first three fields are shared by both format, but
* the pointers are different and should be used with care. * the pointers are different and should be used with care.
* *
* To get the size of the actual short or long form headers please use * To get the size of the actual short or long form headers please use
* the size macros below. Never use sizeof(xfs_btree_block). * the size macros below. Never use sizeof(xfs_btree_block).
*/ */
struct xfs_btree_block { struct xfs_btree_block {
__be32 bb_magic; /* magic number for block type */ __be32 bb_magic; /* magic number for block type */
__be16 bb_level; /* 0 is a leaf */ __be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */ __be16 bb_numrecs; /* current # of data records */
skipping to change at line 154 skipping to change at line 154
size_t key_len; size_t key_len;
size_t rec_len; size_t rec_len;
/* cursor operations */ /* cursor operations */
struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *); struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *);
void (*update_cursor)(struct xfs_btree_cur *src, void (*update_cursor)(struct xfs_btree_cur *src,
struct xfs_btree_cur *dst); struct xfs_btree_cur *dst);
/* update btree root pointer */ /* update btree root pointer */
void (*set_root)(struct xfs_btree_cur *cur, void (*set_root)(struct xfs_btree_cur *cur,
union xfs_btree_ptr *nptr, int level_change) union xfs_btree_ptr *nptr, int level_change);
;
int (*kill_root)(struct xfs_btree_cur *cur, struct xfs_buf *bp,
int level, union xfs_btree_ptr *newroot);
/* block allocation / freeing */ /* block allocation / freeing */
int (*alloc_block)(struct xfs_btree_cur *cur, int (*alloc_block)(struct xfs_btree_cur *cur,
union xfs_btree_ptr *start_bno, union xfs_btree_ptr *start_bno,
union xfs_btree_ptr *new_bno, union xfs_btree_ptr *new_bno,
int length, int *stat); int length, int *stat);
int (*free_block)(struct xfs_btree_cur *cur, struct xfs_buf *bp) ; int (*free_block)(struct xfs_btree_cur *cur, struct xfs_buf *bp) ;
/* update last record information */ /* update last record information */
void (*update_lastrec)(struct xfs_btree_cur *cur, void (*update_lastrec)(struct xfs_btree_cur *cur,
skipping to change at line 378 skipping to change at line 376
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 */
/* /*
* Get a buffer for the block, return it read in.
* Short-form addressing.
*/
int /* error */
xfs_btree_read_bufs(
struct xfs_mount *mp, /* file system mount point */
struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno, /* allocation group number */
xfs_agblock_t agbno, /* allocation group block number */
uint lock, /* lock flags for read_buf */
struct xfs_buf **bpp, /* buffer for agno/agbno */
int refval);/* ref count value for buffer */
/*
* 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 */
/* /*
skipping to change at line 413 skipping to change at line 397
* 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 */
/* /*
* Set the buffer for level "lev" in the cursor to bp, releasing
* any previous buffer.
*/
void
xfs_btree_setbuf(
xfs_btree_cur_t *cur, /* btree cursor */
int lev, /* level in btree */
struct xfs_buf *bp); /* new buffer to set */
/*
* 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_kill_iroot(struct xfs_btree_cur *);
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 * );
/* /*
* 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) ;
 End of changes. 5 change blocks. 
30 lines changed or deleted 2 lines changed or added


 xfs_btree_trace.h   xfs_btree_trace.h 
skipping to change at line 60 skipping to change at line 60
*/ */
#define XBT_ARGS 0 #define XBT_ARGS 0
#define XBT_ENTRY 1 #define XBT_ENTRY 1
#define XBT_ERROR 2 #define XBT_ERROR 2
#define XBT_EXIT 3 #define XBT_EXIT 3
void xfs_btree_trace_argbi(const char *, struct xfs_btree_cur *, void xfs_btree_trace_argbi(const char *, struct xfs_btree_cur *,
struct xfs_buf *, int, int); struct xfs_buf *, int, int);
void xfs_btree_trace_argbii(const char *, struct xfs_btree_cur *, void xfs_btree_trace_argbii(const char *, struct xfs_btree_cur *,
struct xfs_buf *, int, int, int); struct xfs_buf *, int, int, int);
void xfs_btree_trace_argfffi(const char *, struct xfs_btree_cur *,
xfs_dfiloff_t, xfs_dfsbno_t, xfs_dfilblks_t, int, int);
void xfs_btree_trace_argi(const char *, struct xfs_btree_cur *, int, int); void xfs_btree_trace_argi(const char *, struct xfs_btree_cur *, int, int);
void xfs_btree_trace_argipk(const char *, struct xfs_btree_cur *, int, void xfs_btree_trace_argipk(const char *, struct xfs_btree_cur *, int,
union xfs_btree_ptr, union xfs_btree_key *, int); union xfs_btree_ptr, union xfs_btree_key *, int);
void xfs_btree_trace_argipr(const char *, struct xfs_btree_cur *, int, void xfs_btree_trace_argipr(const char *, struct xfs_btree_cur *, int,
union xfs_btree_ptr, union xfs_btree_rec *, int); union xfs_btree_ptr, union xfs_btree_rec *, int);
void xfs_btree_trace_argik(const char *, struct xfs_btree_cur *, int, void xfs_btree_trace_argik(const char *, struct xfs_btree_cur *, int,
union xfs_btree_key *, int); union xfs_btree_key *, int);
void xfs_btree_trace_argr(const char *, struct xfs_btree_cur *, void xfs_btree_trace_argr(const char *, struct xfs_btree_cur *,
union xfs_btree_rec *, int); union xfs_btree_rec *, int);
void xfs_btree_trace_cursor(const char *, struct xfs_btree_cur *, int, int) ; void xfs_btree_trace_cursor(const char *, struct xfs_btree_cur *, int, int) ;
#define XFS_ALLOCBT_TRACE_SIZE 4096 /* size of global trace buffer */
extern ktrace_t *xfs_allocbt_trace_buf;
#define XFS_INOBT_TRACE_SIZE 4096 /* size of global trace buffer */
extern ktrace_t *xfs_inobt_trace_buf;
#define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
#define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
extern ktrace_t *xfs_bmbt_trace_buf;
#define XFS_BTREE_TRACE_ARGBI(c, b, i) \ #define XFS_BTREE_TRACE_ARGBI(c, b, i) \
xfs_btree_trace_argbi(__func__, c, b, i, __LINE__) xfs_btree_trace_argbi(__func__, c, b, i, __LINE__)
#define XFS_BTREE_TRACE_ARGBII(c, b, i, j) \ #define XFS_BTREE_TRACE_ARGBII(c, b, i, j) \
xfs_btree_trace_argbii(__func__, c, b, i, j, __LINE__) xfs_btree_trace_argbii(__func__, c, b, i, j, __LINE__)
#define XFS_BTREE_TRACE_ARGFFFI(c, o, b, i, j) \
xfs_btree_trace_argfffi(__func__, c, o, b, i, j, __LINE__)
#define XFS_BTREE_TRACE_ARGI(c, i) \ #define XFS_BTREE_TRACE_ARGI(c, i) \
xfs_btree_trace_argi(__func__, c, i, __LINE__) xfs_btree_trace_argi(__func__, c, i, __LINE__)
#define XFS_BTREE_TRACE_ARGIPK(c, i, p, k) \ #define XFS_BTREE_TRACE_ARGIPK(c, i, p, k) \
xfs_btree_trace_argipk(__func__, c, i, p, k, __LINE__) xfs_btree_trace_argipk(__func__, c, i, p, k, __LINE__)
#define XFS_BTREE_TRACE_ARGIPR(c, i, p, r) \ #define XFS_BTREE_TRACE_ARGIPR(c, i, p, r) \
xfs_btree_trace_argipr(__func__, c, i, p, r, __LINE__) xfs_btree_trace_argipr(__func__, c, i, p, r, __LINE__)
#define XFS_BTREE_TRACE_ARGIK(c, i, k) \ #define XFS_BTREE_TRACE_ARGIK(c, i, k) \
xfs_btree_trace_argik(__func__, c, i, k, __LINE__) xfs_btree_trace_argik(__func__, c, i, k, __LINE__)
#define XFS_BTREE_TRACE_ARGR(c, r) \ #define XFS_BTREE_TRACE_ARGR(c, r) \
xfs_btree_trace_argr(__func__, c, r, __LINE__) xfs_btree_trace_argr(__func__, c, r, __LINE__)
#define XFS_BTREE_TRACE_CURSOR(c, t) \ #define XFS_BTREE_TRACE_CURSOR(c, t) \
xfs_btree_trace_cursor(__func__, c, t, __LINE__) xfs_btree_trace_cursor(__func__, c, t, __LINE__)
#else #else
#define XFS_BTREE_TRACE_ARGBI(c, b, i) #define XFS_BTREE_TRACE_ARGBI(c, b, i)
#define XFS_BTREE_TRACE_ARGBII(c, b, i, j) #define XFS_BTREE_TRACE_ARGBII(c, b, i, j)
#define XFS_BTREE_TRACE_ARGFFFI(c, o, b, i, j)
#define XFS_BTREE_TRACE_ARGI(c, i) #define XFS_BTREE_TRACE_ARGI(c, i)
#define XFS_BTREE_TRACE_ARGIPK(c, i, p, s) #define XFS_BTREE_TRACE_ARGIPK(c, i, p, s)
#define XFS_BTREE_TRACE_ARGIPR(c, i, p, r) #define XFS_BTREE_TRACE_ARGIPR(c, i, p, r)
#define XFS_BTREE_TRACE_ARGIK(c, i, k) #define XFS_BTREE_TRACE_ARGIK(c, i, k)
#define XFS_BTREE_TRACE_ARGR(c, r) #define XFS_BTREE_TRACE_ARGR(c, r)
#define XFS_BTREE_TRACE_CURSOR(c, t) #define XFS_BTREE_TRACE_CURSOR(c, t)
#endif /* XFS_BTREE_TRACE */ #endif /* XFS_BTREE_TRACE */
#endif /* __XFS_BTREE_TRACE_H__ */ #endif /* __XFS_BTREE_TRACE_H__ */
 End of changes. 4 change blocks. 
15 lines changed or deleted 0 lines changed or added


 xfs_buf_item.h   xfs_buf_item.h 
skipping to change at line 29 skipping to change at line 29
#define __XFS_BUF_ITEM_H__ #define __XFS_BUF_ITEM_H__
extern kmem_zone_t *xfs_buf_item_zone; extern kmem_zone_t *xfs_buf_item_zone;
/* /*
* This is the structure used to lay out a buf log item in the * This is the structure used to lay out a buf log item in the
* log. The data map describes which 128 byte chunks of the buffer * log. The data map describes which 128 byte chunks of the buffer
* have been logged. * have been logged.
* For 6.2 and beyond, this is XFS_LI_BUF. We use this to log everything. * For 6.2 and beyond, this is XFS_LI_BUF. We use this to log everything.
*/ */
typedef struct xfs_buf_log_format_t { typedef struct xfs_buf_log_format {
unsigned short blf_type; /* buf log item type indicator */ unsigned short blf_type; /* buf log item type indicator */
unsigned short blf_size; /* size of this item */ unsigned short blf_size; /* size of this item */
ushort blf_flags; /* misc state */ ushort blf_flags; /* misc state */
ushort blf_len; /* number of blocks in this buf */ ushort blf_len; /* number of blocks in this buf */
__int64_t blf_blkno; /* starting blkno of this buf */ __int64_t blf_blkno; /* starting blkno of this buf */
unsigned int blf_map_size; /* size of data bitmap in words */ unsigned int blf_map_size; /* size of data bitmap in words */
unsigned int blf_data_map[1];/* variable size bitmap of */ unsigned int blf_data_map[1];/* variable size bitmap of */
/* regions of buffer in this item */ /* regions of buffer in this item */
} xfs_buf_log_format_t; } xfs_buf_log_format_t;
/* /*
* This flag indicates that the buffer contains on disk inodes * This flag indicates that the buffer contains on disk inodes
* and requires special recovery handling. * and requires special recovery handling.
*/ */
#define XFS_BLI_INODE_BUF 0x1 #define XFS_BLF_INODE_BUF 0x1
/* /*
* This flag indicates that the buffer should not be replayed * This flag indicates that the buffer should not be replayed
* during recovery because its blocks are being freed. * during recovery because its blocks are being freed.
*/ */
#define XFS_BLI_CANCEL 0x2 #define XFS_BLF_CANCEL 0x2
/* /*
* This flag indicates that the buffer contains on disk * This flag indicates that the buffer contains on disk
* user or group dquots and may require special recovery handling. * user or group dquots and may require special recovery handling.
*/ */
#define XFS_BLI_UDQUOT_BUF 0x4 #define XFS_BLF_UDQUOT_BUF 0x4
#define XFS_BLI_PDQUOT_BUF 0x8 #define XFS_BLF_PDQUOT_BUF 0x8
#define XFS_BLI_GDQUOT_BUF 0x10 #define XFS_BLF_GDQUOT_BUF 0x10
#define XFS_BLI_CHUNK 128 #define XFS_BLF_CHUNK 128
#define XFS_BLI_SHIFT 7 #define XFS_BLF_SHIFT 7
#define BIT_TO_WORD_SHIFT 5 #define BIT_TO_WORD_SHIFT 5
#define NBWORD (NBBY * sizeof(unsigned int)) #define NBWORD (NBBY * sizeof(unsigned int))
/* /*
* buf log item flags * buf log item flags
*/ */
#define XFS_BLI_HOLD 0x01 #define XFS_BLI_HOLD 0x01
#define XFS_BLI_DIRTY 0x02 #define XFS_BLI_DIRTY 0x02
#define XFS_BLI_STALE 0x04 #define XFS_BLI_STALE 0x04
#define XFS_BLI_LOGGED 0x08 #define XFS_BLI_LOGGED 0x08
#define XFS_BLI_INODE_ALLOC_BUF 0x10 #define XFS_BLI_INODE_ALLOC_BUF 0x10
#define XFS_BLI_STALE_INODE 0x20 #define XFS_BLI_STALE_INODE 0x20
#define XFS_BLI_INODE_BUF 0x40
#define XFS_BLI_FLAGS \
{ XFS_BLI_HOLD, "HOLD" }, \
{ XFS_BLI_DIRTY, "DIRTY" }, \
{ XFS_BLI_STALE, "STALE" }, \
{ XFS_BLI_LOGGED, "LOGGED" }, \
{ XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \
{ XFS_BLI_STALE_INODE, "STALE_INODE" }, \
{ XFS_BLI_INODE_BUF, "INODE_BUF" }
#ifdef __KERNEL__ #ifdef __KERNEL__
struct xfs_buf; struct xfs_buf;
struct ktrace;
struct xfs_mount; struct xfs_mount;
struct xfs_buf_log_item; struct xfs_buf_log_item;
#if defined(XFS_BLI_TRACE)
#define XFS_BLI_TRACE_SIZE 32
void xfs_buf_item_trace(char *, struct xfs_buf_log_item *);
#else
#define xfs_buf_item_trace(id, bip)
#endif
/* /*
* This is the in core log item structure used to track information * This is the in core log item structure used to track information
* needed to log buffers. It tracks how many times the lock has been * needed to log buffers. It tracks how many times the lock has been
* locked, and which 128 byte chunks of the buffer are dirty. * locked, and which 128 byte chunks of the buffer are dirty.
*/ */
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; /* lock recursion count */ unsigned int bli_recur; /* lock recursion count */
atomic_t bli_refcount; /* cnt of tp refs */ atomic_t bli_refcount; /* cnt of tp refs */
#ifdef XFS_BLI_TRACE
struct ktrace *bli_trace; /* event trace buf */
#endif
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
char *bli_orig; /* original buffer copy */ char *bli_orig; /* original buffer copy */
char *bli_logged; /* bytes logged (bitmap) */ char *bli_logged; /* bytes logged (bitmap) */
#endif #endif
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;
/*
* This structure is used during recovery to record the buf log
* items which have been canceled and should not be replayed.
*/
typedef struct xfs_buf_cancel {
xfs_daddr_t bc_blkno;
uint bc_len;
int bc_refcount;
struct xfs_buf_cancel *bc_next;
} xfs_buf_cancel_t;
void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
void xfs_buf_item_relse(struct xfs_buf *); void xfs_buf_item_relse(struct xfs_buf *);
void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint); void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
uint xfs_buf_item_dirty(xfs_buf_log_item_t *); uint xfs_buf_item_dirty(xfs_buf_log_item_t *);
void xfs_buf_attach_iodone(struct xfs_buf *, void xfs_buf_attach_iodone(struct xfs_buf *,
void(*)(struct xfs_buf *, xfs_log_item_t *), void(*)(struct xfs_buf *, xfs_log_item_t *),
xfs_log_item_t *); xfs_log_item_t *);
void xfs_buf_iodone_callbacks(struct xfs_buf *); void xfs_buf_iodone_callbacks(struct xfs_buf *);
void xfs_buf_iodone(struct xfs_buf *, xfs_buf_log_item_t *); void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *);
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
void void
xfs_buf_item_flush_log_debug( xfs_buf_item_flush_log_debug(
struct xfs_buf *bp, struct xfs_buf *bp,
uint first, uint first,
uint last); uint last);
#else #else
#define xfs_buf_item_flush_log_debug(bp, first, last) #define xfs_buf_item_flush_log_debug(bp, first, last)
#endif #endif
 End of changes. 11 change blocks. 
32 lines changed or deleted 19 lines changed or added


 xfs_da_btree.h   xfs_da_btree.h 
skipping to change at line 94 skipping to change at line 94
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 uchar_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) */
uchar_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 */
int whichfork; /* data or attribute fork */ int whichfork; /* data or attribute fork */
skipping to change at line 128 skipping to change at line 128
/* /*
* Operation flags: * Operation flags:
*/ */
#define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */ #define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */
#define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */ #define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */
#define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */ #define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
#define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else di e */ #define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else di e */
#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 \
{ XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
{ XFS_DA_OP_RENAME, "RENAME" }, \
{ XFS_DA_OP_ADDNAME, "ADDNAME" }, \
{ XFS_DA_OP_OKNOENT, "OKNOENT" }, \
{ XFS_DA_OP_CILOOKUP, "CILOOKUP" }
/* /*
* Structure to describe buffer(s) for a block. * Structure to describe buffer(s) for a block.
* This is needed in the directory version 2 format case, when * This is needed in the directory version 2 format case, when
* multiple non-contiguous fsblocks might be needed to cover one * multiple non-contiguous fsblocks might be needed to cover one
* logical directory block. * logical directory block.
* If the buffer count is 1 then the data pointer points to the * 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. * same place as the b_addr field for the buffer, else to kmem_alloced memo ry.
*/ */
typedef struct xfs_dabuf { typedef struct xfs_dabuf {
int nbuf; /* number of buffer pointers present */ int nbuf; /* number of buffer pointers present */
skipping to change at line 188 skipping to change at line 195
typedef struct xfs_da_state { typedef struct xfs_da_state {
xfs_da_args_t *args; /* filename arguments */ xfs_da_args_t *args; /* filename arguments */
struct xfs_mount *mp; /* filesystem mount point */ struct xfs_mount *mp; /* filesystem mount point */
unsigned int blocksize; /* logical block size */ unsigned int blocksize; /* logical block size */
unsigned int node_ents; /* how many entries in danod e */ unsigned int node_ents; /* how many entries in danod e */
xfs_da_state_path_t path; /* search/split paths */ xfs_da_state_path_t path; /* search/split paths */
xfs_da_state_path_t altpath; /* alternate path for join * / xfs_da_state_path_t altpath; /* alternate path for join * /
unsigned char inleaf; /* insert into 1->lf, 0->spl f */ unsigned char inleaf; /* insert into 1->lf, 0->spl f */
unsigned char extravalid; /* T/F: extrablk is in use * / unsigned char extravalid; /* T/F: extrablk is in use * /
unsigned char extraafter; /* T/F: extrablk is after ne w */ unsigned char extraafter; /* T/F: extrablk is after ne w */
xfs_da_state_blk_t extrablk; /* for double-splits on leaf s */ xfs_da_state_blk_t extrablk; /* for double-splits on leav es */
/* for dirv2 extrablk is dat a */ /* for dirv2 extrablk is dat a */
} xfs_da_state_t; } xfs_da_state_t;
/* /*
* Utility macros to aid in logging changed structure fields. * Utility macros to aid in logging changed structure fields.
*/ */
#define XFS_DA_LOGOFF(BASE, ADDR) ((char *)(ADDR) - (char *)(BASE)) #define XFS_DA_LOGOFF(BASE, ADDR) ((char *)(ADDR) - (char *)(BASE))
#define XFS_DA_LOGRANGE(BASE, ADDR, SIZE) \ #define XFS_DA_LOGRANGE(BASE, ADDR, SIZE) \
(uint)(XFS_DA_LOGOFF(BASE, ADDR)), \ (uint)(XFS_DA_LOGOFF(BASE, ADDR)), \
(uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1) (uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1)
/* /*
* Name ops for directory and/or attr name operations * Name ops for directory and/or attr name operations
*/ */
struct xfs_nameops { struct xfs_nameops {
xfs_dahash_t (*hashname)(struct xfs_name *); xfs_dahash_t (*hashname)(struct xfs_name *);
enum xfs_dacmp (*compname)(struct xfs_da_args *, const char *, int) enum xfs_dacmp (*compname)(struct xfs_da_args *,
; 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_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level ,
skipping to change at line 253 skipping to change at line 261
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
xfs_dabuf_t **bp, int whichfork); xfs_dabuf_t **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); xfs_dabuf_t **bpp, int whichfork);
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, int whichfork);
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); xfs_dabuf_t *dead_buf);
uint xfs_da_hashname(const uchar_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 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_buf_done(xfs_dabuf_t *dabuf);
void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first, void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
uint last); uint last);
void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf); void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
void xfs_da_binval(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); 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 struct kmem_zone *xfs_dabuf_zone;
extern const struct xfs_nameops xfs_default_nameops;
#endif /* __XFS_DA_BTREE_H__ */ #endif /* __XFS_DA_BTREE_H__ */
 End of changes. 8 change blocks. 
7 lines changed or deleted 15 lines changed or added


 xfs_dfrag.h   xfs_dfrag.h 
skipping to change at line 49 skipping to change at line 49
#define XFS_SX_VERSION 0 #define XFS_SX_VERSION 0
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* Prototypes for visible xfs_dfrag.c routines. * Prototypes for visible xfs_dfrag.c routines.
*/ */
/* /*
* Syscall interface for xfs_swapext * Syscall interface for xfs_swapext
*/ */
int xfs_swapext(struct xfs_swapext __user *sx); int xfs_swapext(struct xfs_swapext *sx);
int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
struct xfs_swapext *sxp);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_DFRAG_H__ */ #endif /* __XFS_DFRAG_H__ */
 End of changes. 1 change blocks. 
4 lines changed or deleted 1 lines changed or added


 xfs_dinode.h   xfs_dinode.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_DINODE_H__ #ifndef __XFS_DINODE_H__
#define __XFS_DINODE_H__ #define __XFS_DINODE_H__
struct xfs_buf; #define XFS_DINODE_MAGIC 0x494e /* 'IN' */
struct xfs_mount; #define XFS_DINODE_GOOD_VERSION(v) (((v) == 1 || (v) == 2))
#define XFS_DINODE_VERSION_1 1
#define XFS_DINODE_VERSION_2 2
#define XFS_DINODE_GOOD_VERSION(v) \
(((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2))
#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
/*
* Disk inode structure.
* This is just the header; the inode is expanded to fill a variable size
* with the last field expanding. It is split into the core and "other"
* because we only need the core part in the in-core inode.
*/
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;
/* /*
* Note: Coordinate changes to this structure with the XFS_DI_* #defines * On-disk inode structure.
* below, the offsets table in xfs_ialloc_log_di() and struct xfs_icdinode *
* in xfs_inode.h. * This is just the header or "dinode core", the inode is expanded to fill
a
* variable size the leftover area split into a data and an attribute fork.
* The format of the data and attribute fork depends on the format of the
* inode as indicated by di_format and di_aformat. To access the data and
* attribute use the XFS_DFORK_PTR, XFS_DFORK_DPTR, and XFS_DFORK_PTR macro
s
* below.
*
* There is a very similar struct icdinode in xfs_inode which matches the
* layout of the first 96 bytes of this structure, but is kept in native
* format instead of big endian.
*/ */
typedef struct xfs_dinode_core { 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 */
__be16 di_projid_lo; /* lower part of owner's project id */ __be16 di_projid_lo; /* lower part of owner's project id */
__be16 di_projid_hi; /* higher part owner's project id */ __be16 di_projid_hi; /* higher part owner's project id */
skipping to change at line 73 skipping to change at line 70
__be64 di_nblocks; /* # of direct & btree blocks used * / __be64 di_nblocks; /* # of direct & btree blocks used * /
__be32 di_extsize; /* basic/minimum extent size for fil e */ __be32 di_extsize; /* basic/minimum extent size for fil e */
__be32 di_nextents; /* number of extents in data fork */ __be32 di_nextents; /* number of extents in data fork */
__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 */
} xfs_dinode_core_t;
#define DI_MAX_FLUSH 0xffff /* di_next_unlinked is the only non-core field in the old dinode */
__be32 di_next_unlinked;/* agi unlinked list ptr */
} __attribute__((packed)) xfs_dinode_t;
typedef struct xfs_dinode #define DI_MAX_FLUSH 0xffff
{
xfs_dinode_core_t di_core;
/*
* In adding anything between the core and the union, be
* sure to update the macros like XFS_LITINO below.
*/
__be32 di_next_unlinked;/* agi unlinked list ptr */
union {
xfs_bmdr_block_t di_bmbt; /* btree root block */
xfs_bmbt_rec_32_t di_bmx[1]; /* extent list */
xfs_dir2_sf_t di_dir2sf; /* shortform directory v2 */
char di_c[1]; /* local contents */
__be32 di_dev; /* device for S_IFCHR/S_IFBL
K */
uuid_t di_muuid; /* mount point value */
char di_symlink[1]; /* local symbolic link */
} di_u;
union {
xfs_bmdr_block_t di_abmbt; /* btree root block */
xfs_bmbt_rec_32_t di_abmx[1]; /* extent list */
xfs_attr_shortform_t di_attrsf; /* shortform attribute list
*/
} di_a;
} xfs_dinode_t;
/* /*
* 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
/* /*
* Bit names for logging disk inodes only
*/
#define XFS_DI_MAGIC 0x0000001
#define XFS_DI_MODE 0x0000002
#define XFS_DI_VERSION 0x0000004
#define XFS_DI_FORMAT 0x0000008
#define XFS_DI_ONLINK 0x0000010
#define XFS_DI_UID 0x0000020
#define XFS_DI_GID 0x0000040
#define XFS_DI_NLINK 0x0000080
#define XFS_DI_PROJID 0x0000100
#define XFS_DI_PAD 0x0000200
#define XFS_DI_ATIME 0x0000400
#define XFS_DI_MTIME 0x0000800
#define XFS_DI_CTIME 0x0001000
#define XFS_DI_SIZE 0x0002000
#define XFS_DI_NBLOCKS 0x0004000
#define XFS_DI_EXTSIZE 0x0008000
#define XFS_DI_NEXTENTS 0x0010000
#define XFS_DI_NAEXTENTS 0x0020000
#define XFS_DI_FORKOFF 0x0040000
#define XFS_DI_AFORMAT 0x0080000
#define XFS_DI_DMEVMASK 0x0100000
#define XFS_DI_DMSTATE 0x0200000
#define XFS_DI_FLAGS 0x0400000
#define XFS_DI_GEN 0x0800000
#define XFS_DI_NEXT_UNLINKED 0x1000000
#define XFS_DI_U 0x2000000
#define XFS_DI_A 0x4000000
#define XFS_DI_NUM_BITS 27
#define XFS_DI_ALL_BITS ((1 << XFS_DI_NUM_BITS) - 1)
#define XFS_DI_CORE_BITS (XFS_DI_ALL_BITS & ~(XFS_DI_U|XFS_DI
_A))
/*
* Values for di_format * Values for di_format
*/ */
typedef enum xfs_dinode_fmt typedef enum xfs_dinode_fmt {
{ XFS_DINODE_FMT_DEV, /* xfs_dev_t */
XFS_DINODE_FMT_DEV, /* CHR, BLK: di_dev */ XFS_DINODE_FMT_LOCAL, /* bulk data */
XFS_DINODE_FMT_LOCAL, /* DIR, REG: di_c */ XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */
/* LNK: di_symlink */ XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */
XFS_DINODE_FMT_EXTENTS, /* DIR, REG, LNK: di_bmx */ XFS_DINODE_FMT_UUID /* uuid_t */
XFS_DINODE_FMT_BTREE, /* DIR, REG, LNK: di_bmbt */
XFS_DINODE_FMT_UUID /* MNT: di_uuid */
} xfs_dinode_fmt_t; } xfs_dinode_fmt_t;
/* /*
* 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) ((mp)->m_litino) #define XFS_LITINO(mp) \
((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode)))
#define XFS_BROOT_SIZE_ADJ \ #define XFS_BROOT_SIZE_ADJ \
(XFS_BTREE_LBLOCK_LEN - sizeof(xfs_bmdr_block_t)) (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_core.di_forkoff != 0) #define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0)
#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_core.di_forkoff << #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3))
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))
#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) - 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))
#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) /*
* Return pointers to the data or attribute forks.
*/
#define XFS_DFORK_DPTR(dip) \
((char *)(dip) + sizeof(struct xfs_dinode))
#define XFS_DFORK_APTR(dip) \ #define XFS_DFORK_APTR(dip) \
((dip)->di_u.di_c + 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_core.di_format : \ (dip)->di_format : \
(dip)->di_core.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_core.di_nextents) : \ be32_to_cpu((dip)->di_nextents) : \
be16_to_cpu((dip)->di_core.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 *)XFS_BUF_PTR(bp))
/* /*
* For block and character special files the 32bit dev_t is stored at the
* beginning of the data fork.
*/
static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
{
return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
}
static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rd
ev)
{
*(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);
}
/*
* Values for di_flags * Values for di_flags
* There should be a one-to-one correspondence between these flags and the * There should be a one-to-one correspondence between these flags and the
* XFS_XFLAG_s. * XFS_XFLAG_s.
*/ */
#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area * / #define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area * /
#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */ #define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */
#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */ #define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */
#define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */ #define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */
#define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */ #define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */
#define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */ #define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */
 End of changes. 17 change blocks. 
98 lines changed or deleted 58 lines changed or added


 xfs_dir2.h   xfs_dir2.h 
skipping to change at line 103 skipping to change at line 103
*/ */
extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space, extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
xfs_dir2_db_t *dbp); xfs_dir2_db_t *dbp);
extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp,
int *vp); int *vp);
extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,
int *vp); int *vp);
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_dabuf *bp);
extern int xfs_dir_cilookup_result(struct xfs_da_args *args, const char *na extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
me, const unsigned char *name, int len);
int len);
#endif /* __XFS_DIR2_H__ */ #endif /* __XFS_DIR2_H__ */
 End of changes. 1 change blocks. 
3 lines changed or deleted 2 lines changed or added


 xfs_dir2_data.h   xfs_dir2_data.h 
skipping to change at line 41 skipping to change at line 41
* Constants. * Constants.
*/ */
#define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multibl ock dirs */ #define XFS_DIR2_DATA_MAGIC 0x58443244 /* XD2D: for multibl ock dirs */
#define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */ #define XFS_DIR2_DATA_ALIGN_LOG 3 /* i.e., 8 bytes */
#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG) #define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG)
#define XFS_DIR2_DATA_FREE_TAG 0xffff #define XFS_DIR2_DATA_FREE_TAG 0xffff
#define XFS_DIR2_DATA_FD_COUNT 3 #define XFS_DIR2_DATA_FD_COUNT 3
/* /*
* Directory address space divided into sections, * Directory address space divided into sections,
* spaces separated by 32gb. * spaces separated by 32GB.
*/ */
#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_L OG)) #define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_L OG))
#define XFS_DIR2_DATA_SPACE 0 #define XFS_DIR2_DATA_SPACE 0
#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPAC E_SIZE) #define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPAC E_SIZE)
#define XFS_DIR2_DATA_FIRSTDB(mp) \ #define XFS_DIR2_DATA_FIRSTDB(mp) \
xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET) xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET)
/* /*
* Offsets of . and .. in data space (always block 0) * Offsets of . and .. in data space (always block 0)
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 xfs_dir2_node.h   xfs_dir2_node.h 
skipping to change at line 78 skipping to change at line 78
/* /*
* Convert data space db to the corresponding index in a free db. * Convert data space db to the corresponding index in a free db.
*/ */
static inline int static inline int
xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db) xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
{ {
return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp)); return ((db) % XFS_DIR2_MAX_FREE_BESTS(mp));
} }
extern void xfs_dir2_free_log_bests(struct xfs_trans *tp, struct xfs_dabuf
*bp,
int first, int last);
extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args, extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
struct xfs_dabuf *lbp); struct xfs_dabuf *lbp);
extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *coun t); extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *coun t);
extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
struct xfs_da_args *args, int *indexp, struct xfs_da_args *args, int *indexp,
struct xfs_da_state *state); struct xfs_da_state *state);
extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
struct xfs_dabuf *leaf2_bp); struct xfs_dabuf *leaf2_bp);
extern int xfs_dir2_leafn_split(struct xfs_da_state *state, extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *oldblk,
 End of changes. 1 change blocks. 
3 lines changed or deleted 0 lines changed or added


 xfs_dir2_sf.h   xfs_dir2_sf.h 
skipping to change at line 37 skipping to change at line 37
struct uio; struct uio;
struct xfs_dabuf; struct xfs_dabuf;
struct xfs_da_args; struct xfs_da_args;
struct xfs_dir2_block; struct xfs_dir2_block;
struct xfs_inode; struct xfs_inode;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
/* /*
* Maximum size of a shortform directory.
*/
#define XFS_DIR2_SF_MAX_SIZE \
(XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \
(uint)sizeof(xfs_agino_t))
/*
* Inode number stored as 8 8-bit values. * Inode number stored as 8 8-bit values.
*/ */
typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t;
/* /*
* Inode number stored as 4 8-bit values. * Inode number stored as 4 8-bit values.
* Works a lot of the time, when all the inode numbers in a directory * Works a lot of the time, when all the inode numbers in a directory
* fit in 32 bits. * fit in 32 bits.
*/ */
typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t; typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t;
 End of changes. 1 change blocks. 
7 lines changed or deleted 0 lines changed or added


 xfs_extfree_item.h   xfs_extfree_item.h 
skipping to change at line 36 skipping to change at line 36
xfs_extlen_t ext_len; xfs_extlen_t ext_len;
} xfs_extent_t; } xfs_extent_t;
/* /*
* Since an xfs_extent_t has types (start:64, len: 32) * Since an xfs_extent_t has types (start:64, len: 32)
* there are different alignments on 32 bit and 64 bit kernels. * there are different alignments on 32 bit and 64 bit kernels.
* So we provide the different variants for use by a * So we provide the different variants for use by a
* conversion routine. * conversion routine.
*/ */
#ifndef HAVE_FORMAT32
typedef struct xfs_extent_32 { typedef struct xfs_extent_32 {
__uint64_t ext_start; __uint64_t ext_start;
__uint32_t ext_len; __uint32_t ext_len;
} __attribute__((packed)) xfs_extent_32_t; } __attribute__((packed)) xfs_extent_32_t;
#endif
typedef struct xfs_extent_64 { typedef struct xfs_extent_64 {
__uint64_t ext_start; __uint64_t ext_start;
__uint32_t ext_len; __uint32_t ext_len;
__uint32_t ext_pad; __uint32_t ext_pad;
} xfs_extent_64_t; } xfs_extent_64_t;
/* /*
* This is the structure used to lay out an efi log item in the * This is the structure used to lay out an efi log item in the
* log. The efi_extents field is a variable size array whose * log. The efi_extents field is a variable size array whose
* size is given by efi_nextents. * size is given by efi_nextents.
*/ */
typedef struct xfs_efi_log_format { typedef struct xfs_efi_log_format {
__uint16_t efi_type; /* efi log item type */ __uint16_t efi_type; /* efi log item type */
__uint16_t efi_size; /* size of this item */ __uint16_t efi_size; /* size of this item */
__uint32_t efi_nextents; /* # extents to free */ __uint32_t efi_nextents; /* # extents to free */
__uint64_t efi_id; /* efi identifier */ __uint64_t efi_id; /* efi identifier */
xfs_extent_t efi_extents[1]; /* array of extents to free */ xfs_extent_t efi_extents[1]; /* array of extents to free */
} xfs_efi_log_format_t; } xfs_efi_log_format_t;
#ifndef HAVE_FORMAT32
typedef struct xfs_efi_log_format_32 { typedef struct xfs_efi_log_format_32 {
__uint16_t efi_type; /* efi log item type */ __uint16_t efi_type; /* efi log item type */
__uint16_t efi_size; /* size of this item */ __uint16_t efi_size; /* size of this item */
__uint32_t efi_nextents; /* # extents to free */ __uint32_t efi_nextents; /* # extents to free */
__uint64_t efi_id; /* efi identifier */ __uint64_t efi_id; /* efi identifier */
xfs_extent_32_t efi_extents[1]; /* array of extents to free */ xfs_extent_32_t efi_extents[1]; /* array of extents to free */
} __attribute__((packed)) xfs_efi_log_format_32_t; } __attribute__((packed)) xfs_efi_log_format_32_t;
#endif
typedef struct xfs_efi_log_format_64 { typedef struct xfs_efi_log_format_64 {
__uint16_t efi_type; /* efi log item type */ __uint16_t efi_type; /* efi log item type */
__uint16_t efi_size; /* size of this item */ __uint16_t efi_size; /* size of this item */
__uint32_t efi_nextents; /* # extents to free */ __uint32_t efi_nextents; /* # extents to free */
__uint64_t efi_id; /* efi identifier */ __uint64_t efi_id; /* efi identifier */
xfs_extent_64_t efi_extents[1]; /* array of extents to free */ xfs_extent_64_t efi_extents[1]; /* array of extents to free */
} xfs_efi_log_format_64_t; } xfs_efi_log_format_64_t;
/* /*
skipping to change at line 93 skipping to change at line 89
* size is given by efd_nextents; * size is given by efd_nextents;
*/ */
typedef struct xfs_efd_log_format { typedef struct xfs_efd_log_format {
__uint16_t efd_type; /* efd log item type */ __uint16_t efd_type; /* efd log item type */
__uint16_t efd_size; /* size of this item */ __uint16_t efd_size; /* size of this item */
__uint32_t efd_nextents; /* # of extents freed */ __uint32_t efd_nextents; /* # of extents freed */
__uint64_t efd_efi_id; /* id of corresponding efi * / __uint64_t efd_efi_id; /* id of corresponding efi * /
xfs_extent_t efd_extents[1]; /* array of extents freed */ xfs_extent_t efd_extents[1]; /* array of extents freed */
} xfs_efd_log_format_t; } xfs_efd_log_format_t;
#ifndef HAVE_FORMAT32
typedef struct xfs_efd_log_format_32 { typedef struct xfs_efd_log_format_32 {
__uint16_t efd_type; /* efd log item type */ __uint16_t efd_type; /* efd log item type */
__uint16_t efd_size; /* size of this item */ __uint16_t efd_size; /* size of this item */
__uint32_t efd_nextents; /* # of extents freed */ __uint32_t efd_nextents; /* # of extents freed */
__uint64_t efd_efi_id; /* id of corresponding efi * / __uint64_t efd_efi_id; /* id of corresponding efi * /
xfs_extent_32_t efd_extents[1]; /* array of extents freed */ xfs_extent_32_t efd_extents[1]; /* array of extents freed */
} __attribute__((packed)) xfs_efd_log_format_32_t; } __attribute__((packed)) xfs_efd_log_format_32_t;
#endif
typedef struct xfs_efd_log_format_64 { typedef struct xfs_efd_log_format_64 {
__uint16_t efd_type; /* efd log item type */ __uint16_t efd_type; /* efd log item type */
__uint16_t efd_size; /* size of this item */ __uint16_t efd_size; /* size of this item */
__uint32_t efd_nextents; /* # of extents freed */ __uint32_t efd_nextents; /* # of extents freed */
__uint64_t efd_efi_id; /* id of corresponding efi * / __uint64_t efd_efi_id; /* id of corresponding efi * /
xfs_extent_64_t efd_extents[1]; /* array of extents freed */ xfs_extent_64_t efd_extents[1]; /* array of extents freed */
} xfs_efd_log_format_64_t; } xfs_efd_log_format_64_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* Max number of extents in fast allocation path. * Max number of extents in fast allocation path.
*/ */
#define XFS_EFI_MAX_FAST_EXTENTS 16 #define XFS_EFI_MAX_FAST_EXTENTS 16
/* /*
* Define EFI flags. * Define EFI flag bits. Manipulated by set/clear/test_bit operators.
*/ */
#define XFS_EFI_RECOVERED 0x1 #define XFS_EFI_RECOVERED 1
#define XFS_EFI_COMMITTED 0x2 #define XFS_EFI_COMMITTED 2
#define XFS_EFI_CANCELED 0x4
/* /*
* This is the "extent free intention" log item. It is used * This is the "extent free intention" log item. It is used
* to log the fact that some extents need to be free. It is * to log the fact that some extents need to be free. It is
* used in conjunction with the "extent free done" log item * used in conjunction with the "extent free done" log item
* described below. * described below.
*/ */
typedef struct xfs_efi_log_item { typedef struct xfs_efi_log_item {
xfs_log_item_t efi_item; xfs_log_item_t efi_item;
uint efi_flags; /* misc flags */ atomic_t efi_next_extent;
uint efi_next_extent; unsigned long efi_flags; /* misc flags */
xfs_efi_log_format_t efi_format; xfs_efi_log_format_t efi_format;
} xfs_efi_log_item_t; } xfs_efi_log_item_t;
/* /*
* This is the "extent free done" log item. It is used to log * This is the "extent free done" log item. It is used to log
* the fact that some extents earlier mentioned in an efi item * the fact that some extents earlier mentioned in an efi item
* have been freed. * have been freed.
*/ */
typedef struct xfs_efd_log_item { typedef struct xfs_efd_log_item {
xfs_log_item_t efd_item; xfs_log_item_t efd_item;
 End of changes. 9 change blocks. 
12 lines changed or deleted 5 lines changed or added


 xfs_fs.h   xfs_fs.h 
skipping to change at line 116 skipping to change at line 116
__s32 bmv_oflags; /* output flags (after 1st structure )*/ __s32 bmv_oflags; /* output flags (after 1st structure )*/
__s32 bmv_unused1; /* future use */ __s32 bmv_unused1; /* future use */
__s32 bmv_unused2; /* future use */ __s32 bmv_unused2; /* future use */
}; };
#endif #endif
/* bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */ /* bmv_iflags values - set by XFS_IOC_GETBMAPX caller. */
#define BMV_IF_ATTRFORK 0x1 /* return attr fork rather t han data */ #define BMV_IF_ATTRFORK 0x1 /* return attr fork rather t han data */
#define BMV_IF_NO_DMAPI_READ 0x2 /* Do not generate DMAPI read event */ #define BMV_IF_NO_DMAPI_READ 0x2 /* Do not generate DMAPI read event */
#define BMV_IF_PREALLOC 0x4 /* rtn status BMV_OF_PREALLO C if req */ #define BMV_IF_PREALLOC 0x4 /* rtn status BMV_OF_PREALLO C if req */
#define BMV_IF_VALID (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLO #define BMV_IF_DELALLOC 0x8 /* rtn status BMV_OF_DELALLO
C) C if req */
#ifdef __KERNEL__ #define BMV_IF_NO_HOLES 0x10 /* Do not return holes */
#define BMV_IF_EXTENDED 0x40000000 /* getpmapx if set */ #define BMV_IF_VALID \
#endif (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC| \
BMV_IF_DELALLOC|BMV_IF_NO_HOLES)
/* bmv_oflags values - returned for for each non-header segment */ /* bmv_oflags values - returned for each non-header segment */
#define BMV_OF_PREALLOC 0x1 /* segment = unwritten pre-a llocation */ #define BMV_OF_PREALLOC 0x1 /* segment = unwritten pre-a llocation */
#define BMV_OF_DELALLOC 0x2 /* segment = delayed allocat
/* Convert getbmap <-> getbmapx - move fields from p1 to p2. */ ion */
#define GETBMAP_CONVERT(p1,p2) { \ #define BMV_OF_LAST 0x4 /* segment is the last in the file *
p2.bmv_offset = p1.bmv_offset; \ /
p2.bmv_block = p1.bmv_block; \
p2.bmv_length = p1.bmv_length; \
p2.bmv_count = p1.bmv_count; \
p2.bmv_entries = p1.bmv_entries; }
/* /*
* Structure for XFS_IOC_FSSETDM. * Structure for XFS_IOC_FSSETDM.
* For use by backup and restore programs to set the XFS on-disk inode * For use by backup and restore programs to set the XFS on-disk inode
* fields di_dmevmask and di_dmstate. These must be set to exactly and * fields di_dmevmask and di_dmstate. These must be set to exactly and
* only values previously obtained via xfs_bulkstat! (Specifically the * only values previously obtained via xfs_bulkstat! (Specifically the
* xfs_bstat_t fields bs_dmevmask and bs_dmstate.) * xfs_bstat_t fields bs_dmevmask and bs_dmstate.)
*/ */
#ifndef HAVE_FSDMIDATA #ifndef HAVE_FSDMIDATA
struct fsdmidata { struct fsdmidata {
skipping to change at line 300 skipping to change at line 295
__s64 bs_size; /* file size */ __s64 bs_size; /* file size */
xfs_bstime_t bs_atime; /* access time */ xfs_bstime_t bs_atime; /* access time */
xfs_bstime_t bs_mtime; /* modify time */ xfs_bstime_t bs_mtime; /* modify time */
xfs_bstime_t bs_ctime; /* inode change time */ xfs_bstime_t bs_ctime; /* inode change time */
int64_t bs_blocks; /* number of blocks */ int64_t bs_blocks; /* number of blocks */
__u32 bs_xflags; /* extended flags */ __u32 bs_xflags; /* extended flags */
__s32 bs_extsize; /* extent size */ __s32 bs_extsize; /* extent size */
__s32 bs_extents; /* number of extents */ __s32 bs_extents; /* number of extents */
__u32 bs_gen; /* generation count */ __u32 bs_gen; /* generation count */
__u16 bs_projid_lo; /* lower part of project id */ __u16 bs_projid_lo; /* lower part of project id */
#define bs_projid bs_projid_lo #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;
/* /*
* The user-level BulkStat Request interface structure. * The user-level BulkStat Request interface structure.
skipping to change at line 429 skipping to change at line 424
#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
#define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS #define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS
#define XFS_IOC_GETVERSION FS_IOC_GETVERSION #define XFS_IOC_GETVERSION FS_IOC_GETVERSION
/* 32-bit compat counterparts */
#define XFS_IOC32_GETXFLAGS FS_IOC32_GETFLAGS
#define XFS_IOC32_SETXFLAGS FS_IOC32_SETFLAGS
#define XFS_IOC32_GETVERSION FS_IOC32_GETVERSION
/* /*
* ioctl commands that replace IRIX fcntl()'s * ioctl commands that replace IRIX fcntl()'s
* For 'documentation' purposed more than anything else, * For 'documentation' purposed more than anything else,
* the "cmd #" field reflects the IRIX fcntl number. * the "cmd #" field reflects the IRIX fcntl number.
*/ */
#define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)
#define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)
#define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr)
#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) #define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr)
skipping to change at line 481 skipping to change at line 472
#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_THAW -- FITHAW 120 */
#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)
#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
 End of changes. 6 change blocks. 
19 lines changed or deleted 14 lines changed or added


 xfs_ialloc.h   xfs_ialloc.h 
skipping to change at line 23 skipping to change at line 23
* *
* 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_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_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
/* /*
* 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.
*/ */
#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
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 (xfs_dinode_t *)
(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. * Find a free (set) bit in the inode bitmask.
*/ */
#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
static inline int xfs_ialloc_find_free(xfs_inofree_t *fp) static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
{ {
return xfs_lowbit64(*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.
* *
skipping to change at line 106 skipping to change at line 105
*/ */
int /* error */ int /* error */
xfs_difree( xfs_difree(
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_ino_t inode, /* inode to be freed */ xfs_ino_t inode, /* inode to be freed */
struct xfs_bmap_free *flist, /* extents to free */ struct xfs_bmap_free *flist, /* extents to free */
int *delete, /* set if inode cluster was deleted */ int *delete, /* set if inode cluster was deleted */
xfs_ino_t *first_ino); /* first inode in deleted cluster */ xfs_ino_t *first_ino); /* first inode in deleted cluster */
/* /*
* Return the location of the inode in bno/len/off, * Return the location of the inode in imap, for mapping it into a buffer.
* for mapping it into a buffer.
*/ */
int int
xfs_dilocate( xfs_imap(
struct xfs_mount *mp, /* file system mount structure */ struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_ino_t ino, /* inode to locate */ xfs_ino_t ino, /* inode to locate */
xfs_fsblock_t *bno, /* output: block containing inode */ struct xfs_imap *imap, /* location map structure */
int *len, /* output: num blocks in cluster*/
int *off, /* output: index in block of inode *
/
uint flags); /* flags for inode btree lookup */ uint flags); /* flags for inode btree lookup */
/* /*
* Compute and fill in value of m_in_maxlevels. * Compute and fill in value of m_in_maxlevels.
*/ */
void void
xfs_ialloc_compute_maxlevels( xfs_ialloc_compute_maxlevels(
struct xfs_mount *mp); /* file system mount structure */ struct xfs_mount *mp); /* file system mount structure */
/* /*
skipping to change at line 156 skipping to change at line 152
* Read in the allocation group header to initialise the per-ag data * Read in the allocation group header to initialise the per-ag data
* in the mount structure * in the mount structure
*/ */
int int
xfs_ialloc_pagi_init( xfs_ialloc_pagi_init(
struct xfs_mount *mp, /* file system mount structure */ struct xfs_mount *mp, /* file system mount structure */
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_agnumber_t agno); /* allocation group number */ xfs_agnumber_t agno); /* allocation group number */
/* /*
* Lookup the first record greater than or equal to ino * Lookup a record by ino in the btree given by cur.
* in the btree given by cur.
*/ */
int xfs_inobt_lookup_ge(struct xfs_btree_cur *cur, xfs_agino_t ino, int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,
__int32_t fcnt, xfs_inofree_t free, int *stat); xfs_lookup_t dir, int *stat);
/*
* Lookup the first record less than or equal to ino
* in the btree given by cur.
*/
int xfs_inobt_lookup_le(struct xfs_btree_cur *cur, xfs_agino_t ino,
__int32_t fcnt, xfs_inofree_t free, 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, xfs_agino_t *ino, extern int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
__int32_t *fcnt, xfs_inofree_t *free, int *stat xfs_inobt_rec_incore_t *rec, int *stat);
);
#endif /* __XFS_IALLOC_H__ */ #endif /* __XFS_IALLOC_H__ */
 End of changes. 9 change blocks. 
23 lines changed or deleted 9 lines changed or added


 xfs_ialloc_btree.h   xfs_ialloc_btree.h 
skipping to change at line 35 skipping to change at line 35
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. * There is a btree for the inode map per allocation group.
*/ */
#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */ #define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */
typedef __uint64_t xfs_inofree_t; typedef __uint64_t xfs_inofree_t;
#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t)) #define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t ))
#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) #define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) #define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n) static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
{ {
return (((n) >= XFS_INODES_PER_CHUNK ? \ return ((n >= XFS_INODES_PER_CHUNK ? 0 : XFS_INOBT_MASK(n)) - 1) <<
(xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i); i;
} }
/* /*
* Data record structure * Data record structure
*/ */
typedef struct xfs_inobt_rec { typedef struct xfs_inobt_rec {
__be32 ir_startino; /* starting inode number */ __be32 ir_startino; /* starting inode number */
__be32 ir_freecount; /* count of free inodes (set bits) * / __be32 ir_freecount; /* count of free inodes (set bits) * /
__be64 ir_free; /* free inode mask */ __be64 ir_free; /* free inode mask */
} xfs_inobt_rec_t; } xfs_inobt_rec_t;
skipping to change at line 72 skipping to change at line 71
* Key structure * Key structure
*/ */
typedef struct xfs_inobt_key { typedef struct xfs_inobt_key {
__be32 ir_startino; /* starting inode number */ __be32 ir_startino; /* starting inode number */
} xfs_inobt_key_t; } xfs_inobt_key_t;
/* btree pointer type */ /* btree pointer type */
typedef __be32 xfs_inobt_ptr_t; typedef __be32 xfs_inobt_ptr_t;
/* /*
* Bit manipulations for ir_free.
*/
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
#define XFS_INOBT_IS_FREE(rp,i) \
(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_
MASK(i))
#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT
_MASK(i))
/*
* Maximum number of inode btree levels.
*/
#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
/*
* block numbers in the AG. * block numbers in the AG.
*/ */
#define XFS_IBT_BLOCK(mp) ((xfs_agblock_t)(XFS_CNT_BLO CK(mp) + 1)) #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)) #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) * (not quite yet, but soon)
*/ */
 End of changes. 5 change blocks. 
21 lines changed or deleted 5 lines changed or added


 xfs_inode.h   xfs_inode.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_INODE_H__ #ifndef __XFS_INODE_H__
#define __XFS_INODE_H__ #define __XFS_INODE_H__
struct posix_acl;
struct xfs_dinode; struct xfs_dinode;
struct xfs_dinode_core;
struct xfs_inode; struct xfs_inode;
/* /*
* Fork identifiers. * Fork identifiers.
*/ */
#define XFS_DATA_FORK 0 #define XFS_DATA_FORK 0
#define XFS_ATTR_FORK 1 #define XFS_ATTR_FORK 1
/* /*
* The following xfs_ext_irec_t struct introduces a second (top) level * The following xfs_ext_irec_t struct introduces a second (top) level
skipping to change at line 87 skipping to change at line 87
xfs_bmbt_rec_host_t if_inline_ext[XFS_INLINE_EXTS]; xfs_bmbt_rec_host_t if_inline_ext[XFS_INLINE_EXTS];
/* very small file extents * / /* very small file extents * /
char if_inline_data[XFS_INLINE_DATA]; char if_inline_data[XFS_INLINE_DATA];
/* very small file data */ /* very small file data */
xfs_dev_t if_rdev; /* dev number if special */ xfs_dev_t if_rdev; /* dev number if special */
uuid_t if_uuid; /* mount point value */ uuid_t if_uuid; /* mount point value */
} if_u2; } if_u2;
} xfs_ifork_t; } xfs_ifork_t;
/* /*
* Inode location information. Stored in the inode and passed to
* xfs_imap_to_bp() to get a buffer and dinode for a given inode.
*/
struct xfs_imap {
xfs_daddr_t im_blkno; /* starting BB of inode chunk */
ushort im_len; /* length in BBs of inode chunk */
ushort im_boffset; /* inode offset in block in bytes */
};
/*
* This is the xfs in-core inode structure. * This is the xfs in-core inode structure.
* Most of the on-disk inode is embedded in the i_d field. * Most of the on-disk inode is embedded in the i_d field.
* *
* The extent pointers/inline file space, however, are managed * The extent pointers/inline file space, however, are managed
* separately. The memory for this information is pointed to by * separately. The memory for this information is pointed to by
* the if_u1 unions depending on the type of the data. * the if_u1 unions depending on the type of the data.
* This is used to linearize the array of extents for fast in-core * This is used to linearize the array of extents for fast in-core
* access. This is used until the file's number of extents * access. This is used until the file's number of extents
* surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers * surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers
* are accessed through the buffer cache. * are accessed through the buffer cache.
skipping to change at line 115 skipping to change at line 125
* i_mnext and i_mprev fields, it is used as a marker in the inode * i_mnext and i_mprev fields, it is used as a marker in the inode
* chain off the mount structure by xfs_sync calls. * chain off the mount structure by xfs_sync calls.
*/ */
typedef struct xfs_ictimestamp { typedef struct xfs_ictimestamp {
__int32_t t_sec; /* timestamp seconds */ __int32_t t_sec; /* timestamp seconds */
__int32_t t_nsec; /* timestamp nanoseconds */ __int32_t t_nsec; /* timestamp nanoseconds */
} xfs_ictimestamp_t; } xfs_ictimestamp_t;
/* /*
* NOTE: This structure must be kept identical to struct xfs_dinode_core * NOTE: This structure must be kept identical to struct xfs_dinode
* in xfs_dinode.h except for the endianess annotations. * in xfs_dinode.h except for the endianness annotations.
*/ */
typedef struct xfs_icdinode { typedef struct xfs_icdinode {
__uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
__uint16_t di_mode; /* mode and type of file */ __uint16_t di_mode; /* mode and type of file */
__int8_t di_version; /* inode version */ __int8_t di_version; /* inode version */
__int8_t di_format; /* format of di_c data */ __int8_t di_format; /* format of di_c data */
__uint16_t di_onlink; /* old number of links to file */ __uint16_t di_onlink; /* old number of links to file */
__uint32_t di_uid; /* owner's user id */ __uint32_t di_uid; /* owner's user id */
__uint32_t di_gid; /* owner's group id */ __uint32_t di_gid; /* owner's group id */
__uint32_t di_nlink; /* number of links to file */ __uint32_t di_nlink; /* number of links to file */
skipping to change at line 162 skipping to change at line 172
/* /*
* Per-fork incore inode flags. * Per-fork incore inode flags.
*/ */
#define XFS_IFINLINE 0x01 /* Inline data is read in */ #define XFS_IFINLINE 0x01 /* Inline data is read in */
#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in * / #define XFS_IFEXTENTS 0x02 /* All extent pointers are read in * /
#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */ #define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
#define XFS_IFEXTIREC 0x08 /* Indirection array of extent block s */ #define XFS_IFEXTIREC 0x08 /* Indirection array of extent block s */
/* /*
* Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
*/
#define XFS_IMAP_LOOKUP 0x1
#define XFS_IMAP_BULKSTAT 0x2
/*
* Fork handling. * Fork handling.
*/ */
#define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0) #define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0)
#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3)) #define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3))
#define XFS_IFORK_PTR(ip,w) \ #define XFS_IFORK_PTR(ip,w) \
((w) == XFS_DATA_FORK ? \ ((w) == XFS_DATA_FORK ? \
&(ip)->i_df : \ &(ip)->i_df : \
(ip)->i_afp) (ip)->i_afp)
skipping to change at line 229 skipping to change at line 233
xfs_set_projid(struct xfs_icdinode *i_d, xfs_set_projid(struct xfs_icdinode *i_d,
__uint32_t projid) __uint32_t projid)
{ {
i_d->di_projid_hi = (__uint16_t) (projid >> 16); i_d->di_projid_hi = (__uint16_t) (projid >> 16);
i_d->di_projid_lo = (__uint16_t) (projid & 0xffff); i_d->di_projid_lo = (__uint16_t) (projid & 0xffff);
} }
#ifdef __KERNEL__ #ifdef __KERNEL__
struct bhv_desc; struct bhv_desc;
struct cred;
struct ktrace;
struct xfs_buf; struct xfs_buf;
struct xfs_bmap_free; struct xfs_bmap_free;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct xfs_inode_log_item; struct xfs_inode_log_item;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct xfs_dquot; struct xfs_dquot;
#if defined(XFS_ILOCK_TRACE)
#define XFS_ILOCK_KTRACE_SIZE 32
extern ktrace_t *xfs_ilock_trace_buf;
extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *
);
#else
#define xfs_ilock_trace(i,n,f,ra)
#endif
typedef struct dm_attrs_s { typedef struct dm_attrs_s {
__uint32_t da_dmevmask; /* DMIG event mask */ __uint32_t da_dmevmask; /* DMIG event mask */
__uint16_t da_dmstate; /* DMIG state info */ __uint16_t da_dmstate; /* DMIG state info */
__uint16_t da_pad; /* DMIG extra padding */ __uint16_t da_pad; /* DMIG extra padding */
} dm_attrs_t; } dm_attrs_t;
typedef struct {
struct xfs_inode *ip_mnext; /* next inode in mount list
*/
struct xfs_inode *ip_mprev; /* ptr to prev inode */
struct xfs_mount *ip_mount; /* fs mount struct ptr */
} xfs_iptr_t;
typedef struct xfs_inode { typedef struct xfs_inode {
/* Inode linking and identification information. */ /* Inode linking and identification information. */
struct xfs_inode *i_mnext; /* next inode in mount list
*/
struct xfs_inode *i_mprev; /* ptr to prev inode */
struct xfs_mount *i_mount; /* fs mount struct ptr */ struct xfs_mount *i_mount; /* fs mount struct ptr */
struct list_head i_reclaim; /* reclaim list */
struct inode *i_vnode; /* vnode backpointer */
struct xfs_dquot *i_udquot; /* user dquot */ struct xfs_dquot *i_udquot; /* user dquot */
struct xfs_dquot *i_gdquot; /* group dquot */ struct xfs_dquot *i_gdquot; /* group dquot */
/* Inode location stuff */ /* Inode location stuff */
xfs_ino_t i_ino; /* inode number (agno/agino) */ xfs_ino_t i_ino; /* inode number (agno/agino) */
xfs_daddr_t i_blkno; /* blkno of inode buffer */ struct xfs_imap i_imap; /* location for xfs_imap() *
ushort i_len; /* len of inode buffer */ /
ushort i_boffset; /* off of inode in buffer */
/* Extent information. */ /* Extent information. */
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 */
/* Transaction and locking information. */ /* Transaction and locking information. */
struct xfs_trans *i_transp; /* ptr to owning transaction */ struct xfs_trans *i_transp; /* ptr to owning transaction */
struct xfs_inode_log_item *i_itemp; /* logging information */ struct xfs_inode_log_item *i_itemp; /* logging information */
mrlock_t i_lock; /* inode lock */ mrlock_t i_lock; /* inode lock */
mrlock_t i_iolock; /* inode IO lock */ mrlock_t i_iolock; /* inode IO lock */
struct completion i_flush; /* inode flush completion q */ struct completion i_flush; /* inode flush completion q */
atomic_t i_pincount; /* inode pin count */ atomic_t i_pincount; /* inode pin count */
wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */ wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */
spinlock_t i_flags_lock; /* inode i_flags lock */ spinlock_t i_flags_lock; /* inode i_flags lock */
/* Miscellaneous state. */ /* Miscellaneous state. */
unsigned short i_flags; /* see defined flags below * / unsigned short i_flags; /* see defined flags below * /
unsigned char i_update_core; /* timestamps/size is dirty */ unsigned char i_update_core; /* timestamps/size is dirty */
unsigned char i_update_size; /* di_size field is dirty */
unsigned int i_gen; /* generation count */
unsigned int i_delayed_blks; /* count of delay alloc blks */ unsigned int i_delayed_blks; /* count of delay alloc blks */
xfs_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_fsize_t i_new_size; /* size when write completes */ xfs_fsize_t i_new_size; /* size when write completes */
atomic_t i_iocount; /* outstanding I/O count */ atomic_t i_iocount; /* outstanding I/O count */
/* Trace buffers per inode. */
#ifdef XFS_INODE_TRACE /* VFS inode */
struct ktrace *i_trace; /* general inode trace */ struct inode i_vnode; /* embedded VFS inode */
#endif
#ifdef XFS_BMAP_TRACE
struct ktrace *i_xtrace; /* inode extent list trace *
/
#endif
#ifdef XFS_BTREE_TRACE
struct ktrace *i_btrace; /* inode bmap btree trace */
#endif
#ifdef XFS_RW_TRACE
struct ktrace *i_rwtrace; /* inode read/write trace */
#endif
#ifdef XFS_ILOCK_TRACE
struct ktrace *i_lock_trace; /* inode lock/unlock trace *
/
#endif
#ifdef XFS_DIR2_TRACE
struct ktrace *i_dir_trace; /* inode directory trace */
#endif
} xfs_inode_t; } xfs_inode_t;
#define XFS_ISIZE(ip) (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \ #define XFS_ISIZE(ip) (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \
(ip)->i_size : (ip)->i_d.di_size; (ip)->i_size : (ip)->i_d.di_size;
/* Convert from vfs inode to xfs inode */ /* Convert from vfs inode to xfs inode */
static inline struct xfs_inode *XFS_I(struct inode *inode) static inline struct xfs_inode *XFS_I(struct inode *inode)
{ {
return (struct xfs_inode *)inode->i_private; return container_of(inode, struct xfs_inode, i_vnode);
} }
/* convert from xfs inode to vfs inode */ /* convert from xfs inode to vfs inode */
static inline struct inode *VFS_I(struct xfs_inode *ip) static inline struct inode *VFS_I(struct xfs_inode *ip)
{ {
return (struct inode *)ip->i_vnode; return &ip->i_vnode;
} }
/* /*
* i_flags helper functions * i_flags helper functions
*/ */
static inline void static inline void
__xfs_iflags_set(xfs_inode_t *ip, unsigned short flags) __xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
{ {
ip->i_flags |= flags; ip->i_flags |= flags;
} }
skipping to change at line 391 skipping to change at line 355
spin_lock(&ip->i_flags_lock); spin_lock(&ip->i_flags_lock);
ret = ip->i_flags & flags; ret = ip->i_flags & flags;
if (ret) if (ret)
ip->i_flags &= ~flags; ip->i_flags &= ~flags;
spin_unlock(&ip->i_flags_lock); spin_unlock(&ip->i_flags_lock);
return ret; return ret;
} }
/* /*
* 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 prid_t
xfs_get_projid(struct xfs_inode *ip)
{
return (prid_t)ip->i_d.di_projid_hi << 16 | ip->i_d.di_projid_lo;
}
static inline void
xfs_set_projid(struct xfs_inode *ip,
prid_t projid)
{
ip->i_d.di_projid_hi = (__uint16_t) (projid >> 16);
ip->i_d.di_projid_lo = (__uint16_t) (projid & 0xffff);
}
/*
* Manage the i_flush queue embedded in the inode. This completion * Manage the i_flush queue embedded in the inode. This completion
* queue synchronizes processes attempting to flush the in-core * queue synchronizes processes attempting to flush the in-core
* inode back to disk. * inode back to disk.
*/ */
static inline void xfs_iflock(xfs_inode_t *ip) static inline void xfs_iflock(xfs_inode_t *ip)
{ {
wait_for_completion(&ip->i_flush); wait_for_completion(&ip->i_flush);
} }
static inline int xfs_iflock_nowait(xfs_inode_t *ip) static inline int xfs_iflock_nowait(xfs_inode_t *ip)
skipping to change at line 413 skipping to change at line 396
} }
static inline void xfs_ifunlock(xfs_inode_t *ip) static inline void xfs_ifunlock(xfs_inode_t *ip)
{ {
complete(&ip->i_flush); complete(&ip->i_flush);
} }
/* /*
* In-core inode flags. * In-core inode flags.
*/ */
#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */ #define XFS_IRECLAIM 0x0001 /* started reclaiming this inode */
#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set #define XFS_ISTALE 0x0002 /* inode has been staled */
*/ #define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode #define XFS_INEW 0x0008 /* inode has just been allocated */
*/ #define XFS_IFILESTREAM 0x0010 /* inode is in a filestream
#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode directory */
*/ #define XFS_ITRUNCATED 0x0020 /* truncated down so flush-on-close
#define XFS_ISTALE 0x0010 /* inode has been staled */ */
#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ #define XFS_IDIRTY_RELEASE 0x0040 /* dirty release already seen */
#define XFS_INEW 0x0040
#define XFS_IFILESTREAM 0x0080 /* inode is in a filestream director
y */
#define XFS_IMODIFIED 0x0100 /* XFS inode state possibly differs */
/* to the Linux inode state. */
#define XFS_ITRUNCATED 0x0200 /* truncated down so flush-on-close */
/* /*
* Flags for inode locking. * Flags for inode locking.
* Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield) * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
* 1<<16 - 1<<32-1 -- lockdep annotation (integers) * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
*/ */
#define XFS_IOLOCK_EXCL (1<<0) #define XFS_IOLOCK_EXCL (1<<0)
#define XFS_IOLOCK_SHARED (1<<1) #define XFS_IOLOCK_SHARED (1<<1)
#define XFS_ILOCK_EXCL (1<<2) #define XFS_ILOCK_EXCL (1<<2)
#define XFS_ILOCK_SHARED (1<<3) #define XFS_ILOCK_SHARED (1<<3)
#define XFS_IUNLOCK_NONOTIFY (1<<4) #define XFS_IUNLOCK_NONOTIFY (1<<4)
#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \ #define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED) | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED)
#define XFS_LOCK_FLAGS \
{ XFS_IOLOCK_EXCL, "IOLOCK_EXCL" }, \
{ XFS_IOLOCK_SHARED, "IOLOCK_SHARED" }, \
{ XFS_ILOCK_EXCL, "ILOCK_EXCL" }, \
{ XFS_ILOCK_SHARED, "ILOCK_SHARED" }, \
{ XFS_IUNLOCK_NONOTIFY, "IUNLOCK_NONOTIFY" }
/* /*
* Flags for lockdep annotations. * Flags for lockdep annotations.
* *
* XFS_I[O]LOCK_PARENT - for operations that require locking two inodes * XFS_I[O]LOCK_PARENT - for operations that require locking two inodes
* (ie directory operations that require locking a directory inode and * (ie directory operations that require locking a directory inode and
* an entry inode). The first inode gets locked with this flag so it * an entry inode). The first inode gets locked with this flag so it
* gets a lockdep subclass of 1 and the second lock will have a lockdep * gets a lockdep subclass of 1 and the second lock will have a lockdep
* subclass of 0. * subclass of 0.
* *
* XFS_LOCK_INUMORDER - for locking several inodes at the some time * XFS_LOCK_INUMORDER - for locking several inodes at the some time
skipping to change at line 472 skipping to change at line 458
#define XFS_ILOCK_SHIFT 24 #define XFS_ILOCK_SHIFT 24
#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) #define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT)
#define XFS_IOLOCK_DEP_MASK 0x00ff0000 #define XFS_IOLOCK_DEP_MASK 0x00ff0000
#define XFS_ILOCK_DEP_MASK 0xff000000 #define XFS_ILOCK_DEP_MASK 0xff000000
#define XFS_LOCK_DEP_MASK (XFS_IOLOCK_DEP_MASK | XFS_ILOCK_DEP_MASK) #define XFS_LOCK_DEP_MASK (XFS_IOLOCK_DEP_MASK | XFS_ILOCK_DEP_MASK)
#define XFS_IOLOCK_DEP(flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLO CK_SHIFT) #define XFS_IOLOCK_DEP(flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLO CK_SHIFT)
#define XFS_ILOCK_DEP(flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK _SHIFT) #define XFS_ILOCK_DEP(flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK _SHIFT)
/* extern struct lock_class_key xfs_iolock_reclaimable;
* Flags for xfs_iflush()
*/
#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
#define XFS_IFLUSH_SYNC 3
#define XFS_IFLUSH_ASYNC 4
#define XFS_IFLUSH_DELWRI 5
#define XFS_IFLUSH_ASYNC_NOBLOCK 6
/* /*
* Flags for xfs_itruncate_start(). * Flags for xfs_itruncate_start().
*/ */
#define XFS_ITRUNC_DEFINITE 0x1 #define XFS_ITRUNC_DEFINITE 0x1
#define XFS_ITRUNC_MAYBE 0x2 #define XFS_ITRUNC_MAYBE 0x2
#define XFS_ITRUNC_FLAGS \
{ XFS_ITRUNC_DEFINITE, "DEFINITE" }, \
{ XFS_ITRUNC_MAYBE, "MAYBE" }
/* /*
* For multiple groups support: if S_ISGID bit is set in the parent * For multiple groups support: if S_ISGID bit is set in the parent
* directory, group of new file is set to that of the parent, and * directory, group of new file is set to that of the parent, and
* new subdirectory gets S_ISGID bit from parent. * new subdirectory gets S_ISGID bit from parent.
*/ */
#define XFS_INHERIT_GID(pip) \ #define XFS_INHERIT_GID(pip) \
(((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
((pip)->i_d.di_mode & S_ISGID)) ((pip)->i_d.di_mode & S_ISGID))
/* /*
* Flags for xfs_iget()
*/
#define XFS_IGET_CREATE 0x1
#define XFS_IGET_BULKSTAT 0x2
/*
* xfs_iget.c prototypes. * xfs_iget.c prototypes.
*/ */
void xfs_ihash_init(struct xfs_mount *);
void xfs_ihash_free(struct xfs_mount *);
xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
struct xfs_trans *);
int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
uint, uint, xfs_inode_t **, xfs_daddr_t); uint, uint, xfs_inode_t **);
void xfs_iput(xfs_inode_t *, uint);
void xfs_iput_new(xfs_inode_t *, uint);
void xfs_ilock(xfs_inode_t *, uint); void xfs_ilock(xfs_inode_t *, uint);
int xfs_ilock_nowait(xfs_inode_t *, uint); int xfs_ilock_nowait(xfs_inode_t *, uint);
void xfs_iunlock(xfs_inode_t *, uint); void xfs_iunlock(xfs_inode_t *, uint);
void xfs_ilock_demote(xfs_inode_t *, uint); void xfs_ilock_demote(xfs_inode_t *, uint);
int xfs_isilocked(xfs_inode_t *, uint); int xfs_isilocked(xfs_inode_t *, uint);
uint xfs_ilock_map_shared(xfs_inode_t *); uint xfs_ilock_map_shared(xfs_inode_t *);
void xfs_iunlock_map_shared(xfs_inode_t *, uint); void xfs_iunlock_map_shared(xfs_inode_t *, uint);
void xfs_ireclaim(xfs_inode_t *); void xfs_inode_free(struct xfs_inode *ip);
int xfs_finish_reclaim(xfs_inode_t *, int, int);
int xfs_finish_reclaim_all(struct xfs_mount *, int);
/* /*
* xfs_inode.c prototypes. * xfs_inode.c prototypes.
*/ */
int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
xfs_inode_t **, xfs_daddr_t, uint);
int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
xfs_nlink_t, xfs_dev_t, struct cred *, prid_t, xfs_nlink_t, xfs_dev_t, prid_t, int,
int, struct xfs_buf **, boolean_t *, xfs_inode_t struct xfs_buf **, boolean_t *, xfs_inode_t **);
**);
uint xfs_ip2xflags(struct xfs_inode *); uint xfs_ip2xflags(struct xfs_inode *);
uint xfs_dic2xflags(struct xfs_dinode *); uint xfs_dic2xflags(struct xfs_dinode *);
int xfs_ifree(struct xfs_trans *, xfs_inode_t *, int xfs_ifree(struct xfs_trans *, xfs_inode_t *,
struct xfs_bmap_free *); struct xfs_bmap_free *);
int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
xfs_fsize_t, int, int); xfs_fsize_t, int, int);
int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
struct xfs_inode * xfs_inode_alloc(struct xfs_mount *, xfs_ino_t);
void xfs_idestroy(xfs_inode_t *);
void xfs_iextract(xfs_inode_t *);
void xfs_iext_realloc(xfs_inode_t *, int, int); void xfs_iext_realloc(xfs_inode_t *, int, int);
void xfs_ipin(xfs_inode_t *); void xfs_iunpin_wait(xfs_inode_t *);
void xfs_iunpin(xfs_inode_t *);
int xfs_iflush(xfs_inode_t *, uint); int xfs_iflush(xfs_inode_t *, uint);
void xfs_iflush_all(struct xfs_mount *);
void xfs_ichgtime(xfs_inode_t *, int);
xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
void xfs_lock_inodes(xfs_inode_t **, int, uint); void xfs_lock_inodes(xfs_inode_t **, int, uint);
void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
void xfs_synchronize_atime(xfs_inode_t *); void xfs_synchronize_times(xfs_inode_t *);
void xfs_mark_inode_dirty(xfs_inode_t *);
void xfs_mark_inode_dirty_sync(xfs_inode_t *); void xfs_mark_inode_dirty_sync(xfs_inode_t *);
#define IHOLD(ip) \
do { \
ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
ihold(VFS_I(ip)); \
trace_xfs_ihold(ip, _THIS_IP_); \
} while (0)
#define IRELE(ip) \
do { \
trace_xfs_irele(ip, _THIS_IP_); \
iput(VFS_I(ip)); \
} while (0)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/*
* Flags for xfs_iget()
*/
#define XFS_IGET_CREATE 0x1
#define XFS_IGET_UNTRUSTED 0x2
int xfs_inotobp(struct xfs_mount *, struct xfs_trans *,
xfs_ino_t, struct xfs_dinode **,
struct xfs_buf **, int *, uint);
int xfs_itobp(struct xfs_mount *, struct xfs_trans *, int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
struct xfs_inode *, struct xfs_dinode **, struct xfs_inode *, struct xfs_dinode **,
struct xfs_buf **, xfs_daddr_t, uint, uint); struct xfs_buf **, uint);
void xfs_dinode_from_disk(struct xfs_icdinode *, int xfs_iread(struct xfs_mount *, struct xfs_trans *,
struct xfs_dinode_core *); struct xfs_inode *, uint);
void xfs_dinode_to_disk(struct xfs_dinode_core *, void xfs_dinode_to_disk(struct xfs_dinode *,
struct xfs_icdinode *); struct xfs_icdinode *);
void xfs_dinode_from_disk(struct xfs_icdinode *,
struct xfs_dinode *);
void xfs_idestroy_fork(struct xfs_inode *, int); void xfs_idestroy_fork(struct xfs_inode *, int);
void xfs_idata_realloc(struct xfs_inode *, int, int); void xfs_idata_realloc(struct xfs_inode *, int, int);
void xfs_iroot_realloc(struct xfs_inode *, int, int); void xfs_iroot_realloc(struct xfs_inode *, int, int);
int xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, in t); int xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, in t);
int xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int) ; int xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int) ;
xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t); xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, void xfs_iext_insert(struct xfs_inode *, xfs_extnum_t, xfs_extnum
xfs_bmbt_irec_t *); _t,
xfs_bmbt_irec_t *, int);
void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t , int); void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t , int);
void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int); void xfs_iext_remove(struct xfs_inode *, xfs_extnum_t, int, int);
void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int); void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int);
void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int); void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int);
void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int); void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int);
void xfs_iext_realloc_direct(xfs_ifork_t *, int); void xfs_iext_realloc_direct(xfs_ifork_t *, int);
void xfs_iext_realloc_indirect(xfs_ifork_t *, int);
void xfs_iext_indirect_to_direct(xfs_ifork_t *);
void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
void xfs_iext_inline_to_direct(xfs_ifork_t *, int); void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
void xfs_iext_destroy(xfs_ifork_t *); void xfs_iext_destroy(xfs_ifork_t *);
xfs_bmbt_rec_host_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *); xfs_bmbt_rec_host_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *);
xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *); xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int); xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
void xfs_iext_irec_init(xfs_ifork_t *); void xfs_iext_irec_init(xfs_ifork_t *);
xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int); xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int);
void xfs_iext_irec_remove(xfs_ifork_t *, int); void xfs_iext_irec_remove(xfs_ifork_t *, int);
void xfs_iext_irec_compact(xfs_ifork_t *); void xfs_iext_irec_compact(xfs_ifork_t *);
 End of changes. 37 change blocks. 
123 lines changed or deleted 99 lines changed or added


 xfs_inode_item.h   xfs_inode_item.h 
skipping to change at line 43 skipping to change at line 43
__uint64_t ilf_ino; /* inode number */ __uint64_t ilf_ino; /* inode number */
union { union {
__uint32_t ilfu_rdev; /* rdev value for dev inode* / __uint32_t ilfu_rdev; /* rdev value for dev inode* /
uuid_t ilfu_uuid; /* mount point value */ uuid_t ilfu_uuid; /* mount point value */
} ilf_u; } ilf_u;
__int64_t ilf_blkno; /* blkno of inode buffer */ __int64_t ilf_blkno; /* blkno of inode buffer */
__int32_t ilf_len; /* len of inode buffer */ __int32_t ilf_len; /* len of inode buffer */
__int32_t ilf_boffset; /* off of inode in buffer */ __int32_t ilf_boffset; /* off of inode in buffer */
} xfs_inode_log_format_t; } xfs_inode_log_format_t;
#ifndef HAVE_FORMAT32
typedef struct xfs_inode_log_format_32 { typedef struct xfs_inode_log_format_32 {
__uint16_t ilf_type; /* inode log item type */ __uint16_t ilf_type; /* inode log item type */
__uint16_t ilf_size; /* size of this item */ __uint16_t ilf_size; /* size of this item */
__uint32_t ilf_fields; /* flags for fields logged * / __uint32_t ilf_fields; /* flags for fields logged * /
__uint16_t ilf_asize; /* size of attr d/ext/root * / __uint16_t ilf_asize; /* size of attr d/ext/root * /
__uint16_t ilf_dsize; /* size of data/ext/root */ __uint16_t ilf_dsize; /* size of data/ext/root */
__uint64_t ilf_ino; /* inode number */ __uint64_t ilf_ino; /* inode number */
union { union {
__uint32_t ilfu_rdev; /* rdev value for dev inode* / __uint32_t ilfu_rdev; /* rdev value for dev inode* /
uuid_t ilfu_uuid; /* mount point value */ uuid_t ilfu_uuid; /* mount point value */
} ilf_u; } ilf_u;
__int64_t ilf_blkno; /* blkno of inode buffer */ __int64_t ilf_blkno; /* blkno of inode buffer */
__int32_t ilf_len; /* len of inode buffer */ __int32_t ilf_len; /* len of inode buffer */
__int32_t ilf_boffset; /* off of inode in buffer */ __int32_t ilf_boffset; /* off of inode in buffer */
} __attribute__((packed)) xfs_inode_log_format_32_t; } __attribute__((packed)) xfs_inode_log_format_32_t;
#endif
typedef struct xfs_inode_log_format_64 { typedef struct xfs_inode_log_format_64 {
__uint16_t ilf_type; /* inode log item type */ __uint16_t ilf_type; /* inode log item type */
__uint16_t ilf_size; /* size of this item */ __uint16_t ilf_size; /* size of this item */
__uint32_t ilf_fields; /* flags for fields logged * / __uint32_t ilf_fields; /* flags for fields logged * /
__uint16_t ilf_asize; /* size of attr d/ext/root * / __uint16_t ilf_asize; /* size of attr d/ext/root * /
__uint16_t ilf_dsize; /* size of data/ext/root */ __uint16_t ilf_dsize; /* size of data/ext/root */
__uint32_t ilf_pad; /* pad for 64 bit boundary * / __uint32_t ilf_pad; /* pad for 64 bit boundary * /
__uint64_t ilf_ino; /* inode number */ __uint64_t ilf_ino; /* inode number */
union { union {
skipping to change at line 108 skipping to change at line 106
#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
XFS_ILOG_ABROOT) XFS_ILOG_ABROOT)
#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \ XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
XFS_ILOG_DEV | XFS_ILOG_UUID | \ XFS_ILOG_DEV | XFS_ILOG_UUID | \
XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
XFS_ILOG_ABROOT) XFS_ILOG_ABROOT)
#define XFS_ILI_HOLD 0x1
#define XFS_ILI_IOLOCKED_EXCL 0x2
#define XFS_ILI_IOLOCKED_SHARED 0x4
#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLO
CKED_SHARED)
#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
static inline int xfs_ilog_fbroot(int w) static inline int xfs_ilog_fbroot(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT); return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
} }
#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
static inline int xfs_ilog_fext(int w) static inline int xfs_ilog_fext(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
} }
#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
static inline int xfs_ilog_fdata(int w) static inline int xfs_ilog_fdata(int w)
{ {
return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA); return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
} }
#ifdef __KERNEL__ #ifdef __KERNEL__
struct xfs_buf; struct xfs_buf;
struct xfs_bmbt_rec_64; struct xfs_bmbt_rec;
struct xfs_inode; struct xfs_inode;
struct xfs_mount; struct xfs_mount;
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 ptr */ struct xfs_inode *ili_inode; /* inode ptr */
xfs_lsn_t ili_flush_lsn; /* lsn at last flush */ xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
xfs_lsn_t ili_last_lsn; /* lsn at last transactio n */ xfs_lsn_t ili_last_lsn; /* lsn at last transactio n */
unsigned short ili_ilock_recur; /* lock recursion count * unsigned short ili_lock_flags; /* lock flags */
/
unsigned short ili_iolock_recur; /* lock recursion count *
/
unsigned short ili_flags; /* misc flags */
unsigned short ili_logged; /* flushed logged data */ unsigned short ili_logged; /* flushed logged data */
unsigned int ili_last_fields; /* fields when flushed */ unsigned int ili_last_fields; /* fields when flushed */
struct xfs_bmbt_rec_64 *ili_extents_buf; /* array of logged struct xfs_bmbt_rec *ili_extents_buf; /* array of logged
data exts */ data exts */
struct xfs_bmbt_rec_64 *ili_aextents_buf; /* array of logged struct xfs_bmbt_rec *ili_aextents_buf; /* array of logged
attr exts */ attr exts */
unsigned int ili_pushbuf_flag; /* one bit used in push_a
il */
#ifdef DEBUG
uint64_t ili_push_owner; /* one who sets pushbuf_f
lag
above gets to push the
buf */
#endif
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
int ili_root_size; int ili_root_size;
char *ili_orig_root; char *ili_orig_root;
#endif #endif
xfs_inode_log_format_t ili_format; /* logged structure */ xfs_inode_log_format_t ili_format; /* logged structure */
} xfs_inode_log_item_t; } xfs_inode_log_item_t;
static inline int xfs_inode_clean(xfs_inode_t *ip) static inline int xfs_inode_clean(xfs_inode_t *ip)
{ {
return (!ip->i_itemp || return (!ip->i_itemp ||
!(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) && !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
!ip->i_update_core; !ip->i_update_core;
} }
extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
extern void xfs_inode_item_destroy(struct xfs_inode *); extern void xfs_inode_item_destroy(struct xfs_inode *);
extern void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *); extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *);
extern void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *); extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *);
extern void xfs_iflush_abort(struct xfs_inode *); extern void xfs_iflush_abort(struct xfs_inode *);
extern int xfs_inode_item_format_convert(xfs_log_iovec_t *, extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
xfs_inode_log_format_t *); xfs_inode_log_format_t *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_INODE_ITEM_H__ */ #endif /* __XFS_INODE_ITEM_H__ */
 End of changes. 11 change blocks. 
31 lines changed or deleted 6 lines changed or added


 xfs_inum.h   xfs_inum.h 
skipping to change at line 75 skipping to change at line 75
#define XFS_AGINO_TO_INO(mp,a,i) \ #define XFS_AGINO_TO_INO(mp,a,i) \
(((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i)) (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS( mp)) #define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS( mp))
#define XFS_AGINO_TO_OFFSET(mp,i) \ #define XFS_AGINO_TO_OFFSET(mp,i) \
((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp))) ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ #define XFS_OFFBNO_TO_AGINO(mp,b,o) \
((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
#if XFS_BIG_INUMS #if XFS_BIG_INUMS
#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))
#else #else
#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL)) #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))
#endif #endif
#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL)) #define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
#endif /* __XFS_INUM_H__ */ #endif /* __XFS_INUM_H__ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 xfs_log.h   xfs_log.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_LOG_H__ #ifndef __XFS_LOG_H__
#define __XFS_LOG_H__ #define __XFS_LOG_H__
/* get lsn fields */ /* get lsn fields */
#define CYCLE_LSN(lsn) ((uint)((lsn)>>32)) #define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
#define BLOCK_LSN(lsn) ((uint)(lsn)) #define BLOCK_LSN(lsn) ((uint)(lsn))
/* this is used in a spot where we might otherwise double-endian-flip */ /* this is used in a spot where we might otherwise double-endian-flip */
#define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0]) #define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* By comparing each component, we don't have to worry about extra * By comparing each component, we don't have to worry about extra
* endian issues in treating two 32 bit numbers as one 64 bit number * endian issues in treating two 32 bit numbers as one 64 bit number
skipping to change at line 59 skipping to change at line 58
*/ */
/* /*
* Flags to xfs_log_done() * Flags to xfs_log_done()
*/ */
#define XFS_LOG_REL_PERM_RESERV 0x1 #define XFS_LOG_REL_PERM_RESERV 0x1
/* /*
* Flags to xfs_log_reserve() * Flags to xfs_log_reserve()
* *
* XFS_LOG_SLEEP: If space is not available, sleep (default)
* XFS_LOG_NOSLEEP: If space is not available, return error
* XFS_LOG_PERM_RESERV: Permanent reservation. When writes are * XFS_LOG_PERM_RESERV: Permanent reservation. When writes are
* performed against this type of reservation, the reservation * performed against this type of reservation, the reservation
* is not decreased. Long running transactions should use this . * is not decreased. Long running transactions should use this .
*/ */
#define XFS_LOG_SLEEP 0x0
#define XFS_LOG_NOSLEEP 0x1
#define XFS_LOG_PERM_RESERV 0x2 #define XFS_LOG_PERM_RESERV 0x2
/* /*
* Flags to xfs_log_force() * Flags to xfs_log_force()
* *
* XFS_LOG_SYNC: Synchronous force in-core log to disk * XFS_LOG_SYNC: Synchronous force in-core log to disk
* XFS_LOG_FORCE: Start in-core log write now.
* XFS_LOG_URGE: Start write within some window of time.
*
* Note: Either XFS_LOG_FORCE or XFS_LOG_URGE must be set.
*/ */
#define XFS_LOG_SYNC 0x1 #define XFS_LOG_SYNC 0x1
#define XFS_LOG_FORCE 0x2
#define XFS_LOG_URGE 0x4
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* Log Clients */ /* Log Clients */
#define XFS_TRANSACTION 0x69 #define XFS_TRANSACTION 0x69
#define XFS_VOLUME 0x2 #define XFS_VOLUME 0x2
#define XFS_LOG 0xaa #define XFS_LOG 0xaa
/* Region types for iovec's i_type */ /* Region types for iovec's i_type */
#define XLOG_REG_TYPE_BFORMAT 1 #define XLOG_REG_TYPE_BFORMAT 1
skipping to change at line 111 skipping to change at line 100
#define XLOG_REG_TYPE_IATTR_LOCAL 12 #define XLOG_REG_TYPE_IATTR_LOCAL 12
#define XLOG_REG_TYPE_QFORMAT 13 #define XLOG_REG_TYPE_QFORMAT 13
#define XLOG_REG_TYPE_DQUOT 14 #define XLOG_REG_TYPE_DQUOT 14
#define XLOG_REG_TYPE_QUOTAOFF 15 #define XLOG_REG_TYPE_QUOTAOFF 15
#define XLOG_REG_TYPE_LRHEADER 16 #define XLOG_REG_TYPE_LRHEADER 16
#define XLOG_REG_TYPE_UNMOUNT 17 #define XLOG_REG_TYPE_UNMOUNT 17
#define XLOG_REG_TYPE_COMMIT 18 #define XLOG_REG_TYPE_COMMIT 18
#define XLOG_REG_TYPE_TRANSHDR 19 #define XLOG_REG_TYPE_TRANSHDR 19
#define XLOG_REG_TYPE_MAX 19 #define XLOG_REG_TYPE_MAX 19
#define XLOG_VEC_SET_TYPE(vecp, t) ((vecp)->i_type = (t))
typedef struct xfs_log_iovec { typedef struct xfs_log_iovec {
xfs_caddr_t i_addr; /* beginning address of regi on */ void *i_addr; /* beginning address of region */
int i_len; /* length in bytes of region */ int i_len; /* length in bytes of region */
uint i_type; /* type of region */ uint i_type; /* type of region */
} xfs_log_iovec_t; } xfs_log_iovec_t;
typedef void* xfs_log_ticket_t; struct xfs_log_vec {
struct xfs_log_vec *lv_next; /* next lv in build list */
int lv_niovecs; /* number of iovecs in lv */
struct xfs_log_iovec *lv_iovecp; /* iovec array */
struct xfs_log_item *lv_item; /* owner */
char *lv_buf; /* formatted buffer */
int lv_buf_len; /* size of formatted buffer
*/
};
/* /*
* Structure used to pass callback function and the function's argument * Structure used to pass callback function and the function's argument
* to the log manager. * to the log manager.
*/ */
typedef struct xfs_log_callback { typedef struct xfs_log_callback {
struct xfs_log_callback *cb_next; struct xfs_log_callback *cb_next;
void (*cb_func)(void *, int); void (*cb_func)(void *, int);
void *cb_arg; void *cb_arg;
} xfs_log_callback_t; } xfs_log_callback_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
/* Log manager interfaces */ /* Log manager interfaces */
struct xfs_mount; struct xfs_mount;
struct xlog_in_core;
struct xlog_ticket;
struct xfs_log_item;
struct xfs_item_ops;
struct xfs_trans;
void xfs_log_item_init(struct xfs_mount *mp,
struct xfs_log_item *item,
int type,
struct xfs_item_ops *ops);
xfs_lsn_t xfs_log_done(struct xfs_mount *mp, xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
xfs_log_ticket_t ticket, struct xlog_ticket *ticket,
void **iclog, struct xlog_in_core **iclog,
uint flags); uint flags);
int _xfs_log_force(struct xfs_mount *mp, int _xfs_log_force(struct xfs_mount *mp,
xfs_lsn_t lsn,
uint flags, uint flags,
int *log_forced); int *log_forced);
void xfs_log_force(struct xfs_mount *mp, void xfs_log_force(struct xfs_mount *mp,
xfs_lsn_t lsn,
uint flags); uint flags);
int _xfs_log_force_lsn(struct xfs_mount *mp,
xfs_lsn_t lsn,
uint flags,
int *log_forced);
void xfs_log_force_lsn(struct xfs_mount *mp,
xfs_lsn_t lsn,
uint flags);
int xfs_log_mount(struct xfs_mount *mp, int xfs_log_mount(struct xfs_mount *mp,
struct xfs_buftarg *log_target, struct xfs_buftarg *log_target,
xfs_daddr_t start_block, xfs_daddr_t start_block,
int num_bblocks); int num_bblocks);
int xfs_log_mount_finish(struct xfs_mount *mp); int xfs_log_mount_finish(struct xfs_mount *mp);
void xfs_log_move_tail(struct xfs_mount *mp, void xfs_log_move_tail(struct xfs_mount *mp,
xfs_lsn_t tail_lsn); xfs_lsn_t tail_lsn);
int xfs_log_notify(struct xfs_mount *mp, int xfs_log_notify(struct xfs_mount *mp,
void *iclog, struct xlog_in_core *iclog,
xfs_log_callback_t *callback_entry); xfs_log_callback_t *callback_entry);
int xfs_log_release_iclog(struct xfs_mount *mp, int xfs_log_release_iclog(struct xfs_mount *mp,
void *iclog_hndl); struct xlog_in_core *iclog);
int xfs_log_reserve(struct xfs_mount *mp, int xfs_log_reserve(struct xfs_mount *mp,
int length, int length,
int count, int count,
xfs_log_ticket_t *ticket, struct xlog_ticket **ticket,
__uint8_t clientid, __uint8_t clientid,
uint flags, uint flags,
uint t_type); uint t_type);
int xfs_log_write(struct xfs_mount *mp, int xfs_log_write(struct xfs_mount *mp,
xfs_log_iovec_t region[], xfs_log_iovec_t region[],
int nentries, int nentries,
xfs_log_ticket_t ticket, struct xlog_ticket *ticket,
xfs_lsn_t *start_lsn); xfs_lsn_t *start_lsn);
int xfs_log_unmount(struct xfs_mount *mp);
int xfs_log_unmount_write(struct xfs_mount *mp); int xfs_log_unmount_write(struct xfs_mount *mp);
void xfs_log_unmount_dealloc(struct xfs_mount *mp); void xfs_log_unmount(struct xfs_mount *mp);
int xfs_log_force_umount(struct xfs_mount *mp, int logerror); int xfs_log_force_umount(struct xfs_mount *mp, int logerror);
int xfs_log_need_covered(struct xfs_mount *mp); int xfs_log_need_covered(struct xfs_mount *mp);
void xlog_iodone(struct xfs_buf *); void xlog_iodone(struct xfs_buf *);
#endif struct xlog_ticket *xfs_log_ticket_get(struct xlog_ticket *ticket);
void xfs_log_ticket_put(struct xlog_ticket *ticket);
xlog_tid_t xfs_log_get_trans_ident(struct xfs_trans *tp);
extern int xlog_debug; /* set to 1 to enable real log */ int xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp,
struct xfs_log_vec *log_vector,
xfs_lsn_t *commit_lsn, int flags);
bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip);
#endif
#endif /* __XFS_LOG_H__ */ #endif /* __XFS_LOG_H__ */
 End of changes. 22 change blocks. 
27 lines changed or deleted 44 lines changed or added


 xfs_log_priv.h   xfs_log_priv.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_LOG_PRIV_H__ #ifndef __XFS_LOG_PRIV_H__
#define __XFS_LOG_PRIV_H__ #define __XFS_LOG_PRIV_H__
struct xfs_buf; struct xfs_buf;
struct ktrace;
struct log; struct log;
struct xlog_ticket; struct xlog_ticket;
struct xfs_buf_cancel;
struct xfs_mount; struct xfs_mount;
/* /*
* Macros, structures, prototypes for internal log manager use. * Macros, structures, prototypes for internal log manager use.
*/ */
#define XLOG_MIN_ICLOGS 2 #define XLOG_MIN_ICLOGS 2
#define XLOG_MAX_ICLOGS 8 #define XLOG_MAX_ICLOGS 8
#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */ #define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */
#define XLOG_VERSION_1 1 #define XLOG_VERSION_1 1
skipping to change at line 136 skipping to change at line 134
#define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region * / #define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region * /
#define XLOG_END_TRANS 0x10 /* End a continued transaction */ #define XLOG_END_TRANS 0x10 /* End a continued transaction */
#define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */ #define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* Flags to log ticket * Flags to log ticket
*/ */
#define XLOG_TIC_INITED 0x1 /* has been initialized */ #define XLOG_TIC_INITED 0x1 /* has been initialized */
#define XLOG_TIC_PERM_RESERV 0x2 /* permanent reservation */ #define XLOG_TIC_PERM_RESERV 0x2 /* permanent reservation */
#define XLOG_TIC_IN_Q 0x4
#define XLOG_TIC_FLAGS \
{ XLOG_TIC_INITED, "XLOG_TIC_INITED" }, \
{ XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" }
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */ #define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */
/* /*
* Flags for log structure * Flags for log structure
*/ */
#define XLOG_CHKSUM_MISMATCH 0x1 /* used only during recovery */ #define XLOG_CHKSUM_MISMATCH 0x1 /* used only during recovery */
#define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */ #define XLOG_ACTIVE_RECOVERY 0x2 /* in the middle of recovery */
#define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ #define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */
#define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being #define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being
shutdown */ shutdown */
typedef __uint32_t xlog_tid_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
/* /*
* Below are states for covering allocation transactions. * Below are states for covering allocation transactions.
* By covering, we mean changing the h_tail_lsn in the last on-disk * By covering, we mean changing the h_tail_lsn in the last on-disk
* log write such that no allocation transactions will be re-done during * log write such that no allocation transactions will be re-done during
* recovery after a system crash. Recovery starts at the last on-disk * recovery after a system crash. Recovery starts at the last on-disk
* log write. * log write.
* *
* These states are used to insert dummy log entries to cover * These states are used to insert dummy log entries to cover
skipping to change at line 241 skipping to change at line 242
* Reservation region * Reservation region
* As would be stored in xfs_log_iovec but without the i_addr which * As would be stored in xfs_log_iovec but without the i_addr which
* we don't care about. * we don't care about.
*/ */
typedef struct xlog_res { typedef struct xlog_res {
uint r_len; /* region length :4 */ uint r_len; /* region length :4 */
uint r_type; /* region's transaction type :4 */ uint r_type; /* region's transaction type :4 */
} xlog_res_t; } xlog_res_t;
typedef struct xlog_ticket { typedef struct xlog_ticket {
sv_t t_wait; /* ticket wait queue : 2 wait_queue_head_t t_wait; /* ticket wait queue */
0 */ struct list_head t_queue; /* reserve/write queue */
struct xlog_ticket *t_next; /* :4|
8 */
struct xlog_ticket *t_prev; /* :4|
8 */
xlog_tid_t t_tid; /* transaction identifier : 4 */ xlog_tid_t t_tid; /* transaction identifier : 4 */
atomic_t t_ref; /* ticket reference count : 4 */
int t_curr_res; /* current reservation in bytes : 4 */ int t_curr_res; /* current reservation in bytes : 4 */
int t_unit_res; /* unit reservation in bytes : 4 */ int t_unit_res; /* unit reservation in bytes : 4 */
char t_ocnt; /* original count : 1 */ char t_ocnt; /* original count : 1 */
char t_cnt; /* current count : 1 */ char t_cnt; /* current count : 1 */
char t_clientid; /* who does this belong to; : 1 */ char t_clientid; /* who does this belong to; : 1 */
char t_flags; /* properties of reservation : 1 */ char t_flags; /* properties of reservation : 1 */
uint t_trans_type; /* transaction type : 4 */ uint t_trans_type; /* transaction type : 4 */
/* reservation array fields */ /* reservation array fields */
uint t_res_num; /* num in array : 4 */ uint t_res_num; /* num in array : 4 */
skipping to change at line 307 skipping to change at line 308
uuid_t h_fs_uuid; /* uuid of FS : 16 */ uuid_t h_fs_uuid; /* uuid of FS : 16 */
__be32 h_size; /* iclog size : 4 */ __be32 h_size; /* iclog size : 4 */
} xlog_rec_header_t; } xlog_rec_header_t;
typedef struct xlog_rec_ext_header { typedef struct xlog_rec_ext_header {
__be32 xh_cycle; /* write cycle of log : 4 */ __be32 xh_cycle; /* write cycle of log : 4 */
__be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 25 6 */ __be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 25 6 */
} xlog_rec_ext_header_t; } xlog_rec_ext_header_t;
#ifdef __KERNEL__ #ifdef __KERNEL__
/*
* Quite misnamed, because this union lays out the actual on-disk log buffe
r.
*/
typedef union xlog_in_core2 {
xlog_rec_header_t hic_header;
xlog_rec_ext_header_t hic_xheader;
char hic_sector[XLOG_HEADER_SIZE];
} xlog_in_core_2_t;
/* /*
* - A log record header is 512 bytes. There is plenty of room to grow the * - A log record header is 512 bytes. There is plenty of room to grow the
* xlog_rec_header_t into the reserved space. * xlog_rec_header_t into the reserved space.
* - ic_data follows, so a write to disk can start at the beginning of * - ic_data follows, so a write to disk can start at the beginning of
* the iclog. * the iclog.
* - ic_forcewait is used to implement synchronous forcing of the iclog to disk. * - ic_forcewait is used to implement synchronous forcing of the iclog to disk.
* - ic_next is the pointer to the next iclog in the ring. * - ic_next is the pointer to the next iclog in the ring.
* - ic_bp is a pointer to the buffer used to write this incore log to disk . * - ic_bp is a pointer to the buffer used to write this incore log to disk .
* - ic_log is a pointer back to the global log structure. * - ic_log is a pointer back to the global log structure.
* - ic_callback is a linked list of callback function/argument pairs to be * - ic_callback is a linked list of callback function/argument pairs to be
skipping to change at line 336 skipping to change at line 347
* by independent processes: * by independent processes:
* *
* - ic_callback_* * - ic_callback_*
* - ic_refcnt * - ic_refcnt
* - fields protected by the global l_icloglock * - fields protected by the global l_icloglock
* *
* so we need to ensure that these fields are located in separate cacheline s. * so we need to ensure that these fields are located in separate cacheline s.
* We'll put all the read-only and l_icloglock fields in the first cachelin e, * We'll put all the read-only and l_icloglock fields in the first cachelin e,
* and move everything else out to subsequent cachelines. * and move everything else out to subsequent cachelines.
*/ */
typedef struct xlog_iclog_fields { typedef struct xlog_in_core {
sv_t ic_force_wait; wait_queue_head_t ic_force_wait;
sv_t ic_write_wait; wait_queue_head_t ic_write_wait;
struct xlog_in_core *ic_next; struct xlog_in_core *ic_next;
struct xlog_in_core *ic_prev; struct xlog_in_core *ic_prev;
struct xfs_buf *ic_bp; struct xfs_buf *ic_bp;
struct log *ic_log; struct log *ic_log;
int ic_size; int ic_size;
int ic_offset; int ic_offset;
int ic_bwritecnt; int ic_bwritecnt;
ushort_t ic_state; unsigned short ic_state;
char *ic_datap; /* pointer to iclog data */ char *ic_datap; /* pointer to iclog data */
#ifdef XFS_LOG_TRACE
struct ktrace *ic_trace;
#endif
/* Callback structures need their own cacheline */ /* Callback structures need their own cacheline */
spinlock_t ic_callback_lock ____cacheline_aligned_in_sm p; spinlock_t ic_callback_lock ____cacheline_aligned_in_sm p;
xfs_log_callback_t *ic_callback; xfs_log_callback_t *ic_callback;
xfs_log_callback_t **ic_callback_tail; xfs_log_callback_t **ic_callback_tail;
/* reference counts need their own cacheline */ /* reference counts need their own cacheline */
atomic_t ic_refcnt ____cacheline_aligned_in_smp; atomic_t ic_refcnt ____cacheline_aligned_in_smp;
} xlog_iclog_fields_t; xlog_in_core_2_t *ic_data;
#define ic_header ic_data->hic_header
typedef union xlog_in_core2 {
xlog_rec_header_t hic_header;
xlog_rec_ext_header_t hic_xheader;
char hic_sector[XLOG_HEADER_SIZE];
} xlog_in_core_2_t;
typedef struct xlog_in_core {
xlog_iclog_fields_t hic_fields;
xlog_in_core_2_t *hic_data;
} xlog_in_core_t; } xlog_in_core_t;
/* /*
* Defines to save our code from this glop. * The CIL context is used to aggregate per-transaction details as well be
* passed to the iclog for checkpoint post-commit processing. After being
* passed to the iclog, another context needs to be allocated for tracking
the
* next set of transactions to be aggregated into a checkpoint.
*/
struct xfs_cil;
struct xfs_cil_ctx {
struct xfs_cil *cil;
xfs_lsn_t sequence; /* chkpt sequence # */
xfs_lsn_t start_lsn; /* first LSN of chkpt commit
*/
xfs_lsn_t commit_lsn; /* chkpt commit record lsn *
/
struct xlog_ticket *ticket; /* chkpt ticket */
int nvecs; /* number of regions */
int space_used; /* aggregate size of regions
*/
struct list_head busy_extents; /* busy extents in chkpt */
struct xfs_log_vec *lv_chain; /* logvecs being pushed */
xfs_log_callback_t log_cb; /* completion callback hook.
*/
struct list_head committing; /* ctx committing list */
};
/*
* Committed Item List structure
*
* This structure is used to track log items that have been committed but n
ot
* yet written into the log. It is used only when the delayed logging mount
* option is enabled.
*
* This structure tracks the list of committing checkpoint contexts so
* we can avoid the problem of having to hold out new transactions during a
* flush until we have a the commit record LSN of the checkpoint. We can
* traverse the list of committing contexts in xlog_cil_push_lsn() to find
a
* sequence match and extract the commit LSN directly from there. If the
* checkpoint is still in the process of committing, we can block waiting f
or
* the commit LSN to be determined as well. This should make synchronous
* operations almost as efficient as the old logging methods.
*/
struct xfs_cil {
struct log *xc_log;
struct list_head xc_cil;
spinlock_t xc_cil_lock;
struct xfs_cil_ctx *xc_ctx;
struct rw_semaphore xc_ctx_lock;
struct list_head xc_committing;
wait_queue_head_t xc_commit_wait;
xfs_lsn_t xc_current_sequence;
};
/*
* The amount of log space we allow the CIL to aggregate is difficult to si
ze.
* Whatever we choose, we have to make sure we can get a reservation for th
e
* log space effectively, that it is large enough to capture sufficient
* relogging to reduce log buffer IO significantly, but it is not too large
for
* the log or induces too much latency when writing out through the iclogs.
We
* track both space consumed and the number of vectors in the checkpoint
* context, so we need to decide which to use for limiting.
*
* Every log buffer we write out during a push needs a header reserved, whi
ch
* is at least one sector and more for v2 logs. Hence we need a reservation
of
* at least 512 bytes per 32k of log space just for the LR headers. That me
ans
* 16KB of reservation per megabyte of delayed logging space we will consum
e,
* plus various headers. The number of headers will vary based on the num
of
* io vectors, so limiting on a specific number of vectors is going to resu
lt
* in transactions of varying size. IOWs, it is more consistent to track an
d
* limit space consumed in the log rather than by the number of objects bei
ng
* logged in order to prevent checkpoint ticket overruns.
*
* Further, use of static reservations through the log grant mechanism is
* problematic. It introduces a lot of complexity (e.g. reserve grant vs wr
ite
* grant) and a significant deadlock potential because regranting write spa
ce
* can block on log pushes. Hence if we have to regrant log space during a
log
* push, we can deadlock.
*
* However, we can avoid this by use of a dynamic "reservation stealing"
* technique during transaction commit whereby unused reservation space in
the
* transaction ticket is transferred to the CIL ctx commit ticket to cover
the
* space needed by the checkpoint transaction. This means that we never nee
d to
* specifically reserve space for the CIL checkpoint transaction, nor do we
* need to regrant space once the checkpoint completes. This also means the
* checkpoint transaction ticket is specific to the checkpoint context, rat
her
* than the CIL itself.
*
* With dynamic reservations, we can effectively make up arbitrary limits f
or
* the checkpoint size so long as they don't violate any other size rules.
* Recovery imposes a rule that no transaction exceed half the log, so we a
re
* limited by that. Furthermore, the log transaction reservation subsystem
* tries to keep 25% of the log free, so we need to keep below that limit o
r we
* risk running out of free log space to start any new transactions.
*
* In order to keep background CIL push efficient, we will set a lower
* threshold at which background pushing is attempted without blocking curr
ent
* transaction commits. A separate, higher bound defines when CIL pushes a
re
* enforced to ensure we stay within our maximum checkpoint size bounds.
* threshold, yet give us plenty of space for aggregation on large logs.
*/ */
#define ic_force_wait hic_fields.ic_force_wait #define XLOG_CIL_SPACE_LIMIT(log) (log->l_logsize >> 3)
#define ic_write_wait hic_fields.ic_write_wait #define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4))
#define ic_next hic_fields.ic_next
#define ic_prev hic_fields.ic_prev
#define ic_bp hic_fields.ic_bp
#define ic_log hic_fields.ic_log
#define ic_callback hic_fields.ic_callback
#define ic_callback_lock hic_fields.ic_callback_lock
#define ic_callback_tail hic_fields.ic_callback_tail
#define ic_trace hic_fields.ic_trace
#define ic_size hic_fields.ic_size
#define ic_offset hic_fields.ic_offset
#define ic_refcnt hic_fields.ic_refcnt
#define ic_bwritecnt hic_fields.ic_bwritecnt
#define ic_state hic_fields.ic_state
#define ic_datap hic_fields.ic_datap
#define ic_header hic_data->hic_header
/* /*
* The reservation head lsn is not made up of a cycle number and block numb er. * The reservation head lsn is not made up of a cycle number and block numb er.
* Instead, it uses a cycle number and byte number. Logs don't expect to * Instead, it uses a cycle number and byte number. Logs don't expect to
* overflow 31 bits worth of byte offset, so using a byte number will mean * overflow 31 bits worth of byte offset, so using a byte number will mean
* that round off problems won't occur when releasing partial reservations. * that round off problems won't occur when releasing partial reservations.
*/ */
typedef struct log { typedef struct log {
/* The following fields don't need locking */ /* The following fields don't need locking */
struct xfs_mount *l_mp; /* mount point */ struct xfs_mount *l_mp; /* mount point */
struct xfs_ail *l_ailp; /* AIL log is working with *
/
struct xfs_cil *l_cilp; /* CIL log is working with *
/
struct xfs_buf *l_xbuf; /* extra buffer for log struct xfs_buf *l_xbuf; /* extra buffer for log
* wrapping */ * wrapping */
struct xfs_buftarg *l_targ; /* buftarg of log */ struct xfs_buftarg *l_targ; /* buftarg of log */
uint l_flags; uint l_flags;
uint l_quotaoffs_flag; /* XFS_DQ_*, for QUOTAOFFs */ uint l_quotaoffs_flag; /* XFS_DQ_*, for QUOTAOFFs */
struct xfs_buf_cancel **l_buf_cancel_table; struct list_head *l_buf_cancel_table;
int l_iclog_hsize; /* size of iclog header */ int l_iclog_hsize; /* size of iclog header */
int l_iclog_heads; /* # of iclog header sectors */ int l_iclog_heads; /* # of iclog header sectors */
uint l_sectbb_log; /* log2 of sector size in BB uint l_sectBBsize; /* sector size in BBs (2^n)
s */ */
uint l_sectbb_mask; /* sector size (in BBs)
* alignment mask */
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 * /
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 BB chunks */ int l_logBBsize; /* size of log in BB chunks */
/* The following block of fields are changed while holding icloglock */ /* The following block of fields are changed while holding icloglock */
sv_t l_flush_wait ____cacheline_aligned_in_smp; wait_queue_head_t l_flush_wait ____cacheline_aligned_in_smp;
/* waiting for iclog flush * / /* waiting for iclog flush * /
int l_covered_state;/* state of "covering disk int l_covered_state;/* state of "covering disk
* log entries" */ * log entries" */
xlog_in_core_t *l_iclog; /* head log queue */ xlog_in_core_t *l_iclog; /* head log queue */
spinlock_t l_icloglock; /* grab to change iclog stat e */ spinlock_t l_icloglock; /* grab to change iclog stat e */
xfs_lsn_t l_tail_lsn; /* lsn of 1st LR with unflus
hed
* buffers */
xfs_lsn_t l_last_sync_lsn;/* lsn of last LR on disk */
int l_curr_cycle; /* Cycle number of log write s */ int l_curr_cycle; /* Cycle number of log write s */
int l_prev_cycle; /* Cycle number before last int l_prev_cycle; /* Cycle number before last
* block increment */ * block increment */
int l_curr_block; /* current logical log block */ int l_curr_block; /* current logical log block */
int l_prev_block; /* previous logical log bloc k */ int l_prev_block; /* previous logical log bloc k */
/* The following block of fields are changed while holding grant_loc /*
k */ * l_last_sync_lsn and l_tail_lsn are atomics so they can be set and
spinlock_t l_grant_lock ____cacheline_aligned_in_smp; * read without needing to hold specific locks. To avoid operations
xlog_ticket_t *l_reserve_headq; * contending with other hot objects, place each of them on a separa
xlog_ticket_t *l_write_headq; te
int l_grant_reserve_cycle; * cacheline.
int l_grant_reserve_bytes; */
int l_grant_write_cycle; /* lsn of last LR on disk */
int l_grant_write_bytes; atomic64_t l_last_sync_lsn ____cacheline_aligned_in_smp
;
#ifdef XFS_LOG_TRACE /* lsn of 1st LR with unflushed * buffers */
struct ktrace *l_grant_trace; atomic64_t l_tail_lsn ____cacheline_aligned_in_smp;
#endif
/*
* ticket grant locks, queues and accounting have their own cachline
s
* as these are quite hot and can be operated on concurrently.
*/
spinlock_t l_grant_reserve_lock ____cacheline_aligned_i
n_smp;
struct list_head l_reserveq;
atomic64_t l_grant_reserve_head;
spinlock_t l_grant_write_lock ____cacheline_aligned_in_
smp;
struct list_head l_writeq;
atomic64_t l_grant_write_head;
/* The following field are used for debugging; need to hold iclogloc k */ /* The following field are used for debugging; need to hold iclogloc k */
#ifdef DEBUG #ifdef DEBUG
char *l_iclog_bak[XLOG_MAX_ICLOGS]; char *l_iclog_bak[XLOG_MAX_ICLOGS];
#endif #endif
} xlog_t; } xlog_t;
#define XLOG_BUF_CANCEL_BUCKET(log, blkno) \
((log)->l_buf_cancel_table + ((__uint64_t)blkno % XLOG_BC_TABLE_SIZE
))
#define XLOG_FORCED_SHUTDOWN(log) ((log)->l_flags & XLOG_IO_ERROR) #define XLOG_FORCED_SHUTDOWN(log) ((log)->l_flags & XLOG_IO_ERROR)
/* common routines */ /* common routines */
extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp);
extern int xlog_find_tail(xlog_t *log,
xfs_daddr_t *head_blk,
xfs_daddr_t *tail_blk);
extern int xlog_recover(xlog_t *log); extern int xlog_recover(xlog_t *log);
extern int xlog_recover_finish(xlog_t *log); extern int xlog_recover_finish(xlog_t *log);
extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int); extern void xlog_pack_data(xlog_t *log, xlog_in_core_t *iclog, int);
extern void xlog_recover_process_iunlinks(xlog_t *log);
extern struct xfs_buf *xlog_get_bp(xlog_t *, int); extern kmem_zone_t *xfs_log_ticket_zone;
extern void xlog_put_bp(struct xfs_buf *); struct xlog_ticket *xlog_ticket_alloc(struct log *log, int unit_bytes,
extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); int count, char client, uint xflags,
int alloc_flags);
extern kmem_zone_t *xfs_log_ticket_zone;
static inline void
/* iclog tracing */ xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
#define XLOG_TRACE_GRAB_FLUSH 1 {
#define XLOG_TRACE_REL_FLUSH 2 *ptr += bytes;
#define XLOG_TRACE_SLEEP_FLUSH 3 *len -= bytes;
#define XLOG_TRACE_WAKE_FLUSH 4 *off += bytes;
}
void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket)
;
int xlog_write(struct log *log, struct xfs_log_vec *log_vector,
struct xlog_ticket *tic, xfs_lsn_t *start_ls
n,
xlog_in_core_t **commit_iclog, uint flags);
/*
* When we crack an atomic LSN, we sample it first so that the value will n
ot
* change while we are cracking it into the component values. This means we
* will always get consistent component values to work from. This should al
ways
* be used to smaple and crack LSNs taht are stored and updated in atomic
* variables.
*/
static inline void
xlog_crack_atomic_lsn(atomic64_t *lsn, uint *cycle, uint *block)
{
xfs_lsn_t val = atomic64_read(lsn);
*cycle = CYCLE_LSN(val);
*block = BLOCK_LSN(val);
}
/*
* Calculate and assign a value to an atomic LSN variable from component pi
eces.
*/
static inline void
xlog_assign_atomic_lsn(atomic64_t *lsn, uint cycle, uint block)
{
atomic64_set(lsn, xlog_assign_lsn(cycle, block));
}
/*
* When we crack the grant head, we sample it first so that the value will
not
* change while we are cracking it into the component values. This means we
* will always get consistent component values to work from.
*/
static inline void
xlog_crack_grant_head_val(int64_t val, int *cycle, int *space)
{
*cycle = val >> 32;
*space = val & 0xffffffff;
}
static inline void
xlog_crack_grant_head(atomic64_t *head, int *cycle, int *space)
{
xlog_crack_grant_head_val(atomic64_read(head), cycle, space);
}
static inline int64_t
xlog_assign_grant_head_val(int cycle, int space)
{
return ((int64_t)cycle << 32) | space;
}
static inline void
xlog_assign_grant_head(atomic64_t *head, int cycle, int space)
{
atomic64_set(head, xlog_assign_grant_head_val(cycle, space));
}
/*
* Committed Item List interfaces
*/
int xlog_cil_init(struct log *log);
void xlog_cil_init_post_recovery(struct log *log);
void xlog_cil_destroy(struct log *log);
/*
* CIL force routines
*/
xfs_lsn_t xlog_cil_force_lsn(struct log *log, xfs_lsn_t sequence);
static inline void
xlog_cil_force(struct log *log)
{
xlog_cil_force_lsn(log, log->l_cilp->xc_current_sequence);
}
/* /*
* Unmount record type is used as a pseudo transaction type for the ticket. * Unmount record type is used as a pseudo transaction type for the ticket.
* It's value must be outside the range of XFS_TRANS_* values. * It's value must be outside the range of XFS_TRANS_* values.
*/ */
#define XLOG_UNMOUNT_REC_TYPE (-1U) #define XLOG_UNMOUNT_REC_TYPE (-1U)
/*
* Wrapper function for waiting on a wait queue serialised against wakeups
* by a spinlock. This matches the semantics of all the wait queues used in
the
* log code.
*/
static inline void xlog_wait(wait_queue_head_t *wq, spinlock_t *lock)
{
DECLARE_WAITQUEUE(wait, current);
add_wait_queue_exclusive(wq, &wait);
__set_current_state(TASK_UNINTERRUPTIBLE);
spin_unlock(lock);
schedule();
remove_wait_queue(wq, &wait);
}
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_LOG_PRIV_H__ */ #endif /* __XFS_LOG_PRIV_H__ */
 End of changes. 24 change blocks. 
84 lines changed or deleted 304 lines changed or added


 xfs_log_recover.h   xfs_log_recover.h 
skipping to change at line 31 skipping to change at line 31
/* /*
* Macros, structures, prototypes for internal log manager use. * Macros, structures, prototypes for internal log manager use.
*/ */
#define XLOG_RHASH_BITS 4 #define XLOG_RHASH_BITS 4
#define XLOG_RHASH_SIZE 16 #define XLOG_RHASH_SIZE 16
#define XLOG_RHASH_SHIFT 2 #define XLOG_RHASH_SHIFT 2
#define XLOG_RHASH(tid) \ #define XLOG_RHASH(tid) \
((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1)) ((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1))
#define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK / 2 + 1) #define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK / 2 + 1)
/* /*
* item headers are in ri_buf[0]. Additional buffers follow. * item headers are in ri_buf[0]. Additional buffers follow.
*/ */
typedef struct xlog_recover_item { typedef struct xlog_recover_item {
struct xlog_recover_item *ri_next; struct list_head ri_list;
struct xlog_recover_item *ri_prev; int ri_type;
int ri_type; int ri_cnt; /* count of regions found */
int ri_cnt; /* count of regions found */ int ri_total; /* total regions */
int ri_total; /* total regions */ xfs_log_iovec_t *ri_buf; /* ptr to regions buffer */
xfs_log_iovec_t *ri_buf; /* ptr to regions buffer */
} xlog_recover_item_t; } xlog_recover_item_t;
struct xlog_tid; struct xlog_tid;
typedef struct xlog_recover { typedef struct xlog_recover {
struct xlog_recover *r_next; struct hlist_node r_list;
xlog_tid_t r_log_tid; /* log's transaction id */ xlog_tid_t r_log_tid; /* log's transaction id */
xfs_trans_header_t r_theader; /* trans header for partial xfs_trans_header_t r_theader; /* trans header for partial
*/ */
int r_state; /* not needed */ int r_state; /* not needed */
xfs_lsn_t r_lsn; /* xact lsn */ xfs_lsn_t r_lsn; /* xact lsn */
xlog_recover_item_t *r_itemq; /* q for items */ struct list_head r_itemq; /* q for items */
} xlog_recover_t; } xlog_recover_t;
#define ITEM_TYPE(i) (*(ushort *)(i)->ri_buf[0].i_addr) #define ITEM_TYPE(i) (*(ushort *)(i)->ri_buf[0].i_addr)
/* /*
* This is the number of entries in the l_buf_cancel_table used during * This is the number of entries in the l_buf_cancel_table used during
* recovery. * recovery.
*/ */
#define XLOG_BC_TABLE_SIZE 64 #define XLOG_BC_TABLE_SIZE 64
 End of changes. 3 change blocks. 
14 lines changed or deleted 13 lines changed or added


 xfs_mount.h   xfs_mount.h 
skipping to change at line 47 skipping to change at line 47
uint tr_attrset; /* set/create an attribute */ uint tr_attrset; /* set/create an attribute */
uint tr_attrrm; /* remove an attribute */ uint tr_attrrm; /* remove an attribute */
uint tr_clearagi; /* clear bad agi unlinked ino bucket */ uint tr_clearagi; /* clear bad agi unlinked ino bucket */
uint tr_growrtalloc; /* grow realtime allocations */ uint tr_growrtalloc; /* grow realtime allocations */
uint tr_growrtzero; /* grow realtime zeroing */ uint tr_growrtzero; /* grow realtime zeroing */
uint tr_growrtfree; /* grow realtime freeing */ uint tr_growrtfree; /* grow realtime freeing */
} xfs_trans_reservations_t; } xfs_trans_reservations_t;
#ifndef __KERNEL__ #ifndef __KERNEL__
#define XFS_DADDR_TO_AGNO(mp,d) \ #define xfs_daddr_to_agno(mp,d) \
((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
#define XFS_DADDR_TO_AGBNO(mp,d) \ #define xfs_daddr_to_agbno(mp,d) \
((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
#else /* __KERNEL__ */ #else /* __KERNEL__ */
struct cred; #include "xfs_sync.h"
struct log; struct log;
struct xfs_mount_args; struct xfs_mount_args;
struct xfs_inode; struct xfs_inode;
struct xfs_bmbt_irec; struct xfs_bmbt_irec;
struct xfs_bmap_free; struct xfs_bmap_free;
struct xfs_extdelta; struct xfs_extdelta;
struct xfs_swapext; struct xfs_swapext;
struct xfs_mru_cache; struct xfs_mru_cache;
struct xfs_nameops; struct xfs_nameops;
struct xfs_ail;
/*
* Prototypes and functions for the Data Migration subsystem.
*/
typedef int (*xfs_send_data_t)(int, struct xfs_inode *,
xfs_off_t, size_t, int, int *);
typedef int (*xfs_send_mmap_t)(struct vm_area_struct *, uint);
typedef int (*xfs_send_destroy_t)(struct xfs_inode *, dm_right_t);
typedef int (*xfs_send_namesp_t)(dm_eventtype_t, struct xfs_mount *,
struct xfs_inode *, dm_right_t,
struct xfs_inode *, dm_right_t,
const char *, const char *, mode_t, int, int);
typedef int (*xfs_send_mount_t)(struct xfs_mount *, dm_right_t,
char *, char *);
typedef void (*xfs_send_unmount_t)(struct xfs_mount *, struct xfs_inode *
,
dm_right_t, mode_t, int, int);
typedef struct xfs_dmops {
xfs_send_data_t xfs_send_data;
xfs_send_mmap_t xfs_send_mmap;
xfs_send_destroy_t xfs_send_destroy;
xfs_send_namesp_t xfs_send_namesp;
xfs_send_mount_t xfs_send_mount;
xfs_send_unmount_t xfs_send_unmount;
} xfs_dmops_t;
#define XFS_SEND_DATA(mp, ev,ip,off,len,fl,lock) \
(*(mp)->m_dm_ops->xfs_send_data)(ev,ip,off,len,fl,lock)
#define XFS_SEND_MMAP(mp, vma,fl) \
(*(mp)->m_dm_ops->xfs_send_mmap)(vma,fl)
#define XFS_SEND_DESTROY(mp, ip,right) \
(*(mp)->m_dm_ops->xfs_send_destroy)(ip,right)
#define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_namesp)(ev,NULL,b1,r1,b2,r2,n1,n2,mode,rv
al,fl)
#define XFS_SEND_PREUNMOUNT(mp,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_namesp)(DM_EVENT_PREUNMOUNT,mp,b1,r1,b2,r
2,n1,n2,mode,rval,fl)
#define XFS_SEND_MOUNT(mp,right,path,name) \
(*(mp)->m_dm_ops->xfs_send_mount)(mp,right,path,name)
#define XFS_SEND_UNMOUNT(mp, ip,right,mode,rval,fl) \
(*(mp)->m_dm_ops->xfs_send_unmount)(mp,ip,right,mode,rval,fl)
/*
* Prototypes and functions for the Quota Management subsystem.
*/
struct xfs_dquot;
struct xfs_dqtrxops;
struct xfs_quotainfo; struct xfs_quotainfo;
typedef int (*xfs_qminit_t)(struct xfs_mount *, uint *, uint *);
typedef int (*xfs_qmmount_t)(struct xfs_mount *, uint, uint);
typedef int (*xfs_qmunmount_t)(struct xfs_mount *);
typedef void (*xfs_qmdone_t)(struct xfs_mount *);
typedef void (*xfs_dqrele_t)(struct xfs_dquot *);
typedef int (*xfs_dqattach_t)(struct xfs_inode *, uint);
typedef void (*xfs_dqdetach_t)(struct xfs_inode *);
typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint);
typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *,
struct xfs_inode *, uid_t, gid_t, prid_t, uint,
struct xfs_dquot **, struct xfs_dquot **);
typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *,
struct xfs_dquot *, struct xfs_dquot *);
typedef int (*xfs_dqvoprename_t)(struct xfs_inode **);
typedef struct xfs_dquot * (*xfs_dqvopchown_t)(
struct xfs_trans *, struct xfs_inode *,
struct xfs_dquot **, struct xfs_dquot *);
typedef int (*xfs_dqvopchownresv_t)(struct xfs_trans *, struct xfs_inode
*,
struct xfs_dquot *, struct xfs_dquot *, uint);
typedef void (*xfs_dqstatvfs_t)(struct xfs_inode *, bhv_statvfs_t *);
typedef int (*xfs_dqsync_t)(struct xfs_mount *, int flags);
typedef int (*xfs_quotactl_t)(struct xfs_mount *, int, int, xfs_caddr_t)
;
typedef struct xfs_qmops {
xfs_qminit_t xfs_qminit;
xfs_qmdone_t xfs_qmdone;
xfs_qmmount_t xfs_qmmount;
xfs_qmunmount_t xfs_qmunmount;
xfs_dqrele_t xfs_dqrele;
xfs_dqattach_t xfs_dqattach;
xfs_dqdetach_t xfs_dqdetach;
xfs_dqpurgeall_t xfs_dqpurgeall;
xfs_dqvopalloc_t xfs_dqvopalloc;
xfs_dqvopcreate_t xfs_dqvopcreate;
xfs_dqvoprename_t xfs_dqvoprename;
xfs_dqvopchown_t xfs_dqvopchown;
xfs_dqvopchownresv_t xfs_dqvopchownresv;
xfs_dqstatvfs_t xfs_dqstatvfs;
xfs_dqsync_t xfs_dqsync;
xfs_quotactl_t xfs_quotactl;
struct xfs_dqtrxops *xfs_dqtrxops;
} xfs_qmops_t;
#define XFS_QM_INIT(mp, mnt, fl) \
(*(mp)->m_qm_ops->xfs_qminit)(mp, mnt, fl)
#define XFS_QM_MOUNT(mp, mnt, fl) \
(*(mp)->m_qm_ops->xfs_qmmount)(mp, mnt, fl)
#define XFS_QM_UNMOUNT(mp) \
(*(mp)->m_qm_ops->xfs_qmunmount)(mp)
#define XFS_QM_DONE(mp) \
(*(mp)->m_qm_ops->xfs_qmdone)(mp)
#define XFS_QM_DQRELE(mp, dq) \
(*(mp)->m_qm_ops->xfs_dqrele)(dq)
#define XFS_QM_DQATTACH(mp, ip, fl) \
(*(mp)->m_qm_ops->xfs_dqattach)(ip, fl)
#define XFS_QM_DQDETACH(mp, ip) \
(*(mp)->m_qm_ops->xfs_dqdetach)(ip)
#define XFS_QM_DQPURGEALL(mp, fl) \
(*(mp)->m_qm_ops->xfs_dqpurgeall)(mp, fl)
#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \
(*(mp)->m_qm_ops->xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, d
q2)
#define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \
(*(mp)->m_qm_ops->xfs_dqvopcreate)(tp, ip, dq1, dq2)
#define XFS_QM_DQVOPRENAME(mp, ip) \
(*(mp)->m_qm_ops->xfs_dqvoprename)(ip)
#define XFS_QM_DQVOPCHOWN(mp, tp, ip, dqp, dq) \
(*(mp)->m_qm_ops->xfs_dqvopchown)(tp, ip, dqp, dq)
#define XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, dq1, dq2, fl) \
(*(mp)->m_qm_ops->xfs_dqvopchownresv)(tp, ip, dq1, dq2, fl)
#define XFS_QM_DQSTATVFS(ip, statp) \
(*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp)
#define XFS_QM_DQSYNC(mp, flags) \
(*(mp)->m_qm_ops->xfs_dqsync)(mp, flags)
#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \
(*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr)
#ifdef HAVE_PERCPU_SB #ifdef HAVE_PERCPU_SB
/* /*
* Valid per-cpu incore superblock counters. Note that if you add new count ers, * Valid per-cpu incore superblock counters. Note that if you add new count ers,
* you may need to define new counter disabled bit field descriptors as the re * you may need to define new counter disabled bit field descriptors as the re
* are more possible fields in the superblock that can fit in a bitfield on a * are more possible fields in the superblock that can fit in a bitfield on a
* 32 bit platform. The XFS_SBS_* values for the current current counters j ust * 32 bit platform. The XFS_SBS_* values for the current current counters j ust
* fit. * fit.
*/ */
typedef struct xfs_icsb_cnts { typedef struct xfs_icsb_cnts {
skipping to change at line 215 skipping to change at line 93
#define XFS_ICSB_FLAG_LOCK (1 << 0) /* counter lock bit */ #define XFS_ICSB_FLAG_LOCK (1 << 0) /* counter lock bit */
#define XFS_ICSB_LAZY_COUNT (1 << 1) /* accuracy not needed */ #define XFS_ICSB_LAZY_COUNT (1 << 1) /* accuracy not needed */
extern int xfs_icsb_init_counters(struct xfs_mount *); extern int xfs_icsb_init_counters(struct xfs_mount *);
extern void xfs_icsb_reinit_counters(struct xfs_mount *); extern void xfs_icsb_reinit_counters(struct xfs_mount *);
extern void xfs_icsb_destroy_counters(struct xfs_mount *); extern void xfs_icsb_destroy_counters(struct xfs_mount *);
extern void xfs_icsb_sync_counters(struct xfs_mount *, int); extern void xfs_icsb_sync_counters(struct xfs_mount *, int);
extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int); extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
extern int xfs_icsb_modify_counters(struct xfs_mount *, xfs_sb_field_t,
int64_t, int);
#else #else
#define xfs_icsb_init_counters(mp) (0) #define xfs_icsb_init_counters(mp) (0)
#define xfs_icsb_destroy_counters(mp) do { } while (0) #define xfs_icsb_destroy_counters(mp) do { } while (0)
#define xfs_icsb_reinit_counters(mp) do { } while (0) #define xfs_icsb_reinit_counters(mp) do { } while (0)
#define xfs_icsb_sync_counters(mp, flags) do { } while (0) #define xfs_icsb_sync_counters(mp, flags) do { } while (0)
#define xfs_icsb_sync_counters_locked(mp, flags) do { } while (0) #define xfs_icsb_sync_counters_locked(mp, flags) do { } while (0)
#define xfs_icsb_modify_counters(mp, field, delta, rsvd) \
xfs_mod_incore_sb(mp, field, delta, rsvd)
#endif #endif
typedef struct xfs_ail { /* dynamic preallocation free space thresholds, 5% down to 1% */
struct list_head xa_ail; enum {
uint xa_gen; XFS_LOWSP_1_PCNT = 0,
struct task_struct *xa_task; XFS_LOWSP_2_PCNT,
xfs_lsn_t xa_target; XFS_LOWSP_3_PCNT,
} xfs_ail_t; XFS_LOWSP_4_PCNT,
XFS_LOWSP_5_PCNT,
XFS_LOWSP_MAX,
};
typedef struct xfs_mount { typedef struct xfs_mount {
struct super_block *m_super; struct super_block *m_super;
xfs_tid_t m_tid; /* next unused tid for fs */ xfs_tid_t m_tid; /* next unused tid for fs */
spinlock_t m_ail_lock; /* fs AIL mutex */ struct xfs_ail *m_ail; /* fs active log item list *
xfs_ail_t m_ail; /* fs active log item list * /
/
xfs_sb_t m_sb; /* copy of fs superblock */ xfs_sb_t m_sb; /* copy of fs superblock */
spinlock_t m_sb_lock; /* sb counter lock */ spinlock_t m_sb_lock; /* sb counter lock */
struct xfs_buf *m_sb_bp; /* buffer for superblock */ struct xfs_buf *m_sb_bp; /* buffer for superblock */
char *m_fsname; /* filesystem name */ char *m_fsname; /* filesystem name */
int m_fsname_len; /* strlen of fs name */ int m_fsname_len; /* strlen of fs name */
char *m_rtname; /* realtime device name */ char *m_rtname; /* realtime device name */
char *m_logname; /* external log device name */ char *m_logname; /* external log device 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 */
spinlock_t m_agirotor_lock;/* .. and lock protecting it */ spinlock_t m_agirotor_lock;/* .. and lock protecting it */
xfs_agnumber_t m_maxagi; /* highest inode alloc group */ xfs_agnumber_t m_maxagi; /* highest inode alloc group */
struct xfs_inode *m_inodes; /* active inode list */
struct list_head m_del_inodes; /* inodes to reclaim */
mutex_t m_ilock; /* inode list mutex */
uint m_ireclaims; /* count of calls to reclaim
*/
uint m_readio_log; /* min read size log bytes * / uint m_readio_log; /* min read size log bytes * /
uint m_readio_blocks; /* min read size blocks */ uint m_readio_blocks; /* min read size blocks */
uint m_writeio_log; /* min write size log bytes */ uint m_writeio_log; /* min write size log bytes */
uint m_writeio_blocks; /* min write size blocks * / uint m_writeio_blocks; /* min write size blocks * /
struct log *m_log; /* log specific stuff */ struct log *m_log; /* log specific stuff */
int m_logbufs; /* number of log buffers */ int m_logbufs; /* number of log buffers */
int m_logbsize; /* size of each log buffer * / int m_logbsize; /* size of each log buffer * /
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 * /
skipping to change at line 284 skipping to change at line 164
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]; /* max alloc btree records * / uint m_alloc_mxr[2]; /* max alloc btree records * /
uint m_alloc_mnr[2]; /* min alloc btree records * / uint m_alloc_mnr[2]; /* min alloc btree records * /
uint m_bmap_dmxr[2]; /* max bmap btree records */ uint m_bmap_dmxr[2]; /* max bmap btree records */
uint m_bmap_dmnr[2]; /* min bmap btree records */ uint m_bmap_dmnr[2]; /* min bmap btree records */
uint m_inobt_mxr[2]; /* max inobt btree records * / uint m_inobt_mxr[2]; /* max inobt btree records * /
uint m_inobt_mnr[2]; /* min inobt btree records * / uint m_inobt_mnr[2]; /* min inobt btree records * /
uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ uint m_in_maxlevels; /* max inobt btree levels. *
struct xfs_perag *m_perag; /* per-ag accounting info */ /
struct rw_semaphore m_peraglock; /* lock for m_perag (pointer struct radix_tree_root m_perag_tree; /* per-ag accounting info */
) */ spinlock_t m_perag_lock; /* lock for m_perag_tree */
struct mutex m_growlock; /* growfs mutex */ struct mutex m_growlock; /* growfs mutex */
int m_fixedfsid[2]; /* unchanged for life of FS */ int m_fixedfsid[2]; /* unchanged for life of FS */
uint m_dmevmask; /* DMI events for this FS */ uint m_dmevmask; /* DMI events for this FS */
__uint64_t m_flags; /* global mount flags */ __uint64_t m_flags; /* global mount flags */
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_inoalign_mask;/* mask sb_inoalignmt if use d */ int m_inoalign_mask;/* mask sb_inoalignmt if use d */
uint m_qflags; /* quota status flags */ uint m_qflags; /* quota status flags */
xfs_trans_reservations_t m_reservations;/* precomputed res values */ xfs_trans_reservations_t m_reservations;/* precomputed res values */
__uint64_t m_maxicount; /* maximum inode count */ __uint64_t m_maxicount; /* maximum inode count */
__uint64_t m_maxioffset; /* maximum inode offset */ __uint64_t m_maxioffset; /* maximum inode offset */
__uint64_t m_resblks; /* total reserved blocks */ __uint64_t m_resblks; /* total reserved blocks */
__uint64_t m_resblks_avail;/* available reserved blocks */ __uint64_t m_resblks_avail;/* available reserved blocks */
#if XFS_BIG_INUMS __uint64_t m_resblks_save; /* reserved blks @ remount,r
xfs_ino_t m_inoadd; /* add value for ino64_offse o */
t */
#endif
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 alignme nt */ int m_sinoalign; /* stripe unit inode alignme nt */
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 */
__uint8_t m_mk_sharedro; /* mark shared ro on unmount
*/
__uint8_t m_inode_quiesce;/* call quiesce on new inode
s.
field governed by m_ilock
*/
__uint8_t m_sectbb_log; /* sectlog - BBSHIFT */ __uint8_t m_sectbb_log; /* sectlog - BBSHIFT */
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 */
uint m_chsize; /* size of next field */ uint m_chsize; /* size of next field */
struct xfs_chash *m_chash; /* fs private inode per-clus ter struct xfs_chash *m_chash; /* fs private inode per-clus ter
* hash table */ * hash table */
struct xfs_dmops *m_dm_ops; /* vector of DMI ops */
struct xfs_qmops *m_qm_ops; /* vector of XQM ops */
atomic_t m_active_trans; /* number trans frozen */ atomic_t m_active_trans; /* number trans frozen */
#ifdef HAVE_PERCPU_SB #ifdef HAVE_PERCPU_SB
xfs_icsb_cnts_t *m_sb_cnts; /* per-cpu superblock counte rs */ xfs_icsb_cnts_t __percpu *m_sb_cnts; /* per-cpu superblock counte rs */
unsigned long m_icsb_counters; /* disabled per-cpu counter s */ unsigned long m_icsb_counters; /* disabled per-cpu counter s */
struct notifier_block m_icsb_notifier; /* hotplug cpu notifier */ struct notifier_block m_icsb_notifier; /* hotplug cpu notifier */
struct mutex m_icsb_mutex; /* balancer sync lock */ struct mutex m_icsb_mutex; /* balancer sync lock */
#endif #endif
struct xfs_mru_cache *m_filestream; /* per-mount filestream data */ struct xfs_mru_cache *m_filestream; /* per-mount filestream data */
struct task_struct *m_sync_task; /* generalised sync thread * / struct task_struct *m_sync_task; /* generalised sync thread * /
bhv_vfs_sync_work_t m_sync_work; /* work item for VFS_SYNC */ xfs_sync_work_t m_sync_work; /* work item for VFS_SYNC */
struct list_head m_sync_list; /* sync thread work item lis t */ struct list_head m_sync_list; /* sync thread work item lis t */
spinlock_t m_sync_lock; /* work item list lock */ spinlock_t m_sync_lock; /* work item list lock */
int m_sync_seq; /* sync thread generation no . */ int m_sync_seq; /* sync thread generation no . */
wait_queue_head_t m_wait_single_sync_task; wait_queue_head_t m_wait_single_sync_task;
struct vfsmount *m_vfsmount; __int64_t m_update_flags; /* sb flags we need to updat
e
on the next remount,rw */
struct shrinker m_inode_shrink; /* inode reclaim shrinker */
int64_t m_low_space[XFS_LOWSP_MAX];
/* low free space thresholds
*/
} xfs_mount_t; } xfs_mount_t;
/* /*
* Flags for m_flags. * Flags for m_flags.
*/ */
#define XFS_MOUNT_WSYNC (1ULL << 0) /* for nfs - all met adata ops #define XFS_MOUNT_WSYNC (1ULL << 0) /* for nfs - all met adata ops
must be synchronous excep t must be synchronous excep t
for space allocations */ for space allocations */
#define XFS_MOUNT_INO64 (1ULL << 1) #define XFS_MOUNT_DELAYLOG (1ULL << 1) /* delayed logging is enable
#define XFS_MOUNT_DMAPI (1ULL << 2) /* dmapi is enabled d */
*/
#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) #define XFS_MOUNT_WAS_CLEAN (1ULL << 3)
#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesy stem #define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesy stem
operations, typically for operations, typically for
disk errors in metadata * / disk errors in metadata * /
#define XFS_MOUNT_RETERR (1ULL << 6) /* return alignment errors t o #define XFS_MOUNT_RETERR (1ULL << 6) /* return alignment errors t o
user */ user */
#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment #define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
allocations */ allocations */
#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr 2 format */ #define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr 2 format */
#define XFS_MOUNT_GRPID (1ULL << 9) /* group-ID assigned from directory */ #define XFS_MOUNT_GRPID (1ULL << 9) /* group-ID assigned from directory */
#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */ #define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */
#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */
#define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */ #define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */
#define XFS_MOUNT_OSYNCISOSYNC (1ULL << 13) /* o_sync is REALLY o_sync *
/
/* osyncisdsync is now defau
lt*/
#define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes abov e #define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes abov e
* 32 bits in size */ * 32 bits in size */
#define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */ #define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */
#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ #define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */
#define XFS_MOUNT_BARRIER (1ULL << 17) #define XFS_MOUNT_BARRIER (1ULL << 17)
#define XFS_MOUNT_IKEEP (1ULL << 18) /* keep empty inode clusters*/ #define XFS_MOUNT_IKEEP (1ULL << 18) /* keep empty inode clusters*/
#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width #define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width
* allocation */ * allocation */
#define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */ #define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */
#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */ #define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */
#define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report larg e preferred #define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report larg e preferred
* I/O size in stat() */ * I/O size in stat() */
#define XFS_MOUNT_NO_PERCPU_SB (1ULL << 23) /* don't use per-cpu superbl
ock
counters */
#define XFS_MOUNT_FILESTREAMS (1ULL << 24) /* enable the filestreams #define XFS_MOUNT_FILESTREAMS (1ULL << 24) /* enable the filestreams
allocator */ allocator */
#define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 form at */ #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 form at */
/* /*
* Default minimum read and write sizes. * Default minimum read and write sizes.
*/ */
#define XFS_READIO_LOG_LARGE 16 #define XFS_READIO_LOG_LARGE 16
#define XFS_WRITEIO_LOG_LARGE 16 #define XFS_WRITEIO_LOG_LARGE 16
skipping to change at line 402 skipping to change at line 271
* Max and min values for mount-option defined I/O * Max and min values for mount-option defined I/O
* preallocation sizes. * preallocation sizes.
*/ */
#define XFS_MAX_IO_LOG 30 /* 1G */ #define XFS_MAX_IO_LOG 30 /* 1G */
#define XFS_MIN_IO_LOG PAGE_SHIFT #define XFS_MIN_IO_LOG PAGE_SHIFT
/* /*
* Synchronous read and write sizes. This should be * Synchronous read and write sizes. This should be
* better for NFSv2 wsync filesystems. * better for NFSv2 wsync filesystems.
*/ */
#define XFS_WSYNC_READIO_LOG 15 /* 32K */ #define XFS_WSYNC_READIO_LOG 15 /* 32k */
#define XFS_WSYNC_WRITEIO_LOG 14 /* 16K */ #define XFS_WSYNC_WRITEIO_LOG 14 /* 16k */
/* /*
* Allow large block sizes to be reported to userspace programs if the * Allow large block sizes to be reported to userspace programs if the
* "largeio" mount option is used. * "largeio" mount option is used.
* *
* If compatibility mode is specified, simply return the basic unit of cach ing * If compatibility mode is specified, simply return the basic unit of cach ing
* so that we don't get inefficient read/modify/write I/O from user apps. * so that we don't get inefficient read/modify/write I/O from user apps.
* Otherwise.... * Otherwise....
* *
* If the underlying volume is a stripe, then return the stripe width in by tes * If the underlying volume is a stripe, then return the stripe width in by tes
skipping to change at line 439 skipping to change at line 308
#define XFS_MAXIOFFSET(mp) ((mp)->m_maxioffset) #define XFS_MAXIOFFSET(mp) ((mp)->m_maxioffset)
#define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \ #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \
((mp)->m_flags & XFS_MOUNT_WAS_CLEAN) ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN)
#define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDO WN) #define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDO WN)
void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
int lnnum); int lnnum);
#define xfs_force_shutdown(m,f) \ #define xfs_force_shutdown(m,f) \
xfs_do_force_shutdown(m, f, __FILE__, __LINE__) xfs_do_force_shutdown(m, f, __FILE__, __LINE__)
#define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed
*/
#define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed *
/
#define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */
#define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data st
ructures */
#define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */
#define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */
#define xfs_test_for_freeze(mp) ((mp)->m_super->s_frozen)
#define xfs_wait_for_freeze(mp,l) vfs_check_frozen((mp)->m_super, (l))
/* /*
* Flags for xfs_mountfs * Flags for xfs_mountfs
*/ */
#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found * / #define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found * /
#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
static inline xfs_agnumber_t static inline xfs_agnumber_t
xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
{ {
xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d); xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
do_div(ld, mp->m_sb.sb_agblocks); do_div(ld, mp->m_sb.sb_agblocks);
return (xfs_agnumber_t) ld; return (xfs_agnumber_t) ld;
} }
#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
static inline xfs_agblock_t static inline xfs_agblock_t
xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
{ {
xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d); xfs_daddr_t ld = XFS_BB_TO_FSBT(mp, d);
return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks); return (xfs_agblock_t) do_div(ld, mp->m_sb.sb_agblocks);
} }
/* /*
* perag get/put wrappers for eventual ref counting
*/
static inline xfs_perag_t *
xfs_get_perag(struct xfs_mount *mp, xfs_ino_t ino)
{
return &mp->m_perag[XFS_INO_TO_AGNO(mp, ino)];
}
static inline void
xfs_put_perag(struct xfs_mount *mp, xfs_perag_t *pag)
{
/* nothing to see here, move along */
}
/*
* Per-cpu superblock locking functions * Per-cpu superblock locking functions
*/ */
#ifdef HAVE_PERCPU_SB #ifdef HAVE_PERCPU_SB
STATIC_INLINE void static inline void
xfs_icsb_lock(xfs_mount_t *mp) xfs_icsb_lock(xfs_mount_t *mp)
{ {
mutex_lock(&mp->m_icsb_mutex); mutex_lock(&mp->m_icsb_mutex);
} }
STATIC_INLINE void static inline void
xfs_icsb_unlock(xfs_mount_t *mp) xfs_icsb_unlock(xfs_mount_t *mp)
{ {
mutex_unlock(&mp->m_icsb_mutex); mutex_unlock(&mp->m_icsb_mutex);
} }
#else #else
#define xfs_icsb_lock(mp) #define xfs_icsb_lock(mp)
#define xfs_icsb_unlock(mp) #define xfs_icsb_unlock(mp)
#endif #endif
/* /*
* This structure is for use by the xfs_mod_incore_sb_batch() routine. * This structure is for use by the xfs_mod_incore_sb_batch() routine.
* xfs_growfs can specify a few fields which are more than int limit * xfs_growfs can specify a few fields which are more than int limit
*/ */
typedef struct xfs_mod_sb { typedef struct xfs_mod_sb {
xfs_sb_field_t msb_field; /* Field to modify, see below */ xfs_sb_field_t msb_field; /* Field to modify, see below */
int64_t msb_delta; /* Change to make to specified field */ int64_t msb_delta; /* Change to make to specified field */
} xfs_mod_sb_t; } xfs_mod_sb_t;
#define XFS_MOUNT_ILOCK(mp) mutex_lock(&((mp)->m_ilock))
#define XFS_MOUNT_IUNLOCK(mp) mutex_unlock(&((mp)->m_ilock))
extern int xfs_log_sbcount(xfs_mount_t *, uint); extern int xfs_log_sbcount(xfs_mount_t *, uint);
extern __uint64_t xfs_default_resblks(xfs_mount_t *mp);
extern int xfs_mountfs(xfs_mount_t *mp); extern int xfs_mountfs(xfs_mount_t *mp);
extern void xfs_mountfs_check_barriers(xfs_mount_t *mp);
extern void xfs_unmountfs(xfs_mount_t *); extern void xfs_unmountfs(xfs_mount_t *);
extern int xfs_unmountfs_writesb(xfs_mount_t *); extern int xfs_unmountfs_writesb(xfs_mount_t *);
extern int xfs_unmount_flush(xfs_mount_t *, int);
extern int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, in t); extern int xfs_mod_incore_sb(xfs_mount_t *, xfs_sb_field_t, int64_t, in t);
extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t,
int64_t, int);
extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *,
uint, int); uint, int);
extern int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
extern int xfs_readsb(xfs_mount_t *, int); extern int xfs_readsb(xfs_mount_t *, int);
extern void xfs_freesb(xfs_mount_t *); extern void xfs_freesb(xfs_mount_t *);
extern int xfs_fs_writable(xfs_mount_t *); extern int xfs_fs_writable(xfs_mount_t *);
extern int xfs_syncsub(xfs_mount_t *, int, int *);
extern int xfs_sync_inodes(xfs_mount_t *, int, int *);
extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t); extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t);
extern int xfs_dmops_get(struct xfs_mount *, struct xfs_mount_args *); extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
extern void xfs_dmops_put(struct xfs_mount *);
extern int xfs_qmops_get(struct xfs_mount *, struct xfs_mount_args *);
extern void xfs_qmops_put(struct xfs_mount *);
extern struct xfs_dmops xfs_dmcore_xfs; extern void xfs_set_low_space_thresholds(struct xfs_mount *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/*
* perag get/put wrappers for ref counting
*/
struct xfs_perag *xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno);
struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *mp, xfs_agnumber_t ag
no,
int tag);
void xfs_perag_put(struct xfs_perag *pag);
extern void xfs_mod_sb(struct xfs_trans *, __int64_t); extern void xfs_mod_sb(struct xfs_trans *, __int64_t);
extern xfs_agnumber_t xfs_initialize_perag(struct xfs_mount *, xfs_agnumbe extern int xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
r_t); xfs_agnumber_t *);
extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *); 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_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t) ;
#endif /* __XFS_MOUNT_H__ */ #endif /* __XFS_MOUNT_H__ */
 End of changes. 41 change blocks. 
216 lines changed or deleted 69 lines changed or added


 xfs_quota.h   xfs_quota.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_QUOTA_H__ #ifndef __XFS_QUOTA_H__
#define __XFS_QUOTA_H__ #define __XFS_QUOTA_H__
struct xfs_trans;
/* /*
* The ondisk form of a dquot structure. * The ondisk form of a dquot structure.
*/ */
#define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */ #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
#define XFS_DQUOT_VERSION (u_int8_t)0x01 /* latest version number */ #define XFS_DQUOT_VERSION (u_int8_t)0x01 /* latest version number */
/* /*
* uid_t and gid_t are hard-coded to 32 bits in the inode. * uid_t and gid_t are hard-coded to 32 bits in the inode.
* Hence, an 'id' in a dquot is 32 bits.. * Hence, an 'id' in a dquot is 32 bits..
*/ */
skipping to change at line 87 skipping to change at line 89
xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */ xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */
char dd_fill[32]; /* filling for posterity */ char dd_fill[32]; /* filling for posterity */
} xfs_dqblk_t; } xfs_dqblk_t;
/* /*
* flags for q_flags field in the dquot. * flags for q_flags field in the dquot.
*/ */
#define XFS_DQ_USER 0x0001 /* a user quota */ #define XFS_DQ_USER 0x0001 /* a user quota */
#define XFS_DQ_PROJ 0x0002 /* project quota */ #define XFS_DQ_PROJ 0x0002 /* project quota */
#define XFS_DQ_GROUP 0x0004 /* a group quota */ #define XFS_DQ_GROUP 0x0004 /* a group quota */
#define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */ #define XFS_DQ_DIRTY 0x0008 /* dquot is dirty */
#define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */ #define XFS_DQ_WANT 0x0010 /* for lookup/reclaim race *
#define XFS_DQ_WANT 0x0020 /* for lookup/reclaim race * /
/ #define XFS_DQ_INACTIVE 0x0020 /* dq off mplist & h
#define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & h ashlist */
ashlist */
#define XFS_DQ_MARKER 0x0080 /* sentinel */
#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROU P) #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROU P)
#define XFS_DQ_FLAGS \
{ XFS_DQ_USER, "USER" }, \
{ XFS_DQ_PROJ, "PROJ" }, \
{ XFS_DQ_GROUP, "GROUP" }, \
{ XFS_DQ_DIRTY, "DIRTY" }, \
{ XFS_DQ_WANT, "WANT" }, \
{ XFS_DQ_INACTIVE, "INACTIVE" }
/* /*
* In the worst case, when both user and group quotas are on, * In the worst case, when both user and group quotas are on,
* we can have a max of three dquots changing in a single transaction. * we can have a max of three dquots changing in a single transaction.
*/ */
#define XFS_DQUOT_LOGRES(mp) (sizeof(xfs_disk_dquot_t) * 3) #define XFS_DQUOT_LOGRES(mp) (sizeof(xfs_disk_dquot_t) * 3)
/* /*
* These are the structures used to lay out dquots and quotaoff * These are the structures used to lay out dquots and quotaoff
* records on the log. Quite similar to those of inodes. * records on the log. Quite similar to those of inodes.
*/ */
skipping to change at line 188 skipping to change at line 196
XFS_PQUOTA_ACTIVE)) XFS_PQUOTA_ACTIVE))
#define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
#define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
#define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) #define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
/* /*
* Flags to tell various functions what to do. Not all of these are meaning ful * Flags to tell various functions what to do. Not all of these are meaning ful
* to a single function. None of these XFS_QMOPT_* flags are meant to have * to a single function. None of these XFS_QMOPT_* flags are meant to have
* persistent values (ie. their values can and will change between versions ) * persistent values (ie. their values can and will change between versions )
*/ */
#define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */
#define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ #define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */
#define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
#define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
#define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot * / #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot * /
#define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num * / #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num * /
#define XFS_QMOPT_QUOTAOFF 0x0000080 /* quotas are being turned off */
#define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */
#define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quo
tacheck) */
#define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */
#define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */
#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */
#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
#define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */ #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */
/* /*
* flags to xfs_trans_mod_dquot to indicate which field needs to be * flags to xfs_trans_mod_dquot to indicate which field needs to be
* modified. * modified.
*/ */
#define XFS_QMOPT_RES_REGBLKS 0x0010000 #define XFS_QMOPT_RES_REGBLKS 0x0010000
#define XFS_QMOPT_RES_RTBLKS 0x0020000 #define XFS_QMOPT_RES_RTBLKS 0x0020000
#define XFS_QMOPT_BCOUNT 0x0040000 #define XFS_QMOPT_BCOUNT 0x0040000
#define XFS_QMOPT_ICOUNT 0x0080000 #define XFS_QMOPT_ICOUNT 0x0080000
#define XFS_QMOPT_RTBCOUNT 0x0100000 #define XFS_QMOPT_RTBCOUNT 0x0100000
#define XFS_QMOPT_DELBCOUNT 0x0200000 #define XFS_QMOPT_DELBCOUNT 0x0200000
#define XFS_QMOPT_DELRTBCOUNT 0x0400000 #define XFS_QMOPT_DELRTBCOUNT 0x0400000
#define XFS_QMOPT_RES_INOS 0x0800000 #define XFS_QMOPT_RES_INOS 0x0800000
/* /*
* flags for dqflush and dqflush_all.
*/
#define XFS_QMOPT_SYNC 0x1000000
#define XFS_QMOPT_ASYNC 0x2000000
#define XFS_QMOPT_DELWRI 0x4000000
/*
* flags for dqalloc. * flags for dqalloc.
*/ */
#define XFS_QMOPT_INHERIT 0x8000000 #define XFS_QMOPT_INHERIT 0x1000000
/* /*
* flags to xfs_trans_mod_dquot. * flags to xfs_trans_mod_dquot.
*/ */
#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS #define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS
#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS #define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS #define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS
#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT #define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT
#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT #define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT
#define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT #define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT
skipping to change at line 302 skipping to change at line 298
ulong qt_ino_res_used; /* inodes used from the reservatio n */ ulong qt_ino_res_used; /* inodes used from the reservatio n */
long qt_bcount_delta; /* dquot blk count changes */ long qt_bcount_delta; /* dquot blk count changes */
long qt_delbcnt_delta; /* delayed dquot blk count changes */ long qt_delbcnt_delta; /* delayed dquot blk count changes */
long qt_icount_delta; /* dquot inode count changes */ long qt_icount_delta; /* dquot inode count changes */
ulong qt_rtblk_res; /* # blks reserved on a dquot */ ulong qt_rtblk_res; /* # blks reserved on a dquot */
ulong qt_rtblk_res_used;/* # blks used from reservation */ ulong qt_rtblk_res_used;/* # blks used from reservation */
long qt_rtbcount_delta;/* dquot realtime blk changes */ long qt_rtbcount_delta;/* dquot realtime blk changes */
long qt_delrtb_delta; /* delayed RT blk count changes */ long qt_delrtb_delta; /* delayed RT blk count changes */
} xfs_dqtrx_t; } xfs_dqtrx_t;
/*
* Dquot transaction functions, used if quota is enabled.
*/
typedef void (*qo_dup_dqinfo_t)(struct xfs_trans *, struct xfs_trans *);
typedef void (*qo_mod_dquot_byino_t)(struct xfs_trans *,
struct xfs_inode *, uint, long);
typedef void (*qo_free_dqinfo_t)(struct xfs_trans *);
typedef void (*qo_apply_dquot_deltas_t)(struct xfs_trans *);
typedef void (*qo_unreserve_and_mod_dquots_t)(struct xfs_trans *);
typedef int (*qo_reserve_quota_nblks_t)(
struct xfs_trans *, struct xfs_mount *,
struct xfs_inode *, long, long, uint);
typedef int (*qo_reserve_quota_bydquots_t)(
struct xfs_trans *, struct xfs_mount *,
struct xfs_dquot *, struct xfs_dquot *,
long, long, uint);
typedef struct xfs_dqtrxops {
qo_dup_dqinfo_t qo_dup_dqinfo;
qo_free_dqinfo_t qo_free_dqinfo;
qo_mod_dquot_byino_t qo_mod_dquot_byino;
qo_apply_dquot_deltas_t qo_apply_dquot_deltas;
qo_reserve_quota_nblks_t qo_reserve_quota_nblks;
qo_reserve_quota_bydquots_t qo_reserve_quota_bydquots;
qo_unreserve_and_mod_dquots_t qo_unreserve_and_mod_dquots;
} xfs_dqtrxops_t;
#define XFS_DQTRXOP(mp, tp, op, args...) \
((mp)->m_qm_ops->xfs_dqtrxops ? \
((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : 0)
#define XFS_DQTRXOP_VOID(mp, tp, op, args...) \
((mp)->m_qm_ops->xfs_dqtrxops ? \
((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : (void)0)
#define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \
XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp)
#define XFS_TRANS_FREE_DQINFO(mp, tp) \
XFS_DQTRXOP_VOID(mp, tp, qo_free_dqinfo)
#define XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, field, delta) \
XFS_DQTRXOP_VOID(mp, tp, qo_mod_dquot_byino, ip, field, delta)
#define XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp) \
XFS_DQTRXOP_VOID(mp, tp, qo_apply_dquot_deltas)
#define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, fl) \
XFS_DQTRXOP(mp, tp, qo_reserve_quota_nblks, mp, ip, nblks, ninos, fl
)
#define XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, fl) \
XFS_DQTRXOP(mp, tp, qo_reserve_quota_bydquots, mp, ud, gd, nb, ni, f
l)
#define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \
XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots)
#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \
XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags)
#define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \
XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \
f | XFS_QMOPT_RES_REGBLKS)
#define XFS_TRANS_UNRESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \
XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, -(nb), -(ni), \
f | XFS_QMOPT_RES_REGBLKS)
extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *);
extern int xfs_mount_reset_sbqflags(struct xfs_mount *); extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
extern struct xfs_qmops xfs_qmcore_xfs;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#ifdef CONFIG_XFS_QUOTA
extern void xfs_trans_dup_dqinfo(struct xfs_trans *, struct xfs_trans *);
extern void xfs_trans_free_dqinfo(struct xfs_trans *);
extern void xfs_trans_mod_dquot_byino(struct xfs_trans *, struct xfs_inode
*,
uint, long);
extern void xfs_trans_apply_dquot_deltas(struct xfs_trans *);
extern void xfs_trans_unreserve_and_mod_dquots(struct xfs_trans *);
extern int xfs_trans_reserve_quota_nblks(struct xfs_trans *,
struct xfs_inode *, long, long, uint);
extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
struct xfs_mount *, struct xfs_dquot *,
struct xfs_dquot *, long, long, uint);
extern int xfs_qm_vop_dqalloc(struct xfs_inode *, uid_t, gid_t, prid_t, uin
t,
struct xfs_dquot **, struct xfs_dquot **);
extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode
*,
struct xfs_dquot *, struct xfs_dquot *);
extern int xfs_qm_vop_rename_dqattach(struct xfs_inode **);
extern struct xfs_dquot *xfs_qm_vop_chown(struct xfs_trans *,
struct xfs_inode *, struct xfs_dquot **, struct xfs_dquot *)
;
extern int xfs_qm_vop_chown_reserve(struct xfs_trans *, struct xfs_inode *,
struct xfs_dquot *, struct xfs_dquot *, uint);
extern int xfs_qm_dqattach(struct xfs_inode *, uint);
extern int xfs_qm_dqattach_locked(struct xfs_inode *, uint);
extern void xfs_qm_dqdetach(struct xfs_inode *);
extern void xfs_qm_dqrele(struct xfs_dquot *);
extern void xfs_qm_statvfs(struct xfs_inode *, struct kstatfs *);
extern int xfs_qm_sync(struct xfs_mount *, int);
extern int xfs_qm_newmount(struct xfs_mount *, uint *, uint *);
extern void xfs_qm_mount_quotas(struct xfs_mount *);
extern void xfs_qm_unmount(struct xfs_mount *);
extern void xfs_qm_unmount_quotas(struct xfs_mount *);
#else
#define xfs_qm_vop_dqalloc(ip, uid, gid, prid, flags, udqp, gdqp) ({ \
*(udqp) = NULL; \
*(gdqp) = NULL; \
0; \
})
#define xfs_trans_dup_dqinfo(tp, tp2)
#define xfs_trans_free_dqinfo(tp)
#define xfs_trans_mod_dquot_byino(tp, ip, fields, delta)
#define xfs_trans_apply_dquot_deltas(tp)
#define xfs_trans_unreserve_and_mod_dquots(tp)
#define xfs_trans_reserve_quota_nblks(tp, ip, blks, inos, flg) (0)
#define xfs_trans_reserve_quota_bydquots(tp, mp, uqp, gqp, blks, inos, flg)
(0)
#define xfs_qm_vop_create_dqattach(tp, ip, u, g)
#define xfs_qm_vop_rename_dqattach(it) (0)
#define xfs_qm_vop_chown(tp, ip, old, new) (NUL
L)
#define xfs_qm_vop_chown_reserve(tp, ip, u, g, fl) (0)
#define xfs_qm_dqattach(ip, fl)
(0)
#define xfs_qm_dqattach_locked(ip, fl) (0)
#define xfs_qm_dqdetach(ip)
#define xfs_qm_dqrele(d)
#define xfs_qm_statvfs(ip, s)
#define xfs_qm_sync(mp, flags) (0)
#define xfs_qm_newmount(mp, a, b) (0)
#define xfs_qm_mount_quotas(mp)
#define xfs_qm_unmount(mp)
#define xfs_qm_unmount_quotas(mp)
#endif /* CONFIG_XFS_QUOTA */
#define xfs_trans_unreserve_quota_nblks(tp, ip, nblks, ninos, flags) \
xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), -(ninos), flags)
#define xfs_trans_reserve_quota(tp, mp, ud, gd, nb, ni, f) \
xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \
f | XFS_QMOPT_RES_REGBLKS)
#endif /* __XFS_QUOTA_H__ */ #endif /* __XFS_QUOTA_H__ */
 End of changes. 11 change blocks. 
83 lines changed or deleted 91 lines changed or added


 xfs_rtalloc.h   xfs_rtalloc.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_RTALLOC_H__ #ifndef __XFS_RTALLOC_H__
#define __XFS_RTALLOC_H__ #define __XFS_RTALLOC_H__
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
/* Min and max rt extent sizes, specified in bytes */ /* Min and max rt extent sizes, specified in bytes */
#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */ #define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024) /* 1GB */
#define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64KB */ #define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64kB */
#define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4KB */ #define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4kB */
/* /*
* Constants for bit manipulations. * Constants for bit manipulations.
*/ */
#define XFS_NBBYLOG 3 /* log2(NBBY) */ #define XFS_NBBYLOG 3 /* log2(NBBY) */
#define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t) ) */ #define XFS_WORDLOG 2 /* log2(sizeof(xfs_rtword_t) ) */
#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) #define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG)
#define XFS_NBWORD (1 << XFS_NBWORDLOG) #define XFS_NBWORD (1 << XFS_NBWORDLOG)
#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) #define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1)
skipping to change at line 110 skipping to change at line 110
struct xfs_trans *tp, /* transaction pointer */ struct xfs_trans *tp, /* transaction pointer */
xfs_rtblock_t bno, /* starting block number to free */ xfs_rtblock_t bno, /* starting block number to free */
xfs_extlen_t len); /* length of extent freed */ xfs_extlen_t len); /* length of extent freed */
/* /*
* Initialize realtime fields in the mount structure. * Initialize realtime fields in the mount structure.
*/ */
int /* error */ int /* error */
xfs_rtmount_init( xfs_rtmount_init(
struct xfs_mount *mp); /* file system mount structure */ struct xfs_mount *mp); /* file system mount structure */
void
xfs_rtunmount_inodes(
struct xfs_mount *mp);
/* /*
* Get the bitmap and summary inodes into the mount structure * Get the bitmap and summary inodes into the mount structure
* at mount time. * at mount time.
*/ */
int /* error */ int /* error */
xfs_rtmount_inodes( xfs_rtmount_inodes(
struct xfs_mount *mp); /* file system mount structure */ struct xfs_mount *mp); /* file system mount structure */
/* /*
skipping to change at line 146 skipping to change at line 149
int int
xfs_growfs_rt( xfs_growfs_rt(
struct xfs_mount *mp, /* file system mount structure */ struct xfs_mount *mp, /* file system mount structure */
xfs_growfs_rt_t *in); /* user supplied growfs struct */ xfs_growfs_rt_t *in); /* user supplied growfs struct */
#else #else
# define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS) # define xfs_rtallocate_extent(t,b,min,max,l,a,f,p,rb) (ENOSYS)
# define xfs_rtfree_extent(t,b,l) (ENOSYS) # define xfs_rtfree_extent(t,b,l) (ENOSYS)
# define xfs_rtpick_extent(m,t,l,rb) (ENOSYS) # define xfs_rtpick_extent(m,t,l,rb) (ENOSYS)
# define xfs_growfs_rt(mp,in) (ENOSYS) # define xfs_growfs_rt(mp,in) (ENOSYS)
# define xfs_rtmount_init(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS) static inline int /* error */
) xfs_rtmount_init(
xfs_mount_t *mp) /* file system mount structure */
{
if (mp->m_sb.sb_rblocks == 0)
return 0;
cmn_err(CE_WARN, "XFS: Not built with CONFIG_XFS_RT");
return ENOSYS;
}
# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS) ) # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS) )
# define xfs_rtunmount_inodes(m)
#endif /* CONFIG_XFS_RT */ #endif /* CONFIG_XFS_RT */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_RTALLOC_H__ */ #endif /* __XFS_RTALLOC_H__ */
 End of changes. 4 change blocks. 
4 lines changed or deleted 16 lines changed or added


 xfs_sb.h   xfs_sb.h 
skipping to change at line 301 skipping to change at line 301
#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
*/ */
#define XFS_SB_MAX_SHARED_VN 0 #define XFS_SB_MAX_SHARED_VN 0
#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSI ON_NUMBITS) #define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSI ON_NUMBITS)
#ifdef __KERNEL__
static inline int xfs_sb_good_version(xfs_sb_t *sbp) static inline int xfs_sb_good_version(xfs_sb_t *sbp)
{ {
return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \ /* We always support version 1-3 */
(sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \ if (sbp->sb_versionnum >= XFS_SB_VERSION_1 &&
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ sbp->sb_versionnum <= XFS_SB_VERSION_3)
!((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \ return 1;
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
\ /* We support version 4 if all feature bits are supported */
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) & if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) {
& \ if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) ||
(sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))); ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
} (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
return 0;
#ifdef __KERNEL__
if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
return 0;
#else #else
static inline int xfs_sb_good_version(xfs_sb_t *sbp) if ((sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) &&
{ sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN)
return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \ return 0;
(sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \ #endif
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \ return 1;
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && }
\
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) & return 0;
& \
(!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
(sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
} }
#endif /* __KERNEL__ */
/* /*
* 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)
{ {
return (sbp->sb_bad_features2 != sbp->sb_features2); return (sbp->sb_bad_features2 != sbp->sb_features2);
} }
static inline unsigned xfs_sb_version_tonew(unsigned v) static inline unsigned xfs_sb_version_tonew(unsigned v)
{ {
return ((((v) == XFS_SB_VERSION_1) ? \ if (v == XFS_SB_VERSION_1)
0 : \ return XFS_SB_VERSION_4;
(((v) == XFS_SB_VERSION_2) ? \
XFS_SB_VERSION_ATTRBIT : \ if (v == XFS_SB_VERSION_2)
(XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) return XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT;
| \
XFS_SB_VERSION_4); return XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT |
XFS_SB_VERSION_NLINKBIT;
} }
static inline unsigned xfs_sb_version_toold(unsigned v) static inline unsigned xfs_sb_version_toold(unsigned v)
{ {
return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) if (v & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT))
? \ return 0;
0 : \ if (v & XFS_SB_VERSION_NLINKBIT)
(((v) & XFS_SB_VERSION_NLINKBIT) ? \ return XFS_SB_VERSION_3;
XFS_SB_VERSION_3 : \ if (v & XFS_SB_VERSION_ATTRBIT)
(((v) & XFS_SB_VERSION_ATTRBIT) ? \ return XFS_SB_VERSION_2;
XFS_SB_VERSION_2 : \ return XFS_SB_VERSION_1;
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)
{ {
(sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? if (sbp->sb_versionnum == XFS_SB_VERSION_1)
\ sbp->sb_versionnum = XFS_SB_VERSION_2;
XFS_SB_VERSION_2 : \ else if (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) : \ else
(XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT))); 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)
{ {
(sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \ if (sbp->sb_versionnum <= XFS_SB_VERSION_2)
XFS_SB_VERSION_3 : \ sbp->sb_versionnum = XFS_SB_VERSION_3;
((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT)); else
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)
{ {
(sbp)->sb_versionnum = \ if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ else
(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_4 &&
((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT); (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_4 &&
((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT); (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_4 &&
((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT); (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_4 &&
((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT); (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_4 &&
((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT); (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_hasmorebits(sbp) &&
((sbp)->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)); (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_hasmorebits(sbp) &&
((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT); (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 = \ sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \ sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
((sbp)->sb_features2 = \
((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)
skipping to change at line 516 skipping to change at line 522
/* /*
* end of superblock version macros * end of superblock version macros
*/ */
#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag * / #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag * /
#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 *)XFS_BUF_PTR(bp))
#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.
 End of changes. 25 change blocks. 
88 lines changed or deleted 89 lines changed or added


 xfs_trans.h   xfs_trans.h 
skipping to change at line 52 skipping to change at line 52
* Log item types. * Log item types.
*/ */
#define XFS_LI_EFI 0x1236 #define XFS_LI_EFI 0x1236
#define XFS_LI_EFD 0x1237 #define XFS_LI_EFD 0x1237
#define XFS_LI_IUNLINK 0x1238 #define XFS_LI_IUNLINK 0x1238
#define XFS_LI_INODE 0x123b /* aligned ino chunks, var-s ize ibufs */ #define XFS_LI_INODE 0x123b /* aligned ino chunks, var-s ize ibufs */
#define XFS_LI_BUF 0x123c /* v2 bufs, variable sized i node bufs */ #define XFS_LI_BUF 0x123c /* v2 bufs, variable sized i node bufs */
#define XFS_LI_DQUOT 0x123d #define XFS_LI_DQUOT 0x123d
#define XFS_LI_QUOTAOFF 0x123e #define XFS_LI_QUOTAOFF 0x123e
#define XFS_LI_TYPE_DESC \
{ XFS_LI_EFI, "XFS_LI_EFI" }, \
{ XFS_LI_EFD, "XFS_LI_EFD" }, \
{ XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \
{ XFS_LI_INODE, "XFS_LI_INODE" }, \
{ XFS_LI_BUF, "XFS_LI_BUF" }, \
{ XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \
{ XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }
/* /*
* Transaction types. Used to distinguish types of buffers. * Transaction types. Used to distinguish types of buffers.
*/ */
#define XFS_TRANS_SETATTR_NOT_SIZE 1 #define XFS_TRANS_SETATTR_NOT_SIZE 1
#define XFS_TRANS_SETATTR_SIZE 2 #define XFS_TRANS_SETATTR_SIZE 2
#define XFS_TRANS_INACTIVE 3 #define XFS_TRANS_INACTIVE 3
#define XFS_TRANS_CREATE 4 #define XFS_TRANS_CREATE 4
#define XFS_TRANS_CREATE_TRUNC 5 #define XFS_TRANS_CREATE_TRUNC 5
#define XFS_TRANS_TRUNCATE_FILE 6 #define XFS_TRANS_TRUNCATE_FILE 6
#define XFS_TRANS_REMOVE 7 #define XFS_TRANS_REMOVE 7
#define XFS_TRANS_LINK 8 #define XFS_TRANS_LINK 8
#define XFS_TRANS_RENAME 9 #define XFS_TRANS_RENAME 9
#define XFS_TRANS_MKDIR 10 #define XFS_TRANS_MKDIR 10
#define XFS_TRANS_RMDIR 11 #define XFS_TRANS_RMDIR 11
#define XFS_TRANS_SYMLINK 12 #define XFS_TRANS_SYMLINK 12
#define XFS_TRANS_SET_DMATTRS 13 #define XFS_TRANS_SET_DMATTRS 13
#define XFS_TRANS_GROWFS 14 #define XFS_TRANS_GROWFS 14
#define XFS_TRANS_STRAT_WRITE 15 #define XFS_TRANS_STRAT_WRITE 15
#define XFS_TRANS_DIOSTRAT 16 #define XFS_TRANS_DIOSTRAT 16
#define XFS_TRANS_WRITE_SYNC 17 /* 17 was XFS_TRANS_WRITE_SYNC */
#define XFS_TRANS_WRITEID 18 #define XFS_TRANS_WRITEID 18
#define XFS_TRANS_ADDAFORK 19 #define XFS_TRANS_ADDAFORK 19
#define XFS_TRANS_ATTRINVAL 20 #define XFS_TRANS_ATTRINVAL 20
#define XFS_TRANS_ATRUNCATE 21 #define XFS_TRANS_ATRUNCATE 21
#define XFS_TRANS_ATTR_SET 22 #define XFS_TRANS_ATTR_SET 22
#define XFS_TRANS_ATTR_RM 23 #define XFS_TRANS_ATTR_RM 23
#define XFS_TRANS_ATTR_FLAG 24 #define XFS_TRANS_ATTR_FLAG 24
#define XFS_TRANS_CLEAR_AGI_BUCKET 25 #define XFS_TRANS_CLEAR_AGI_BUCKET 25
#define XFS_TRANS_QM_SBCHANGE 26 #define XFS_TRANS_QM_SBCHANGE 26
/* /*
skipping to change at line 100 skipping to change at line 109
#define XFS_TRANS_QM_DQCLUSTER 32 #define XFS_TRANS_QM_DQCLUSTER 32
#define XFS_TRANS_QM_QINOCREATE 33 #define XFS_TRANS_QM_QINOCREATE 33
#define XFS_TRANS_QM_QUOTAOFF_END 34 #define XFS_TRANS_QM_QUOTAOFF_END 34
#define XFS_TRANS_SB_UNIT 35 #define XFS_TRANS_SB_UNIT 35
#define XFS_TRANS_FSYNC_TS 36 #define XFS_TRANS_FSYNC_TS 36
#define XFS_TRANS_GROWFSRT_ALLOC 37 #define XFS_TRANS_GROWFSRT_ALLOC 37
#define XFS_TRANS_GROWFSRT_ZERO 38 #define XFS_TRANS_GROWFSRT_ZERO 38
#define XFS_TRANS_GROWFSRT_FREE 39 #define XFS_TRANS_GROWFSRT_FREE 39
#define XFS_TRANS_SWAPEXT 40 #define XFS_TRANS_SWAPEXT 40
#define XFS_TRANS_SB_COUNT 41 #define XFS_TRANS_SB_COUNT 41
#define XFS_TRANS_TYPE_MAX 41 #define XFS_TRANS_CHECKPOINT 42
#define XFS_TRANS_TYPE_MAX 42
/* new transaction types need to be reflected in xfs_logprint(8) */ /* new transaction types need to be reflected in xfs_logprint(8) */
#define XFS_TRANS_TYPES \
{ XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \
{ XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \
{ XFS_TRANS_INACTIVE, "INACTIVE" }, \
{ XFS_TRANS_CREATE, "CREATE" }, \
{ XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \
{ XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \
{ XFS_TRANS_REMOVE, "REMOVE" }, \
{ XFS_TRANS_LINK, "LINK" }, \
{ XFS_TRANS_RENAME, "RENAME" }, \
{ XFS_TRANS_MKDIR, "MKDIR" }, \
{ XFS_TRANS_RMDIR, "RMDIR" }, \
{ XFS_TRANS_SYMLINK, "SYMLINK" }, \
{ XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \
{ XFS_TRANS_GROWFS, "GROWFS" }, \
{ XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \
{ XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \
{ XFS_TRANS_WRITEID, "WRITEID" }, \
{ XFS_TRANS_ADDAFORK, "ADDAFORK" }, \
{ XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \
{ XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \
{ XFS_TRANS_ATTR_SET, "ATTR_SET" }, \
{ XFS_TRANS_ATTR_RM, "ATTR_RM" }, \
{ XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \
{ XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \
{ XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \
{ XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \
{ XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \
{ XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \
{ XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \
{ XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \
{ XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \
{ XFS_TRANS_SB_UNIT, "SB_UNIT" }, \
{ XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \
{ XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \
{ XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \
{ XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \
{ XFS_TRANS_SWAPEXT, "SWAPEXT" }, \
{ XFS_TRANS_SB_COUNT, "SB_COUNT" }, \
{ XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \
{ XFS_TRANS_DUMMY1, "DUMMY1" }, \
{ XFS_TRANS_DUMMY2, "DUMMY2" }, \
{ XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" }
/* /*
* This structure is used to track log items associated with * This structure is used to track log items associated with
* a transaction. It points to the log item and keeps some * a transaction. It points to the log item and keeps some
* flags to track the state of the log item. It also tracks * flags to track the state of the log item. It also tracks
* the amount of space needed to log the item it describes * the amount of space needed to log the item it describes
* once we get to commit processing (see xfs_trans_commit()). * once we get to commit processing (see xfs_trans_commit()).
*/ */
typedef struct xfs_log_item_desc { struct xfs_log_item_desc {
struct xfs_log_item *lid_item; struct xfs_log_item *lid_item;
ushort lid_size; ushort lid_size;
unsigned char lid_flags; unsigned char lid_flags;
unsigned char lid_index; struct list_head lid_trans;
} xfs_log_item_desc_t; };
#define XFS_LID_DIRTY 0x1 #define XFS_LID_DIRTY 0x1
#define XFS_LID_PINNED 0x2
#define XFS_LID_BUF_STALE 0x8
/*
* This structure is used to maintain a chunk list of log_item_desc
* structures. The free field is a bitmask indicating which descriptors
* in this chunk's array are free. The unused field is the first value
* not used since this chunk was allocated.
*/
#define XFS_LIC_NUM_SLOTS 15
typedef struct xfs_log_item_chunk {
struct xfs_log_item_chunk *lic_next;
ushort lic_free;
ushort lic_unused;
xfs_log_item_desc_t lic_descs[XFS_LIC_NUM_SLOTS];
} xfs_log_item_chunk_t;
#define XFS_LIC_MAX_SLOT (XFS_LIC_NUM_SLOTS - 1)
#define XFS_LIC_FREEMASK ((1 << XFS_LIC_NUM_SLOTS) - 1)
/*
* Initialize the given chunk. Set the chunk's free descriptor mask
* to indicate that all descriptors are free. The caller gets to set
* lic_unused to the right value (0 matches all free). The
* lic_descs.lid_index values are set up as each desc is allocated.
*/
static inline void xfs_lic_init(xfs_log_item_chunk_t *cp)
{
cp->lic_free = XFS_LIC_FREEMASK;
}
static inline void xfs_lic_init_slot(xfs_log_item_chunk_t *cp, int slot)
{
cp->lic_descs[slot].lid_index = (unsigned char)(slot);
}
static inline int xfs_lic_vacancy(xfs_log_item_chunk_t *cp)
{
return cp->lic_free & XFS_LIC_FREEMASK;
}
static inline void xfs_lic_all_free(xfs_log_item_chunk_t *cp)
{
cp->lic_free = XFS_LIC_FREEMASK;
}
static inline int xfs_lic_are_all_free(xfs_log_item_chunk_t *cp)
{
return ((cp->lic_free & XFS_LIC_FREEMASK) == XFS_LIC_FREEMASK);
}
static inline int xfs_lic_isfree(xfs_log_item_chunk_t *cp, int slot)
{
return (cp->lic_free & (1 << slot));
}
static inline void xfs_lic_claim(xfs_log_item_chunk_t *cp, int slot)
{
cp->lic_free &= ~(1 << slot);
}
static inline void xfs_lic_relse(xfs_log_item_chunk_t *cp, int slot)
{
cp->lic_free |= 1 << slot;
}
static inline xfs_log_item_desc_t *
xfs_lic_slot(xfs_log_item_chunk_t *cp, int slot)
{
return &(cp->lic_descs[slot]);
}
static inline int xfs_lic_desc_to_slot(xfs_log_item_desc_t *dp)
{
return (uint)dp->lid_index;
}
/*
* Calculate the address of a chunk given a descriptor pointer:
* dp - dp->lid_index give the address of the start of the lic_descs array.
* From this we subtract the offset of the lic_descs field in a chunk.
* All of this yields the address of the chunk, which is
* cast to a chunk pointer.
*/
static inline xfs_log_item_chunk_t *
xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
{
return (xfs_log_item_chunk_t*) \
(((xfs_caddr_t)((dp) - (dp)->lid_index)) - \
(xfs_caddr_t)(((xfs_log_item_chunk_t*)0)->lic_descs));
}
#define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */ #define XFS_TRANS_MAGIC 0x5452414E /* 'TRAN' */
/* /*
* Values for t_flags. * Values for t_flags.
*/ */
#define XFS_TRANS_DIRTY 0x01 /* something needs to be log ged */ #define XFS_TRANS_DIRTY 0x01 /* something needs to be log ged */
#define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ #define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */
#define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ #define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */
#define XFS_TRANS_SYNC 0x08 /* make commit synchronous * / #define XFS_TRANS_SYNC 0x08 /* make commit synchronous * /
#define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty * / #define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty * /
#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ #define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
/* /*
* Values for call flags parameter. * Values for call flags parameter.
*/ */
#define XFS_TRANS_NOSLEEP 0x1
#define XFS_TRANS_WAIT 0x2
#define XFS_TRANS_RELEASE_LOG_RES 0x4 #define XFS_TRANS_RELEASE_LOG_RES 0x4
#define XFS_TRANS_ABORT 0x8 #define XFS_TRANS_ABORT 0x8
/* /*
* Field values for xfs_trans_mod_sb. * Field values for xfs_trans_mod_sb.
*/ */
#define XFS_TRANS_SB_ICOUNT 0x00000001 #define XFS_TRANS_SB_ICOUNT 0x00000001
#define XFS_TRANS_SB_IFREE 0x00000002 #define XFS_TRANS_SB_IFREE 0x00000002
#define XFS_TRANS_SB_FDBLOCKS 0x00000004 #define XFS_TRANS_SB_FDBLOCKS 0x00000004
#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 #define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008
skipping to change at line 248 skipping to change at line 209
#define XFS_TRANS_SB_DBLOCKS 0x00000040 #define XFS_TRANS_SB_DBLOCKS 0x00000040
#define XFS_TRANS_SB_AGCOUNT 0x00000080 #define XFS_TRANS_SB_AGCOUNT 0x00000080
#define XFS_TRANS_SB_IMAXPCT 0x00000100 #define XFS_TRANS_SB_IMAXPCT 0x00000100
#define XFS_TRANS_SB_REXTSIZE 0x00000200 #define XFS_TRANS_SB_REXTSIZE 0x00000200
#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 #define XFS_TRANS_SB_RBMBLOCKS 0x00000400
#define XFS_TRANS_SB_RBLOCKS 0x00000800 #define XFS_TRANS_SB_RBLOCKS 0x00000800
#define XFS_TRANS_SB_REXTENTS 0x00001000 #define XFS_TRANS_SB_REXTENTS 0x00001000
#define XFS_TRANS_SB_REXTSLOG 0x00002000 #define XFS_TRANS_SB_REXTSLOG 0x00002000
/* /*
* Various log reservation values.
* These are based on the size of the file system block
* because that is what most transactions manipulate.
* Each adds in an additional 128 bytes per item logged to
* try to account for the overhead of the transaction mechanism.
*
* Note:
* Most of the reservations underestimate the number of allocation
* groups into which they could free extents in the xfs_bmap_finish()
* call. This is because the number in the worst case is quite high
* and quite unusual. In order to fix this we need to change
* xfs_bmap_finish() to free extents in only a single AG at a time.
* This will require changes to the EFI code as well, however, so that
* the EFI for the extents not freed is logged again in each transaction.
* See bug 261917.
*/
/*
* Per-extent log reservation for the allocation btree changes * Per-extent log reservation for the allocation btree changes
* involved in freeing or allocating an extent. * involved in freeing or allocating an extent.
* 2 trees * (2 blocks/level * max depth - 1) * block size * 2 trees * (2 blocks/level * max depth - 1) * block size
*/ */
#define XFS_ALLOCFREE_LOG_RES(mp,nx) \ #define XFS_ALLOCFREE_LOG_RES(mp,nx) \
((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1))) ((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1)))
#define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \ #define XFS_ALLOCFREE_LOG_COUNT(mp,nx) \
((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1))) ((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1)))
/* /*
skipping to change at line 289 skipping to change at line 232
* v2 directory blocks can be fragmented below the dirblksize down to the f sb * v2 directory blocks can be fragmented below the dirblksize down to the f sb
* size, so account for that in the DAENTER macros. * size, so account for that in the DAENTER macros.
*/ */
#define XFS_DIROP_LOG_RES(mp) \ #define XFS_DIROP_LOG_RES(mp) \
(XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \ (XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \
(XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1))) (XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)))
#define XFS_DIROP_LOG_COUNT(mp) \ #define XFS_DIROP_LOG_COUNT(mp) \
(XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \
XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)
/*
* In a write transaction we can allocate a maximum of 2
* extents. This gives:
* the inode getting the new extents: inode size
* the inode\'s bmap btree: max depth * block size
* the agfs of the ags from which the extents are allocated: 2 * sector
* the superblock free block counter: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block
size
* And the bmap_finish transaction can free bmap blocks in a join:
* the agfs of the ags containing the blocks: 2 * sector size
* the agfls of the ags containing the blocks: 2 * sector size
* the super block free block counter: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block
size
*/
#define XFS_CALC_WRITE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \
(2 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (4 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + XFS_ALLOCFREE_LO
G_COUNT(mp, 2)))),\
((2 * (mp)->m_sb.sb_sectsize) + \
(2 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
#define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write) #define XFS_WRITE_LOG_RES(mp) ((mp)->m_reservations.tr_write)
/*
* In truncating a file we free up to two extents at once. We can modify:
* the inode being truncated: inode size
* the inode\'s bmap btree: (max depth + 1) * block size
* And the bmap_finish transaction can free the blocks and bmap blocks:
* the agf for each of the ags: 4 * sector size
* the agfl for each of the ags: 4 * sector size
* the super block to reflect the freed blocks: sector size
* worst case split in allocation btrees per extent assuming 4 extents:
* 4 exts * 2 trees * (2 * max depth - 1) * block size
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (max depth - 1) * block size
*/
#define XFS_CALC_ITRUNCATE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) + \
(128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)))), \
((4 * (mp)->m_sb.sb_sectsize) + \
(4 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 4) + \
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \
(128 * 5) + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itrunca te) #define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itrunca te)
/*
* In renaming a files we can modify:
* the four inodes involved: 4 * inode size
* the two directory btrees: 2 * (max depth + v2) * dir block size
* the two directory bmap btrees: 2 * max depth * block size
* And the bmap_finish transaction can free dir and bmap blocks (two sets
* of bmap blocks) giving:
* the agf for the ags in which the blocks live: 3 * sector size
* the agfl for the ags in which the blocks live: 3 * sector size
* the superblock for the free block count: sector size
* the allocation btrees: 3 exts * 2 trees * (2 * max depth - 1) * block
size
*/
#define XFS_CALC_RENAME_LOG_RES(mp) \
(MAX( \
((4 * (mp)->m_sb.sb_inodesize) + \
(2 * XFS_DIROP_LOG_RES(mp)) + \
(128 * (4 + 2 * XFS_DIROP_LOG_COUNT(mp)))), \
((3 * (mp)->m_sb.sb_sectsize) + \
(3 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 3) + \
(128 * (7 + XFS_ALLOCFREE_LOG_COUNT(mp, 3))))))
#define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename) #define XFS_RENAME_LOG_RES(mp) ((mp)->m_reservations.tr_rename)
/*
* For creating a link to an inode:
* the parent directory inode: inode size
* the linked inode: inode size
* the directory btree could split: (max depth + v2) * dir block size
* the directory bmap btree could join or split: (max depth + v2) * bloc
ksize
* And the bmap_finish transaction can free some bmap blocks giving:
* the agf for the ag in which the blocks live: sector size
* the agfl for the ag in which the blocks live: sector size
* the superblock for the free block count: sector size
* the allocation btrees: 2 trees * (2 * max depth - 1) * block size
*/
#define XFS_CALC_LINK_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
XFS_DIROP_LOG_RES(mp) + \
(128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
((mp)->m_sb.sb_sectsize + \
(mp)->m_sb.sb_sectsize + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
#define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link) #define XFS_LINK_LOG_RES(mp) ((mp)->m_reservations.tr_link)
/*
* For removing a directory entry we can modify:
* the parent directory inode: inode size
* the removed inode: inode size
* the directory btree could join: (max depth + v2) * dir block size
* the directory bmap btree could join or split: (max depth + v2) * bloc
ksize
* And the bmap_finish transaction can free the dir and bmap blocks giving:
* the agf for the ag in which the blocks live: 2 * sector size
* the agfl for the ag in which the blocks live: 2 * sector size
* the superblock for the free block count: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block
size
*/
#define XFS_CALC_REMOVE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
XFS_DIROP_LOG_RES(mp) + \
(128 * (2 + XFS_DIROP_LOG_COUNT(mp)))), \
((2 * (mp)->m_sb.sb_sectsize) + \
(2 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
#define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove) #define XFS_REMOVE_LOG_RES(mp) ((mp)->m_reservations.tr_remove)
/*
* For symlink we can modify:
* the parent directory inode: inode size
* the new inode: inode size
* the inode btree entry: 1 block
* the directory btree: (max depth + v2) * dir block size
* the directory inode\'s bmap btree: (max depth + v2) * block size
* the blocks for the symlink: 1 KB
* Or in the first xact we allocate some inodes giving:
* the agi and agf of the ag getting the new inodes: 2 * sectorsize
* the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (2 * max depth - 1) * block size
*/
#define XFS_CALC_SYMLINK_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B(mp, 1) + \
XFS_DIROP_LOG_RES(mp) + \
1024 + \
(128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \
(2 * (mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink) #define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
/*
* For create we can modify:
* the parent directory inode: inode size
* the new inode: inode size
* the inode btree entry: block size
* the superblock for the nlink flag: sector size
* the directory btree: (max depth + v2) * dir block size
* the directory inode\'s bmap btree: (max depth + v2) * block size
* Or in the first xact we allocate some inodes giving:
* the agi and agf of the ag getting the new inodes: 2 * sectorsize
* the superblock for the nlink flag: sector size
* the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (max depth - 1) * block size
*/
#define XFS_CALC_CREATE_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B(mp, 1) + \
XFS_DIROP_LOG_RES(mp) + \
(128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \
(3 * (mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create) #define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
/*
* Making a new directory is the same as creating a new file.
*/
#define XFS_CALC_MKDIR_LOG_RES(mp) XFS_CALC_CREATE_LOG_RES(mp)
#define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir) #define XFS_MKDIR_LOG_RES(mp) ((mp)->m_reservations.tr_mkdir)
/*
* In freeing an inode we can modify:
* the inode being freed: inode size
* the super block free inode counter: sector size
* the agi hash list and counters: sector size
* the inode btree entry: block size
* the on disk inode before ours in the agi hash list: inode cluster siz
e
* the inode btree: max depth * blocksize
* the allocation btrees: 2 trees * (max depth - 1) * block size
*/
#define XFS_CALC_IFREE_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + \
(mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), 1) + \
MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp))
+ \
(128 * 5) + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
#define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree) #define XFS_IFREE_LOG_RES(mp) ((mp)->m_reservations.tr_ifree)
/*
* When only changing the inode we log the inode and possibly the superbloc
k
* We also add a bit of slop for the transaction stuff.
*/
#define XFS_CALC_ICHANGE_LOG_RES(mp) ((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + 512)
#define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange) #define XFS_ICHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_ichange)
/*
* Growing the data section of the filesystem.
* superblock
* agi and agf
* allocation btrees
*/
#define XFS_CALC_GROWDATA_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize * 3 + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (3 + XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
#define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdat a) #define XFS_GROWDATA_LOG_RES(mp) ((mp)->m_reservations.tr_growdat a)
/*
* Growing the rt section of the filesystem.
* In the first set of transactions (ALLOC) we allocate space to the
* bitmap or summary files.
* superblock: sector size
* agf of the ag from which the extent is allocated: sector size
* bmap btree for bitmap/summary inode: max depth * blocksize
* bitmap/summary inode: inode size
* allocation btrees for 1 block alloc: 2 * (2 * maxdepth - 1) * blocks
ize
*/
#define XFS_CALC_GROWRTALLOC_LOG_RES(mp) \
(2 * (mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK)) + \
(mp)->m_sb.sb_inodesize + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * \
(3 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
#define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtalloc) #define XFS_GROWRTALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtalloc)
/*
* Growing the rt section of the filesystem.
* In the second set of transactions (ZERO) we zero the new metadata blocks
.
* one bitmap/summary block: blocksize
*/
#define XFS_CALC_GROWRTZERO_LOG_RES(mp) \
((mp)->m_sb.sb_blocksize + 128)
#define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtzero) #define XFS_GROWRTZERO_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtzero)
/*
* Growing the rt section of the filesystem.
* In the third set of transactions (FREE) we update metadata without
* allocating any new blocks.
* superblock: sector size
* bitmap inode: inode size
* summary inode: inode size
* one bitmap block: blocksize
* summary blocks: new summary size
*/
#define XFS_CALC_GROWRTFREE_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize + \
2 * (mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_blocksize + \
(mp)->m_rsumsize + \
(128 * 5))
#define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtfree) #define XFS_GROWRTFREE_LOG_RES(mp) ((mp)->m_reservations.tr_gro wrtfree)
/*
* Logging the inode modification timestamp on a synchronous write.
* inode
*/
#define XFS_CALC_SWRITE_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + 128)
#define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) #define XFS_SWRITE_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/* /*
* Logging the inode timestamps on an fsync -- same as SWRITE * Logging the inode timestamps on an fsync -- same as SWRITE
* as long as SWRITE logs the entire inode core * as long as SWRITE logs the entire inode core
*/ */
#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) #define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/*
* Logging the inode mode bits when writing a setuid/setgid file
* inode
*/
#define XFS_CALC_WRITEID_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + 128)
#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) #define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
/*
* Converting the inode from non-attributed to attributed.
* the inode being converted: inode size
* agf block and superblock (for block allocation)
* the new block (directory sized)
* bmap blocks for the new directory block
* allocation btrees
*/
#define XFS_CALC_ADDAFORK_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize * 2 + \
(mp)->m_dirblksize + \
XFS_FSB_TO_B(mp, (XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1)) + \
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
(128 * (4 + (XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK) + 1) + \
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_add afork) #define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_add afork)
/*
* Removing the attribute fork of a file
* the inode being truncated: inode size
* the inode\'s bmap btree: max depth * block size
* And the bmap_finish transaction can free the blocks and bmap blocks:
* the agf for each of the ags: 4 * sector size
* the agfl for each of the ags: 4 * sector size
* the super block to reflect the freed blocks: sector size
* worst case split in allocation btrees per extent assuming 4 extents:
* 4 exts * 2 trees * (2 * max depth - 1) * block size
*/
#define XFS_CALC_ATTRINVAL_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
(128 * (1 + XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))), \
((4 * (mp)->m_sb.sb_sectsize) + \
(4 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 4) + \
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))))))
#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_att rinval) #define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_att rinval)
/*
* Setting an attribute.
* the inode getting the attribute
* the superblock for allocations
* the agfs extents are allocated from
* the attribute btree * max depth
* the inode allocation btree
* Since attribute transaction space is dependent on the size of the attrib
ute,
* the calculation is done partially at mount time and partially at runtime
.
*/
#define XFS_CALC_ATTRSET_LOG_RES(mp) \
((mp)->m_sb.sb_inodesize + \
(mp)->m_sb.sb_sectsize + \
XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
(128 * (2 + XFS_DA_NODE_MAXDEPTH)))
#define XFS_ATTRSET_LOG_RES(mp, ext) \ #define XFS_ATTRSET_LOG_RES(mp, ext) \
((mp)->m_reservations.tr_attrset + \ ((mp)->m_reservations.tr_attrset + \
(ext * (mp)->m_sb.sb_sectsize) + \ (ext * (mp)->m_sb.sb_sectsize) + \
(ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \ (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \
(128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))))) (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))))
/*
* Removing an attribute.
* the inode: inode size
* the attribute btree could join: max depth * block size
* the inode bmap btree could join or split: max depth * block size
* And the bmap_finish transaction can free the attr blocks freed giving:
* the agf for the ag in which the blocks live: 2 * sector size
* the agfl for the ag in which the blocks live: 2 * sector size
* the superblock for the free block count: sector size
* the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block
size
*/
#define XFS_CALC_ATTRRM_LOG_RES(mp) \
(MAX( \
((mp)->m_sb.sb_inodesize + \
XFS_FSB_TO_B((mp), XFS_DA_NODE_MAXDEPTH) + \
XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) + \
(128 * (1 + XFS_DA_NODE_MAXDEPTH + XFS_BM_MAXLEVELS(mp, XFS_DATA_F
ORK)))), \
((2 * (mp)->m_sb.sb_sectsize) + \
(2 * (mp)->m_sb.sb_sectsize) + \
(mp)->m_sb.sb_sectsize + \
XFS_ALLOCFREE_LOG_RES(mp, 2) + \
(128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))))))
#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
/*
* Clearing a bad agino number in an agi hash bucket.
*/
#define XFS_CALC_CLEAR_AGI_BUCKET_LOG_RES(mp) \
((mp)->m_sb.sb_sectsize + 128)
#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_c learagi) #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_c learagi)
/* /*
* Various log count values. * Various log count values.
*/ */
#define XFS_DEFAULT_LOG_COUNT 1 #define XFS_DEFAULT_LOG_COUNT 1
#define XFS_DEFAULT_PERM_LOG_COUNT 2 #define XFS_DEFAULT_PERM_LOG_COUNT 2
#define XFS_ITRUNCATE_LOG_COUNT 2 #define XFS_ITRUNCATE_LOG_COUNT 2
#define XFS_INACTIVE_LOG_COUNT 2 #define XFS_INACTIVE_LOG_COUNT 2
#define XFS_CREATE_LOG_COUNT 2 #define XFS_CREATE_LOG_COUNT 2
skipping to change at line 744 skipping to change at line 294
* reference count values. This determine how hard the buffer * reference count values. This determine how hard the buffer
* cache tries to hold onto the buffer. * cache tries to hold onto the buffer.
*/ */
#define XFS_AGF_REF 4 #define XFS_AGF_REF 4
#define XFS_AGI_REF 4 #define XFS_AGI_REF 4
#define XFS_AGFL_REF 3 #define XFS_AGFL_REF 3
#define XFS_INO_BTREE_REF 3 #define XFS_INO_BTREE_REF 3
#define XFS_ALLOC_BTREE_REF 2 #define XFS_ALLOC_BTREE_REF 2
#define XFS_BMAP_BTREE_REF 2 #define XFS_BMAP_BTREE_REF 2
#define XFS_DIR_BTREE_REF 2 #define XFS_DIR_BTREE_REF 2
#define XFS_INO_REF 2
#define XFS_ATTR_BTREE_REF 1 #define XFS_ATTR_BTREE_REF 1
#define XFS_INO_REF 1
#define XFS_DQUOT_REF 1 #define XFS_DQUOT_REF 1
#ifdef __KERNEL__ #ifdef __KERNEL__
struct xfs_buf; struct xfs_buf;
struct xfs_buftarg; struct xfs_buftarg;
struct xfs_efd_log_item; struct xfs_efd_log_item;
struct xfs_efi_log_item; struct xfs_efi_log_item;
struct xfs_inode; struct xfs_inode;
struct xfs_item_ops; struct xfs_item_ops;
struct xfs_log_iovec; struct xfs_log_iovec;
struct xfs_log_item_desc; struct xfs_log_item_desc;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct xfs_dquot_acct; struct xfs_dquot_acct;
struct xfs_busy_extent;
typedef struct xfs_log_item { typedef struct xfs_log_item {
struct list_head li_ail; /* AIL pointers */ struct list_head li_ail; /* AIL pointers */
xfs_lsn_t li_lsn; /* last on-disk lsn */ xfs_lsn_t li_lsn; /* last on-disk lsn */
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 * /
struct xfs_ail *li_ailp; /* ptr to AIL */
uint li_type; /* item type */ uint li_type; /* item type */
uint li_flags; /* misc flags */ uint li_flags; /* misc flags */
struct xfs_log_item *li_bio_list; /* buffer item list */ struct xfs_log_item *li_bio_list; /* buffer item list */
void (*li_cb)(struct xfs_buf *, void (*li_cb)(struct xfs_buf *,
struct xfs_log_item *); struct xfs_log_item *);
/* buffer item iodon e */ /* buffer item iodon e */
/* callback func */ /* callback func */
struct xfs_item_ops *li_ops; /* function list */ struct xfs_item_ops *li_ops; /* function list */
/* delayed logging */
struct list_head li_cil; /* CIL pointers */
struct xfs_log_vec *li_lv; /* active log vector
*/
xfs_lsn_t li_seq; /* CIL commit seq */
} xfs_log_item_t; } xfs_log_item_t;
#define XFS_LI_IN_AIL 0x1 #define XFS_LI_IN_AIL 0x1
#define XFS_LI_ABORTED 0x2 #define XFS_LI_ABORTED 0x2
#define XFS_LI_FLAGS \
{ XFS_LI_IN_AIL, "IN_AIL" }, \
{ XFS_LI_ABORTED, "ABORTED" }
typedef struct xfs_item_ops { typedef struct xfs_item_ops {
uint (*iop_size)(xfs_log_item_t *); uint (*iop_size)(xfs_log_item_t *);
void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
void (*iop_pin)(xfs_log_item_t *); void (*iop_pin)(xfs_log_item_t *);
void (*iop_unpin)(xfs_log_item_t *, int); void (*iop_unpin)(xfs_log_item_t *, int remove);
void (*iop_unpin_remove)(xfs_log_item_t *, struct xfs_trans *);
uint (*iop_trylock)(xfs_log_item_t *); uint (*iop_trylock)(xfs_log_item_t *);
void (*iop_unlock)(xfs_log_item_t *); void (*iop_unlock)(xfs_log_item_t *);
xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t);
void (*iop_push)(xfs_log_item_t *); void (*iop_push)(xfs_log_item_t *);
void (*iop_pushbuf)(xfs_log_item_t *); void (*iop_pushbuf)(xfs_log_item_t *);
void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
} xfs_item_ops_t; } xfs_item_ops_t;
#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip) #define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)
#define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip) #define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip)
#define IOP_UNPIN(ip, flags) (*(ip)->li_ops->iop_unpin)(ip, flags) #define IOP_UNPIN(ip, remove) (*(ip)->li_ops->iop_unpin)(ip, remove)
#define IOP_UNPIN_REMOVE(ip,tp) (*(ip)->li_ops->iop_unpin_remove)(ip, tp)
#define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip) #define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip)
#define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip) #define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip)
#define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) #define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn)
#define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip) #define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip)
#define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip) #define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip)
#define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn) #define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn)
/* /*
* Return values for the IOP_TRYLOCK() routines. * Return values for the IOP_TRYLOCK() routines.
*/ */
#define XFS_ITEM_SUCCESS 0 #define XFS_ITEM_SUCCESS 0
#define XFS_ITEM_PINNED 1 #define XFS_ITEM_PINNED 1
#define XFS_ITEM_LOCKED 2 #define XFS_ITEM_LOCKED 2
#define XFS_ITEM_FLUSHING 3 #define XFS_ITEM_PUSHBUF 3
#define XFS_ITEM_PUSHBUF 4
/*
* This structure is used to maintain a list of block ranges that have been
* freed in the transaction. The ranges are listed in the perag[] busy lis
t
* between when they're freed and the transaction is committed to disk.
*/
typedef struct xfs_log_busy_slot {
xfs_agnumber_t lbc_ag;
ushort lbc_idx; /* index in perag.busy[] */
} xfs_log_busy_slot_t;
#define XFS_LBC_NUM_SLOTS 31
typedef struct xfs_log_busy_chunk {
struct xfs_log_busy_chunk *lbc_next;
uint lbc_free; /* free slots bitmas
k */
ushort lbc_unused; /* first unused */
xfs_log_busy_slot_t lbc_busy[XFS_LBC_NUM_SLOTS];
} xfs_log_busy_chunk_t;
#define XFS_LBC_MAX_SLOT (XFS_LBC_NUM_SLOTS - 1)
#define XFS_LBC_FREEMASK ((1U << XFS_LBC_NUM_SLOTS) - 1)
#define XFS_LBC_INIT(cp) ((cp)->lbc_free = XFS_LBC_FREEMASK)
#define XFS_LBC_CLAIM(cp, slot) ((cp)->lbc_free &= ~(1 << (slot)))
#define XFS_LBC_SLOT(cp, slot) (&((cp)->lbc_busy[(slot)]))
#define XFS_LBC_VACANCY(cp) (((cp)->lbc_free) & XFS_LBC_FREEMASK
)
#define XFS_LBC_ISFREE(cp, slot) ((cp)->lbc_free & (1 << (slot)))
/* /*
* This is the type of function which can be given to xfs_trans_callback() * This is the type of function which can be given to xfs_trans_callback()
* to be called upon the transaction's commit to disk. * to be called upon the transaction's commit to disk.
*/ */
typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *); typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *);
/* /*
* This is the structure maintained for every active transaction. * This is the structure maintained for every active transaction.
*/ */
typedef struct xfs_trans { typedef struct xfs_trans {
unsigned int t_magic; /* magic number */ unsigned int t_magic; /* magic number */
xfs_log_callback_t t_logcb; /* log callback struct */ xfs_log_callback_t t_logcb; /* log callback struct */
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 */
unsigned int t_blk_res; /* # of blocks resvd */ unsigned int t_blk_res; /* # of blocks resvd */
unsigned int t_blk_res_used; /* # of resvd blocks used */ unsigned int t_blk_res_used; /* # of resvd blocks used */
unsigned int t_rtx_res; /* # of rt extents resvd */ unsigned int t_rtx_res; /* # of rt extents resvd */
unsigned int t_rtx_res_used; /* # of resvd rt extents use d */ unsigned int t_rtx_res_used; /* # of resvd rt extents use d */
xfs_log_ticket_t t_ticket; /* log mgr ticket */ struct xlog_ticket *t_ticket; /* log mgr ticket */
xfs_lsn_t t_lsn; /* log seq num of start of xfs_lsn_t t_lsn; /* log seq num of start of
* transaction. */ * transaction. */
xfs_lsn_t t_commit_lsn; /* log seq num of end of xfs_lsn_t t_commit_lsn; /* log seq num of end of
* transaction. */ * transaction. */
struct xfs_mount *t_mountp; /* ptr to fs mount struct */ struct xfs_mount *t_mountp; /* ptr to fs mount struct */
struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */ struct xfs_dquot_acct *t_dqinfo; /* acctg info for dquots */
xfs_trans_callback_t t_callback; /* transaction callback */
void *t_callarg; /* callback arg */
unsigned int t_flags; /* misc flags */ unsigned int t_flags; /* misc flags */
int64_t t_icount_delta; /* superblock icount change */ int64_t t_icount_delta; /* superblock icount change */
int64_t t_ifree_delta; /* superblock ifree change * / int64_t t_ifree_delta; /* superblock ifree change * /
int64_t t_fdblocks_delta; /* superblock fdblocks chg */ int64_t t_fdblocks_delta; /* superblock fdblocks chg */
int64_t t_res_fdblocks_delta; /* on-disk only chg */ int64_t t_res_fdblocks_delta; /* on-disk only chg */
int64_t t_frextents_delta;/* superblock freextents c hg*/ int64_t t_frextents_delta;/* superblock freextents c hg*/
int64_t t_res_frextents_delta; /* on-disk only chg * / int64_t t_res_frextents_delta; /* on-disk only chg * /
#ifdef DEBUG #ifdef DEBUG
int64_t t_ag_freeblks_delta; /* debugging counter */ int64_t t_ag_freeblks_delta; /* debugging counter */
int64_t t_ag_flist_delta; /* debugging counter */ int64_t t_ag_flist_delta; /* debugging counter */
int64_t t_ag_btree_delta; /* debugging counter */ int64_t t_ag_btree_delta; /* debugging counter */
#endif #endif
int64_t t_dblocks_delta;/* superblock dblocks change */ int64_t t_dblocks_delta;/* superblock dblocks change */
int64_t t_agcount_delta;/* superblock agcount change */ int64_t t_agcount_delta;/* superblock agcount change */
int64_t t_imaxpct_delta;/* superblock imaxpct change */ int64_t t_imaxpct_delta;/* superblock imaxpct change */
int64_t t_rextsize_delta;/* superblock rextsize chg */ int64_t t_rextsize_delta;/* superblock rextsize chg */
int64_t t_rbmblocks_delta;/* superblock rbmblocks ch g */ int64_t t_rbmblocks_delta;/* superblock rbmblocks ch g */
int64_t t_rblocks_delta;/* superblock rblocks change */ int64_t t_rblocks_delta;/* superblock rblocks change */
int64_t t_rextents_delta;/* superblocks rextents chg */ int64_t t_rextents_delta;/* superblocks rextents chg */
int64_t t_rextslog_delta;/* superblocks rextslog chg */ int64_t t_rextslog_delta;/* superblocks rextslog chg */
unsigned int t_items_free; /* log item descs free */ struct list_head t_items; /* log item descriptors */
xfs_log_item_chunk_t t_items; /* first log item desc chunk
*/
xfs_trans_header_t t_header; /* header for in-log trans * / xfs_trans_header_t t_header; /* header for in-log trans * /
unsigned int t_busy_free; /* busy descs free */ struct list_head t_busy; /* list of busy extents */
xfs_log_busy_chunk_t t_busy; /* busy/async free blocks */
unsigned long t_pflags; /* saved process flags state */ unsigned long t_pflags; /* saved process flags state */
} xfs_trans_t; } xfs_trans_t;
/* /*
* XFS transaction mechanism exported interfaces that are * XFS transaction mechanism exported interfaces that are
* actually macros. * actually macros.
*/ */
#define xfs_trans_get_log_res(tp) ((tp)->t_log_res) #define xfs_trans_get_log_res(tp) ((tp)->t_log_res)
#define xfs_trans_get_log_count(tp) ((tp)->t_log_count) #define xfs_trans_get_log_count(tp) ((tp)->t_log_count)
#define xfs_trans_get_block_res(tp) ((tp)->t_blk_res) #define xfs_trans_get_block_res(tp) ((tp)->t_blk_res)
skipping to change at line 922 skipping to change at line 448
#else #else
#define xfs_trans_agblocks_delta(tp, d) #define xfs_trans_agblocks_delta(tp, d)
#define xfs_trans_agflist_delta(tp, d) #define xfs_trans_agflist_delta(tp, d)
#define xfs_trans_agbtree_delta(tp, d) #define xfs_trans_agbtree_delta(tp, d)
#endif #endif
/* /*
* XFS transaction mechanism exported interfaces. * XFS transaction mechanism exported interfaces.
*/ */
xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint); xfs_trans_t *xfs_trans_alloc(struct xfs_mount *, uint);
xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint); xfs_trans_t *_xfs_trans_alloc(struct xfs_mount *, uint, uint);
xfs_trans_t *xfs_trans_dup(xfs_trans_t *); xfs_trans_t *xfs_trans_dup(xfs_trans_t *);
int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint, int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint,
uint, uint); uint, uint);
void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t); void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_ daddr_t, struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_ daddr_t,
int, uint); int, uint);
int xfs_trans_read_buf(struct xfs_mount *, xfs_trans_t *, int xfs_trans_read_buf(struct xfs_mount *, xfs_trans_t *,
struct xfs_buftarg *, xfs_daddr_t, int, u int, struct xfs_buftarg *, xfs_daddr_t, int, u int,
struct xfs_buf **); struct xfs_buf **);
struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int); struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int);
skipping to change at line 945 skipping to change at line 471
void xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *); void xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *); void xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *); void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_binval(xfs_trans_t *, struct xfs_buf *); void xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *, int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *,
xfs_ino_t , uint, uint, struct xfs_inode **); xfs_ino_t , uint, uint, struct xfs_inode **);
void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint); void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, i
void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); nt);
void xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *,
uint);
void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *);
void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uin t); void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uin t);
void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint) ; void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint) ;
struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
void xfs_efi_release(struct xfs_efi_log_item *, uint); void xfs_efi_release(struct xfs_efi_log_item *, uint);
void xfs_trans_log_efi_extent(xfs_trans_t *, void xfs_trans_log_efi_extent(xfs_trans_t *,
struct xfs_efi_log_item *, struct xfs_efi_log_item *,
xfs_fsblock_t, xfs_fsblock_t,
xfs_extlen_t); xfs_extlen_t);
struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *, struct xfs_efd_log_item *xfs_trans_get_efd(xfs_trans_t *,
struct xfs_efi_log_item *, struct xfs_efi_log_item *,
skipping to change at line 969 skipping to change at line 496
struct xfs_efd_log_item *, struct xfs_efd_log_item *,
xfs_fsblock_t, xfs_fsblock_t,
xfs_extlen_t); xfs_extlen_t);
int _xfs_trans_commit(xfs_trans_t *, int _xfs_trans_commit(xfs_trans_t *,
uint flags, uint flags,
int *); int *);
#define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL) #define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL)
void xfs_trans_cancel(xfs_trans_t *, int); void xfs_trans_cancel(xfs_trans_t *, int);
int xfs_trans_ail_init(struct xfs_mount *); int xfs_trans_ail_init(struct xfs_mount *);
void xfs_trans_ail_destroy(struct xfs_mount *); void xfs_trans_ail_destroy(struct xfs_mount *);
void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
xfs_lsn_t xfs_trans_tail_ail(struct xfs_mount *);
void xfs_trans_unlocked_item(struct xfs_mount *,
xfs_log_item_t *);
xfs_log_busy_slot_t *xfs_trans_add_busy(xfs_trans_t *tp,
xfs_agnumber_t ag,
xfs_extlen_t idx);
extern kmem_zone_t *xfs_trans_zone; extern kmem_zone_t *xfs_trans_zone;
extern kmem_zone_t *xfs_log_item_desc_zone;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
void xfs_trans_init(struct xfs_mount *); void xfs_trans_init(struct xfs_mount *);
int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
#endif /* __XFS_TRANS_H__ */ #endif /* __XFS_TRANS_H__ */
 End of changes. 48 change blocks. 
583 lines changed or deleted 87 lines changed or added


 xfs_trans_space.h   xfs_trans_space.h 
skipping to change at line 50 skipping to change at line 50
#define XFS_DAENTER_SPACE_RES(mp,w) \ #define XFS_DAENTER_SPACE_RES(mp,w) \
(XFS_DAENTER_BLOCKS(mp,w) + XFS_DAENTER_BMAPS(mp,w)) (XFS_DAENTER_BLOCKS(mp,w) + XFS_DAENTER_BMAPS(mp,w))
#define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w) #define XFS_DAREMOVE_SPACE_RES(mp,w) XFS_DAENTER_BMAPS(mp,w)
#define XFS_DIRENTER_MAX_SPLIT(mp,nl) 1 #define XFS_DIRENTER_MAX_SPLIT(mp,nl) 1
#define XFS_DIRENTER_SPACE_RES(mp,nl) \ #define XFS_DIRENTER_SPACE_RES(mp,nl) \
(XFS_DAENTER_SPACE_RES(mp, XFS_DATA_FORK) * \ (XFS_DAENTER_SPACE_RES(mp, XFS_DATA_FORK) * \
XFS_DIRENTER_MAX_SPLIT(mp,nl)) XFS_DIRENTER_MAX_SPLIT(mp,nl))
#define XFS_DIRREMOVE_SPACE_RES(mp) \ #define XFS_DIRREMOVE_SPACE_RES(mp) \
XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK) XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
#define XFS_IALLOC_SPACE_RES(mp) \ #define XFS_IALLOC_SPACE_RES(mp) \
(XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp)-1) (XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels - 1)
/* /*
* Space reservation values for various transactions. * Space reservation values for various transactions.
*/ */
#define XFS_ADDAFORK_SPACE_RES(mp) \ #define XFS_ADDAFORK_SPACE_RES(mp) \
((mp)->m_dirblkfsbs + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK)) ((mp)->m_dirblkfsbs + XFS_DAENTER_BMAP1B(mp, XFS_DATA_FORK))
#define XFS_ATTRRM_SPACE_RES(mp) \ #define XFS_ATTRRM_SPACE_RES(mp) \
XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK) XFS_DAREMOVE_SPACE_RES(mp, XFS_ATTR_FORK)
/* This macro is not used - see inline code in xfs_attr_set */ /* This macro is not used - see inline code in xfs_attr_set */
#define XFS_ATTRSET_SPACE_RES(mp, v) \ #define XFS_ATTRSET_SPACE_RES(mp, v) \
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 xfs_types.h   xfs_types.h 
skipping to change at line 24 skipping to change at line 24
* 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__ #ifdef __KERNEL__
/* /*
* POSIX Extensions
*/
typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned int uint_t;
typedef unsigned long ulong_t;
/*
* Additional type declarations for XFS * Additional type declarations for XFS
*/ */
typedef signed char __int8_t; typedef signed char __int8_t;
typedef unsigned char __uint8_t; typedef unsigned char __uint8_t;
typedef signed short int __int16_t; typedef signed short int __int16_t;
typedef unsigned short int __uint16_t; typedef unsigned short int __uint16_t;
typedef signed int __int32_t; typedef signed int __int32_t;
typedef unsigned int __uint32_t; typedef unsigned int __uint32_t;
typedef signed long long int __int64_t; typedef signed long long int __int64_t;
typedef unsigned long long int __uint64_t; typedef unsigned long long int __uint64_t;
typedef enum { B_FALSE,B_TRUE } boolean_t; typedef enum { B_FALSE,B_TRUE } boolean_t;
typedef __uint32_t prid_t; /* project ID */ typedef __uint32_t prid_t; /* project ID */
typedef __uint32_t inst_t; /* an instruction */ typedef __uint32_t inst_t; /* an instruction */
typedef __s64 xfs_off_t; /* <file offset> type */ typedef __s64 xfs_off_t; /* <file offset> type */
typedef __u64 xfs_ino_t; /* <inode> type */ typedef unsigned long long xfs_ino_t; /* <inode> type */
typedef __s64 xfs_daddr_t; /* <disk address> type */ typedef __s64 xfs_daddr_t; /* <disk address> type */
typedef char * xfs_caddr_t; /* <core address> type */ typedef char * xfs_caddr_t; /* <core address> type */
typedef __u32 xfs_dev_t; typedef __u32 xfs_dev_t;
typedef __u32 xfs_nlink_t; typedef __u32 xfs_nlink_t;
/* __psint_t is the same size as a pointer */ /* __psint_t is the same size as a pointer */
#if (BITS_PER_LONG == 32) #if (BITS_PER_LONG == 32)
typedef __int32_t __psint_t; typedef __int32_t __psint_t;
typedef __uint32_t __psunsigned_t; typedef __uint32_t __psunsigned_t;
#elif (BITS_PER_LONG == 64) #elif (BITS_PER_LONG == 64)
skipping to change at line 84 skipping to change at line 76
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 112 skipping to change at line 106
#else #else
typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (ag no|agbno) */ typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (ag no|agbno) */
typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area * / typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area * /
typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtb lock_t */ typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtb lock_t */
#endif #endif
typedef __uint64_t xfs_fileoff_t; /* block number in a file */ typedef __uint64_t xfs_fileoff_t; /* block number in a file */
typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
/* /*
* Null values for the types. * Null values for the types.
*/ */
#define NULLDFSBNO ((xfs_dfsbno_t)-1) #define NULLDFSBNO ((xfs_dfsbno_t)-1)
#define NULLDRFSBNO ((xfs_drfsbno_t)-1) #define NULLDRFSBNO ((xfs_drfsbno_t)-1)
#define NULLDRTBNO ((xfs_drtbno_t)-1) #define NULLDRTBNO ((xfs_drtbno_t)-1)
#define NULLDFILOFF ((xfs_dfiloff_t)-1) #define NULLDFILOFF ((xfs_dfiloff_t)-1)
#define NULLFSBLOCK ((xfs_fsblock_t)-1) #define NULLFSBLOCK ((xfs_fsblock_t)-1)
#define NULLRFSBLOCK ((xfs_rfsblock_t)-1) #define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
skipping to change at line 162 skipping to change at line 154
typedef enum { typedef enum {
XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi XFS_LOOKUP_EQi, XFS_LOOKUP_LEi, XFS_LOOKUP_GEi
} 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 char *name; const unsigned char *name;
int len; int len;
}; };
#endif /* __XFS_TYPES_H__ */ #endif /* __XFS_TYPES_H__ */
 End of changes. 5 change blocks. 
13 lines changed or deleted 5 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/