| libxfs.h | | libxfs.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| #include <xfs/list.h> | | #include <xfs/list.h> | |
| #include <xfs/hlist.h> | | #include <xfs/hlist.h> | |
| #include <xfs/cache.h> | | #include <xfs/cache.h> | |
| #include <xfs/bitops.h> | | #include <xfs/bitops.h> | |
| #include <xfs/kmem.h> | | #include <xfs/kmem.h> | |
| #include <xfs/radix-tree.h> | | #include <xfs/radix-tree.h> | |
| #include <xfs/swab.h> | | #include <xfs/swab.h> | |
| #include <xfs/atomic.h> | | #include <xfs/atomic.h> | |
| | | | |
|
| #include <xfs/xfs_fs.h> | | | |
| #include <xfs/xfs_types.h> | | #include <xfs/xfs_types.h> | |
|
| | | #include <xfs/xfs_fs.h> | |
| #include <xfs/xfs_arch.h> | | #include <xfs/xfs_arch.h> | |
|
| | | | |
| | | #include <xfs/xfs_shared.h> | |
| | | #include <xfs/xfs_format.h> | |
| | | #include <xfs/xfs_log_format.h> | |
| | | #include <xfs/xfs_quota_defs.h> | |
| | | #include <xfs/xfs_trans_resv.h> | |
| | | | |
| #include <xfs/xfs_bit.h> | | #include <xfs/xfs_bit.h> | |
| #include <xfs/xfs_inum.h> | | #include <xfs/xfs_inum.h> | |
| #include <xfs/xfs_sb.h> | | #include <xfs/xfs_sb.h> | |
| #include <xfs/xfs_ag.h> | | #include <xfs/xfs_ag.h> | |
|
| #include <xfs/xfs_dir2.h> | | | |
| #include <xfs/xfs_mount.h> | | | |
| #include <xfs/xfs_da_btree.h> | | | |
| #include <xfs/xfs_bmap_btree.h> | | #include <xfs/xfs_bmap_btree.h> | |
| #include <xfs/xfs_alloc_btree.h> | | #include <xfs/xfs_alloc_btree.h> | |
| #include <xfs/xfs_ialloc_btree.h> | | #include <xfs/xfs_ialloc_btree.h> | |
|
| #include <xfs/xfs_dir_sf.h> | | | |
| #include <xfs/xfs_dir2_sf.h> | | | |
| #include <xfs/xfs_attr_sf.h> | | #include <xfs/xfs_attr_sf.h> | |
| #include <xfs/xfs_dinode.h> | | #include <xfs/xfs_dinode.h> | |
|
| #include <xfs/xfs_inode.h> | | #include <xfs/xfs_inode_fork.h> | |
| #include <xfs/xfs_buf_item.h> | | #include <xfs/xfs_inode_buf.h> | |
| #include <xfs/xfs_inode_item.h> | | | |
| #include <xfs/xfs_alloc.h> | | #include <xfs/xfs_alloc.h> | |
| #include <xfs/xfs_btree.h> | | #include <xfs/xfs_btree.h> | |
| #include <xfs/xfs_btree_trace.h> | | #include <xfs/xfs_btree_trace.h> | |
| #include <xfs/xfs_bmap.h> | | #include <xfs/xfs_bmap.h> | |
| #include <xfs/xfs_trace.h> | | #include <xfs/xfs_trace.h> | |
| | | | |
| #ifndef ARRAY_SIZE | | #ifndef ARRAY_SIZE | |
| #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 112 | |
| /* (blocks allocated for use as | | /* (blocks allocated for use as | |
| * log is stored in mount structure)
*/ | | * log is stored in mount structure)
*/ | |
| long long logBBstart; /* start block of log subvolume (BBs
) */ | | long long logBBstart; /* start block of log subvolume (BBs
) */ | |
| long long rtsize; /* size of realtime subvolume (BBs)
*/ | | long long rtsize; /* size of realtime subvolume (BBs)
*/ | |
| int dbsize; /* data subvolume device blksize */ | | int dbsize; /* data subvolume device blksize */ | |
| int lbsize; /* log subvolume device blksize */ | | int lbsize; /* log subvolume device blksize */ | |
| int rtbsize; /* realtime subvolume device blksize
*/ | | int rtbsize; /* realtime subvolume device blksize
*/ | |
| int dfd; /* data subvolume file descriptor */ | | int dfd; /* data subvolume file descriptor */ | |
| int logfd; /* log subvolume file descriptor */ | | int logfd; /* log subvolume file descriptor */ | |
| int rtfd; /* realtime subvolume file descripto
r */ | | int rtfd; /* realtime subvolume file descripto
r */ | |
|
| | | int icache_flags; /* cache init flags */ | |
| | | int bcache_flags; /* cache init flags */ | |
| } libxfs_init_t; | | } libxfs_init_t; | |
| | | | |
| #define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails
*/ | | #define LIBXFS_EXIT_ON_FAILURE 0x0001 /* exit the program if a call fails
*/ | |
| #define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems
*/ | | #define LIBXFS_ISREADONLY 0x0002 /* disallow all mounted filesystems
*/ | |
| #define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro
*/ | | #define LIBXFS_ISINACTIVE 0x0004 /* allow mounted only if mounted ro
*/ | |
| #define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro
*/ | | #define LIBXFS_DANGEROUSLY 0x0008 /* repairing a device mounted ro
*/ | |
| #define LIBXFS_EXCLUSIVELY 0x0010 /* disallow other accesses (O_EXCL)
*/ | | #define LIBXFS_EXCLUSIVELY 0x0010 /* disallow other accesses (O_EXCL)
*/ | |
| #define LIBXFS_DIRECT 0x0020 /* can use direct I/O, not buffered
*/ | | #define LIBXFS_DIRECT 0x0020 /* can use direct I/O, not buffered
*/ | |
| | | | |
|
| | | /* | |
| | | * IO verifier callbacks need the xfs_mount pointer, so we have to behave | |
| | | * somewhat like the kernel now for userspace IO in terms of having buftarg | |
| | | * based devices... | |
| | | */ | |
| | | struct xfs_buftarg { | |
| | | struct xfs_mount *bt_mount; | |
| | | dev_t dev; | |
| | | }; | |
| | | | |
| | | extern void libxfs_buftarg_init(struct xfs_mount *mp, dev_t ddev, | |
| | | dev_t logdev, dev_t rtdev); | |
| | | | |
| extern char *progname; | | extern char *progname; | |
| extern int libxfs_init (libxfs_init_t *); | | extern int libxfs_init (libxfs_init_t *); | |
| extern void libxfs_destroy (void); | | extern void libxfs_destroy (void); | |
| extern int libxfs_device_to_fd (dev_t); | | extern int libxfs_device_to_fd (dev_t); | |
| extern dev_t libxfs_device_open (char *, int, int, int); | | extern dev_t libxfs_device_open (char *, int, int, int); | |
|
| extern void libxfs_device_zero (dev_t, xfs_daddr_t, uint); | | extern void libxfs_device_zero(struct xfs_buftarg *, xfs_daddr_t, uint); | |
| extern void libxfs_device_close (dev_t); | | extern void libxfs_device_close (dev_t); | |
| extern int libxfs_device_alignment (void); | | extern int libxfs_device_alignment (void); | |
| extern void libxfs_report(FILE *); | | extern void libxfs_report(FILE *); | |
| extern void platform_findsizes(char *path, int fd, long long *sz, int *b
sz); | | extern void platform_findsizes(char *path, int fd, long long *sz, int *b
sz); | |
|
| | | extern int platform_nproc(void); | |
| | | | |
| /* check or write log footer: specify device, log size in blocks & uuid */ | | /* check or write log footer: specify device, log size in blocks & uuid */ | |
| typedef xfs_caddr_t (libxfs_get_block_t)(xfs_caddr_t, int, void *); | | typedef xfs_caddr_t (libxfs_get_block_t)(xfs_caddr_t, int, void *); | |
| | | | |
|
| extern int libxfs_log_clear (dev_t, xfs_daddr_t, uint, uuid_t *, | | extern int libxfs_log_clear (struct xfs_buftarg *, xfs_daddr_t, uint, | |
| int, int, int); | | uuid_t *, int, int, int); | |
| extern int libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int, | | extern int libxfs_log_header (xfs_caddr_t, uuid_t *, int, int, int, | |
| libxfs_get_block_t *, void *); | | libxfs_get_block_t *, void *); | |
| | | | |
| /* | | /* | |
| * Define a user-level mount structure with all we need | | * Define a user-level mount structure with all we need | |
| * in order to make use of the numerous XFS_* macros. | | * in order to make use of the numerous XFS_* macros. | |
| */ | | */ | |
| typedef struct xfs_mount { | | typedef struct xfs_mount { | |
| xfs_sb_t m_sb; /* copy of fs superblock */ | | xfs_sb_t m_sb; /* copy of fs superblock */ | |
| char *m_fsname; /* filesystem name */ | | char *m_fsname; /* filesystem name */ | |
| int m_bsize; /* fs logical block size */ | | int m_bsize; /* fs logical block size */ | |
| xfs_agnumber_t m_agfrotor; /* last ag where space found
*/ | | xfs_agnumber_t m_agfrotor; /* last ag where space found
*/ | |
| xfs_agnumber_t m_agirotor; /* last ag dir inode alloced
*/ | | xfs_agnumber_t m_agirotor; /* last ag dir inode alloced
*/ | |
| xfs_agnumber_t m_maxagi; /* highest inode alloc group
*/ | | xfs_agnumber_t m_maxagi; /* highest inode alloc group
*/ | |
| uint m_rsumlevels; /* rt summary levels */ | | uint m_rsumlevels; /* rt summary levels */ | |
| uint m_rsumsize; /* size of rt summary, bytes
*/ | | uint m_rsumsize; /* size of rt summary, bytes
*/ | |
| struct xfs_inode *m_rbmip; /* pointer to bitmap inode *
/ | | struct xfs_inode *m_rbmip; /* pointer to bitmap inode *
/ | |
| struct xfs_inode *m_rsumip; /* pointer to summary inode
*/ | | struct xfs_inode *m_rsumip; /* pointer to summary inode
*/ | |
|
| struct xfs_inode *m_rootip; /* pointer to root directory | | struct xfs_buftarg *m_ddev_targp; | |
| */ | | struct xfs_buftarg *m_logdev_targp; | |
| dev_t m_dev; | | struct xfs_buftarg *m_rtdev_targp; | |
| dev_t m_logdev; | | #define m_dev m_ddev_targp | |
| dev_t m_rtdev; | | #define m_logdev m_logdev_targp | |
| | | #define m_rtdev m_rtdev_targp | |
| __uint8_t m_dircook_elog; /* log d-cookie entry bits *
/ | | __uint8_t m_dircook_elog; /* log d-cookie entry bits *
/ | |
| __uint8_t m_blkbit_log; /* blocklog + NBBY */ | | __uint8_t m_blkbit_log; /* blocklog + NBBY */ | |
| __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ | | __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ | |
| __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */ | | __uint8_t m_sectbb_log; /* sectorlog - BBSHIFT */ | |
| __uint8_t m_agno_log; /* log #ag's */ | | __uint8_t m_agno_log; /* log #ag's */ | |
| __uint8_t m_agino_log; /* #bits for agino in inum *
/ | | __uint8_t m_agino_log; /* #bits for agino in inum *
/ | |
|
| __uint16_t m_inode_cluster_size;/* min inode buf size *
/ | | uint m_inode_cluster_size;/* min inode buf size *
/ | |
| uint m_blockmask; /* sb_blocksize-1 */ | | uint m_blockmask; /* sb_blocksize-1 */ | |
| uint m_blockwsize; /* sb_blocksize in words */ | | uint m_blockwsize; /* sb_blocksize in words */ | |
| uint m_blockwmask; /* blockwsize-1 */ | | uint m_blockwmask; /* blockwsize-1 */ | |
| uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS *
/ | | uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS *
/ | |
| uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS *
/ | | uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS *
/ | |
| uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS *
/ | | uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS *
/ | |
| uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS *
/ | | uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS *
/ | |
| uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS *
/ | | uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS *
/ | |
| uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS *
/ | | uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS *
/ | |
| uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ | | uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ | |
| | | | |
| skipping to change at line 187 | | skipping to change at line 206 | |
| struct radix_tree_root m_perag_tree; | | struct radix_tree_root m_perag_tree; | |
| uint m_flags; /* global mount flags */ | | uint m_flags; /* global mount flags */ | |
| uint m_qflags; /* quota status flags */ | | uint m_qflags; /* quota status flags */ | |
| uint m_attroffset; /* inode attribute offset */ | | uint m_attroffset; /* inode attribute offset */ | |
| uint m_dir_node_ents; /* #entries in a dir danode
*/ | | uint m_dir_node_ents; /* #entries in a dir danode
*/ | |
| uint m_attr_node_ents; /* #entries in attr danode
*/ | | uint m_attr_node_ents; /* #entries in attr danode
*/ | |
| int m_ialloc_inos; /* inodes in inode allocatio
n */ | | int m_ialloc_inos; /* inodes in inode allocatio
n */ | |
| int m_ialloc_blks; /* blocks in inode allocatio
n */ | | int m_ialloc_blks; /* blocks in inode allocatio
n */ | |
| int m_litino; /* size of inode union area
*/ | | int m_litino; /* size of inode union area
*/ | |
| int m_inoalign_mask;/* mask sb_inoalignmt if use
d */ | | int m_inoalign_mask;/* mask sb_inoalignmt if use
d */ | |
|
| xfs_trans_reservations_t m_reservations;/* precomputed res values */ | | struct xfs_trans_resv m_resv; /* precomputed res values */ | |
| __uint64_t m_maxicount; /* maximum inode count */ | | __uint64_t m_maxicount; /* maximum inode count */ | |
| int m_dalign; /* stripe unit */ | | int m_dalign; /* stripe unit */ | |
| int m_swidth; /* stripe width */ | | int m_swidth; /* stripe width */ | |
| int m_sinoalign; /* stripe unit inode alignmn
t */ | | int m_sinoalign; /* stripe unit inode alignmn
t */ | |
| int m_attr_magicpct;/* 37% of the blocksize */ | | int m_attr_magicpct;/* 37% of the blocksize */ | |
| int m_dir_magicpct; /* 37% of the dir blocksize
*/ | | int m_dir_magicpct; /* 37% of the dir blocksize
*/ | |
| const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */ | | const struct xfs_nameops *m_dirnameops; /* vector of dir name ops */ | |
| int m_dirblksize; /* directory block sz--bytes
*/ | | int m_dirblksize; /* directory block sz--bytes
*/ | |
| int m_dirblkfsbs; /* directory block sz--fsbs
*/ | | int m_dirblkfsbs; /* directory block sz--fsbs
*/ | |
| xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ | | xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ | |
| xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v
2 */ | | xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v
2 */ | |
| xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v
2 */ | | xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v
2 */ | |
|
| | | | |
| | | /* | |
| | | * anonymous struct to allow xfs_dquot_buf.c to compile. | |
| | | * Pointer is always null in userspace, so code does not use it at a | |
| | | ll | |
| | | */ | |
| | | struct { | |
| | | int qi_dqperchunk; | |
| | | } *m_quotainfo; | |
| | | | |
| } xfs_mount_t; | | } xfs_mount_t; | |
| | | | |
|
| #define LIBXFS_MOUNT_ROOTINOS 0x0001 | | /* | |
| #define LIBXFS_MOUNT_DEBUGGER 0x0002 | | * Per-ag incore structure, copies of information in agf and agi, | |
| #define LIBXFS_MOUNT_32BITINODES 0x0004 | | * to improve the performance of allocation group selection. | |
| #define LIBXFS_MOUNT_32BITINOOPT 0x0008 | | */ | |
| #define LIBXFS_MOUNT_COMPAT_ATTR 0x0010 | | typedef struct xfs_perag { | |
| #define LIBXFS_MOUNT_ATTR2 0x0020 | | struct xfs_mount *pag_mount; /* owner filesystem */ | |
| | | xfs_agnumber_t pag_agno; /* AG this structure belongs to */ | |
| | | atomic_t pag_ref; /* perag reference count */ | |
| | | char pagf_init; /* this agf's entry is initialized * | |
| | | / | |
| | | char pagi_init; /* this agi's entry is initialized * | |
| | | / | |
| | | char pagf_metadata; /* the agf is preferred to be metada | |
| | | ta */ | |
| | | char pagi_inodeok; /* The agi is ok for inodes */ | |
| | | __uint8_t pagf_levels[XFS_BTNUM_AGF]; | |
| | | /* # of levels in bno & cnt btree */ | |
| | | __uint32_t pagf_flcount; /* count of blocks in freelist */ | |
| | | xfs_extlen_t pagf_freeblks; /* total free blocks */ | |
| | | xfs_extlen_t pagf_longest; /* longest free space */ | |
| | | __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */ | |
| | | xfs_agino_t pagi_freecount; /* number of free inodes */ | |
| | | xfs_agino_t pagi_count; /* number of allocated inodes */ | |
| | | | |
| | | /* | |
| | | * Inode allocation search lookup optimisation. | |
| | | * If the pagino matches, the search for new inodes | |
| | | * doesn't need to search the near ones again straight away | |
| | | */ | |
| | | xfs_agino_t pagl_pagino; | |
| | | xfs_agino_t pagl_leftrec; | |
| | | xfs_agino_t pagl_rightrec; | |
| | | int pagb_count; /* pagb slots in use */ | |
| | | } xfs_perag_t; | |
| | | | |
| | | #define LIBXFS_MOUNT_DEBUGGER 0x0001 | |
| | | #define LIBXFS_MOUNT_32BITINODES 0x0002 | |
| | | #define LIBXFS_MOUNT_32BITINOOPT 0x0004 | |
| | | #define LIBXFS_MOUNT_COMPAT_ATTR 0x0008 | |
| | | #define LIBXFS_MOUNT_ATTR2 0x0010 | |
| | | | |
|
| #define LIBXFS_IHASHSIZE(sbp) (1<<10) | | | |
| #define LIBXFS_BHASHSIZE(sbp) (1<<10) | | #define LIBXFS_BHASHSIZE(sbp) (1<<10) | |
| | | | |
| extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, | | extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, | |
| dev_t, dev_t, dev_t, int); | | dev_t, dev_t, dev_t, int); | |
| extern void libxfs_umount (xfs_mount_t *); | | extern void libxfs_umount (xfs_mount_t *); | |
| extern void libxfs_rtmount_destroy (xfs_mount_t *); | | extern void libxfs_rtmount_destroy (xfs_mount_t *); | |
| | | | |
| /* | | /* | |
|
| | | * xfs/xfs_da_format.h needs struct xfs_mount to be defined | |
| | | */ | |
| | | #include <xfs/xfs_da_format.h> | |
| | | #include <xfs/xfs_da_btree.h> | |
| | | #include <xfs/xfs_dir2.h> | |
| | | | |
| | | /* | |
| * Simple I/O interface | | * Simple I/O interface | |
| */ | | */ | |
|
| | | #define XB_PAGES 2 | |
| | | | |
| | | struct xfs_buf_map { | |
| | | xfs_daddr_t bm_bn; /* block number for I/O */ | |
| | | int bm_len; /* size of I/O */ | |
| | | }; | |
| | | | |
| | | #define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk) \ | |
| | | struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) }; | |
| | | | |
| | | struct xfs_buf_ops { | |
| | | void (*verify_read)(struct xfs_buf *); | |
| | | void (*verify_write)(struct xfs_buf *); | |
| | | }; | |
| | | | |
| typedef struct xfs_buf { | | typedef struct xfs_buf { | |
| struct cache_node b_node; | | struct cache_node b_node; | |
| unsigned int b_flags; | | unsigned int b_flags; | |
|
| xfs_daddr_t b_blkno; | | xfs_daddr_t b_bn; | |
| unsigned b_bcount; | | unsigned b_bcount; | |
|
| dev_t b_dev; | | unsigned int b_length; | |
| | | struct xfs_buftarg *b_target; | |
| | | #define b_dev b_target->dev | |
| pthread_mutex_t b_lock; | | pthread_mutex_t b_lock; | |
| pthread_t b_holder; | | pthread_t b_holder; | |
| unsigned int b_recur; | | unsigned int b_recur; | |
|
| void *b_fsprivate; | | void *b_fspriv; | |
| void *b_fsprivate2; | | void *b_fsprivate2; | |
| void *b_fsprivate3; | | void *b_fsprivate3; | |
|
| char *b_addr; | | void *b_addr; | |
| int b_error; | | int b_error; | |
|
| | | const struct xfs_buf_ops *b_ops; | |
| | | struct xfs_perag *b_pag; | |
| | | struct xfs_buf_map *b_map; | |
| | | int b_nmaps; | |
| #ifdef XFS_BUF_TRACING | | #ifdef XFS_BUF_TRACING | |
| struct list_head b_lock_list; | | struct list_head b_lock_list; | |
| const char *b_func; | | const char *b_func; | |
| const char *b_file; | | const char *b_file; | |
| int b_line; | | int b_line; | |
| #endif | | #endif | |
| } xfs_buf_t; | | } xfs_buf_t; | |
| | | | |
| enum xfs_buf_flags_t { /* b_flags bits */ | | enum xfs_buf_flags_t { /* b_flags bits */ | |
| LIBXFS_B_EXIT = 0x0001, /* ==LIBXFS_EXIT_ON_FAILURE
*/ | | LIBXFS_B_EXIT = 0x0001, /* ==LIBXFS_EXIT_ON_FAILURE
*/ | |
| LIBXFS_B_DIRTY = 0x0002, /* buffer has been modified
*/ | | LIBXFS_B_DIRTY = 0x0002, /* buffer has been modified
*/ | |
| LIBXFS_B_STALE = 0x0004, /* buffer marked as invalid
*/ | | LIBXFS_B_STALE = 0x0004, /* buffer marked as invalid
*/ | |
|
| LIBXFS_B_UPTODATE = 0x0008 /* buffer is sync'd to disk | | LIBXFS_B_UPTODATE = 0x0008, /* buffer is sync'd to disk | |
| */ | | */ | |
| | | LIBXFS_B_DISCONTIG = 0x0010, /* discontiguous buffer */ | |
| | | LIBXFS_B_UNCHECKED = 0x0020, /* needs verification */ | |
| }; | | }; | |
| | | | |
|
| #define XFS_BUF_PTR(bp) ((bp)->b_addr) | | #define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL)) | |
| | | | |
| | | #define XFS_BUF_PTR(bp) ((char *)(bp)->b_addr) | |
| #define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset)) | | #define xfs_buf_offset(bp, offset) (XFS_BUF_PTR(bp) + (offset)) | |
|
| #define XFS_BUF_ADDR(bp) ((bp)->b_blkno) | | #define XFS_BUF_ADDR(bp) ((bp)->b_bn) | |
| #define XFS_BUF_SIZE(bp) ((bp)->b_bcount) | | #define XFS_BUF_SIZE(bp) ((bp)->b_bcount) | |
| #define XFS_BUF_COUNT(bp) ((bp)->b_bcount) | | #define XFS_BUF_COUNT(bp) ((bp)->b_bcount) | |
| #define XFS_BUF_TARGET(bp) ((bp)->b_dev) | | #define XFS_BUF_TARGET(bp) ((bp)->b_dev) | |
| #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \ | | #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \ | |
| (bp)->b_addr = (char *)(p); \ | | (bp)->b_addr = (char *)(p); \ | |
| XFS_BUF_SET_COUNT(bp,cnt); \ | | XFS_BUF_SET_COUNT(bp,cnt); \ | |
| }) | | }) | |
| | | | |
|
| #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_blkno = (blk)) | | #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_bn = (blk)) | |
| #define XFS_BUF_SET_COUNT(bp,cnt) ((bp)->b_bcount = (cnt)) | | #define XFS_BUF_SET_COUNT(bp,cnt) ((bp)->b_bcount = (cnt)) | |
| | | | |
|
| #define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fsprivate) | | #define XFS_BUF_FSPRIVATE(bp,type) ((type)(bp)->b_fspriv) | |
| #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fsprivate = (void *)(val) | | #define XFS_BUF_SET_FSPRIVATE(bp,val) (bp)->b_fspriv = (void *)(val) | |
| #define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2) | | #define XFS_BUF_FSPRIVATE2(bp,type) ((type)(bp)->b_fsprivate2) | |
| #define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val) | | #define XFS_BUF_SET_FSPRIVATE2(bp,val) (bp)->b_fsprivate2 = (void *)(val) | |
| #define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3) | | #define XFS_BUF_FSPRIVATE3(bp,type) ((type)(bp)->b_fsprivate3) | |
| #define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val) | | #define XFS_BUF_SET_FSPRIVATE3(bp,val) (bp)->b_fsprivate3 = (void *)(val) | |
| | | | |
| #define XFS_BUF_SET_PRIORITY(bp,pri) cache_node_set_priority( \ | | #define XFS_BUF_SET_PRIORITY(bp,pri) cache_node_set_priority( \ | |
| libxfs_bcache, \ | | libxfs_bcache, \ | |
| (struct cache_node *)(bp), \ | | (struct cache_node *)(bp), \ | |
| (pri)) | | (pri)) | |
| #define XFS_BUF_PRIORITY(bp) (cache_node_get_priority( \ | | #define XFS_BUF_PRIORITY(bp) (cache_node_get_priority( \ | |
| (struct cache_node *)(bp))) | | (struct cache_node *)(bp))) | |
|
| | | #define xfs_buf_set_ref(bp,ref) ((void) 0) | |
| | | #define xfs_buf_ioerror(bp,err) ((bp)->b_error = (err)) | |
| | | | |
| | | #define xfs_daddr_to_agno(mp,d) \ | |
| | | ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) | |
| | | #define xfs_daddr_to_agbno(mp,d) \ | |
| | | ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) | |
| | | | |
| /* Buffer Cache Interfaces */ | | /* Buffer Cache Interfaces */ | |
| | | | |
| extern struct cache *libxfs_bcache; | | extern struct cache *libxfs_bcache; | |
| extern struct cache_operations libxfs_bcache_operations; | | extern struct cache_operations libxfs_bcache_operations; | |
| | | | |
| #define LIBXFS_GETBUF_TRYLOCK (1 << 0) | | #define LIBXFS_GETBUF_TRYLOCK (1 << 0) | |
| | | | |
| #ifdef XFS_BUF_TRACING | | #ifdef XFS_BUF_TRACING | |
| | | | |
|
| #define libxfs_readbuf(dev, daddr, len, flags) \ | | #define libxfs_readbuf(dev, daddr, len, flags, ops) \ | |
| libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ | | libxfs_trace_readbuf(__FUNCTION__, __FILE__, __LINE__, \ | |
|
| (dev), (daddr), (len), (flags)) | | (dev), (daddr), (len), (flags), (ops)) | |
| | | #define libxfs_readbuf_map(dev, map, nmaps, flags, ops) \ | |
| | | libxfs_trace_readbuf_map(__FUNCTION__, __FILE__, __LINE__, \ | |
| | | (dev), (map), (nmaps), (flags), (ops)) | |
| #define libxfs_writebuf(buf, flags) \ | | #define libxfs_writebuf(buf, flags) \ | |
| libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ | | libxfs_trace_writebuf(__FUNCTION__, __FILE__, __LINE__, \ | |
| (buf), (flags)) | | (buf), (flags)) | |
| #define libxfs_getbuf(dev, daddr, len) \ | | #define libxfs_getbuf(dev, daddr, len) \ | |
| libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ | | libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ | |
| (dev), (daddr), (len)) | | (dev), (daddr), (len)) | |
|
| | | #define libxfs_getbuf_map(dev, map, nmaps, flags) \ | |
| | | libxfs_trace_getbuf_map(__FUNCTION__, __FILE__, __LINE__, \ | |
| | | (dev), (map), (nmaps), (flags)) | |
| #define libxfs_getbuf_flags(dev, daddr, len, flags) \ | | #define libxfs_getbuf_flags(dev, daddr, len, flags) \ | |
|
| libxfs_trace_getbuf(__FUNCTION__, __FILE__, __LINE__, \ | | libxfs_trace_getbuf_flags(__FUNCTION__, __FILE__, __LINE__, \ | |
| (dev), (daddr), (len), (flags)) | | (dev), (daddr), (len), (flags)) | |
| #define libxfs_putbuf(buf) \ | | #define libxfs_putbuf(buf) \ | |
| libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) | | libxfs_trace_putbuf(__FUNCTION__, __FILE__, __LINE__, (buf)) | |
| | | | |
| extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, | | extern xfs_buf_t *libxfs_trace_readbuf(const char *, const char *, int, | |
|
| dev_t, xfs_daddr_t, int, int); | | struct xfs_buftarg *, xfs_daddr_t, int, int, | |
| | | const struct xfs_buf_ops *); | |
| | | extern xfs_buf_t *libxfs_trace_readbuf_map(const char *, const char *, int, | |
| | | struct xfs_buftarg *, struct xfs_buf_map *, int, int | |
| | | , | |
| | | const struct xfs_buf_ops *); | |
| extern int libxfs_trace_writebuf(const char *, const char *, int, | | extern int libxfs_trace_writebuf(const char *, const char *, int, | |
| xfs_buf_t *, int); | | xfs_buf_t *, int); | |
|
| extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int, dev_ | | extern xfs_buf_t *libxfs_trace_getbuf(const char *, const char *, int, | |
| t, xfs_daddr_t, int); | | struct xfs_buftarg *, xfs_daddr_t, int); | |
| | | extern xfs_buf_t *libxfs_trace_getbuf_map(const char *, const char *, int, | |
| | | struct xfs_buftarg *, struct xfs_buf_map *, int, int | |
| | | ); | |
| extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int
, | | extern xfs_buf_t *libxfs_trace_getbuf_flags(const char *, const char *, int
, | |
|
| dev_t, xfs_daddr_t, int, unsigned int); | | struct xfs_buftarg *, xfs_daddr_t, int, unsigned int
); | |
| extern void libxfs_trace_putbuf (const char *, const char *, int, | | extern void libxfs_trace_putbuf (const char *, const char *, int, | |
| xfs_buf_t *); | | xfs_buf_t *); | |
| | | | |
| #else | | #else | |
| | | | |
|
| extern xfs_buf_t *libxfs_readbuf(dev_t, xfs_daddr_t, int, int); | | extern xfs_buf_t *libxfs_readbuf(struct xfs_buftarg *, xfs_daddr_t, int, in | |
| | | t, | |
| | | const struct xfs_buf_ops *); | |
| | | extern xfs_buf_t *libxfs_readbuf_map(struct xfs_buftarg *, struct xfs_buf_m | |
| | | ap *, | |
| | | int, int, const struct xfs_buf_ops *); | |
| extern int libxfs_writebuf(xfs_buf_t *, int); | | extern int libxfs_writebuf(xfs_buf_t *, int); | |
|
| extern xfs_buf_t *libxfs_getbuf(dev_t, xfs_daddr_t, int); | | extern xfs_buf_t *libxfs_getbuf(struct xfs_buftarg *, xfs_daddr_t, int); | |
| extern xfs_buf_t *libxfs_getbuf_flags(dev_t, xfs_daddr_t, int, unsigned int | | extern xfs_buf_t *libxfs_getbuf_map(struct xfs_buftarg *, | |
| ); | | struct xfs_buf_map *, int, int); | |
| | | extern xfs_buf_t *libxfs_getbuf_flags(struct xfs_buftarg *, xfs_daddr_t, | |
| | | int, unsigned int); | |
| extern void libxfs_putbuf (xfs_buf_t *); | | extern void libxfs_putbuf (xfs_buf_t *); | |
| | | | |
| #endif | | #endif | |
| | | | |
|
| | | extern void libxfs_readbuf_verify(struct xfs_buf *bp, | |
| | | const struct xfs_buf_ops *ops); | |
| extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int); | | extern xfs_buf_t *libxfs_getsb(xfs_mount_t *, int); | |
| extern void libxfs_bcache_purge(void); | | extern void libxfs_bcache_purge(void); | |
| extern void libxfs_bcache_flush(void); | | extern void libxfs_bcache_flush(void); | |
| extern void libxfs_purgebuf(xfs_buf_t *); | | extern void libxfs_purgebuf(xfs_buf_t *); | |
| extern int libxfs_bcache_overflowed(void); | | extern int libxfs_bcache_overflowed(void); | |
| extern int libxfs_bcache_usage(void); | | extern int libxfs_bcache_usage(void); | |
| | | | |
| /* Buffer (Raw) Interfaces */ | | /* Buffer (Raw) Interfaces */ | |
|
| extern xfs_buf_t *libxfs_getbufr(dev_t, xfs_daddr_t, int); | | extern xfs_buf_t *libxfs_getbufr(struct xfs_buftarg *, xfs_daddr_t, int); | |
| extern void libxfs_putbufr(xfs_buf_t *); | | extern void libxfs_putbufr(xfs_buf_t *); | |
| | | | |
| extern int libxfs_writebuf_int(xfs_buf_t *, int); | | extern int libxfs_writebuf_int(xfs_buf_t *, int); | |
|
| extern int libxfs_readbufr(dev_t, xfs_daddr_t, xfs_buf_t *, int, int); | | extern int libxfs_writebufr(struct xfs_buf *); | |
| | | extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t | |
| | | *, int, int); | |
| | | extern int libxfs_readbufr_map(struct xfs_buftarg *, struct xfs_buf *, | |
| | | int); | |
| | | | |
| extern int libxfs_bhash_size; | | extern int libxfs_bhash_size; | |
|
| extern int libxfs_ihash_size; | | | |
| | | | |
| #define LIBXFS_BREAD 0x1 | | #define LIBXFS_BREAD 0x1 | |
| #define LIBXFS_BWRITE 0x2 | | #define LIBXFS_BWRITE 0x2 | |
| #define LIBXFS_BZERO 0x4 | | #define LIBXFS_BZERO 0x4 | |
| | | | |
| extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int); | | extern void libxfs_iomove (xfs_buf_t *, uint, int, void *, int); | |
| | | | |
| /* | | /* | |
| * Transaction interface | | * Transaction interface | |
| */ | | */ | |
| | | | |
| typedef struct xfs_log_item { | | typedef struct xfs_log_item { | |
| struct xfs_log_item_desc *li_desc; /* ptr to current de
sc*/ | | struct xfs_log_item_desc *li_desc; /* ptr to current de
sc*/ | |
| struct xfs_mount *li_mountp; /* ptr to fs mount *
/ | | struct xfs_mount *li_mountp; /* ptr to fs mount *
/ | |
| uint li_type; /* item type */ | | uint li_type; /* item type */ | |
|
| | | xfs_lsn_t li_lsn; | |
| } xfs_log_item_t; | | } xfs_log_item_t; | |
| | | | |
| typedef struct xfs_inode_log_item { | | typedef struct xfs_inode_log_item { | |
| xfs_log_item_t ili_item; /* common portion */ | | xfs_log_item_t ili_item; /* common portion */ | |
| struct xfs_inode *ili_inode; /* inode pointer */ | | struct xfs_inode *ili_inode; /* inode pointer */ | |
| unsigned short ili_flags; /* misc flags */ | | unsigned short ili_flags; /* misc flags */ | |
|
| | | unsigned int ili_fields; /* fields to be logg
ed */ | |
| unsigned int ili_last_fields; /* fields when flush
ed*/ | | unsigned int ili_last_fields; /* fields when flush
ed*/ | |
| xfs_inode_log_format_t ili_format; /* logged structure
*/ | | xfs_inode_log_format_t ili_format; /* logged structure
*/ | |
| int ili_lock_flags; | | int ili_lock_flags; | |
| } xfs_inode_log_item_t; | | } xfs_inode_log_item_t; | |
| | | | |
| typedef struct xfs_buf_log_item { | | typedef struct xfs_buf_log_item { | |
| xfs_log_item_t bli_item; /* common item structure */ | | xfs_log_item_t bli_item; /* common item structure */ | |
| struct xfs_buf *bli_buf; /* real buffer pointer */ | | struct xfs_buf *bli_buf; /* real buffer pointer */ | |
| unsigned int bli_flags; /* misc flags */ | | unsigned int bli_flags; /* misc flags */ | |
| unsigned int bli_recur; /* recursion count */ | | unsigned int bli_recur; /* recursion count */ | |
| xfs_buf_log_format_t bli_format; /* in-log header */ | | xfs_buf_log_format_t bli_format; /* in-log header */ | |
| } xfs_buf_log_item_t; | | } xfs_buf_log_item_t; | |
| | | | |
|
| #include <xfs/xfs_trans.h> | | #define XFS_BLI_DIRTY (1<<0) | |
| | | #define XFS_BLI_HOLD (1<<1) | |
| | | #define XFS_BLI_STALE (1<<2) | |
| | | #define XFS_BLI_INODE_ALLOC_BUF (1<<3) | |
| | | | |
| | | typedef struct xfs_dq_logitem { | |
| | | xfs_log_item_t qli_item; /* common portion */ | |
| | | struct xfs_dquot *qli_dquot; /* dquot ptr */ | |
| | | xfs_lsn_t qli_flush_lsn; /* lsn at last flush */ | |
| | | xfs_dq_logformat_t qli_format; /* logged structure */ | |
| | | } xfs_dq_logitem_t; | |
| | | | |
| | | typedef struct xfs_qoff_logitem { | |
| | | xfs_log_item_t qql_item; /* common portion */ | |
| | | struct xfs_qoff_logitem *qql_start_lip; /* qoff-start logitem, if an | |
| | | y */ | |
| | | xfs_qoff_logformat_t qql_format; /* logged structure */ | |
| | | } xfs_qoff_logitem_t; | |
| | | | |
| typedef struct xfs_trans { | | typedef struct xfs_trans { | |
| unsigned int t_type; /* transaction type */ | | unsigned int t_type; /* transaction type */ | |
| unsigned int t_log_res; /* amt of log space resvd */ | | unsigned int t_log_res; /* amt of log space resvd */ | |
| unsigned int t_log_count; /* count for perm log res */ | | unsigned int t_log_count; /* count for perm log res */ | |
| xfs_mount_t *t_mountp; /* ptr to fs mount struct */ | | xfs_mount_t *t_mountp; /* ptr to fs mount struct */ | |
| unsigned int t_flags; /* misc flags */ | | unsigned int t_flags; /* misc flags */ | |
| long t_icount_delta; /* superblock icount change
*/ | | long t_icount_delta; /* superblock icount change
*/ | |
| long t_ifree_delta; /* superblock ifree change *
/ | | long t_ifree_delta; /* superblock ifree change *
/ | |
| long t_fdblocks_delta; /* superblock fdblocks chg *
/ | | long t_fdblocks_delta; /* superblock fdblocks chg *
/ | |
| long t_frextents_delta; /* superblock freextents chg
*/ | | long t_frextents_delta; /* superblock freextents chg
*/ | |
| struct list_head t_items; /* first log item desc chunk
*/ | | struct list_head t_items; /* first log item desc chunk
*/ | |
| } xfs_trans_t; | | } xfs_trans_t; | |
| | | | |
|
| | | extern void xfs_trans_init(struct xfs_mount *); | |
| | | extern int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | |
| | | | |
| extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int); | | extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *, int); | |
| extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); | | extern xfs_trans_t *libxfs_trans_dup (xfs_trans_t *); | |
|
| extern int libxfs_trans_reserve (xfs_trans_t *, uint,uint,uint,uint,uin | | extern int libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_re | |
| t); | | s *, | |
| | | uint, uint); | |
| extern int libxfs_trans_commit (xfs_trans_t *, uint); | | extern int libxfs_trans_commit (xfs_trans_t *, uint); | |
| extern void libxfs_trans_cancel (xfs_trans_t *, int); | | extern void libxfs_trans_cancel (xfs_trans_t *, int); | |
|
| extern void libxfs_mod_sb (xfs_trans_t *, __int64_t); | | | |
| extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, i
nt); | | extern xfs_buf_t *libxfs_trans_getsb (xfs_trans_t *, xfs_mount_t *, i
nt); | |
| | | | |
| extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | | extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
| uint, uint, struct xfs_inode **); | | uint, uint, struct xfs_inode **); | |
| extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); | | extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); | |
| extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint)
; | | extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint)
; | |
| extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); | | extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); | |
| extern void libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, in
t); | | extern void libxfs_trans_ijoin_ref(xfs_trans_t *, struct xfs_inode *, in
t); | |
| extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *, | | extern void libxfs_trans_log_inode (xfs_trans_t *, struct xfs_inode *, | |
| uint); | | uint); | |
| | | | |
| extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *); | | extern void libxfs_trans_brelse (xfs_trans_t *, struct xfs_buf *); | |
| extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *); | | extern void libxfs_trans_binval (xfs_trans_t *, struct xfs_buf *); | |
| extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *); | | extern void libxfs_trans_bjoin (xfs_trans_t *, struct xfs_buf *); | |
| extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *); | | extern void libxfs_trans_bhold (xfs_trans_t *, struct xfs_buf *); | |
| extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *, | | extern void libxfs_trans_log_buf (xfs_trans_t *, struct xfs_buf *, | |
| uint, uint); | | uint, uint); | |
|
| | | /* | |
| extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t, | | extern xfs_buf_t *libxfs_trans_get_buf (xfs_trans_t *, dev_t, | |
| xfs_daddr_t, int, uint); | | xfs_daddr_t, int, uint); | |
| extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t, | | extern int libxfs_trans_read_buf (xfs_mount_t *, xfs_trans_t *, dev_t, | |
| xfs_daddr_t, int, uint, struct xfs_buf **); | | xfs_daddr_t, int, uint, struct xfs_buf **); | |
|
| | | */ | |
| | | | |
| | | struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp, | |
| | | struct xfs_buftarg *btp, | |
| | | struct xfs_buf_map *map, int nmaps, | |
| | | uint flags); | |
| | | | |
| | | static inline struct xfs_buf * | |
| | | libxfs_trans_get_buf( | |
| | | struct xfs_trans *tp, | |
| | | struct xfs_buftarg *btp, | |
| | | xfs_daddr_t blkno, | |
| | | int numblks, | |
| | | uint flags) | |
| | | { | |
| | | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | |
| | | return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags); | |
| | | } | |
| | | | |
| | | int libxfs_trans_read_buf_map(struct xfs_mount *mp, | |
| | | struct xfs_trans *tp, | |
| | | struct xfs_buftarg *btp, | |
| | | struct xfs_buf_map *map, int nmaps, | |
| | | uint flags, struct xfs_buf **bpp, | |
| | | const struct xfs_buf_ops *ops); | |
| | | | |
| | | static inline int | |
| | | libxfs_trans_read_buf( | |
| | | struct xfs_mount *mp, | |
| | | struct xfs_trans *tp, | |
| | | struct xfs_buftarg *btp, | |
| | | xfs_daddr_t blkno, | |
| | | int numblks, | |
| | | uint flags, | |
| | | struct xfs_buf **bpp, | |
| | | const struct xfs_buf_ops *ops) | |
| | | { | |
| | | DEFINE_SINGLE_BUF_MAP(map, blkno, numblks); | |
| | | return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1, | |
| | | flags, bpp, ops); | |
| | | } | |
| | | | |
| /* | | /* | |
| * Inode interface | | * Inode interface | |
| */ | | */ | |
| typedef struct xfs_inode { | | typedef struct xfs_inode { | |
| struct cache_node i_node; | | struct cache_node i_node; | |
| xfs_mount_t *i_mount; /* fs mount struct ptr */ | | xfs_mount_t *i_mount; /* fs mount struct ptr */ | |
| xfs_ino_t i_ino; /* inode number (agno/agino)
*/ | | xfs_ino_t i_ino; /* inode number (agno/agino)
*/ | |
| struct xfs_imap i_imap; /* location for xfs_imap() *
/ | | struct xfs_imap i_imap; /* location for xfs_imap() *
/ | |
|
| dev_t i_dev; /* dev for this inode */ | | struct xfs_buftarg i_dev; /* dev for this inode */ | |
| xfs_ifork_t *i_afp; /* attribute fork pointer */ | | xfs_ifork_t *i_afp; /* attribute fork pointer */ | |
| xfs_ifork_t i_df; /* data fork */ | | xfs_ifork_t i_df; /* data fork */ | |
| xfs_trans_t *i_transp; /* ptr to owning transaction
*/ | | xfs_trans_t *i_transp; /* ptr to owning transaction
*/ | |
| xfs_inode_log_item_t *i_itemp; /* logging information */ | | xfs_inode_log_item_t *i_itemp; /* logging information */ | |
| unsigned int i_delayed_blks; /* count of delay alloc blks
*/ | | unsigned int i_delayed_blks; /* count of delay alloc blks
*/ | |
| xfs_icdinode_t i_d; /* most of ondisk inode */ | | xfs_icdinode_t i_d; /* most of ondisk inode */ | |
| xfs_fsize_t i_size; /* in-memory size */ | | xfs_fsize_t i_size; /* in-memory size */ | |
| } xfs_inode_t; | | } xfs_inode_t; | |
| | | | |
| #define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */ | | #define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */ | |
| #define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace *
/ | | #define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace *
/ | |
| #define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists *
/ | | #define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists *
/ | |
| #define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists
*/ | | #define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists
*/ | |
| | | | |
|
| | | /* | |
| | | * Project quota id helpers (previously projid was 16bit only and using two | |
| | | * 16bit values to hold new 32bit projid was chosen to retain compatibility | |
| | | with | |
| | | * "old" filesystems). | |
| | | * | |
| | | * Copied here from xfs_inode.h because it has to be defined after the stru | |
| | | ct | |
| | | * xfs_inode... | |
| | | */ | |
| | | static inline prid_t | |
| | | xfs_get_projid(struct xfs_icdinode *id) | |
| | | { | |
| | | return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo; | |
| | | } | |
| | | | |
| | | static inline void | |
| | | xfs_set_projid(struct xfs_icdinode *id, prid_t projid) | |
| | | { | |
| | | id->di_projid_hi = (__uint16_t) (projid >> 16); | |
| | | id->di_projid_lo = (__uint16_t) (projid & 0xffff); | |
| | | } | |
| | | | |
| typedef struct cred { | | typedef struct cred { | |
| uid_t cr_uid; | | uid_t cr_uid; | |
| gid_t cr_gid; | | gid_t cr_gid; | |
| } cred_t; | | } cred_t; | |
| | | | |
| extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, | | extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, | |
| nlink_t, xfs_dev_t, struct cred *, | | nlink_t, xfs_dev_t, struct cred *, | |
| struct fsxattr *, xfs_inode_t **); | | struct fsxattr *, xfs_inode_t **); | |
| extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); | | extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); | |
| | | | |
| extern void libxfs_trans_ichgtime(struct xfs_trans *, | | extern void libxfs_trans_ichgtime(struct xfs_trans *, | |
| struct xfs_inode *, int); | | struct xfs_inode *, int); | |
| extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *); | | extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *); | |
|
| extern int libxfs_iread (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | | | |
| xfs_inode_t *, xfs_daddr_t); | | | |
| | | | |
| /* Inode Cache Interfaces */ | | /* Inode Cache Interfaces */ | |
|
| extern struct cache *libxfs_icache; | | | |
| extern struct cache_operations libxfs_icache_operations; | | | |
| extern void libxfs_icache_purge (void); | | | |
| extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | | extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, | |
| uint, xfs_inode_t **, xfs_daddr_t); | | uint, xfs_inode_t **, xfs_daddr_t); | |
| extern void libxfs_iput (xfs_inode_t *, uint); | | extern void libxfs_iput (xfs_inode_t *, uint); | |
| | | | |
|
| extern int xfs_imap_to_bp(xfs_mount_t *mp, xfs_trans_t *tp, struct xfs_ | | | |
| imap *imap, | | | |
| xfs_buf_t **bpp, uint buf_flags, uint iget_flags); | | | |
| | | | |
| #include <xfs/xfs_dir_leaf.h> /* dirv1 support in db & repair */ | | | |
| #include <xfs/xfs_dir2_data.h> | | | |
| #include <xfs/xfs_dir2_leaf.h> | | | |
| #include <xfs/xfs_dir2_block.h> | | | |
| #include <xfs/xfs_dir2_node.h> | | | |
| | | | |
| /* Shared utility routines */ | | /* Shared utility routines */ | |
| extern unsigned int libxfs_log2_roundup(unsigned int i); | | extern unsigned int libxfs_log2_roundup(unsigned int i); | |
| | | | |
| extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, | | extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, | |
| xfs_off_t, int, int); | | xfs_off_t, int, int); | |
| extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *)
; | | extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *)
; | |
| | | | |
|
| extern void libxfs_da_bjoin (xfs_trans_t *, xfs_dabuf_t *); | | | |
| extern void libxfs_da_bhold (xfs_trans_t *, xfs_dabuf_t *); | | | |
| extern int libxfs_da_read_bufr(xfs_trans_t *, xfs_inode_t *, xfs_dablk_ | | | |
| t, | | | |
| xfs_daddr_t, xfs_dabuf_t **, int); | | | |
| | | | |
| extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ..
.); | | extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ..
.); | |
| extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...); | | extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...); | |
| | | | |
| extern void cmn_err(int, char *, ...); | | extern void cmn_err(int, char *, ...); | |
| enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | | enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; | |
| | | | |
| #define LIBXFS_BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT) | | #define LIBXFS_BBTOOFF64(bbs) (((xfs_off_t)(bbs)) << BBSHIFT) | |
| extern int libxfs_nproc(void); | | extern int libxfs_nproc(void); | |
| extern unsigned long libxfs_physmem(void); /* in kilobytes */ | | extern unsigned long libxfs_physmem(void); /* in kilobytes */ | |
| | | | |
| #include <xfs/xfs_ialloc.h> | | #include <xfs/xfs_ialloc.h> | |
|
| #include <xfs/xfs_rtalloc.h> | | | |
| | | | |
| #include <xfs/xfs_attr_leaf.h> | | #include <xfs/xfs_attr_leaf.h> | |
|
| #include <xfs/xfs_quota.h> | | #include <xfs/xfs_attr_remote.h> | |
| #include <xfs/xfs_trans_space.h> | | #include <xfs/xfs_trans_space.h> | |
|
| #include <xfs/xfs_log.h> | | | |
| #include <xfs/xfs_log_priv.h> | | | |
| | | | |
| #define XFS_INOBT_IS_FREE_DISK(rp,i) \ | | #define XFS_INOBT_IS_FREE_DISK(rp,i) \ | |
| ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) !=
0) | | ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) !=
0) | |
| | | | |
| /* | | /* | |
| * public xfs kernel routines to be called as libxfs_* | | * public xfs kernel routines to be called as libxfs_* | |
| */ | | */ | |
| | | | |
| /* xfs_alloc.c */ | | /* xfs_alloc.c */ | |
| int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int); | | int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int); | |
| | | | |
| skipping to change at line 521 | | skipping to change at line 702 | |
| /* xfs_attr.c */ | | /* xfs_attr.c */ | |
| int libxfs_attr_get(struct xfs_inode *, const unsigned char *, | | int libxfs_attr_get(struct xfs_inode *, const unsigned char *, | |
| unsigned char *, int *, int); | | unsigned char *, int *, int); | |
| int libxfs_attr_set(struct xfs_inode *, const unsigned char *, | | int libxfs_attr_set(struct xfs_inode *, const unsigned char *, | |
| unsigned char *, int, int); | | unsigned char *, int, int); | |
| int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int); | | int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int); | |
| | | | |
| /* xfs_bmap.c */ | | /* xfs_bmap.c */ | |
| xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t, | | xfs_bmbt_rec_host_t *xfs_bmap_search_extents(xfs_inode_t *, xfs_fileoff_t, | |
| int, int *, xfs_extnum_t *, xfs_bmbt_irec_t
*, | | int, int *, xfs_extnum_t *, xfs_bmbt_irec_t
*, | |
|
| xfs_bmbt_irec_t *); | | xfs_bmbt_irec_t *); | |
| void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | | void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | |
| | | | |
| /* xfs_attr_leaf.h */ | | /* xfs_attr_leaf.h */ | |
| #define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize | | #define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize | |
| | | | |
| /* xfs_bit.h */ | | /* xfs_bit.h */ | |
| #define libxfs_highbit32 xfs_highbit32 | | #define libxfs_highbit32 xfs_highbit32 | |
| #define libxfs_highbit64 xfs_highbit64 | | #define libxfs_highbit64 xfs_highbit64 | |
| | | | |
| /* xfs_bmap.h */ | | /* xfs_bmap.h */ | |
| #define libxfs_bmap_cancel xfs_bmap_cancel | | #define libxfs_bmap_cancel xfs_bmap_cancel | |
| #define libxfs_bmap_last_offset xfs_bmap_last_offset | | #define libxfs_bmap_last_offset xfs_bmap_last_offset | |
|
| #define libxfs_bmapi xfs_bmapi | | #define libxfs_bmapi_write xfs_bmapi_write | |
| | | #define libxfs_bmapi_read xfs_bmapi_read | |
| #define libxfs_bunmapi xfs_bunmapi | | #define libxfs_bunmapi xfs_bunmapi | |
| | | | |
| /* xfs_bmap_btree.h */ | | /* xfs_bmap_btree.h */ | |
| #define libxfs_bmbt_disk_get_all xfs_bmbt_disk_get_all | | #define libxfs_bmbt_disk_get_all xfs_bmbt_disk_get_all | |
| | | | |
| /* xfs_da_btree.h */ | | /* xfs_da_btree.h */ | |
| #define libxfs_da_brelse xfs_da_brelse | | #define libxfs_da_brelse xfs_da_brelse | |
| #define libxfs_da_hashname xfs_da_hashname | | #define libxfs_da_hashname xfs_da_hashname | |
| #define libxfs_da_shrink_inode xfs_da_shrink_inode | | #define libxfs_da_shrink_inode xfs_da_shrink_inode | |
|
| | | #define libxfs_da_read_buf xfs_da_read_buf | |
| | | | |
| /* xfs_dir2.h */ | | /* xfs_dir2.h */ | |
| #define libxfs_dir_createname xfs_dir_createname | | #define libxfs_dir_createname xfs_dir_createname | |
| #define libxfs_dir_init xfs_dir_init | | #define libxfs_dir_init xfs_dir_init | |
| #define libxfs_dir_lookup xfs_dir_lookup | | #define libxfs_dir_lookup xfs_dir_lookup | |
| #define libxfs_dir_replace xfs_dir_replace | | #define libxfs_dir_replace xfs_dir_replace | |
| #define libxfs_dir2_isblock xfs_dir2_isblock | | #define libxfs_dir2_isblock xfs_dir2_isblock | |
| #define libxfs_dir2_isleaf xfs_dir2_isleaf | | #define libxfs_dir2_isleaf xfs_dir2_isleaf | |
| | | | |
| /* xfs_dir2_data.h */ | | /* xfs_dir2_data.h */ | |
| #define libxfs_dir2_data_freescan xfs_dir2_data_freescan | | #define libxfs_dir2_data_freescan xfs_dir2_data_freescan | |
| #define libxfs_dir2_data_log_entry xfs_dir2_data_log_entry | | #define libxfs_dir2_data_log_entry xfs_dir2_data_log_entry | |
| #define libxfs_dir2_data_log_header xfs_dir2_data_log_header | | #define libxfs_dir2_data_log_header xfs_dir2_data_log_header | |
| #define libxfs_dir2_data_make_free xfs_dir2_data_make_free | | #define libxfs_dir2_data_make_free xfs_dir2_data_make_free | |
| #define libxfs_dir2_data_use_free xfs_dir2_data_use_free | | #define libxfs_dir2_data_use_free xfs_dir2_data_use_free | |
| #define libxfs_dir2_shrink_inode xfs_dir2_shrink_inode | | #define libxfs_dir2_shrink_inode xfs_dir2_shrink_inode | |
| | | | |
| /* xfs_inode.h */ | | /* xfs_inode.h */ | |
| #define libxfs_dinode_from_disk xfs_dinode_from_disk | | #define libxfs_dinode_from_disk xfs_dinode_from_disk | |
| #define libxfs_dinode_to_disk xfs_dinode_to_disk | | #define libxfs_dinode_to_disk xfs_dinode_to_disk | |
|
| | | void xfs_dinode_from_disk(struct xfs_icdinode *, | |
| | | struct xfs_dinode *); | |
| | | #define libxfs_dinode_calc_crc xfs_dinode_calc_crc | |
| #define libxfs_idata_realloc xfs_idata_realloc | | #define libxfs_idata_realloc xfs_idata_realloc | |
| #define libxfs_idestroy_fork xfs_idestroy_fork | | #define libxfs_idestroy_fork xfs_idestroy_fork | |
| | | | |
|
| /* xfs_mount.h */ | | #define libxfs_dinode_verify xfs_dinode_verify | |
| | | bool xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino, | |
| | | struct xfs_dinode *dip); | |
| | | | |
| | | /* xfs_sb.h */ | |
| #define libxfs_mod_sb xfs_mod_sb | | #define libxfs_mod_sb xfs_mod_sb | |
| #define libxfs_sb_from_disk xfs_sb_from_disk | | #define libxfs_sb_from_disk xfs_sb_from_disk | |
| #define libxfs_sb_to_disk xfs_sb_to_disk | | #define libxfs_sb_to_disk xfs_sb_to_disk | |
| | | | |
|
| | | /* xfs_symlink.h */ | |
| | | #define libxfs_symlink_blocks xfs_symlink_blocks | |
| | | #define libxfs_symlink_hdr_ok xfs_symlink_hdr_ok | |
| | | | |
| | | /* xfs_trans_resv.h */ | |
| | | #define libxfs_trans_resv_calc xfs_trans_resv_calc | |
| | | | |
| /* xfs_rtalloc.c */ | | /* xfs_rtalloc.c */ | |
| int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); | | int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t); | |
| | | | |
|
| | | /* CRC wrappers */ | |
| | | | |
| | | extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len); | |
| | | extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len) | |
| | | ; | |
| | | | |
| | | #define crc32(c,p,l) crc32_le((c),(unsigned char const *)(p),(l)) | |
| | | #define crc32c(c,p,l) crc32c_le((c),(unsigned char const *)(p),(l)) | |
| | | | |
| | | #include <xfs/xfs_cksum.h> | |
| | | | |
| | | static inline int | |
| | | xfs_buf_verify_cksum(struct xfs_buf *bp, unsigned long cksum_offset) | |
| | | { | |
| | | return xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length), | |
| | | cksum_offset); | |
| | | } | |
| | | | |
| | | static inline void | |
| | | xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset) | |
| | | { | |
| | | xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), | |
| | | cksum_offset); | |
| | | } | |
| | | | |
| | | #define xfs_notice(mp,fmt,args...) cmn_err(CE_NOTE,fmt, ## args | |
| | | ) | |
| | | #define xfs_warn(mp,fmt,args...) cmn_err(CE_WARN,fmt, ## args | |
| | | ) | |
| | | #define xfs_alert(mp,fmt,args...) cmn_err(CE_ALERT,fmt, ## arg | |
| | | s) | |
| | | #define xfs_hex_dump(d,n) ((void) 0) | |
| | | | |
| #endif /* __LIBXFS_H__ */ | | #endif /* __LIBXFS_H__ */ | |
| | | | |
End of changes. 67 change blocks. |
| 84 lines changed or deleted | | 322 lines changed or added | |
|
| xfs_ag.h | | xfs_ag.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| * This is divided into three structures, placed in sequential 512-byte | | * This is divided into three structures, placed in sequential 512-byte | |
| * buffers after a copy of the superblock (also in a 512-byte buffer). | | * buffers after a copy of the superblock (also in a 512-byte buffer). | |
| */ | | */ | |
| | | | |
| struct xfs_buf; | | struct xfs_buf; | |
| struct xfs_mount; | | struct xfs_mount; | |
| struct xfs_trans; | | struct xfs_trans; | |
| | | | |
| #define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ | | #define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ | |
| #define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ | | #define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ | |
|
| | | #define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */ | |
| #define XFS_AGF_VERSION 1 | | #define XFS_AGF_VERSION 1 | |
| #define XFS_AGI_VERSION 1 | | #define XFS_AGI_VERSION 1 | |
| | | | |
| #define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION) | | #define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION) | |
| #define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION) | | #define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION) | |
| | | | |
| /* | | /* | |
| * Btree number 0 is bno, 1 is cnt. This value gives the size of the | | * Btree number 0 is bno, 1 is cnt. This value gives the size of the | |
| * arrays below. | | * arrays below. | |
| */ | | */ | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 67 | |
| __be32 agf_versionnum; /* header version == XFS_AGF_VERSION
*/ | | __be32 agf_versionnum; /* header version == XFS_AGF_VERSION
*/ | |
| __be32 agf_seqno; /* sequence # starting from 0 */ | | __be32 agf_seqno; /* sequence # starting from 0 */ | |
| __be32 agf_length; /* size in blocks of a.g. */ | | __be32 agf_length; /* size in blocks of a.g. */ | |
| /* | | /* | |
| * Freespace information | | * Freespace information | |
| */ | | */ | |
| __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */ | | __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */ | |
| __be32 agf_spare0; /* spare field */ | | __be32 agf_spare0; /* spare field */ | |
| __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */ | | __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */ | |
| __be32 agf_spare1; /* spare field */ | | __be32 agf_spare1; /* spare field */ | |
|
| | | | |
| __be32 agf_flfirst; /* first freelist block's index */ | | __be32 agf_flfirst; /* first freelist block's index */ | |
| __be32 agf_fllast; /* last freelist block's index */ | | __be32 agf_fllast; /* last freelist block's index */ | |
| __be32 agf_flcount; /* count of blocks in freelist */ | | __be32 agf_flcount; /* count of blocks in freelist */ | |
| __be32 agf_freeblks; /* total free blocks */ | | __be32 agf_freeblks; /* total free blocks */ | |
|
| | | | |
| __be32 agf_longest; /* longest free space */ | | __be32 agf_longest; /* longest free space */ | |
| __be32 agf_btreeblks; /* # of blocks held in AGF btrees */ | | __be32 agf_btreeblks; /* # of blocks held in AGF btrees */ | |
|
| | | uuid_t agf_uuid; /* uuid of filesystem */ | |
| | | | |
| | | /* | |
| | | * reserve some contiguous space for future logged fields before we | |
| | | add | |
| | | * the unlogged fields. This makes the range logging via flags and | |
| | | * structure offsets much simpler. | |
| | | */ | |
| | | __be64 agf_spare64[16]; | |
| | | | |
| | | /* unlogged fields, written during buffer writeback. */ | |
| | | __be64 agf_lsn; /* last write sequence */ | |
| | | __be32 agf_crc; /* crc of agf sector */ | |
| | | __be32 agf_spare2; | |
| | | | |
| | | /* structure must be padded to 64 bit alignment */ | |
| } xfs_agf_t; | | } xfs_agf_t; | |
| | | | |
|
| | | #define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc) | |
| | | | |
| #define XFS_AGF_MAGICNUM 0x00000001 | | #define XFS_AGF_MAGICNUM 0x00000001 | |
| #define XFS_AGF_VERSIONNUM 0x00000002 | | #define XFS_AGF_VERSIONNUM 0x00000002 | |
| #define XFS_AGF_SEQNO 0x00000004 | | #define XFS_AGF_SEQNO 0x00000004 | |
| #define XFS_AGF_LENGTH 0x00000008 | | #define XFS_AGF_LENGTH 0x00000008 | |
| #define XFS_AGF_ROOTS 0x00000010 | | #define XFS_AGF_ROOTS 0x00000010 | |
| #define XFS_AGF_LEVELS 0x00000020 | | #define XFS_AGF_LEVELS 0x00000020 | |
| #define XFS_AGF_FLFIRST 0x00000040 | | #define XFS_AGF_FLFIRST 0x00000040 | |
| #define XFS_AGF_FLLAST 0x00000080 | | #define XFS_AGF_FLLAST 0x00000080 | |
| #define XFS_AGF_FLCOUNT 0x00000100 | | #define XFS_AGF_FLCOUNT 0x00000100 | |
| #define XFS_AGF_FREEBLKS 0x00000200 | | #define XFS_AGF_FREEBLKS 0x00000200 | |
| #define XFS_AGF_LONGEST 0x00000400 | | #define XFS_AGF_LONGEST 0x00000400 | |
| #define XFS_AGF_BTREEBLKS 0x00000800 | | #define XFS_AGF_BTREEBLKS 0x00000800 | |
|
| #define XFS_AGF_NUM_BITS 12 | | #define XFS_AGF_UUID 0x00001000 | |
| | | #define XFS_AGF_NUM_BITS 13 | |
| #define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) | | #define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) | |
| | | | |
| #define XFS_AGF_FLAGS \ | | #define XFS_AGF_FLAGS \ | |
| { XFS_AGF_MAGICNUM, "MAGICNUM" }, \ | | { XFS_AGF_MAGICNUM, "MAGICNUM" }, \ | |
| { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \ | | { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \ | |
| { XFS_AGF_SEQNO, "SEQNO" }, \ | | { XFS_AGF_SEQNO, "SEQNO" }, \ | |
| { XFS_AGF_LENGTH, "LENGTH" }, \ | | { XFS_AGF_LENGTH, "LENGTH" }, \ | |
| { XFS_AGF_ROOTS, "ROOTS" }, \ | | { XFS_AGF_ROOTS, "ROOTS" }, \ | |
| { XFS_AGF_LEVELS, "LEVELS" }, \ | | { XFS_AGF_LEVELS, "LEVELS" }, \ | |
| { XFS_AGF_FLFIRST, "FLFIRST" }, \ | | { XFS_AGF_FLFIRST, "FLFIRST" }, \ | |
| { XFS_AGF_FLLAST, "FLLAST" }, \ | | { XFS_AGF_FLLAST, "FLLAST" }, \ | |
| { XFS_AGF_FLCOUNT, "FLCOUNT" }, \ | | { XFS_AGF_FLCOUNT, "FLCOUNT" }, \ | |
| { XFS_AGF_FREEBLKS, "FREEBLKS" }, \ | | { XFS_AGF_FREEBLKS, "FREEBLKS" }, \ | |
| { XFS_AGF_LONGEST, "LONGEST" }, \ | | { XFS_AGF_LONGEST, "LONGEST" }, \ | |
|
| { XFS_AGF_BTREEBLKS, "BTREEBLKS" } | | { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \ | |
| | | { XFS_AGF_UUID, "UUID" } | |
| | | | |
| /* disk block (xfs_daddr_t) in the AG */ | | /* disk block (xfs_daddr_t) in the AG */ | |
| #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) | | #define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) | |
| #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) | | #define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp)) | |
|
| #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)XFS_BUF_PTR(bp)) | | #define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr)) | |
| | | | |
| extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp, | | extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp, | |
| xfs_agnumber_t agno, int flags, struct xfs_buf **bpp
); | | xfs_agnumber_t agno, int flags, struct xfs_buf **bpp
); | |
| | | | |
| /* | | /* | |
| * Size of the unlinked inode hash table in the agi. | | * Size of the unlinked inode hash table in the agi. | |
| */ | | */ | |
| #define XFS_AGI_UNLINKED_BUCKETS 64 | | #define XFS_AGI_UNLINKED_BUCKETS 64 | |
| | | | |
| typedef struct xfs_agi { | | typedef struct xfs_agi { | |
| | | | |
| skipping to change at line 133 | | skipping to change at line 155 | |
| __be32 agi_length; /* size in blocks of a.g. */ | | __be32 agi_length; /* size in blocks of a.g. */ | |
| /* | | /* | |
| * Inode information | | * Inode information | |
| * Inodes are mapped by interpreting the inode number, so no | | * Inodes are mapped by interpreting the inode number, so no | |
| * mapping data is needed here. | | * mapping data is needed here. | |
| */ | | */ | |
| __be32 agi_count; /* count of allocated inodes */ | | __be32 agi_count; /* count of allocated inodes */ | |
| __be32 agi_root; /* root of inode btree */ | | __be32 agi_root; /* root of inode btree */ | |
| __be32 agi_level; /* levels in inode btree */ | | __be32 agi_level; /* levels in inode btree */ | |
| __be32 agi_freecount; /* number of free inodes */ | | __be32 agi_freecount; /* number of free inodes */ | |
|
| | | | |
| __be32 agi_newino; /* new inode just allocated */ | | __be32 agi_newino; /* new inode just allocated */ | |
| __be32 agi_dirino; /* last directory inode chunk */ | | __be32 agi_dirino; /* last directory inode chunk */ | |
| /* | | /* | |
| * Hash table of inodes which have been unlinked but are | | * Hash table of inodes which have been unlinked but are | |
| * still being referenced. | | * still being referenced. | |
| */ | | */ | |
| __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS]; | | __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS]; | |
|
| | | | |
| | | uuid_t agi_uuid; /* uuid of filesystem */ | |
| | | __be32 agi_crc; /* crc of agi sector */ | |
| | | __be32 agi_pad32; | |
| | | __be64 agi_lsn; /* last write sequence */ | |
| | | | |
| | | /* structure must be padded to 64 bit alignment */ | |
| } xfs_agi_t; | | } xfs_agi_t; | |
| | | | |
|
| | | #define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc) | |
| | | | |
| #define XFS_AGI_MAGICNUM 0x00000001 | | #define XFS_AGI_MAGICNUM 0x00000001 | |
| #define XFS_AGI_VERSIONNUM 0x00000002 | | #define XFS_AGI_VERSIONNUM 0x00000002 | |
| #define XFS_AGI_SEQNO 0x00000004 | | #define XFS_AGI_SEQNO 0x00000004 | |
| #define XFS_AGI_LENGTH 0x00000008 | | #define XFS_AGI_LENGTH 0x00000008 | |
| #define XFS_AGI_COUNT 0x00000010 | | #define XFS_AGI_COUNT 0x00000010 | |
| #define XFS_AGI_ROOT 0x00000020 | | #define XFS_AGI_ROOT 0x00000020 | |
| #define XFS_AGI_LEVEL 0x00000040 | | #define XFS_AGI_LEVEL 0x00000040 | |
| #define XFS_AGI_FREECOUNT 0x00000080 | | #define XFS_AGI_FREECOUNT 0x00000080 | |
| #define XFS_AGI_NEWINO 0x00000100 | | #define XFS_AGI_NEWINO 0x00000100 | |
| #define XFS_AGI_DIRINO 0x00000200 | | #define XFS_AGI_DIRINO 0x00000200 | |
| #define XFS_AGI_UNLINKED 0x00000400 | | #define XFS_AGI_UNLINKED 0x00000400 | |
| #define XFS_AGI_NUM_BITS 11 | | #define XFS_AGI_NUM_BITS 11 | |
| #define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1) | | #define XFS_AGI_ALL_BITS ((1 << XFS_AGI_NUM_BITS) - 1) | |
| | | | |
| /* disk block (xfs_daddr_t) in the AG */ | | /* disk block (xfs_daddr_t) in the AG */ | |
| #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) | | #define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log)) | |
| #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) | | #define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp)) | |
|
| #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)XFS_BUF_PTR(bp)) | | #define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr)) | |
| | | | |
| extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp, | | extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp, | |
| xfs_agnumber_t agno, struct xfs_buf **bpp); | | xfs_agnumber_t agno, struct xfs_buf **bpp); | |
| | | | |
| /* | | /* | |
| * The third a.g. block contains the a.g. freelist, an array | | * The third a.g. block contains the a.g. freelist, an array | |
| * of block pointers to blocks owned by the allocation btree code. | | * of block pointers to blocks owned by the allocation btree code. | |
| */ | | */ | |
| #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) | | #define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) | |
| #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)
) | | #define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)
) | |
|
| #define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock | | #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr)) | |
| _t)) | | | |
| #define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)XFS_BUF_PTR(bp)) | | #define XFS_BUF_TO_AGFL_BNO(mp, bp) \ | |
| | | (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ | |
| | | &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \ | |
| | | (__be32 *)(bp)->b_addr) | |
| | | | |
| | | /* | |
| | | * Size of the AGFL. For CRC-enabled filesystes we steal a couple of | |
| | | * slots in the beginning of the block for a proper header with the | |
| | | * location information and CRC. | |
| | | */ | |
| | | #define XFS_AGFL_SIZE(mp) \ | |
| | | (((mp)->m_sb.sb_sectsize - \ | |
| | | (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ | |
| | | sizeof(struct xfs_agfl) : 0)) / \ | |
| | | sizeof(xfs_agblock_t)) | |
| | | | |
| typedef struct xfs_agfl { | | typedef struct xfs_agfl { | |
|
| __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ | | __be32 agfl_magicnum; | |
| | | __be32 agfl_seqno; | |
| | | uuid_t agfl_uuid; | |
| | | __be64 agfl_lsn; | |
| | | __be32 agfl_crc; | |
| | | __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */ | |
| } xfs_agfl_t; | | } xfs_agfl_t; | |
| | | | |
|
| /* | | #define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc) | |
| * Busy block/extent entry. Indexed by a rbtree in perag to mark blocks th | | | |
| at | | | |
| * have been freed but whose transactions aren't committed to disk yet. | | | |
| * | | | |
| * Note that we use the transaction ID to record the transaction, not the | | | |
| * transaction structure itself. See xfs_alloc_busy_insert() for details. | | | |
| */ | | | |
| struct xfs_busy_extent { | | | |
| #ifdef __KERNEL__ | | | |
| struct rb_node rb_node; /* ag by-bno indexed search tree */ | | | |
| #endif | | | |
| struct list_head list; /* transaction busy extent list */ | | | |
| xfs_agnumber_t agno; | | | |
| xfs_agblock_t bno; | | | |
| xfs_extlen_t length; | | | |
| xlog_tid_t tid; /* transaction that created this */ | | | |
| }; | | | |
| | | | |
| /* | | | |
| * Per-ag incore structure, copies of information in agf and agi, | | | |
| * to improve the performance of allocation group selection. | | | |
| */ | | | |
| #define XFS_PAGB_NUM_SLOTS 128 | | | |
| | | | |
| typedef struct xfs_perag { | | | |
| struct xfs_mount *pag_mount; /* owner filesystem */ | | | |
| xfs_agnumber_t pag_agno; /* AG this structure belongs to */ | | | |
| atomic_t pag_ref; /* perag reference count */ | | | |
| char pagf_init; /* this agf's entry is initialized * | | | |
| / | | | |
| char pagi_init; /* this agi's entry is initialized * | | | |
| / | | | |
| char pagf_metadata; /* the agf is preferred to be metada | | | |
| ta */ | | | |
| char pagi_inodeok; /* The agi is ok for inodes */ | | | |
| __uint8_t pagf_levels[XFS_BTNUM_AGF]; | | | |
| /* # of levels in bno & cnt btree */ | | | |
| __uint32_t pagf_flcount; /* count of blocks in freelist */ | | | |
| xfs_extlen_t pagf_freeblks; /* total free blocks */ | | | |
| xfs_extlen_t pagf_longest; /* longest free space */ | | | |
| __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */ | | | |
| xfs_agino_t pagi_freecount; /* number of free inodes */ | | | |
| xfs_agino_t pagi_count; /* number of allocated inodes */ | | | |
| | | | |
| /* | | | |
| * Inode allocation search lookup optimisation. | | | |
| * If the pagino matches, the search for new inodes | | | |
| * doesn't need to search the near ones again straight away | | | |
| */ | | | |
| xfs_agino_t pagl_pagino; | | | |
| xfs_agino_t pagl_leftrec; | | | |
| xfs_agino_t pagl_rightrec; | | | |
| #ifdef __KERNEL__ | | | |
| spinlock_t pagb_lock; /* lock for pagb_tree */ | | | |
| struct rb_root pagb_tree; /* ordered tree of busy extents */ | | | |
| | | | |
| atomic_t pagf_fstrms; /* # of filestreams active in this A | | | |
| G */ | | | |
| | | | |
| spinlock_t pag_ici_lock; /* incore inode cache lock */ | | | |
| struct radix_tree_root pag_ici_root; /* incore inode cache root * | | | |
| / | | | |
| int pag_ici_reclaimable; /* reclaimable inodes */ | | | |
| struct mutex pag_ici_reclaim_lock; /* serialisation point */ | | | |
| unsigned long pag_ici_reclaim_cursor; /* reclaim restart point */ | | | |
| | | | |
| /* buffer cache index */ | | | |
| spinlock_t pag_buf_lock; /* lock for pag_buf_tree */ | | | |
| struct rb_root pag_buf_tree; /* ordered tree of active buffers */ | | | |
| | | | |
| /* for rcu-safe freeing */ | | | |
| struct rcu_head rcu_head; | | | |
| #endif | | | |
| int pagb_count; /* pagb slots in use */ | | | |
| } xfs_perag_t; | | | |
| | | | |
| /* | | /* | |
| * tags for inode radix tree | | * tags for inode radix tree | |
| */ | | */ | |
| #define XFS_ICI_NO_TAG (-1) /* special flag for an untagged look
up | | #define XFS_ICI_NO_TAG (-1) /* special flag for an untagged look
up | |
| in xfs_inode_ag_iterator */ | | in xfs_inode_ag_iterator */ | |
| #define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */ | | #define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */ | |
|
| | | #define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */ | |
| | | | |
| #define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) | | #define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels) | |
| #define XFS_MIN_FREELIST_RAW(bl,cl,mp) \ | | #define XFS_MIN_FREELIST_RAW(bl,cl,mp) \ | |
| (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp
))) | | (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp
))) | |
| #define XFS_MIN_FREELIST(a,mp) \ | | #define XFS_MIN_FREELIST(a,mp) \ | |
| (XFS_MIN_FREELIST_RAW( \ | | (XFS_MIN_FREELIST_RAW( \ | |
| be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \ | | be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \ | |
| be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp)) | | be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp)) | |
| #define XFS_MIN_FREELIST_PAG(pag,mp) \ | | #define XFS_MIN_FREELIST_PAG(pag,mp) \ | |
| (XFS_MIN_FREELIST_RAW( \ | | (XFS_MIN_FREELIST_RAW( \ | |
| | | | |
End of changes. 16 change blocks. |
| 84 lines changed or deleted | | 62 lines changed or added | |
|
| xfs_attr_leaf.h | | xfs_attr_leaf.h | |
| /* | | /* | |
| * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. | | * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. | |
|
| | | * Copyright (c) 2013 Red Hat, Inc. | |
| * All Rights Reserved. | | * All Rights Reserved. | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation. | | * published by the Free Software Foundation. | |
| * | | * | |
| * This program is distributed in the hope that it would be useful, | | * This program is distributed in the hope that it would be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU General Public License | | * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write the Free Software Foundation, | | * along with this program; if not, write the Free Software Foundation, | |
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| */ | | */ | |
| #ifndef __XFS_ATTR_LEAF_H__ | | #ifndef __XFS_ATTR_LEAF_H__ | |
| #define __XFS_ATTR_LEAF_H__ | | #define __XFS_ATTR_LEAF_H__ | |
| | | | |
|
| /* | | | |
| * Attribute storage layout, internal structure, access macros, etc. | | | |
| * | | | |
| * Attribute lists are structured around Btrees where all the data | | | |
| * elements are in the leaf nodes. Attribute names are hashed into an int, | | | |
| * then that int is used as the index into the Btree. Since the hashval | | | |
| * of an attribute name may not be unique, we may have duplicate keys. The | | | |
| * internal links in the Btree are logical block offsets into the file. | | | |
| */ | | | |
| | | | |
| struct attrlist; | | struct attrlist; | |
| struct attrlist_cursor_kern; | | struct attrlist_cursor_kern; | |
| struct xfs_attr_list_context; | | struct xfs_attr_list_context; | |
|
| struct xfs_dabuf; | | | |
| struct xfs_da_args; | | struct xfs_da_args; | |
| struct xfs_da_state; | | struct xfs_da_state; | |
| struct xfs_da_state_blk; | | struct xfs_da_state_blk; | |
| struct xfs_inode; | | struct xfs_inode; | |
| struct xfs_trans; | | struct xfs_trans; | |
| | | | |
|
| /*======================================================================== | | | |
| * Attribute structure when equal to XFS_LBSIZE(mp) bytes. | | | |
| *========================================================================* | | | |
| / | | | |
| | | | |
| /* | | | |
| * This is the structure of the leaf nodes in the Btree. | | | |
| * | | | |
| * Struct leaf_entry's are packed from the top. Name/values grow from the | | | |
| * bottom but are not packed. The freemap contains run-length-encoded entr | | | |
| ies | | | |
| * for the free bytes after the leaf_entry's, but only the N largest such, | | | |
| * smaller runs are dropped. When the freemap doesn't show enough space | | | |
| * for an allocation, we compact the name/value area and try again. If we | | | |
| * still don't have enough space, then we have to split the block. The | | | |
| * name/value structs (both local and remote versions) must be 32bit aligne | | | |
| d. | | | |
| * | | | |
| * Since we have duplicate hash keys, for each key that matches, compare | | | |
| * the actual name string. The root and intermediate node search always | | | |
| * takes the first-in-the-block key match found, so we should only have | | | |
| * to work "forw"ard. If none matches, continue with the "forw"ard leaf | | | |
| * nodes until the hash key changes or the attribute name is found. | | | |
| * | | | |
| * We store the fact that an attribute is a ROOT/USER/SECURE attribute in | | | |
| * the leaf_entry. The namespaces are independent only because we also loo | | | |
| k | | | |
| * at the namespace bit when we are looking for a matching attribute name. | | | |
| * | | | |
| * We also store an "incomplete" bit in the leaf_entry. It shows that an | | | |
| * attribute is in the middle of being created and should not be shown to | | | |
| * the user if we crash during the time that the bit is set. We clear the | | | |
| * bit when we have finished setting up the attribute. We do this because | | | |
| * we cannot create some large attributes inside a single transaction, and | | | |
| we | | | |
| * need some indication that we weren't finished if we crash in the middle. | | | |
| */ | | | |
| #define XFS_ATTR_LEAF_MAPSIZE 3 /* how many freespace slots */ | | | |
| | | | |
| typedef struct xfs_attr_leaf_map { /* RLE map of free bytes */ | | | |
| __be16 base; /* base of free region */ | | | |
| __be16 size; /* length of free region */ | | | |
| } xfs_attr_leaf_map_t; | | | |
| | | | |
| typedef struct xfs_attr_leaf_hdr { /* constant-structure header block * | | | |
| / | | | |
| xfs_da_blkinfo_t info; /* block type, links, etc. */ | | | |
| __be16 count; /* count of active leaf_entry's */ | | | |
| __be16 usedbytes; /* num bytes of names/values stored | | | |
| */ | | | |
| __be16 firstused; /* first used byte in name area */ | | | |
| __u8 holes; /* != 0 if blk needs compaction */ | | | |
| __u8 pad1; | | | |
| xfs_attr_leaf_map_t freemap[XFS_ATTR_LEAF_MAPSIZE]; | | | |
| /* N largest free regions */ | | | |
| } xfs_attr_leaf_hdr_t; | | | |
| | | | |
| typedef struct xfs_attr_leaf_entry { /* sorted on key, not name */ | | | |
| __be32 hashval; /* hash value of name */ | | | |
| __be16 nameidx; /* index into buffer of name/value * | | | |
| / | | | |
| __u8 flags; /* LOCAL/ROOT/SECURE/INCOMPLETE flag | | | |
| */ | | | |
| __u8 pad2; /* unused pad byte */ | | | |
| } xfs_attr_leaf_entry_t; | | | |
| | | | |
| typedef struct xfs_attr_leaf_name_local { | | | |
| __be16 valuelen; /* number of bytes in value */ | | | |
| __u8 namelen; /* length of name bytes */ | | | |
| __u8 nameval[1]; /* name/value bytes */ | | | |
| } xfs_attr_leaf_name_local_t; | | | |
| | | | |
| typedef struct xfs_attr_leaf_name_remote { | | | |
| __be32 valueblk; /* block number of value bytes */ | | | |
| __be32 valuelen; /* number of bytes in value */ | | | |
| __u8 namelen; /* length of name bytes */ | | | |
| __u8 name[1]; /* name bytes */ | | | |
| } xfs_attr_leaf_name_remote_t; | | | |
| | | | |
| typedef struct xfs_attr_leafblock { | | | |
| xfs_attr_leaf_hdr_t hdr; /* constant-structure header block * | | | |
| / | | | |
| xfs_attr_leaf_entry_t entries[1]; /* sorted on key, not name * | | | |
| / | | | |
| xfs_attr_leaf_name_local_t namelist; /* grows from bottom of buf | | | |
| */ | | | |
| xfs_attr_leaf_name_remote_t valuelist; /* grows from bottom of buf | | | |
| */ | | | |
| } xfs_attr_leafblock_t; | | | |
| | | | |
| /* | | | |
| * Flags used in the leaf_entry[i].flags field. | | | |
| * NOTE: the INCOMPLETE bit must not collide with the flags bits specified | | | |
| * on the system call, they are "or"ed together for various operations. | | | |
| */ | | | |
| #define XFS_ATTR_LOCAL_BIT 0 /* attr is stored locally */ | | | |
| #define XFS_ATTR_ROOT_BIT 1 /* limit access to trusted a | | | |
| ttrs */ | | | |
| #define XFS_ATTR_SECURE_BIT 2 /* limit access to secure at | | | |
| trs */ | | | |
| #define XFS_ATTR_INCOMPLETE_BIT 7 /* attr in middle of create/ | | | |
| delete */ | | | |
| #define XFS_ATTR_LOCAL (1 << XFS_ATTR_LOCAL_BIT) | | | |
| #define XFS_ATTR_ROOT (1 << XFS_ATTR_ROOT_BIT) | | | |
| #define XFS_ATTR_SECURE (1 << XFS_ATTR_SECURE_BIT) | | | |
| #define XFS_ATTR_INCOMPLETE (1 << XFS_ATTR_INCOMPLETE_BIT) | | | |
| | | | |
| /* | | | |
| * Conversion macros for converting namespace bits from argument flags | | | |
| * to ondisk flags. | | | |
| */ | | | |
| #define XFS_ATTR_NSP_ARGS_MASK (ATTR_ROOT | ATTR_SECURE) | | | |
| #define XFS_ATTR_NSP_ONDISK_MASK (XFS_ATTR_ROOT | XFS_ATTR_SECURE) | | | |
| #define XFS_ATTR_NSP_ONDISK(flags) ((flags) & XFS_ATTR_NSP_ONDISK_MASK) | | | |
| #define XFS_ATTR_NSP_ARGS(flags) ((flags) & XFS_ATTR_NSP_ARGS_MASK) | | | |
| #define XFS_ATTR_NSP_ARGS_TO_ONDISK(x) (((x) & ATTR_ROOT ? XFS_ATTR_ROOT : | | | |
| 0) |\ | | | |
| ((x) & ATTR_SECURE ? XFS_ATTR_SECUR | | | |
| E : 0)) | | | |
| #define XFS_ATTR_NSP_ONDISK_TO_ARGS(x) (((x) & XFS_ATTR_ROOT ? ATTR_ROOT : | | | |
| 0) |\ | | | |
| ((x) & XFS_ATTR_SECURE ? ATTR_SECUR | | | |
| E : 0)) | | | |
| | | | |
| /* | | | |
| * Alignment for namelist and valuelist entries (since they are mixed | | | |
| * there can be only one alignment value) | | | |
| */ | | | |
| #define XFS_ATTR_LEAF_NAME_ALIGN ((uint)sizeof(xfs_dablk_t)) | | | |
| | | | |
| /* | | | |
| * Cast typed pointers for "local" and "remote" name/value structs. | | | |
| */ | | | |
| static inline xfs_attr_leaf_name_remote_t * | | | |
| xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) | | | |
| { | | | |
| return (xfs_attr_leaf_name_remote_t *) | | | |
| &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | | | |
| } | | | |
| | | | |
| static inline xfs_attr_leaf_name_local_t * | | | |
| xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) | | | |
| { | | | |
| return (xfs_attr_leaf_name_local_t *) | | | |
| &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | | | |
| } | | | |
| | | | |
| static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx | | | |
| ) | | | |
| { | | | |
| return &((char *)leafp)[be16_to_cpu(leafp->entries[idx].nameidx)]; | | | |
| } | | | |
| | | | |
| /* | | | |
| * Calculate total bytes used (including trailing pad for alignment) for | | | |
| * a "local" name/value structure, a "remote" name/value structure, and | | | |
| * a pointer which might be either. | | | |
| */ | | | |
| static inline int xfs_attr_leaf_entsize_remote(int nlen) | | | |
| { | | | |
| return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ | | | |
| XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - | | | |
| 1); | | | |
| } | | | |
| | | | |
| static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) | | | |
| { | | | |
| return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vle | | | |
| n) + | | | |
| XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - | | | |
| 1); | | | |
| } | | | |
| | | | |
| static inline int xfs_attr_leaf_entsize_local_max(int bsize) | | | |
| { | | | |
| return (((bsize) >> 1) + ((bsize) >> 2)); | | | |
| } | | | |
| | | | |
| /* | | /* | |
| * Used to keep a list of "remote value" extents when unlinking an inode. | | * Used to keep a list of "remote value" extents when unlinking an inode. | |
| */ | | */ | |
| typedef struct xfs_attr_inactive_list { | | typedef struct xfs_attr_inactive_list { | |
| xfs_dablk_t valueblk; /* block number of value bytes */ | | xfs_dablk_t valueblk; /* block number of value bytes */ | |
| int valuelen; /* number of bytes in value */ | | int valuelen; /* number of bytes in value */ | |
| } xfs_attr_inactive_list_t; | | } xfs_attr_inactive_list_t; | |
| | | | |
| /*======================================================================== | | /*======================================================================== | |
| * Function prototypes for the kernel. | | * Function prototypes for the kernel. | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 53 | |
| /* | | /* | |
| * Internal routines when attribute fork size < XFS_LITINO(mp). | | * Internal routines when attribute fork size < XFS_LITINO(mp). | |
| */ | | */ | |
| void xfs_attr_shortform_create(struct xfs_da_args *args); | | void xfs_attr_shortform_create(struct xfs_da_args *args); | |
| void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); | | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); | |
| int xfs_attr_shortform_lookup(struct xfs_da_args *args); | | int xfs_attr_shortform_lookup(struct xfs_da_args *args); | |
| int xfs_attr_shortform_getvalue(struct xfs_da_args *args); | | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); | |
| int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); | | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); | |
| int xfs_attr_shortform_remove(struct xfs_da_args *args); | | int xfs_attr_shortform_remove(struct xfs_da_args *args); | |
| int xfs_attr_shortform_list(struct xfs_attr_list_context *context); | | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); | |
|
| int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp
); | | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); | |
| int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); | | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); | |
| | | | |
| /* | | /* | |
| * Internal routines when attribute fork size == XFS_LBSIZE(mp). | | * Internal routines when attribute fork size == XFS_LBSIZE(mp). | |
| */ | | */ | |
|
| int xfs_attr_leaf_to_node(struct xfs_da_args *args); | | int xfs_attr3_leaf_to_node(struct xfs_da_args *args); | |
| int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp, | | int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp, | |
| struct xfs_da_args *args, int forkoff); | | struct xfs_da_args *args, int forkoff); | |
|
| int xfs_attr_leaf_clearflag(struct xfs_da_args *args); | | int xfs_attr3_leaf_clearflag(struct xfs_da_args *args); | |
| int xfs_attr_leaf_setflag(struct xfs_da_args *args); | | int xfs_attr3_leaf_setflag(struct xfs_da_args *args); | |
| int xfs_attr_leaf_flipflags(xfs_da_args_t *args); | | int xfs_attr3_leaf_flipflags(struct xfs_da_args *args); | |
| | | | |
| /* | | /* | |
| * Routines used for growing the Btree. | | * Routines used for growing the Btree. | |
| */ | | */ | |
|
| int xfs_attr_leaf_split(struct xfs_da_state *state, | | int xfs_attr3_leaf_split(struct xfs_da_state *state, | |
| struct xfs_da_state_blk *oldblk, | | struct xfs_da_state_blk *oldblk, | |
| struct xfs_da_state_blk *newblk); | | struct xfs_da_state_blk *newblk); | |
|
| int xfs_attr_leaf_lookup_int(struct xfs_dabuf *leaf, | | int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf, | |
| struct xfs_da_args *args); | | struct xfs_da_args *args); | |
|
| int xfs_attr_leaf_getvalue(struct xfs_dabuf *bp, struct xfs_da_args *arg | | int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args | |
| s); | | ); | |
| int xfs_attr_leaf_add(struct xfs_dabuf *leaf_buffer, | | int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer, | |
| struct xfs_da_args *args); | | struct xfs_da_args *args); | |
|
| int xfs_attr_leaf_remove(struct xfs_dabuf *leaf_buffer, | | int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer, | |
| struct xfs_da_args *args); | | struct xfs_da_args *args); | |
|
| int xfs_attr_leaf_list_int(struct xfs_dabuf *bp, | | int xfs_attr3_leaf_list_int(struct xfs_buf *bp, | |
| struct xfs_attr_list_context *context)
; | | struct xfs_attr_list_context *context)
; | |
| | | | |
| /* | | /* | |
| * Routines used for shrinking the Btree. | | * Routines used for shrinking the Btree. | |
| */ | | */ | |
|
| int xfs_attr_leaf_toosmall(struct xfs_da_state *state, int *retval); | | int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval); | |
| void xfs_attr_leaf_unbalance(struct xfs_da_state *state, | | void xfs_attr3_leaf_unbalance(struct xfs_da_state *state, | |
| struct xfs_da_state_blk *drop_blk, | | struct xfs_da_state_blk *drop_blk, | |
| struct xfs_da_state_blk *save_blk); | | struct xfs_da_state_blk *save_blk); | |
|
| int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *d
p); | | int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *
dp); | |
| | | | |
| /* | | /* | |
| * Utility routines. | | * Utility routines. | |
| */ | | */ | |
|
| xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); | | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); | |
| int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, | | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, | |
| struct xfs_dabuf *leaf2_bp); | | struct xfs_buf *leaf2_bp); | |
| int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, | | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, | |
| int *local); | | int *local); | |
|
| | | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, | |
| | | xfs_dablk_t bno, xfs_daddr_t mappedbno, | |
| | | struct xfs_buf **bpp); | |
| | | void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to, | |
| | | struct xfs_attr_leafblock *from); | |
| | | void xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to, | |
| | | struct xfs_attr3_icleaf_hdr *from); | |
| | | | |
| #endif /* __XFS_ATTR_LEAF_H__ */ | | #endif /* __XFS_ATTR_LEAF_H__ */ | |
| | | | |
End of changes. 16 change blocks. |
| 208 lines changed or deleted | | 28 lines changed or added | |
|
| xfs_bmap.h | | xfs_bmap.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| typedef struct xfs_bmap_free | | typedef struct xfs_bmap_free | |
| { | | { | |
| xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extent
s */ | | xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extent
s */ | |
| int xbf_count; /* count of items on list */ | | int xbf_count; /* count of items on list */ | |
| int xbf_low; /* alloc in low mode */ | | int xbf_low; /* alloc in low mode */ | |
| } xfs_bmap_free_t; | | } xfs_bmap_free_t; | |
| | | | |
| #define XFS_BMAP_MAX_NMAP 4 | | #define XFS_BMAP_MAX_NMAP 4 | |
| | | | |
| /* | | /* | |
|
| * Flags for xfs_bmapi | | * Flags for xfs_bmapi_* | |
| */ | | */ | |
|
| #define XFS_BMAPI_WRITE 0x001 /* write operation: allocate | | #define XFS_BMAPI_ENTIRE 0x001 /* return entire extent, not trimmed | |
| space */ | | */ | |
| #define XFS_BMAPI_DELAY 0x002 /* delayed write operation * | | #define XFS_BMAPI_METADATA 0x002 /* mapping metadata not user data */ | |
| / | | #define XFS_BMAPI_ATTRFORK 0x004 /* use attribute fork not data */ | |
| #define XFS_BMAPI_ENTIRE 0x004 /* return entire extent, not trimmed | | #define XFS_BMAPI_PREALLOC 0x008 /* preallocation op: unwritten space | |
| */ | | */ | |
| #define XFS_BMAPI_METADATA 0x008 /* mapping metadata not user data */ | | #define XFS_BMAPI_IGSTATE 0x010 /* Ignore state - */ | |
| #define XFS_BMAPI_ATTRFORK 0x010 /* use attribute fork not data */ | | | |
| #define XFS_BMAPI_RSVBLOCKS 0x020 /* OK to alloc. reserved data blocks | | | |
| */ | | | |
| #define XFS_BMAPI_PREALLOC 0x040 /* preallocation op: unwritt | | | |
| en space */ | | | |
| #define XFS_BMAPI_IGSTATE 0x080 /* Ignore state - */ | | | |
| /* combine contig. space */ | | /* combine contig. space */ | |
|
| #define XFS_BMAPI_CONTIG 0x100 /* must allocate only one ex
tent */ | | #define XFS_BMAPI_CONTIG 0x020 /* must allocate only one extent */ | |
| /* | | /* | |
| * unwritten extent conversion - this needs write cache flushing and no add
itional | | * unwritten extent conversion - this needs write cache flushing and no add
itional | |
| * allocation alignments. When specified with XFS_BMAPI_PREALLOC it convert
s | | * allocation alignments. When specified with XFS_BMAPI_PREALLOC it convert
s | |
| * from written to unwritten, otherwise convert from unwritten to written. | | * from written to unwritten, otherwise convert from unwritten to written. | |
| */ | | */ | |
|
| #define XFS_BMAPI_CONVERT 0x200 | | #define XFS_BMAPI_CONVERT 0x040 | |
| | | #define XFS_BMAPI_STACK_SWITCH 0x080 | |
| | | | |
| #define XFS_BMAPI_FLAGS \ | | #define XFS_BMAPI_FLAGS \ | |
|
| { XFS_BMAPI_WRITE, "WRITE" }, \ | | | |
| { XFS_BMAPI_DELAY, "DELAY" }, \ | | | |
| { XFS_BMAPI_ENTIRE, "ENTIRE" }, \ | | { XFS_BMAPI_ENTIRE, "ENTIRE" }, \ | |
| { XFS_BMAPI_METADATA, "METADATA" }, \ | | { XFS_BMAPI_METADATA, "METADATA" }, \ | |
| { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \ | | { XFS_BMAPI_ATTRFORK, "ATTRFORK" }, \ | |
|
| { XFS_BMAPI_RSVBLOCKS, "RSVBLOCKS" }, \ | | | |
| { XFS_BMAPI_PREALLOC, "PREALLOC" }, \ | | { XFS_BMAPI_PREALLOC, "PREALLOC" }, \ | |
| { XFS_BMAPI_IGSTATE, "IGSTATE" }, \ | | { XFS_BMAPI_IGSTATE, "IGSTATE" }, \ | |
| { XFS_BMAPI_CONTIG, "CONTIG" }, \ | | { XFS_BMAPI_CONTIG, "CONTIG" }, \ | |
|
| { XFS_BMAPI_CONVERT, "CONVERT" } | | { XFS_BMAPI_CONVERT, "CONVERT" }, \ | |
| | | { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" } | |
| | | | |
| static inline int xfs_bmapi_aflag(int w) | | static inline int xfs_bmapi_aflag(int w) | |
| { | | { | |
| return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0); | | return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0); | |
| } | | } | |
| | | | |
| /* | | /* | |
| * Special values for xfs_bmbt_irec_t br_startblock field. | | * Special values for xfs_bmbt_irec_t br_startblock field. | |
| */ | | */ | |
| #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) | | #define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) | |
| #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) | | #define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) | |
| | | | |
| static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) | | static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) | |
| { | | { | |
| ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ | | ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ | |
| (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK); | | (flp)->xbf_low = 0, *(fbp) = NULLFSBLOCK); | |
| } | | } | |
| | | | |
| /* | | /* | |
|
| * Argument structure for xfs_bmap_alloc. | | | |
| */ | | | |
| typedef struct xfs_bmalloca { | | | |
| xfs_fsblock_t firstblock; /* i/o first block allocated */ | | | |
| xfs_fsblock_t rval; /* starting block of new extent */ | | | |
| xfs_fileoff_t off; /* offset in file filling in */ | | | |
| struct xfs_trans *tp; /* transaction pointer */ | | | |
| struct xfs_inode *ip; /* incore inode pointer */ | | | |
| struct xfs_bmbt_irec *prevp; /* extent before the new one */ | | | |
| struct xfs_bmbt_irec *gotp; /* extent after, or delayed */ | | | |
| xfs_extlen_t alen; /* i/o length asked/allocated */ | | | |
| xfs_extlen_t total; /* total blocks needed for xaction * | | | |
| / | | | |
| xfs_extlen_t minlen; /* minimum allocation size (blocks) | | | |
| */ | | | |
| xfs_extlen_t minleft; /* amount must be left after alloc | | | |
| */ | | | |
| char eof; /* set if allocating past last exten | | | |
| t */ | | | |
| char wasdel; /* replacing a delayed allocation */ | | | |
| char userdata;/* set if is user data */ | | | |
| char low; /* low on space, using seq'l ags */ | | | |
| char aeof; /* allocated space at eof */ | | | |
| char conv; /* overwriting unwritten extents */ | | | |
| } xfs_bmalloca_t; | | | |
| | | | |
| /* | | | |
| * Flags for xfs_bmap_add_extent*. | | * Flags for xfs_bmap_add_extent*. | |
| */ | | */ | |
| #define BMAP_LEFT_CONTIG (1 << 0) | | #define BMAP_LEFT_CONTIG (1 << 0) | |
| #define BMAP_RIGHT_CONTIG (1 << 1) | | #define BMAP_RIGHT_CONTIG (1 << 1) | |
| #define BMAP_LEFT_FILLING (1 << 2) | | #define BMAP_LEFT_FILLING (1 << 2) | |
| #define BMAP_RIGHT_FILLING (1 << 3) | | #define BMAP_RIGHT_FILLING (1 << 3) | |
| #define BMAP_LEFT_DELAY (1 << 4) | | #define BMAP_LEFT_DELAY (1 << 4) | |
| #define BMAP_RIGHT_DELAY (1 << 5) | | #define BMAP_RIGHT_DELAY (1 << 5) | |
| #define BMAP_LEFT_VALID (1 << 6) | | #define BMAP_LEFT_VALID (1 << 6) | |
| #define BMAP_RIGHT_VALID (1 << 7) | | #define BMAP_RIGHT_VALID (1 << 7) | |
| #define BMAP_ATTRFORK (1 << 8) | | #define BMAP_ATTRFORK (1 << 8) | |
| | | | |
| #define XFS_BMAP_EXT_FLAGS \ | | #define XFS_BMAP_EXT_FLAGS \ | |
| { BMAP_LEFT_CONTIG, "LC" }, \ | | { BMAP_LEFT_CONTIG, "LC" }, \ | |
| { BMAP_RIGHT_CONTIG, "RC" }, \ | | { BMAP_RIGHT_CONTIG, "RC" }, \ | |
| { BMAP_LEFT_FILLING, "LF" }, \ | | { BMAP_LEFT_FILLING, "LF" }, \ | |
| { BMAP_RIGHT_FILLING, "RF" }, \ | | { BMAP_RIGHT_FILLING, "RF" }, \ | |
| { BMAP_ATTRFORK, "ATTR" } | | { BMAP_ATTRFORK, "ATTR" } | |
| | | | |
|
| /* | | #ifdef DEBUG | |
| * Add bmap trace insert entries for all the contents of the extent list. | | void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt, | |
| * | | int whichfork, unsigned long caller_ip); | |
| * Quite excessive tracing. Only do this for debug builds. | | | |
| */ | | | |
| #if defined(__KERNEL) && defined(DEBUG) | | | |
| void | | | |
| xfs_bmap_trace_exlist( | | | |
| struct xfs_inode *ip, /* incore inode pointer */ | | | |
| xfs_extnum_t cnt, /* count of entries in list | | | |
| */ | | | |
| int whichfork, | | | |
| unsigned long caller_ip); /* data or attr fork */ | | | |
| #define XFS_BMAP_TRACE_EXLIST(ip,c,w) \ | | #define XFS_BMAP_TRACE_EXLIST(ip,c,w) \ | |
| xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_) | | xfs_bmap_trace_exlist(ip,c,w, _THIS_IP_) | |
| #else | | #else | |
| #define XFS_BMAP_TRACE_EXLIST(ip,c,w) | | #define XFS_BMAP_TRACE_EXLIST(ip,c,w) | |
| #endif | | #endif | |
| | | | |
|
| /* | | int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd); | |
| * Convert inode from non-attributed to attributed. | | void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork) | |
| * Must not be in a transaction, ip must not be locked. | | ; | |
| */ | | void xfs_bmap_add_free(xfs_fsblock_t bno, xfs_filblks_t len, | |
| int /* error code */ | | struct xfs_bmap_free *flist, struct xfs_mount *mp); | |
| xfs_bmap_add_attrfork( | | void xfs_bmap_cancel(struct xfs_bmap_free *flist); | |
| struct xfs_inode *ip, /* incore inode pointer */ | | void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork); | |
| int size, /* space needed for new attribute */ | | int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip, | |
| int rsvd); /* flag for reserved block allocatio | | xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork); | |
| n */ | | int xfs_bmap_last_before(struct xfs_trans *tp, struct xfs_inode *ip, | |
| | | xfs_fileoff_t *last_block, int whichfork); | |
| /* | | int xfs_bmap_last_offset(struct xfs_trans *tp, struct xfs_inode *ip, | |
| * Add the extent to the list of extents to be free at transaction end. | | xfs_fileoff_t *unused, int whichfork); | |
| * The list is maintained sorted (by block number). | | int xfs_bmap_one_block(struct xfs_inode *ip, int whichfork); | |
| */ | | int xfs_bmap_read_extents(struct xfs_trans *tp, struct xfs_inode *ip, | |
| void | | int whichfork); | |
| xfs_bmap_add_free( | | int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, | |
| xfs_fsblock_t bno, /* fs block number of extent | | xfs_filblks_t len, struct xfs_bmbt_irec *mval, | |
| */ | | int *nmap, int flags); | |
| xfs_filblks_t len, /* length of extent */ | | int xfs_bmapi_delay(struct xfs_inode *ip, xfs_fileoff_t bno, | |
| xfs_bmap_free_t *flist, /* list of extents */ | | xfs_filblks_t len, struct xfs_bmbt_irec *mval, | |
| struct xfs_mount *mp); /* mount point structure */ | | int *nmap, int flags); | |
| | | int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip, | |
| /* | | xfs_fileoff_t bno, xfs_filblks_t len, int flags, | |
| * Routine to clean up the free list data structure when | | xfs_fsblock_t *firstblock, xfs_extlen_t total, | |
| * an error occurs during a transaction. | | struct xfs_bmbt_irec *mval, int *nmap, | |
| */ | | struct xfs_bmap_free *flist); | |
| void | | int xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, | |
| xfs_bmap_cancel( | | xfs_fileoff_t bno, xfs_filblks_t len, int flags, | |
| xfs_bmap_free_t *flist); /* free list to clean up */ | | xfs_extnum_t nexts, xfs_fsblock_t *firstblock, | |
| | | struct xfs_bmap_free *flist, int *done); | |
| /* | | int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx, | |
| * Compute and fill in the value of the maximum depth of a bmap btree | | xfs_extnum_t num); | |
| * in this filesystem. Done once, during mount. | | uint xfs_default_attroffset(struct xfs_inode *ip); | |
| */ | | | |
| void | | | |
| xfs_bmap_compute_maxlevels( | | | |
| struct xfs_mount *mp, /* file system mount structure */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Returns the file-relative block number of the first unused block in the | | | |
| file. | | | |
| * This is the lowest-address hole if the file has holes, else the first bl | | | |
| ock | | | |
| * past the end of file. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmap_first_unused( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| xfs_extlen_t len, /* size of hole to find */ | | | |
| xfs_fileoff_t *unused, /* unused block num */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Returns the file-relative block number of the last block + 1 before | | | |
| * last_block (input value) in the file. | | | |
| * This is not based on i_size, it is based on the extent list. | | | |
| * Returns 0 for local files, as they do not have an extent list. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmap_last_before( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| xfs_fileoff_t *last_block, /* last block */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Returns the file-relative block number of the first block past eof in | | | |
| * the file. This is not based on i_size, it is based on the extent list. | | | |
| * Returns 0 for local files, as they do not have an extent list. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmap_last_offset( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| xfs_fileoff_t *unused, /* last block num */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Returns whether the selected fork of the inode has exactly one | | | |
| * block or not. For the data fork we check this matches di_size, | | | |
| * implying the file's range is 0..bsize-1. | | | |
| */ | | | |
| int | | | |
| xfs_bmap_one_block( | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Read in the extents to iu_extents. | | | |
| * All inode fields are set up by caller, we just traverse the btree | | | |
| * and copy the records in. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmap_read_extents( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| int whichfork); /* data or attr fork */ | | | |
| | | | |
| /* | | | |
| * Map file blocks to filesystem blocks. | | | |
| * File range is given by the bno/len pair. | | | |
| * Adds blocks to file if a write ("flags & XFS_BMAPI_WRITE" set) | | | |
| * into a hole or past eof. | | | |
| * Only allocates blocks from a single allocation group, | | | |
| * to avoid locking problems. | | | |
| * The returned value in "firstblock" from the first call in a transaction | | | |
| * must be remembered and presented to subsequent calls in "firstblock". | | | |
| * An upper bound for the number of blocks to be allocated is supplied to | | | |
| * the first call in "total"; if no allocation group has that many free | | | |
| * blocks then the call will fail (return NULLFSBLOCK in "firstblock"). | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmapi( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| xfs_fileoff_t bno, /* starting file offs. mappe | | | |
| d */ | | | |
| xfs_filblks_t len, /* length to map in file */ | | | |
| int flags, /* XFS_BMAPI_... */ | | | |
| xfs_fsblock_t *firstblock, /* first allocated block | | | |
| controls a.g. for allocs | | | |
| */ | | | |
| xfs_extlen_t total, /* total blocks needed */ | | | |
| struct xfs_bmbt_irec *mval, /* output: map values */ | | | |
| int *nmap, /* i/o: mval size/count */ | | | |
| xfs_bmap_free_t *flist); /* i/o: list extents to free | | | |
| */ | | | |
| | | | |
| /* | | | |
| * Map file blocks to filesystem blocks, simple version. | | | |
| * One block only, read-only. | | | |
| * For flags, only the XFS_BMAPI_ATTRFORK flag is examined. | | | |
| * For the other flag values, the effect is as if XFS_BMAPI_METADATA | | | |
| * was set and all the others were clear. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmapi_single( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| int whichfork, /* data or attr fork */ | | | |
| xfs_fsblock_t *fsb, /* output: mapped block */ | | | |
| xfs_fileoff_t bno); /* starting file offs. mappe | | | |
| d */ | | | |
| | | | |
| /* | | | |
| * Unmap (remove) blocks from a file. | | | |
| * If nexts is nonzero then the number of extents to remove is limited to | | | |
| * that value. If not all extents in the block range can be removed then | | | |
| * *done is set. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bunmapi( | | | |
| struct xfs_trans *tp, /* transaction pointer */ | | | |
| struct xfs_inode *ip, /* incore inode */ | | | |
| xfs_fileoff_t bno, /* starting offset to unmap | | | |
| */ | | | |
| xfs_filblks_t len, /* length to unmap in file * | | | |
| / | | | |
| int flags, /* XFS_BMAPI_... */ | | | |
| xfs_extnum_t nexts, /* number of extents max */ | | | |
| xfs_fsblock_t *firstblock, /* first allocated block | | | |
| controls a.g. for allocs | | | |
| */ | | | |
| xfs_bmap_free_t *flist, /* i/o: list extents to free | | | |
| */ | | | |
| int *done); /* set if not done yet */ | | | |
| | | | |
| /* | | | |
| * Check an extent list, which has just been read, for | | | |
| * any bit in the extent flag field. | | | |
| */ | | | |
| int | | | |
| xfs_check_nostate_extents( | | | |
| struct xfs_ifork *ifp, | | | |
| xfs_extnum_t idx, | | | |
| xfs_extnum_t num); | | | |
| | | | |
| uint | | | |
| xfs_default_attroffset( | | | |
| struct xfs_inode *ip); | | | |
| | | | |
| #ifdef __KERNEL__ | | | |
| | | | |
| /* | | | |
| * Routine to be called at transaction's end by xfs_bmapi, xfs_bunmapi | | | |
| * caller. Frees all the extents that need freeing, which must be done | | | |
| * last due to locking considerations. | | | |
| * | | | |
| * Return 1 if the given transaction was committed and a new one allocated, | | | |
| * and 0 otherwise. | | | |
| */ | | | |
| int /* error */ | | | |
| xfs_bmap_finish( | | | |
| struct xfs_trans **tp, /* transaction pointer addr | | | |
| */ | | | |
| xfs_bmap_free_t *flist, /* i/o: list extents to free | | | |
| */ | | | |
| int *committed); /* xact committed or not */ | | | |
| | | | |
| /* bmap to userspace formatter - copy to user & advance pointer */ | | | |
| typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *); | | | |
| | | | |
| /* | | | |
| * Get inode's extents as described in bmv, and format for output. | | | |
| */ | | | |
| int /* error code */ | | | |
| xfs_getbmap( | | | |
| xfs_inode_t *ip, | | | |
| struct getbmapx *bmv, /* user bmap structure */ | | | |
| xfs_bmap_format_t formatter, /* format to user */ | | | |
| void *arg); /* formatter arg */ | | | |
| | | | |
| /* | | | |
| * Check if the endoff is outside the last extent. If so the caller will gr | | | |
| ow | | | |
| * the allocation to a stripe unit boundary | | | |
| */ | | | |
| int | | | |
| xfs_bmap_eof( | | | |
| struct xfs_inode *ip, | | | |
| xfs_fileoff_t endoff, | | | |
| int whichfork, | | | |
| int *eof); | | | |
| | | | |
| /* | | | |
| * Count fsblocks of the given fork. | | | |
| */ | | | |
| int | | | |
| xfs_bmap_count_blocks( | | | |
| xfs_trans_t *tp, | | | |
| struct xfs_inode *ip, | | | |
| int whichfork, | | | |
| int *count); | | | |
| | | | |
| int | | | |
| xfs_bmap_punch_delalloc_range( | | | |
| struct xfs_inode *ip, | | | |
| xfs_fileoff_t start_fsb, | | | |
| xfs_fileoff_t length); | | | |
| #endif /* __KERNEL__ */ | | | |
| | | | |
| #endif /* __XFS_BMAP_H__ */ | | #endif /* __XFS_BMAP_H__ */ | |
| | | | |
End of changes. 10 change blocks. |
| 303 lines changed or deleted | | 50 lines changed or added | |
|
| xfs_btree.h | | xfs_btree.h | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| #define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi) | | #define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi) | |
| #define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi) | | #define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi) | |
| #define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi) | | #define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi) | |
| | | | |
| #define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi) | | #define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi) | |
| #define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi) | | #define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi) | |
| #define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi) | | #define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi) | |
| #define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) | | #define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi) | |
| | | | |
| /* | | /* | |
|
| * Generic btree header. | | | |
| * | | | |
| * This is a combination of the actual format used on disk for short and lo | | | |
| ng | | | |
| * format btrees. The first three fields are shared by both format, but | | | |
| * the pointers are different and should be used with care. | | | |
| * | | | |
| * To get the size of the actual short or long form headers please use | | | |
| * the size macros below. Never use sizeof(xfs_btree_block). | | | |
| */ | | | |
| struct xfs_btree_block { | | | |
| __be32 bb_magic; /* magic number for block type */ | | | |
| __be16 bb_level; /* 0 is a leaf */ | | | |
| __be16 bb_numrecs; /* current # of data records */ | | | |
| union { | | | |
| struct { | | | |
| __be32 bb_leftsib; | | | |
| __be32 bb_rightsib; | | | |
| } s; /* short form pointers */ | | | |
| struct { | | | |
| __be64 bb_leftsib; | | | |
| __be64 bb_rightsib; | | | |
| } l; /* long form pointers */ | | | |
| } bb_u; /* rest */ | | | |
| }; | | | |
| | | | |
| #define XFS_BTREE_SBLOCK_LEN 16 /* size of a short form block */ | | | |
| #define XFS_BTREE_LBLOCK_LEN 24 /* size of a long form block */ | | | |
| | | | |
| /* | | | |
| * Generic key, ptr and record wrapper structures. | | | |
| * | | | |
| * These are disk format structures, and are converted where necessary | | | |
| * by the btree specific code that needs to interpret them. | | | |
| */ | | | |
| union xfs_btree_ptr { | | | |
| __be32 s; /* short form ptr */ | | | |
| __be64 l; /* long form ptr */ | | | |
| }; | | | |
| | | | |
| union xfs_btree_key { | | | |
| xfs_bmbt_key_t bmbt; | | | |
| xfs_bmdr_key_t bmbr; /* bmbt root block */ | | | |
| xfs_alloc_key_t alloc; | | | |
| xfs_inobt_key_t inobt; | | | |
| }; | | | |
| | | | |
| union xfs_btree_rec { | | | |
| xfs_bmbt_rec_t bmbt; | | | |
| xfs_bmdr_rec_t bmbr; /* bmbt root block */ | | | |
| xfs_alloc_rec_t alloc; | | | |
| xfs_inobt_rec_t inobt; | | | |
| }; | | | |
| | | | |
| /* | | | |
| * For logging record fields. | | * For logging record fields. | |
| */ | | */ | |
|
| #define XFS_BB_MAGIC 0x01 | | #define XFS_BB_MAGIC (1 << 0) | |
| #define XFS_BB_LEVEL 0x02 | | #define XFS_BB_LEVEL (1 << 1) | |
| #define XFS_BB_NUMRECS 0x04 | | #define XFS_BB_NUMRECS (1 << 2) | |
| #define XFS_BB_LEFTSIB 0x08 | | #define XFS_BB_LEFTSIB (1 << 3) | |
| #define XFS_BB_RIGHTSIB 0x10 | | #define XFS_BB_RIGHTSIB (1 << 4) | |
| | | #define XFS_BB_BLKNO (1 << 5) | |
| | | #define XFS_BB_LSN (1 << 6) | |
| | | #define XFS_BB_UUID (1 << 7) | |
| | | #define XFS_BB_OWNER (1 << 8) | |
| #define XFS_BB_NUM_BITS 5 | | #define XFS_BB_NUM_BITS 5 | |
| #define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) | | #define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1) | |
|
| | | #define XFS_BB_NUM_BITS_CRC 9 | |
| /* | | #define XFS_BB_ALL_BITS_CRC ((1 << XFS_BB_NUM_BITS_CRC) - 1) | |
| * Magic numbers for btree blocks. | | | |
| */ | | | |
| extern const __uint32_t xfs_magics[]; | | | |
| | | | |
| /* | | /* | |
| * Generic stats interface | | * Generic stats interface | |
| */ | | */ | |
| #define __XFS_BTREE_STATS_INC(type, stat) \ | | #define __XFS_BTREE_STATS_INC(type, stat) \ | |
| XFS_STATS_INC(xs_ ## type ## _2_ ## stat) | | XFS_STATS_INC(xs_ ## type ## _2_ ## stat) | |
| #define XFS_BTREE_STATS_INC(cur, stat) \ | | #define XFS_BTREE_STATS_INC(cur, stat) \ | |
| do { \ | | do { \ | |
| switch (cur->bc_btnum) { \ | | switch (cur->bc_btnum) { \ | |
| case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \ | | case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \ | |
| | | | |
| skipping to change at line 190 | | skipping to change at line 137 | |
| union xfs_btree_rec *rec); | | union xfs_btree_rec *rec); | |
| void (*init_rec_from_cur)(struct xfs_btree_cur *cur, | | void (*init_rec_from_cur)(struct xfs_btree_cur *cur, | |
| union xfs_btree_rec *rec); | | union xfs_btree_rec *rec); | |
| void (*init_ptr_from_cur)(struct xfs_btree_cur *cur, | | void (*init_ptr_from_cur)(struct xfs_btree_cur *cur, | |
| union xfs_btree_ptr *ptr); | | union xfs_btree_ptr *ptr); | |
| | | | |
| /* difference between key value and cursor value */ | | /* difference between key value and cursor value */ | |
| __int64_t (*key_diff)(struct xfs_btree_cur *cur, | | __int64_t (*key_diff)(struct xfs_btree_cur *cur, | |
| union xfs_btree_key *key); | | union xfs_btree_key *key); | |
| | | | |
|
| #ifdef DEBUG | | const struct xfs_buf_ops *buf_ops; | |
| | | | |
| | | #if defined(DEBUG) || defined(XFS_WARN) | |
| /* check that k1 is lower than k2 */ | | /* check that k1 is lower than k2 */ | |
| int (*keys_inorder)(struct xfs_btree_cur *cur, | | int (*keys_inorder)(struct xfs_btree_cur *cur, | |
| union xfs_btree_key *k1, | | union xfs_btree_key *k1, | |
| union xfs_btree_key *k2); | | union xfs_btree_key *k2); | |
| | | | |
| /* check that r1 is lower than r2 */ | | /* check that r1 is lower than r2 */ | |
| int (*recs_inorder)(struct xfs_btree_cur *cur, | | int (*recs_inorder)(struct xfs_btree_cur *cur, | |
| union xfs_btree_rec *r1, | | union xfs_btree_rec *r1, | |
| union xfs_btree_rec *r2); | | union xfs_btree_rec *r2); | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 274 | | skipping to change at line 223 | |
| char flags; /* flags */ | | char flags; /* flags */ | |
| #define XFS_BTCUR_BPRV_WASDEL 1 /* was delay
ed */ | | #define XFS_BTCUR_BPRV_WASDEL 1 /* was delay
ed */ | |
| } b; | | } b; | |
| } bc_private; /* per-btree type data */ | | } bc_private; /* per-btree type data */ | |
| } xfs_btree_cur_t; | | } xfs_btree_cur_t; | |
| | | | |
| /* cursor flags */ | | /* cursor flags */ | |
| #define XFS_BTREE_LONG_PTRS (1<<0) /* pointers are 64bits long
*/ | | #define XFS_BTREE_LONG_PTRS (1<<0) /* pointers are 64bits long
*/ | |
| #define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be varia
ble size */ | | #define XFS_BTREE_ROOT_IN_INODE (1<<1) /* root may be varia
ble size */ | |
| #define XFS_BTREE_LASTREC_UPDATE (1<<2) /* track last rec externally
*/ | | #define XFS_BTREE_LASTREC_UPDATE (1<<2) /* track last rec externally
*/ | |
|
| | | #define XFS_BTREE_CRC_BLOCKS (1<<3) /* uses extended btree block
s */ | |
| | | | |
| #define XFS_BTREE_NOERROR 0 | | #define XFS_BTREE_NOERROR 0 | |
| #define XFS_BTREE_ERROR 1 | | #define XFS_BTREE_ERROR 1 | |
| | | | |
| /* | | /* | |
| * Convert from buffer to btree block header. | | * Convert from buffer to btree block header. | |
| */ | | */ | |
|
| #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)XFS_BUF_P
TR(bp)) | | #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)((bp)->b_
addr)) | |
| | | | |
| /* | | /* | |
| * Check that block header is ok. | | * Check that block header is ok. | |
| */ | | */ | |
| int | | int | |
| xfs_btree_check_block( | | xfs_btree_check_block( | |
| struct xfs_btree_cur *cur, /* btree cursor */ | | struct xfs_btree_cur *cur, /* btree cursor */ | |
| struct xfs_btree_block *block, /* generic btree block pointer */ | | struct xfs_btree_block *block, /* generic btree block pointer */ | |
| int level, /* level of the btree block */ | | int level, /* level of the btree block */ | |
| struct xfs_buf *bp); /* buffer containing block, if any *
/ | | struct xfs_buf *bp); /* buffer containing block, if any *
/ | |
| | | | |
| skipping to change at line 373 | | skipping to change at line 323 | |
| * Get a buffer for the block, return it read in. | | * Get a buffer for the block, return it read in. | |
| * Long-form addressing. | | * Long-form addressing. | |
| */ | | */ | |
| int /* error */ | | int /* error */ | |
| xfs_btree_read_bufl( | | xfs_btree_read_bufl( | |
| struct xfs_mount *mp, /* file system mount point */ | | struct xfs_mount *mp, /* file system mount point */ | |
| struct xfs_trans *tp, /* transaction pointer */ | | struct xfs_trans *tp, /* transaction pointer */ | |
| xfs_fsblock_t fsbno, /* file system block number */ | | xfs_fsblock_t fsbno, /* file system block number */ | |
| uint lock, /* lock flags for read_buf */ | | uint lock, /* lock flags for read_buf */ | |
| struct xfs_buf **bpp, /* buffer for fsbno */ | | struct xfs_buf **bpp, /* buffer for fsbno */ | |
|
| int refval);/* ref count value for buffer */ | | int refval, /* ref count value for buffer */ | |
| | | const struct xfs_buf_ops *ops); | |
| | | | |
| /* | | /* | |
| * Read-ahead the block, don't wait for it, don't return a buffer. | | * Read-ahead the block, don't wait for it, don't return a buffer. | |
| * Long-form addressing. | | * Long-form addressing. | |
| */ | | */ | |
| void /* error */ | | void /* error */ | |
| xfs_btree_reada_bufl( | | xfs_btree_reada_bufl( | |
| struct xfs_mount *mp, /* file system mount point */ | | struct xfs_mount *mp, /* file system mount point */ | |
| xfs_fsblock_t fsbno, /* file system block number */ | | xfs_fsblock_t fsbno, /* file system block number */ | |
|
| xfs_extlen_t count); /* count of filesystem blocks */ | | xfs_extlen_t count, /* count of filesystem blocks */ | |
| | | const struct xfs_buf_ops *ops); | |
| | | | |
| /* | | /* | |
| * Read-ahead the block, don't wait for it, don't return a buffer. | | * Read-ahead the block, don't wait for it, don't return a buffer. | |
| * Short-form addressing. | | * Short-form addressing. | |
| */ | | */ | |
| void /* error */ | | void /* error */ | |
| xfs_btree_reada_bufs( | | xfs_btree_reada_bufs( | |
| struct xfs_mount *mp, /* file system mount point */ | | struct xfs_mount *mp, /* file system mount point */ | |
| xfs_agnumber_t agno, /* allocation group number */ | | xfs_agnumber_t agno, /* allocation group number */ | |
| xfs_agblock_t agbno, /* allocation group block number */ | | xfs_agblock_t agbno, /* allocation group block number */ | |
|
| xfs_extlen_t count); /* count of filesystem blocks */ | | xfs_extlen_t count, /* count of filesystem blocks */ | |
| | | const struct xfs_buf_ops *ops); | |
| | | | |
| | | /* | |
| | | * Initialise a new btree block header | |
| | | */ | |
| | | void | |
| | | xfs_btree_init_block( | |
| | | struct xfs_mount *mp, | |
| | | struct xfs_buf *bp, | |
| | | __u32 magic, | |
| | | __u16 level, | |
| | | __u16 numrecs, | |
| | | __u64 owner, | |
| | | unsigned int flags); | |
| | | | |
| | | void | |
| | | xfs_btree_init_block_int( | |
| | | struct xfs_mount *mp, | |
| | | struct xfs_btree_block *buf, | |
| | | xfs_daddr_t blkno, | |
| | | __u32 magic, | |
| | | __u16 level, | |
| | | __u16 numrecs, | |
| | | __u64 owner, | |
| | | unsigned int flags); | |
| | | | |
| /* | | /* | |
| * Common btree core entry points. | | * Common btree core entry points. | |
| */ | | */ | |
| int xfs_btree_increment(struct xfs_btree_cur *, int, int *); | | int xfs_btree_increment(struct xfs_btree_cur *, int, int *); | |
| int xfs_btree_decrement(struct xfs_btree_cur *, int, int *); | | int xfs_btree_decrement(struct xfs_btree_cur *, int, int *); | |
| int xfs_btree_lookup(struct xfs_btree_cur *, xfs_lookup_t, int *); | | int xfs_btree_lookup(struct xfs_btree_cur *, xfs_lookup_t, int *); | |
| int xfs_btree_update(struct xfs_btree_cur *, union xfs_btree_rec *); | | int xfs_btree_update(struct xfs_btree_cur *, union xfs_btree_rec *); | |
| int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *); | | int xfs_btree_new_iroot(struct xfs_btree_cur *, int *, int *); | |
| int xfs_btree_insert(struct xfs_btree_cur *, int *); | | int xfs_btree_insert(struct xfs_btree_cur *, int *); | |
| int xfs_btree_delete(struct xfs_btree_cur *, int *); | | int xfs_btree_delete(struct xfs_btree_cur *, int *); | |
| int xfs_btree_get_rec(struct xfs_btree_cur *, union xfs_btree_rec **, int *
); | | int xfs_btree_get_rec(struct xfs_btree_cur *, union xfs_btree_rec **, int *
); | |
|
| | | int xfs_btree_change_owner(struct xfs_btree_cur *cur, __uint64_t new_owner, | |
| | | struct list_head *buffer_list); | |
| | | | |
| | | /* | |
| | | * btree block CRC helpers | |
| | | */ | |
| | | void xfs_btree_lblock_calc_crc(struct xfs_buf *); | |
| | | bool xfs_btree_lblock_verify_crc(struct xfs_buf *); | |
| | | void xfs_btree_sblock_calc_crc(struct xfs_buf *); | |
| | | bool xfs_btree_sblock_verify_crc(struct xfs_buf *); | |
| | | | |
| /* | | /* | |
| * Internal btree helpers also used by xfs_bmap.c. | | * Internal btree helpers also used by xfs_bmap.c. | |
| */ | | */ | |
| void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int); | | void xfs_btree_log_block(struct xfs_btree_cur *, struct xfs_buf *, int); | |
| void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int)
; | | void xfs_btree_log_recs(struct xfs_btree_cur *, struct xfs_buf *, int, int)
; | |
| | | | |
| /* | | /* | |
| * Helpers. | | * Helpers. | |
| */ | | */ | |
| | | | |
End of changes. 10 change blocks. |
| 70 lines changed or deleted | | 56 lines changed or added | |
|
| xfs_da_btree.h | | xfs_da_btree.h | |
| /* | | /* | |
| * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. | | * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. | |
|
| | | * Copyright (c) 2013 Red Hat, Inc. | |
| * All Rights Reserved. | | * All Rights Reserved. | |
| * | | * | |
| * This program is free software; you can redistribute it and/or | | * This program is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU General Public License as | | * modify it under the terms of the GNU General Public License as | |
| * published by the Free Software Foundation. | | * published by the Free Software Foundation. | |
| * | | * | |
| * This program is distributed in the hope that it would be useful, | | * This program is distributed in the hope that it would be useful, | |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| * GNU General Public License for more details. | | * GNU General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU General Public License | | * You should have received a copy of the GNU General Public License | |
| * along with this program; if not, write the Free Software Foundation, | | * along with this program; if not, write the Free Software Foundation, | |
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| */ | | */ | |
| #ifndef __XFS_DA_BTREE_H__ | | #ifndef __XFS_DA_BTREE_H__ | |
| #define __XFS_DA_BTREE_H__ | | #define __XFS_DA_BTREE_H__ | |
| | | | |
|
| struct xfs_buf; | | | |
| struct xfs_bmap_free; | | struct xfs_bmap_free; | |
| struct xfs_inode; | | struct xfs_inode; | |
|
| struct xfs_mount; | | | |
| struct xfs_trans; | | struct xfs_trans; | |
| struct zone; | | struct zone; | |
| | | | |
| /*======================================================================== | | /*======================================================================== | |
|
| * Directory Structure when greater than XFS_LBSIZE(mp) bytes. | | | |
| *========================================================================* | | | |
| / | | | |
| | | | |
| /* | | | |
| * This structure is common to both leaf nodes and non-leaf nodes in the Bt | | | |
| ree. | | | |
| * | | | |
| * Is is used to manage a doubly linked list of all blocks at the same | | | |
| * level in the Btree, and to identify which type of block this is. | | | |
| */ | | | |
| #define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */ | | | |
| #define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks | | | |
| */ | | | |
| #define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf si | | | |
| ngle blks */ | | | |
| #define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf mu | | | |
| lti blks */ | | | |
| | | | |
| typedef struct xfs_da_blkinfo { | | | |
| __be32 forw; /* previous block in list */ | | | |
| __be32 back; /* following block in list * | | | |
| / | | | |
| __be16 magic; /* validity check on block * | | | |
| / | | | |
| __be16 pad; /* unused */ | | | |
| } xfs_da_blkinfo_t; | | | |
| | | | |
| /* | | | |
| * This is the structure of the root and intermediate nodes in the Btree. | | | |
| * The leaf nodes are defined above. | | | |
| * | | | |
| * Entries are not packed. | | | |
| * | | | |
| * Since we have duplicate keys, use a binary search but always follow | | | |
| * all match in the block, not just the first match found. | | | |
| */ | | | |
| #define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */ | | | |
| | | | |
| typedef struct xfs_da_intnode { | | | |
| struct xfs_da_node_hdr { /* constant-structure header block * | | | |
| / | | | |
| xfs_da_blkinfo_t info; /* block type, links, etc. */ | | | |
| __be16 count; /* count of active entries */ | | | |
| __be16 level; /* level above leaves (leaf == 0) */ | | | |
| } hdr; | | | |
| struct xfs_da_node_entry { | | | |
| __be32 hashval; /* hash value for this descendant */ | | | |
| __be32 before; /* Btree block before this key */ | | | |
| } btree[1]; /* variable sized array of keys */ | | | |
| } xfs_da_intnode_t; | | | |
| typedef struct xfs_da_node_hdr xfs_da_node_hdr_t; | | | |
| typedef struct xfs_da_node_entry xfs_da_node_entry_t; | | | |
| | | | |
| #define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize | | | |
| | | | |
| /*======================================================================== | | | |
| * Btree searching and modification structure definitions. | | * Btree searching and modification structure definitions. | |
| *========================================================================*
/ | | *========================================================================*
/ | |
| | | | |
| /* | | /* | |
| * Search comparison results | | * Search comparison results | |
| */ | | */ | |
| enum xfs_dacmp { | | enum xfs_dacmp { | |
| XFS_CMP_DIFFERENT, /* names are completely different */ | | XFS_CMP_DIFFERENT, /* names are completely different */ | |
| XFS_CMP_EXACT, /* names are exactly the same */ | | XFS_CMP_EXACT, /* names are exactly the same */ | |
| XFS_CMP_CASE /* names are same but differ in case */ | | XFS_CMP_CASE /* names are same but differ in case */ | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Structure to ease passing around component names. | | * Structure to ease passing around component names. | |
| */ | | */ | |
| typedef struct xfs_da_args { | | typedef struct xfs_da_args { | |
| const __uint8_t *name; /* string (maybe not NULL terminated
) */ | | const __uint8_t *name; /* string (maybe not NULL terminated
) */ | |
| int namelen; /* length of string (maybe no NULL)
*/ | | int namelen; /* length of string (maybe no NULL)
*/ | |
|
| | | __uint8_t filetype; /* filetype of inode for directories
*/ | |
| __uint8_t *value; /* set of bytes (maybe contain NULLs
) */ | | __uint8_t *value; /* set of bytes (maybe contain NULLs
) */ | |
| int valuelen; /* length of value */ | | int valuelen; /* length of value */ | |
| int flags; /* argument flags (eg: ATTR_NOCREATE
) */ | | int flags; /* argument flags (eg: ATTR_NOCREATE
) */ | |
| xfs_dahash_t hashval; /* hash value of name */ | | xfs_dahash_t hashval; /* hash value of name */ | |
| xfs_ino_t inumber; /* input/output inode number */ | | xfs_ino_t inumber; /* input/output inode number */ | |
| struct xfs_inode *dp; /* directory inode to manipulate */ | | struct xfs_inode *dp; /* directory inode to manipulate */ | |
| xfs_fsblock_t *firstblock; /* ptr to firstblock for bmap calls
*/ | | xfs_fsblock_t *firstblock; /* ptr to firstblock for bmap calls
*/ | |
| struct xfs_bmap_free *flist; /* ptr to freelist for bmap_finish *
/ | | struct xfs_bmap_free *flist; /* ptr to freelist for bmap_finish *
/ | |
| struct xfs_trans *trans; /* current trans (changes over time)
*/ | | struct xfs_trans *trans; /* current trans (changes over time)
*/ | |
| xfs_extlen_t total; /* total blocks needed, for 1st bmap
*/ | | xfs_extlen_t total; /* total blocks needed, for 1st bmap
*/ | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 87 | |
| #define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found
*/ | | #define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found
*/ | |
| | | | |
| #define XFS_DA_OP_FLAGS \ | | #define XFS_DA_OP_FLAGS \ | |
| { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ | | { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ | |
| { XFS_DA_OP_RENAME, "RENAME" }, \ | | { XFS_DA_OP_RENAME, "RENAME" }, \ | |
| { XFS_DA_OP_ADDNAME, "ADDNAME" }, \ | | { XFS_DA_OP_ADDNAME, "ADDNAME" }, \ | |
| { XFS_DA_OP_OKNOENT, "OKNOENT" }, \ | | { XFS_DA_OP_OKNOENT, "OKNOENT" }, \ | |
| { XFS_DA_OP_CILOOKUP, "CILOOKUP" } | | { XFS_DA_OP_CILOOKUP, "CILOOKUP" } | |
| | | | |
| /* | | /* | |
|
| * Structure to describe buffer(s) for a block. | | | |
| * This is needed in the directory version 2 format case, when | | | |
| * multiple non-contiguous fsblocks might be needed to cover one | | | |
| * logical directory block. | | | |
| * If the buffer count is 1 then the data pointer points to the | | | |
| * same place as the b_addr field for the buffer, else to kmem_alloced memo | | | |
| ry. | | | |
| */ | | | |
| typedef struct xfs_dabuf { | | | |
| int nbuf; /* number of buffer pointers present | | | |
| */ | | | |
| short dirty; /* data needs to be copied back */ | | | |
| short bbcount; /* how large is data in bbs */ | | | |
| void *data; /* pointer for buffers' data */ | | | |
| #ifdef XFS_DABUF_DEBUG | | | |
| inst_t *ra; /* return address of caller to make | | | |
| */ | | | |
| struct xfs_dabuf *next; /* next in global chain */ | | | |
| struct xfs_dabuf *prev; /* previous in global chain */ | | | |
| struct xfs_buftarg *target; /* device for buffer */ | | | |
| xfs_daddr_t blkno; /* daddr first in bps[0] */ | | | |
| #endif | | | |
| struct xfs_buf *bps[1]; /* actually nbuf of these */ | | | |
| } xfs_dabuf_t; | | | |
| #define XFS_DA_BUF_SIZE(n) \ | | | |
| (sizeof(xfs_dabuf_t) + sizeof(struct xfs_buf *) * ((n) - 1)) | | | |
| | | | |
| #ifdef XFS_DABUF_DEBUG | | | |
| extern xfs_dabuf_t *xfs_dabuf_global_list; | | | |
| #endif | | | |
| | | | |
| /* | | | |
| * Storage for holding state during Btree searches and split/join ops. | | * Storage for holding state during Btree searches and split/join ops. | |
| * | | * | |
| * Only need space for 5 intermediate nodes. With a minimum of 62-way | | * Only need space for 5 intermediate nodes. With a minimum of 62-way | |
| * fanout to the Btree, we can support over 900 million directory blocks, | | * fanout to the Btree, we can support over 900 million directory blocks, | |
| * which is slightly more than enough. | | * which is slightly more than enough. | |
| */ | | */ | |
| typedef struct xfs_da_state_blk { | | typedef struct xfs_da_state_blk { | |
|
| xfs_dabuf_t *bp; /* buffer containing block */ | | struct xfs_buf *bp; /* buffer containing block */ | |
| xfs_dablk_t blkno; /* filesystem blkno of buffer */ | | xfs_dablk_t blkno; /* filesystem blkno of buffer */ | |
| xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer
*/ | | xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer
*/ | |
| int index; /* relevant index into block */ | | int index; /* relevant index into block */ | |
| xfs_dahash_t hashval; /* last hash value in block */ | | xfs_dahash_t hashval; /* last hash value in block */ | |
| int magic; /* blk's magic number, ie: blk type
*/ | | int magic; /* blk's magic number, ie: blk type
*/ | |
| } xfs_da_state_blk_t; | | } xfs_da_state_blk_t; | |
| | | | |
| typedef struct xfs_da_state_path { | | typedef struct xfs_da_state_path { | |
| int active; /* number of active levels *
/ | | int active; /* number of active levels *
/ | |
| xfs_da_state_blk_t blk[XFS_DA_NODE_MAXDEPTH]; | | xfs_da_state_blk_t blk[XFS_DA_NODE_MAXDEPTH]; | |
| | | | |
| skipping to change at line 223 | | skipping to change at line 145 | |
| const unsigned char *, int); | | const unsigned char *, int); | |
| }; | | }; | |
| | | | |
| /*======================================================================== | | /*======================================================================== | |
| * Function prototypes. | | * Function prototypes. | |
| *========================================================================*
/ | | *========================================================================*
/ | |
| | | | |
| /* | | /* | |
| * Routines used for growing the Btree. | | * Routines used for growing the Btree. | |
| */ | | */ | |
|
| int xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level | | int xfs_da3_node_create(struct xfs_da_args *args, xfs_dablk_t blkno, | |
| , | | int level, struct xfs_buf **bpp, int whichfork); | |
| xfs_dabuf_t **bpp, int whichfork); | | int xfs_da3_split(xfs_da_state_t *state); | |
| int xfs_da_split(xfs_da_state_t *state); | | | |
| | | | |
| /* | | /* | |
| * Routines used for shrinking the Btree. | | * Routines used for shrinking the Btree. | |
| */ | | */ | |
|
| int xfs_da_join(xfs_da_state_t *state); | | int xfs_da3_join(xfs_da_state_t *state); | |
| void xfs_da_fixhashpath(xfs_da_state_t *state, | | void xfs_da3_fixhashpath(struct xfs_da_state *state, | |
| xfs_da_state_path_t *path_to_to_fi | | struct xfs_da_state_path *path_to_to_fix); | |
| x); | | | |
| | | | |
| /* | | /* | |
| * Routines used for finding things in the Btree. | | * Routines used for finding things in the Btree. | |
| */ | | */ | |
|
| int xfs_da_node_lookup_int(xfs_da_state_t *state, int *result); | | int xfs_da3_node_lookup_int(xfs_da_state_t *state, int *result); | |
| int xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | | int xfs_da3_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, | |
| int forward, int release, int *resu
lt); | | int forward, int release, int *resu
lt); | |
| /* | | /* | |
| * Utility routines. | | * Utility routines. | |
| */ | | */ | |
|
| int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, | | int xfs_da3_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, | |
| xfs_da_state_blk_t *new_blk); | | xfs_da_state_blk_t *new_blk); | |
|
| | | int xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp, | |
| | | xfs_dablk_t bno, xfs_daddr_t mappedbno, | |
| | | struct xfs_buf **bpp, int which_fork); | |
| | | | |
| /* | | /* | |
| * Utility routines. | | * Utility routines. | |
| */ | | */ | |
| int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno); | | int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno); | |
|
| | | int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno, | |
| | | int count); | |
| int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp, | | int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp, | |
| xfs_dablk_t bno, xfs_daddr_t mappedbno, | | xfs_dablk_t bno, xfs_daddr_t mappedbno, | |
|
| xfs_dabuf_t **bp, int whichfork); | | struct xfs_buf **bp, int whichfork); | |
| int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, | | int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, | |
| xfs_dablk_t bno, xfs_daddr_t mappedbno, | | xfs_dablk_t bno, xfs_daddr_t mappedbno, | |
|
| xfs_dabuf_t **bpp, int whichfork); | | struct xfs_buf **bpp, int whichfork, | |
| | | const struct xfs_buf_ops *ops); | |
| xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *
dp, | | xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *
dp, | |
|
| xfs_dablk_t bno, int whichfork); | | xfs_dablk_t bno, xfs_daddr_t mapped_bno, | |
| | | int whichfork, const struct xfs_buf_ops *ops | |
| | | ); | |
| int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, | | int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, | |
|
| xfs_dabuf_t *dead_buf); | | struct xfs_buf *dead_buf); | |
| | | | |
| uint xfs_da_hashname(const __uint8_t *name_string, int name_length); | | uint xfs_da_hashname(const __uint8_t *name_string, int name_length); | |
| enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args, | | enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args, | |
| const unsigned char *name, int len); | | const unsigned char *name, int len); | |
| | | | |
| xfs_da_state_t *xfs_da_state_alloc(void); | | xfs_da_state_t *xfs_da_state_alloc(void); | |
| void xfs_da_state_free(xfs_da_state_t *state); | | void xfs_da_state_free(xfs_da_state_t *state); | |
| | | | |
|
| void xfs_da_buf_done(xfs_dabuf_t *dabuf); | | | |
| void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first, | | | |
| uint last); | | | |
| void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf); | | | |
| void xfs_da_binval(struct xfs_trans *tp, xfs_dabuf_t *dabuf); | | | |
| xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf); | | | |
| | | | |
| extern struct kmem_zone *xfs_da_state_zone; | | extern struct kmem_zone *xfs_da_state_zone; | |
|
| extern struct kmem_zone *xfs_dabuf_zone; | | | |
| extern const struct xfs_nameops xfs_default_nameops; | | extern const struct xfs_nameops xfs_default_nameops; | |
| | | | |
| #endif /* __XFS_DA_BTREE_H__ */ | | #endif /* __XFS_DA_BTREE_H__ */ | |
| | | | |
End of changes. 19 change blocks. |
| 115 lines changed or deleted | | 24 lines changed or added | |
|
| xfs_fs.h | | xfs_fs.h | |
| | | | |
| skipping to change at line 236 | | skipping to change at line 236 | |
| #define XFS_FSOP_GEOM_FLAGS_NLINK 0x0002 /* 32-bit nlink values */ | | #define XFS_FSOP_GEOM_FLAGS_NLINK 0x0002 /* 32-bit nlink values */ | |
| #define XFS_FSOP_GEOM_FLAGS_QUOTA 0x0004 /* quotas enabled */ | | #define XFS_FSOP_GEOM_FLAGS_QUOTA 0x0004 /* quotas enabled */ | |
| #define XFS_FSOP_GEOM_FLAGS_IALIGN 0x0008 /* inode alignment */ | | #define XFS_FSOP_GEOM_FLAGS_IALIGN 0x0008 /* inode alignment */ | |
| #define XFS_FSOP_GEOM_FLAGS_DALIGN 0x0010 /* large data alignment */ | | #define XFS_FSOP_GEOM_FLAGS_DALIGN 0x0010 /* large data alignment */ | |
| #define XFS_FSOP_GEOM_FLAGS_SHARED 0x0020 /* read-only shared */ | | #define XFS_FSOP_GEOM_FLAGS_SHARED 0x0020 /* read-only shared */ | |
| #define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x0040 /* special extent flag */ | | #define XFS_FSOP_GEOM_FLAGS_EXTFLG 0x0040 /* special extent flag */ | |
| #define XFS_FSOP_GEOM_FLAGS_DIRV2 0x0080 /* directory version 2 */ | | #define XFS_FSOP_GEOM_FLAGS_DIRV2 0x0080 /* directory version 2 */ | |
| #define XFS_FSOP_GEOM_FLAGS_LOGV2 0x0100 /* log format version 2 */ | | #define XFS_FSOP_GEOM_FLAGS_LOGV2 0x0100 /* log format version 2 */ | |
| #define XFS_FSOP_GEOM_FLAGS_SECTOR 0x0200 /* sector sizes >1BB */ | | #define XFS_FSOP_GEOM_FLAGS_SECTOR 0x0200 /* sector sizes >1BB */ | |
| #define XFS_FSOP_GEOM_FLAGS_ATTR2 0x0400 /* inline attributes rework
*/ | | #define XFS_FSOP_GEOM_FLAGS_ATTR2 0x0400 /* inline attributes rework
*/ | |
|
| #define XFS_FSOP_GEOM_FLAGS_DIRV2CI 0x1000 /* ASCII only CI names */ | | #define XFS_FSOP_GEOM_FLAGS_PROJID32 0x0800 /* 32-bit project IDs */ | |
| | | #define XFS_FSOP_GEOM_FLAGS_DIRV2CI 0x1000 /* ASCII only CI names */ | |
| #define XFS_FSOP_GEOM_FLAGS_LAZYSB 0x4000 /* lazy superblock counters
*/ | | #define XFS_FSOP_GEOM_FLAGS_LAZYSB 0x4000 /* lazy superblock counters
*/ | |
|
| | | #define XFS_FSOP_GEOM_FLAGS_V5SB 0x8000 /* version 5 superblock */ | |
| | | #define XFS_FSOP_GEOM_FLAGS_FTYPE 0x10000 /* inode directory types */ | |
| | | | |
| /* | | /* | |
|
| * Minimum and maximum sizes need for growth checks | | * Minimum and maximum sizes need for growth checks. | |
| | | * | |
| | | * Block counts are in units of filesystem blocks, not basic blocks. | |
| */ | | */ | |
| #define XFS_MIN_AG_BLOCKS 64 | | #define XFS_MIN_AG_BLOCKS 64 | |
| #define XFS_MIN_LOG_BLOCKS 512ULL | | #define XFS_MIN_LOG_BLOCKS 512ULL | |
| #define XFS_MAX_LOG_BLOCKS (1024 * 1024ULL) | | #define XFS_MAX_LOG_BLOCKS (1024 * 1024ULL) | |
| #define XFS_MIN_LOG_BYTES (10 * 1024 * 1024ULL) | | #define XFS_MIN_LOG_BYTES (10 * 1024 * 1024ULL) | |
| | | | |
| /* keep the maximum size under 2^31 by a small amount */ | | /* keep the maximum size under 2^31 by a small amount */ | |
| #define XFS_MAX_LOG_BYTES \ | | #define XFS_MAX_LOG_BYTES \ | |
| ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES) | | ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES) | |
| | | | |
|
| | | /* Used for sanity checks on superblock */ | |
| | | #define XFS_MAX_DBLOCKS(s) ((xfs_drfsbno_t)(s)->sb_agcount * (s)->sb_agbloc | |
| | | ks) | |
| | | #define XFS_MIN_DBLOCKS(s) ((xfs_drfsbno_t)((s)->sb_agcount - 1) * \ | |
| | | (s)->sb_agblocks + XFS_MIN_AG_BLOCKS) | |
| | | | |
| /* | | /* | |
| * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGRO
WFSRT | | * Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGRO
WFSRT | |
| */ | | */ | |
| typedef struct xfs_growfs_data { | | typedef struct xfs_growfs_data { | |
| __u64 newblocks; /* new data subvol size, fsblocks */ | | __u64 newblocks; /* new data subvol size, fsblocks */ | |
| __u32 imaxpct; /* new inode space percentage limit
*/ | | __u32 imaxpct; /* new inode space percentage limit
*/ | |
| } xfs_growfs_data_t; | | } xfs_growfs_data_t; | |
| | | | |
| typedef struct xfs_growfs_log { | | typedef struct xfs_growfs_log { | |
| __u32 newblocks; /* new log size, fsblocks */ | | __u32 newblocks; /* new log size, fsblocks */ | |
| | | | |
| skipping to change at line 305 | | skipping to change at line 315 | |
| #define bs_projid bs_projid_lo /* (previously just bs_proji
d) */ | | #define bs_projid bs_projid_lo /* (previously just bs_proji
d) */ | |
| __u16 bs_forkoff; /* inode fork offset in bytes */ | | __u16 bs_forkoff; /* inode fork offset in bytes */ | |
| __u16 bs_projid_hi; /* higher part of project id */ | | __u16 bs_projid_hi; /* higher part of project id */ | |
| unsigned char bs_pad[10]; /* pad space, unused */ | | unsigned char bs_pad[10]; /* pad space, unused */ | |
| __u32 bs_dmevmask; /* DMIG event mask */ | | __u32 bs_dmevmask; /* DMIG event mask */ | |
| __u16 bs_dmstate; /* DMIG state info */ | | __u16 bs_dmstate; /* DMIG state info */ | |
| __u16 bs_aextents; /* attribute number of extents */ | | __u16 bs_aextents; /* attribute number of extents */ | |
| } xfs_bstat_t; | | } xfs_bstat_t; | |
| | | | |
| /* | | /* | |
|
| | | * Project quota id helpers (previously projid was 16bit only | |
| | | * and using two 16bit values to hold new 32bit projid was choosen | |
| | | * to retain compatibility with "old" filesystems). | |
| | | */ | |
| | | static inline __uint32_t | |
| | | bstat_get_projid(struct xfs_bstat *bs) | |
| | | { | |
| | | return (__uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo; | |
| | | } | |
| | | | |
| | | /* | |
| * The user-level BulkStat Request interface structure. | | * The user-level BulkStat Request interface structure. | |
| */ | | */ | |
| typedef struct xfs_fsop_bulkreq { | | typedef struct xfs_fsop_bulkreq { | |
| __u64 __user *lastip; /* last inode # pointer */ | | __u64 __user *lastip; /* last inode # pointer */ | |
| __s32 icount; /* count of entries in buffer */ | | __s32 icount; /* count of entries in buffer */ | |
| void __user *ubuffer;/* user buffer for inode desc. */ | | void __user *ubuffer;/* user buffer for inode desc. */ | |
| __s32 __user *ocount; /* output count pointer */ | | __s32 __user *ocount; /* output count pointer */ | |
| } xfs_fsop_bulkreq_t; | | } xfs_fsop_bulkreq_t; | |
| | | | |
| /* | | /* | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 353 | |
| | | | |
| /* | | /* | |
| * Error injection. | | * Error injection. | |
| */ | | */ | |
| typedef struct xfs_error_injection { | | typedef struct xfs_error_injection { | |
| __s32 fd; | | __s32 fd; | |
| __s32 errtag; | | __s32 errtag; | |
| } xfs_error_injection_t; | | } xfs_error_injection_t; | |
| | | | |
| /* | | /* | |
|
| | | * Speculative preallocation trimming. | |
| | | */ | |
| | | #define XFS_EOFBLOCKS_VERSION 1 | |
| | | struct xfs_fs_eofblocks { | |
| | | __u32 eof_version; | |
| | | __u32 eof_flags; | |
| | | uid_t eof_uid; | |
| | | gid_t eof_gid; | |
| | | prid_t eof_prid; | |
| | | __u32 pad32; | |
| | | __u64 eof_min_file_size; | |
| | | __u64 pad64[12]; | |
| | | }; | |
| | | | |
| | | /* eof_flags values */ | |
| | | #define XFS_EOF_FLAGS_SYNC (1 << 0) /* sync/wait mode scan */ | |
| | | #define XFS_EOF_FLAGS_UID (1 << 1) /* filter by uid */ | |
| | | #define XFS_EOF_FLAGS_GID (1 << 2) /* filter by gid */ | |
| | | #define XFS_EOF_FLAGS_PRID (1 << 3) /* filter by project id */ | |
| | | #define XFS_EOF_FLAGS_MINFILESIZE (1 << 4) /* filter by min file size | |
| | | */ | |
| | | #define XFS_EOF_FLAGS_VALID \ | |
| | | (XFS_EOF_FLAGS_SYNC | \ | |
| | | XFS_EOF_FLAGS_UID | \ | |
| | | XFS_EOF_FLAGS_GID | \ | |
| | | XFS_EOF_FLAGS_PRID | \ | |
| | | XFS_EOF_FLAGS_MINFILESIZE) | |
| | | | |
| | | /* | |
| * The user-level Handle Request interface structure. | | * The user-level Handle Request interface structure. | |
| */ | | */ | |
| typedef struct xfs_fsop_handlereq { | | typedef struct xfs_fsop_handlereq { | |
| __u32 fd; /* fd for FD_TO_HANDLE */ | | __u32 fd; /* fd for FD_TO_HANDLE */ | |
| void __user *path; /* user pathname */ | | void __user *path; /* user pathname */ | |
| __u32 oflags; /* open flags */ | | __u32 oflags; /* open flags */ | |
| void __user *ihandle;/* user supplied handle */ | | void __user *ihandle;/* user supplied handle */ | |
| __u32 ihandlen; /* user supplied length */ | | __u32 ihandlen; /* user supplied length */ | |
| void __user *ohandle;/* user buffer for handle */ | | void __user *ohandle;/* user buffer for handle */ | |
| __u32 __user *ohandlen;/* user buffer length */ | | __u32 __user *ohandlen;/* user buffer length */ | |
| | | | |
| skipping to change at line 412 | | skipping to change at line 461 | |
| } ha_u; | | } ha_u; | |
| xfs_fid_t ha_fid; /* file system specific file ID */ | | xfs_fid_t ha_fid; /* file system specific file ID */ | |
| } xfs_handle_t; | | } xfs_handle_t; | |
| #define ha_fsid ha_u._ha_fsid | | #define ha_fsid ha_u._ha_fsid | |
| | | | |
| #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \ | | #define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \ | |
| - (char *) &(handle)) \ | | - (char *) &(handle)) \ | |
| + (handle).ha_fid.fid_len) | | + (handle).ha_fid.fid_len) | |
| | | | |
| /* | | /* | |
|
| | | * Structure passed to XFS_IOC_SWAPEXT | |
| | | */ | |
| | | typedef struct xfs_swapext | |
| | | { | |
| | | __int64_t sx_version; /* version */ | |
| | | #define XFS_SX_VERSION 0 | |
| | | __int64_t sx_fdtarget; /* fd of target file */ | |
| | | __int64_t sx_fdtmp; /* fd of tmp file */ | |
| | | xfs_off_t sx_offset; /* offset into file */ | |
| | | xfs_off_t sx_length; /* leng from offset */ | |
| | | char sx_pad[16]; /* pad space, unused */ | |
| | | xfs_bstat_t sx_stat; /* stat of target b4 copy */ | |
| | | } xfs_swapext_t; | |
| | | | |
| | | /* | |
| * Flags for going down operation | | * Flags for going down operation | |
| */ | | */ | |
| #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */ | | #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */ | |
| #define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not
data */ | | #define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not
data */ | |
| #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flu
sh log nor data */ | | #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flu
sh log nor data */ | |
| | | | |
| /* | | /* | |
| * ioctl commands that are used by Linux filesystems | | * ioctl commands that are used by Linux filesystems | |
| */ | | */ | |
| #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS | | #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS | |
| | | | |
| skipping to change at line 449 | | skipping to change at line 513 | |
| #define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64) | | #define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64) | |
| #define XFS_IOC_UNRESVSP _IOW ('X', 41, struct xfs_flock64) | | #define XFS_IOC_UNRESVSP _IOW ('X', 41, struct xfs_flock64) | |
| #define XFS_IOC_RESVSP64 _IOW ('X', 42, struct xfs_flock64) | | #define XFS_IOC_RESVSP64 _IOW ('X', 42, struct xfs_flock64) | |
| #define XFS_IOC_UNRESVSP64 _IOW ('X', 43, struct xfs_flock64) | | #define XFS_IOC_UNRESVSP64 _IOW ('X', 43, struct xfs_flock64) | |
| #define XFS_IOC_GETBMAPA _IOWR('X', 44, struct getbmap) | | #define XFS_IOC_GETBMAPA _IOWR('X', 44, struct getbmap) | |
| #define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr) | | #define XFS_IOC_FSGETXATTRA _IOR ('X', 45, struct fsxattr) | |
| /* XFS_IOC_SETBIOSIZE ---- deprecated 46 */ | | /* XFS_IOC_SETBIOSIZE ---- deprecated 46 */ | |
| /* XFS_IOC_GETBIOSIZE ---- deprecated 47 */ | | /* XFS_IOC_GETBIOSIZE ---- deprecated 47 */ | |
| #define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) | | #define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) | |
| #define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64) | | #define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64) | |
|
| | | #define XFS_IOC_FREE_EOFBLOCKS _IOR ('X', 58, struct xfs_fs_eofblocks) | |
| | | | |
| /* | | /* | |
| * ioctl commands that replace IRIX syssgi()'s | | * ioctl commands that replace IRIX syssgi()'s | |
| */ | | */ | |
| #define XFS_IOC_FSGEOMETRY_V1 _IOR ('X', 100, struct xfs_fsop_geom_v1
) | | #define XFS_IOC_FSGEOMETRY_V1 _IOR ('X', 100, struct xfs_fsop_geom_v1
) | |
| #define XFS_IOC_FSBULKSTAT _IOWR('X', 101, struct xfs_fsop_bulkreq
) | | #define XFS_IOC_FSBULKSTAT _IOWR('X', 101, struct xfs_fsop_bulkreq
) | |
| #define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkre
q) | | #define XFS_IOC_FSBULKSTAT_SINGLE _IOWR('X', 102, struct xfs_fsop_bulkre
q) | |
| #define XFS_IOC_FSINUMBERS _IOWR('X', 103, struct xfs_fsop_bulkreq
) | | #define XFS_IOC_FSINUMBERS _IOWR('X', 103, struct xfs_fsop_bulkreq
) | |
| #define XFS_IOC_PATH_TO_FSHANDLE _IOWR('X', 104, struct xfs_fsop_handle
req) | | #define XFS_IOC_PATH_TO_FSHANDLE _IOWR('X', 104, struct xfs_fsop_handle
req) | |
| #define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handler
eq) | | #define XFS_IOC_PATH_TO_HANDLE _IOWR('X', 105, struct xfs_fsop_handler
eq) | |
| | | | |
| skipping to change at line 472 | | skipping to change at line 537 | |
| #define XFS_IOC_SWAPEXT _IOWR('X', 109, struct xfs_swap
ext) | | #define XFS_IOC_SWAPEXT _IOWR('X', 109, struct xfs_swap
ext) | |
| #define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data) | | #define XFS_IOC_FSGROWFSDATA _IOW ('X', 110, struct xfs_growfs_data) | |
| #define XFS_IOC_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log) | | #define XFS_IOC_FSGROWFSLOG _IOW ('X', 111, struct xfs_growfs_log) | |
| #define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt) | | #define XFS_IOC_FSGROWFSRT _IOW ('X', 112, struct xfs_growfs_rt) | |
| #define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts) | | #define XFS_IOC_FSCOUNTS _IOR ('X', 113, struct xfs_fsop_counts) | |
| #define XFS_IOC_SET_RESBLKS _IOWR('X', 114, struct xfs_fsop_resblks
) | | #define XFS_IOC_SET_RESBLKS _IOWR('X', 114, struct xfs_fsop_resblks
) | |
| #define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks
) | | #define XFS_IOC_GET_RESBLKS _IOR ('X', 115, struct xfs_fsop_resblks
) | |
| #define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_erro
r_injection) | | #define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_erro
r_injection) | |
| #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_inject
ion) | | #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_inject
ion) | |
| /* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ | | /* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ | |
|
| | | | |
| /* XFS_IOC_FREEZE -- FIFREEZE 119 */ | | /* XFS_IOC_FREEZE -- FIFREEZE 119 */ | |
| /* XFS_IOC_THAW -- FITHAW 120 */ | | /* XFS_IOC_THAW -- FITHAW 120 */ | |
|
| | | #ifndef FIFREEZE | |
| #define XFS_IOC_FREEZE _IOWR('X', 119, int) | | #define XFS_IOC_FREEZE _IOWR('X', 119, int) | |
| #define XFS_IOC_THAW _IOWR('X', 120, int) | | #define XFS_IOC_THAW _IOWR('X', 120, int) | |
|
| | | #endif | |
| | | | |
| #define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_
handlereq) | | #define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_
handlereq) | |
| #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrli
st_handlereq) | | #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrli
st_handlereq) | |
| #define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmu
lti_handlereq) | | #define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmu
lti_handlereq) | |
| #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom) | | #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom) | |
| #define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t) | | #define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t) | |
| /* XFS_IOC_GETFSUUID ---------- deprecated 140 */ | | /* XFS_IOC_GETFSUUID ---------- deprecated 140 */ | |
| | | | |
| #ifndef HAVE_BBMACROS | | #ifndef HAVE_BBMACROS | |
| /* | | /* | |
| * Block I/O parameterization. A basic block (BB) is the lowest size of | | * Block I/O parameterization. A basic block (BB) is the lowest size of | |
| | | | |
| skipping to change at line 497 | | skipping to change at line 566 | |
| * routines are in BB's. | | * routines are in BB's. | |
| */ | | */ | |
| #define BBSHIFT 9 | | #define BBSHIFT 9 | |
| #define BBSIZE (1<<BBSHIFT) | | #define BBSIZE (1<<BBSHIFT) | |
| #define BBMASK (BBSIZE-1) | | #define BBMASK (BBSIZE-1) | |
| #define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) | | #define BTOBB(bytes) (((__u64)(bytes) + BBSIZE - 1) >> BBSHIFT) | |
| #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) | | #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) | |
| #define BBTOB(bbs) ((bbs) << BBSHIFT) | | #define BBTOB(bbs) ((bbs) << BBSHIFT) | |
| #endif | | #endif | |
| | | | |
|
| /* | | | |
| * Project quota id helpers (previously projid was 16bit only | | | |
| * and using two 16bit values to hold new 32bit projid was choosen | | | |
| * to retain compatibility with "old" filesystems). | | | |
| */ | | | |
| static inline __uint32_t | | | |
| bstat_get_projid(struct xfs_bstat *bs) | | | |
| { | | | |
| return (__uint32_t)bs->bs_projid_hi << 16 | bs->bs_projid_lo; | | | |
| } | | | |
| | | | |
| #endif /* __XFS_FS_H__ */ | | #endif /* __XFS_FS_H__ */ | |
| | | | |
End of changes. 12 change blocks. |
| 13 lines changed or deleted | | 73 lines changed or added | |
|
| xfs_sb.h | | xfs_sb.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| #define __XFS_SB_H__ | | #define __XFS_SB_H__ | |
| | | | |
| /* | | /* | |
| * Super block | | * Super block | |
| * Fits into a sector-sized buffer at address 0 of each allocation group. | | * Fits into a sector-sized buffer at address 0 of each allocation group. | |
| * Only the first of these is ever updated except during growfs. | | * Only the first of these is ever updated except during growfs. | |
| */ | | */ | |
| | | | |
| struct xfs_buf; | | struct xfs_buf; | |
| struct xfs_mount; | | struct xfs_mount; | |
|
| | | struct xfs_trans; | |
| | | | |
| #define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ | | #define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ | |
| #define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 *
/ | | #define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 *
/ | |
| #define XFS_SB_VERSION_2 2 /* 6.2 - attributes
*/ | | #define XFS_SB_VERSION_2 2 /* 6.2 - attributes
*/ | |
| #define XFS_SB_VERSION_3 3 /* 6.2 - new inode v
ersion */ | | #define XFS_SB_VERSION_3 3 /* 6.2 - new inode v
ersion */ | |
| #define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask ve
rsion */ | | #define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask ve
rsion */ | |
|
| | | #define XFS_SB_VERSION_5 5 /* CRC enabled files
ystem */ | |
| #define XFS_SB_VERSION_NUMBITS 0x000f | | #define XFS_SB_VERSION_NUMBITS 0x000f | |
| #define XFS_SB_VERSION_ALLFBITS 0xfff0 | | #define XFS_SB_VERSION_ALLFBITS 0xfff0 | |
| #define XFS_SB_VERSION_SASHFBITS 0xf000 | | #define XFS_SB_VERSION_SASHFBITS 0xf000 | |
| #define XFS_SB_VERSION_REALFBITS 0x0ff0 | | #define XFS_SB_VERSION_REALFBITS 0x0ff0 | |
| #define XFS_SB_VERSION_ATTRBIT 0x0010 | | #define XFS_SB_VERSION_ATTRBIT 0x0010 | |
| #define XFS_SB_VERSION_NLINKBIT 0x0020 | | #define XFS_SB_VERSION_NLINKBIT 0x0020 | |
| #define XFS_SB_VERSION_QUOTABIT 0x0040 | | #define XFS_SB_VERSION_QUOTABIT 0x0040 | |
| #define XFS_SB_VERSION_ALIGNBIT 0x0080 | | #define XFS_SB_VERSION_ALIGNBIT 0x0080 | |
| #define XFS_SB_VERSION_DALIGNBIT 0x0100 | | #define XFS_SB_VERSION_DALIGNBIT 0x0100 | |
| #define XFS_SB_VERSION_SHAREDBIT 0x0200 | | #define XFS_SB_VERSION_SHAREDBIT 0x0200 | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 86 | |
| * | | * | |
| * These defines represent bits in sb_features2. | | * These defines represent bits in sb_features2. | |
| */ | | */ | |
| #define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ | | #define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ | |
| #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 | | #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 | |
| #define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters
*/ | | #define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters
*/ | |
| #define XFS_SB_VERSION2_RESERVED4BIT 0x00000004 | | #define XFS_SB_VERSION2_RESERVED4BIT 0x00000004 | |
| #define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rewor
k */ | | #define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rewor
k */ | |
| #define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers *
/ | | #define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers *
/ | |
| #define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id
*/ | | #define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id
*/ | |
|
| | | #define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */ | |
| | | #define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir | |
| | | */ | |
| | | | |
| #define XFS_SB_VERSION2_OKREALFBITS \ | | #define XFS_SB_VERSION2_OKREALFBITS \ | |
| (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ | | (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \ | |
| XFS_SB_VERSION2_ATTR2BIT | \ | | XFS_SB_VERSION2_ATTR2BIT | \ | |
|
| XFS_SB_VERSION2_PROJID32BIT) | | XFS_SB_VERSION2_PROJID32BIT | \ | |
| | | XFS_SB_VERSION2_FTYPE) | |
| #define XFS_SB_VERSION2_OKSASHFBITS \ | | #define XFS_SB_VERSION2_OKSASHFBITS \ | |
| (0) | | (0) | |
| #define XFS_SB_VERSION2_OKREALBITS \ | | #define XFS_SB_VERSION2_OKREALBITS \ | |
| (XFS_SB_VERSION2_OKREALFBITS | \ | | (XFS_SB_VERSION2_OKREALFBITS | \ | |
| XFS_SB_VERSION2_OKSASHFBITS ) | | XFS_SB_VERSION2_OKSASHFBITS ) | |
| | | | |
| /* | | /* | |
| * Superblock - in core version. Must match the ondisk version below. | | * Superblock - in core version. Must match the ondisk version below. | |
| * Must be padded to 64 bit alignment. | | * Must be padded to 64 bit alignment. | |
| */ | | */ | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 168 | |
| __uint32_t sb_features2; /* additional feature bits */ | | __uint32_t sb_features2; /* additional feature bits */ | |
| | | | |
| /* | | /* | |
| * bad features2 field as a result of failing to pad the sb | | * bad features2 field as a result of failing to pad the sb | |
| * structure to 64 bits. Some machines will be using this field | | * structure to 64 bits. Some machines will be using this field | |
| * for features2 bits. Easiest just to mark it bad and not use | | * for features2 bits. Easiest just to mark it bad and not use | |
| * it for anything else. | | * it for anything else. | |
| */ | | */ | |
| __uint32_t sb_bad_features2; | | __uint32_t sb_bad_features2; | |
| | | | |
|
| | | /* version 5 superblock fields start here */ | |
| | | | |
| | | /* feature masks */ | |
| | | __uint32_t sb_features_compat; | |
| | | __uint32_t sb_features_ro_compat; | |
| | | __uint32_t sb_features_incompat; | |
| | | __uint32_t sb_features_log_incompat; | |
| | | | |
| | | __uint32_t sb_crc; /* superblock crc */ | |
| | | __uint32_t sb_pad; | |
| | | | |
| | | xfs_ino_t sb_pquotino; /* project quota inode */ | |
| | | xfs_lsn_t sb_lsn; /* last write sequence */ | |
| | | | |
| /* must be padded to 64 bit alignment */ | | /* must be padded to 64 bit alignment */ | |
| } xfs_sb_t; | | } xfs_sb_t; | |
| | | | |
|
| | | #define XFS_SB_CRC_OFF offsetof(struct xfs_sb, sb_crc) | |
| | | | |
| /* | | /* | |
| * Superblock - on disk version. Must match the in core version above. | | * Superblock - on disk version. Must match the in core version above. | |
| * Must be padded to 64 bit alignment. | | * Must be padded to 64 bit alignment. | |
| */ | | */ | |
| typedef struct xfs_dsb { | | typedef struct xfs_dsb { | |
| __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ | | __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ | |
| __be32 sb_blocksize; /* logical block size, bytes */ | | __be32 sb_blocksize; /* logical block size, bytes */ | |
| __be64 sb_dblocks; /* number of data blocks */ | | __be64 sb_dblocks; /* number of data blocks */ | |
| __be64 sb_rblocks; /* number of realtime blocks */ | | __be64 sb_rblocks; /* number of realtime blocks */ | |
| __be64 sb_rextents; /* number of realtime extents */ | | __be64 sb_rextents; /* number of realtime extents */ | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 252 | |
| __u8 sb_logsectlog; /* log2 of the log sector size */ | | __u8 sb_logsectlog; /* log2 of the log sector size */ | |
| __be16 sb_logsectsize; /* sector size for the log, bytes */ | | __be16 sb_logsectsize; /* sector size for the log, bytes */ | |
| __be32 sb_logsunit; /* stripe unit size for the log */ | | __be32 sb_logsunit; /* stripe unit size for the log */ | |
| __be32 sb_features2; /* additional feature bits */ | | __be32 sb_features2; /* additional feature bits */ | |
| /* | | /* | |
| * bad features2 field as a result of failing to pad the sb | | * bad features2 field as a result of failing to pad the sb | |
| * structure to 64 bits. Some machines will be using this field | | * structure to 64 bits. Some machines will be using this field | |
| * for features2 bits. Easiest just to mark it bad and not use | | * for features2 bits. Easiest just to mark it bad and not use | |
| * it for anything else. | | * it for anything else. | |
| */ | | */ | |
|
| __be32 sb_bad_features2; | | __be32 sb_bad_features2; | |
| | | | |
| | | /* version 5 superblock fields start here */ | |
| | | | |
| | | /* feature masks */ | |
| | | __be32 sb_features_compat; | |
| | | __be32 sb_features_ro_compat; | |
| | | __be32 sb_features_incompat; | |
| | | __be32 sb_features_log_incompat; | |
| | | | |
| | | __le32 sb_crc; /* superblock crc */ | |
| | | __be32 sb_pad; | |
| | | | |
| | | __be64 sb_pquotino; /* project quota inode */ | |
| | | __be64 sb_lsn; /* last write sequence */ | |
| | | | |
| /* must be padded to 64 bit alignment */ | | /* must be padded to 64 bit alignment */ | |
| } xfs_dsb_t; | | } xfs_dsb_t; | |
| | | | |
| /* | | /* | |
| * Sequence number values for the fields. | | * Sequence number values for the fields. | |
| */ | | */ | |
| typedef enum { | | typedef enum { | |
| XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCK
S, | | XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCK
S, | |
| XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO, | | XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO, | |
| XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS, | | XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS, | |
| XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS, | | XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS, | |
| XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE, | | XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE, | |
| XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG, | | XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG, | |
| XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLO
G, | | XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLO
G, | |
| XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOU
NT, | | XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOU
NT, | |
| XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO
, | | XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO
, | |
| XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN, | | XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN, | |
| XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG, | | XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG, | |
| XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT, | | XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT, | |
|
| XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, | | XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT, | |
| | | XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT, | |
| | | XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD, | |
| | | XFS_SBS_PQUOTINO, XFS_SBS_LSN, | |
| XFS_SBS_FIELDCOUNT | | XFS_SBS_FIELDCOUNT | |
| } xfs_sb_field_t; | | } xfs_sb_field_t; | |
| | | | |
| /* | | /* | |
| * Mask values, defined based on the xfs_sb_field_t values. | | * Mask values, defined based on the xfs_sb_field_t values. | |
| * Only define the ones we're using. | | * Only define the ones we're using. | |
| */ | | */ | |
| #define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x) | | #define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x) | |
| #define XFS_SB_UUID XFS_SB_MVAL(UUID) | | #define XFS_SB_UUID XFS_SB_MVAL(UUID) | |
| #define XFS_SB_FNAME XFS_SB_MVAL(FNAME) | | #define XFS_SB_FNAME XFS_SB_MVAL(FNAME) | |
| | | | |
| skipping to change at line 278 | | skipping to change at line 316 | |
| #define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO) | | #define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO) | |
| #define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS) | | #define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS) | |
| #define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) | | #define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) | |
| #define XFS_SB_UNIT XFS_SB_MVAL(UNIT) | | #define XFS_SB_UNIT XFS_SB_MVAL(UNIT) | |
| #define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) | | #define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) | |
| #define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT) | | #define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT) | |
| #define XFS_SB_IFREE XFS_SB_MVAL(IFREE) | | #define XFS_SB_IFREE XFS_SB_MVAL(IFREE) | |
| #define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS) | | #define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS) | |
| #define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2) | | #define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2) | |
| #define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2) | | #define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2) | |
|
| | | #define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT) | |
| | | #define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT) | |
| | | #define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT) | |
| | | #define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT) | |
| | | #define XFS_SB_CRC XFS_SB_MVAL(CRC) | |
| | | #define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO) | |
| #define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) | | #define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) | |
| #define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) | | #define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) | |
| #define XFS_SB_MOD_BITS \ | | #define XFS_SB_MOD_BITS \ | |
| (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ | | (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ | |
| XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ | | XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ | |
| XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \ | | XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \ | |
| XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 |
\ | | XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 |
\ | |
|
| XFS_SB_BAD_FEATURES2) | | XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \ | |
| | | XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \ | |
| | | XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO) | |
| | | | |
| /* | | /* | |
| * Misc. Flags - warning - these will be cleared by xfs_repair unless | | * Misc. Flags - warning - these will be cleared by xfs_repair unless | |
| * a feature bit is set when the flag is used. | | * a feature bit is set when the flag is used. | |
| */ | | */ | |
| #define XFS_SBF_NOFLAGS 0x00 /* no flags set */ | | #define XFS_SBF_NOFLAGS 0x00 /* no flags set */ | |
| #define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */ | | #define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */ | |
| | | | |
| /* | | /* | |
| * define max. shared version we can interoperate with | | * define max. shared version we can interoperate with | |
| | | | |
| skipping to change at line 315 | | skipping to change at line 361 | |
| sbp->sb_versionnum <= XFS_SB_VERSION_3) | | sbp->sb_versionnum <= XFS_SB_VERSION_3) | |
| return 1; | | return 1; | |
| | | | |
| /* We support version 4 if all feature bits are supported */ | | /* We support version 4 if all feature bits are supported */ | |
| if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) { | | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) { | |
| if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || | | if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || | |
| ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && | | ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && | |
| (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) | | (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) | |
| return 0; | | return 0; | |
| | | | |
|
| #ifdef __KERNEL__ | | | |
| if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN) | | if (sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN) | |
| return 0; | | return 0; | |
|
| #else | | | |
| if ((sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) && | | | |
| sbp->sb_shared_vn > XFS_SB_MAX_SHARED_VN) | | | |
| return 0; | | | |
| #endif | | | |
| | | | |
| return 1; | | return 1; | |
| } | | } | |
|
| | | if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) | |
| | | return 1; | |
| | | | |
| return 0; | | return 0; | |
| } | | } | |
| | | | |
| /* | | /* | |
| * Detect a mismatched features2 field. Older kernels read/wrote | | * Detect a mismatched features2 field. Older kernels read/wrote | |
| * this into the wrong slot, so to be safe we keep them in sync. | | * this into the wrong slot, so to be safe we keep them in sync. | |
| */ | | */ | |
| static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp) | | static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp) | |
| { | | { | |
| | | | |
| skipping to change at line 366 | | skipping to change at line 407 | |
| return XFS_SB_VERSION_3; | | return XFS_SB_VERSION_3; | |
| if (v & XFS_SB_VERSION_ATTRBIT) | | if (v & XFS_SB_VERSION_ATTRBIT) | |
| return XFS_SB_VERSION_2; | | return XFS_SB_VERSION_2; | |
| return XFS_SB_VERSION_1; | | return XFS_SB_VERSION_1; | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp) | |
| { | | { | |
| return sbp->sb_versionnum == XFS_SB_VERSION_2 || | | return sbp->sb_versionnum == XFS_SB_VERSION_2 || | |
| sbp->sb_versionnum == XFS_SB_VERSION_3 || | | sbp->sb_versionnum == XFS_SB_VERSION_3 || | |
|
| (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT)); | | (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT)); | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_addattr(xfs_sb_t *sbp) | | static inline void xfs_sb_version_addattr(xfs_sb_t *sbp) | |
| { | | { | |
| if (sbp->sb_versionnum == XFS_SB_VERSION_1) | | if (sbp->sb_versionnum == XFS_SB_VERSION_1) | |
| sbp->sb_versionnum = XFS_SB_VERSION_2; | | sbp->sb_versionnum = XFS_SB_VERSION_2; | |
|
| else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) | | else if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4) | |
| sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT; | | sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT; | |
| else | | else | |
| sbp->sb_versionnum = XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRB
IT; | | sbp->sb_versionnum = XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRB
IT; | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp) | |
| { | | { | |
| return sbp->sb_versionnum == XFS_SB_VERSION_3 || | | return sbp->sb_versionnum == XFS_SB_VERSION_3 || | |
|
| (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)); | | (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)); | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp) | | static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp) | |
| { | | { | |
| if (sbp->sb_versionnum <= XFS_SB_VERSION_2) | | if (sbp->sb_versionnum <= XFS_SB_VERSION_2) | |
| sbp->sb_versionnum = XFS_SB_VERSION_3; | | sbp->sb_versionnum = XFS_SB_VERSION_3; | |
| else | | else | |
| sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT; | | sbp->sb_versionnum |= XFS_SB_VERSION_NLINKBIT; | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT); | | (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT); | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_addquota(xfs_sb_t *sbp) | | static inline void xfs_sb_version_addquota(xfs_sb_t *sbp) | |
| { | | { | |
|
| if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) | | if (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4) | |
| sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT; | | sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT; | |
| else | | else | |
| sbp->sb_versionnum = xfs_sb_version_tonew(sbp->sb_versionnum
) | | | sbp->sb_versionnum = xfs_sb_version_tonew(sbp->sb_versionnum
) | | |
| XFS_SB_VERSION_QUOTABIT; | | XFS_SB_VERSION_QUOTABIT; | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT); | | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| | | (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); | | (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp) | |
| { | | { | |
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT); | | (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT); | | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | |
| | | (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp) | | static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT); | | (XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| | | (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT); | | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | |
| | | (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hassector(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hassector(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT); | | (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return XFS_SB_VERSION_NUM(sbp) >= XFS_SB_VERSION_4 && | |
| (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT); | | (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp) | |
| { | | { | |
|
| return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT); | | (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 && | |
| | | (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)); | |
| } | | } | |
| | | | |
| /* | | /* | |
| * sb_features2 bit version macros. | | * sb_features2 bit version macros. | |
| * | | * | |
| * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro: | | * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro: | |
| * | | * | |
| * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) | | * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) | |
| * ((xfs_sb_version_hasmorebits(sbp) && | | * ((xfs_sb_version_hasmorebits(sbp) && | |
| * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) | | * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) | |
| */ | | */ | |
| | | | |
| static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp) | | static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp) | |
| { | | { | |
|
| return xfs_sb_version_hasmorebits(sbp) && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT); | | (xfs_sb_version_hasmorebits(sbp) && | |
| | | (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)); | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp) | |
| { | | { | |
|
| return xfs_sb_version_hasmorebits(sbp) && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT); | | (xfs_sb_version_hasmorebits(sbp) && | |
| | | (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT)); | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) | | static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) | |
| { | | { | |
| sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | |
| sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; | | sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp) | | static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp) | |
| { | | { | |
| sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; | | sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT; | |
| if (!sbp->sb_features2) | | if (!sbp->sb_features2) | |
| sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT; | | sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT; | |
| } | | } | |
| | | | |
| static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) | | static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) | |
| { | | { | |
|
| return xfs_sb_version_hasmorebits(sbp) && | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || | |
| (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT); | | (xfs_sb_version_hasmorebits(sbp) && | |
| | | (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); | |
| } | | } | |
| | | | |
| static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) | | static inline void xfs_sb_version_addprojid32bit(xfs_sb_t *sbp) | |
| { | | { | |
| sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | | sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT; | |
| sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; | | sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT; | |
| sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; | | sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT; | |
| } | | } | |
| | | | |
| /* | | /* | |
|
| | | * Extended v5 superblock feature masks. These are to be used for new v5 | |
| | | * superblock features only. | |
| | | * | |
| | | * Compat features are new features that old kernels will not notice or aff | |
| | | ect | |
| | | * and so can mount read-write without issues. | |
| | | * | |
| | | * RO-Compat (read only) are features that old kernels can read but will br | |
| | | eak | |
| | | * if they write. Hence only read-only mounts of such filesystems are allow | |
| | | ed on | |
| | | * kernels that don't support the feature bit. | |
| | | * | |
| | | * InCompat features are features which old kernels will not understand and | |
| | | so | |
| | | * must not mount. | |
| | | * | |
| | | * Log-InCompat features are for changes to log formats or new transactions | |
| | | that | |
| | | * can't be replayed on older kernels. The fields are set when the filesyst | |
| | | em is | |
| | | * mounted, and a clean unmount clears the fields. | |
| | | */ | |
| | | #define XFS_SB_FEAT_COMPAT_ALL 0 | |
| | | #define XFS_SB_FEAT_COMPAT_UNKNOWN ~XFS_SB_FEAT_COMPAT_ALL | |
| | | static inline bool | |
| | | xfs_sb_has_compat_feature( | |
| | | struct xfs_sb *sbp, | |
| | | __uint32_t feature) | |
| | | { | |
| | | return (sbp->sb_features_compat & feature) != 0; | |
| | | } | |
| | | | |
| | | #define XFS_SB_FEAT_RO_COMPAT_ALL 0 | |
| | | #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL | |
| | | static inline bool | |
| | | xfs_sb_has_ro_compat_feature( | |
| | | struct xfs_sb *sbp, | |
| | | __uint32_t feature) | |
| | | { | |
| | | return (sbp->sb_features_ro_compat & feature) != 0; | |
| | | } | |
| | | | |
| | | #define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in diren | |
| | | t */ | |
| | | #define XFS_SB_FEAT_INCOMPAT_ALL \ | |
| | | (XFS_SB_FEAT_INCOMPAT_FTYPE) | |
| | | | |
| | | #define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL | |
| | | static inline bool | |
| | | xfs_sb_has_incompat_feature( | |
| | | struct xfs_sb *sbp, | |
| | | __uint32_t feature) | |
| | | { | |
| | | return (sbp->sb_features_incompat & feature) != 0; | |
| | | } | |
| | | | |
| | | #define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0 | |
| | | #define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_LOG_AL | |
| | | L | |
| | | static inline bool | |
| | | xfs_sb_has_incompat_log_feature( | |
| | | struct xfs_sb *sbp, | |
| | | __uint32_t feature) | |
| | | { | |
| | | return (sbp->sb_features_log_incompat & feature) != 0; | |
| | | } | |
| | | | |
| | | /* | |
| | | * V5 superblock specific feature checks | |
| | | */ | |
| | | static inline int xfs_sb_version_hascrc(xfs_sb_t *sbp) | |
| | | { | |
| | | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; | |
| | | } | |
| | | | |
| | | static inline int xfs_sb_version_has_pquotino(xfs_sb_t *sbp) | |
| | | { | |
| | | return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; | |
| | | } | |
| | | | |
| | | static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp) | |
| | | { | |
| | | return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 && | |
| | | xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE) | |
| | | ) || | |
| | | (xfs_sb_version_hasmorebits(sbp) && | |
| | | (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE)); | |
| | | } | |
| | | | |
| | | /* | |
| * end of superblock version macros | | * end of superblock version macros | |
| */ | | */ | |
| | | | |
|
| | | static inline bool | |
| | | xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino) | |
| | | { | |
| | | return (ino == sbp->sb_uquotino || | |
| | | ino == sbp->sb_gquotino || | |
| | | ino == sbp->sb_pquotino); | |
| | | } | |
| | | | |
| #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag *
/ | | #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag *
/ | |
| #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) | | #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) | |
|
| #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp)) | | #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr)) | |
| | | | |
| #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)
) | | #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)
) | |
| #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ | | #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ | |
| xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d)) | | xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d)) | |
| #define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \ | | #define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \ | |
| XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno
)) | | XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno
)) | |
| | | | |
| /* | | /* | |
| * File system sector to basic block conversions. | | * File system sector to basic block conversions. | |
| */ | | */ | |
| #define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log) | | #define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log) | |
| | | | |
| /* | | /* | |
| * File system block to basic block conversions. | | * File system block to basic block conversions. | |
| */ | | */ | |
| #define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log) | | #define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log) | |
| #define XFS_BB_TO_FSB(mp,bb) \ | | #define XFS_BB_TO_FSB(mp,bb) \ | |
| (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log) | | (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log) | |
| #define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log) | | #define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log) | |
|
| #define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1)) | | | |
| | | | |
| /* | | /* | |
| * File system block to byte conversions. | | * File system block to byte conversions. | |
| */ | | */ | |
| #define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_block
log) | | #define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_block
log) | |
| #define XFS_B_TO_FSB(mp,b) \ | | #define XFS_B_TO_FSB(mp,b) \ | |
| ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog) | | ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog) | |
| #define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog
) | | #define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog
) | |
| #define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask) | | #define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask) | |
| | | | |
|
| | | /* | |
| | | * perag get/put wrappers for ref counting | |
| | | */ | |
| | | extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t); | |
| | | extern struct xfs_perag *xfs_perag_get_tag(struct xfs_mount *, xfs_agnumber | |
| | | _t, | |
| | | int tag); | |
| | | extern void xfs_perag_put(struct xfs_perag *pag); | |
| | | extern int xfs_initialize_perag_data(struct xfs_mount *, xfs_agnumber_t | |
| | | ); | |
| | | | |
| | | extern void xfs_sb_calc_crc(struct xfs_buf *); | |
| | | extern void xfs_mod_sb(struct xfs_trans *, __int64_t); | |
| | | extern void xfs_sb_mount_common(struct xfs_mount *, struct xfs_sb *); | |
| | | extern void xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *); | |
| | | extern void xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t) | |
| | | ; | |
| | | extern void xfs_sb_quota_from_disk(struct xfs_sb *sbp); | |
| | | | |
| #endif /* __XFS_SB_H__ */ | | #endif /* __XFS_SB_H__ */ | |
| | | | |
End of changes. 34 change blocks. |
| 37 lines changed or deleted | | 204 lines changed or added | |
|