aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h78
1 files changed, 64 insertions, 14 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 1cfbcf18ce86..39ef9c36ea55 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -25,10 +25,37 @@
25#define XFS_ATTR_FORK 1 25#define XFS_ATTR_FORK 1
26 26
27/* 27/*
28 * The following xfs_ext_irec_t struct introduces a second (top) level
29 * to the in-core extent allocation scheme. These structs are allocated
30 * in a contiguous block, creating an indirection array where each entry
31 * (irec) contains a pointer to a buffer of in-core extent records which
32 * it manages. Each extent buffer is 4k in size, since 4k is the system
33 * page size on Linux i386 and systems with larger page sizes don't seem
34 * to gain much, if anything, by using their native page size as the
35 * extent buffer size. Also, using 4k extent buffers everywhere provides
36 * a consistent interface for CXFS across different platforms.
37 *
38 * There is currently no limit on the number of irec's (extent lists)
39 * allowed, so heavily fragmented files may require an indirection array
40 * which spans multiple system pages of memory. The number of extents
41 * which would require this amount of contiguous memory is very large
42 * and should not cause problems in the foreseeable future. However,
43 * if the memory needed for the contiguous array ever becomes a problem,
44 * it is possible that a third level of indirection may be required.
45 */
46typedef struct xfs_ext_irec {
47 xfs_bmbt_rec_t *er_extbuf; /* block of extent records */
48 xfs_extnum_t er_extoff; /* extent offset in file */
49 xfs_extnum_t er_extcount; /* number of extents in page/block */
50} xfs_ext_irec_t;
51
52/*
28 * File incore extent information, present for each of data & attr forks. 53 * File incore extent information, present for each of data & attr forks.
29 */ 54 */
30#define XFS_INLINE_EXTS 2 55#define XFS_IEXT_BUFSZ 4096
31#define XFS_INLINE_DATA 32 56#define XFS_LINEAR_EXTS (XFS_IEXT_BUFSZ / (uint)sizeof(xfs_bmbt_rec_t))
57#define XFS_INLINE_EXTS 2
58#define XFS_INLINE_DATA 32
32typedef struct xfs_ifork { 59typedef struct xfs_ifork {
33 int if_bytes; /* bytes in if_u1 */ 60 int if_bytes; /* bytes in if_u1 */
34 int if_real_bytes; /* bytes allocated in if_u1 */ 61 int if_real_bytes; /* bytes allocated in if_u1 */
@@ -39,6 +66,7 @@ typedef struct xfs_ifork {
39 xfs_extnum_t if_lastex; /* last if_extents used */ 66 xfs_extnum_t if_lastex; /* last if_extents used */
40 union { 67 union {
41 xfs_bmbt_rec_t *if_extents; /* linear map file exts */ 68 xfs_bmbt_rec_t *if_extents; /* linear map file exts */
69 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */
42 char *if_data; /* inline file data */ 70 char *if_data; /* inline file data */
43 } if_u1; 71 } if_u1;
44 union { 72 union {
@@ -61,20 +89,16 @@ typedef struct xfs_ifork {
61/* 89/*
62 * Per-fork incore inode flags. 90 * Per-fork incore inode flags.
63 */ 91 */
64#define XFS_IFINLINE 0x0001 /* Inline data is read in */ 92#define XFS_IFINLINE 0x01 /* Inline data is read in */
65#define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */ 93#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
66#define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */ 94#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
95#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
67 96
68/* 97/*
69 * Flags for xfs_imap() and xfs_dilocate(). 98 * Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
70 */ 99 */
71#define XFS_IMAP_LOOKUP 0x1 100#define XFS_IMAP_LOOKUP 0x1
72 101#define XFS_IMAP_BULKSTAT 0x2
73/*
74 * Maximum number of extent pointers in if_u1.if_extents.
75 */
76#define XFS_MAX_INCORE_EXTENTS 32768
77
78 102
79#ifdef __KERNEL__ 103#ifdef __KERNEL__
80struct bhv_desc; 104struct bhv_desc;
@@ -398,7 +422,7 @@ int xfs_finish_reclaim_all(struct xfs_mount *, int);
398 */ 422 */
399int xfs_itobp(struct xfs_mount *, struct xfs_trans *, 423int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
400 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **, 424 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **,
401 xfs_daddr_t); 425 xfs_daddr_t, uint);
402int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 426int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
403 xfs_inode_t **, xfs_daddr_t); 427 xfs_inode_t **, xfs_daddr_t);
404int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); 428int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
@@ -440,6 +464,32 @@ xfs_inode_t *xfs_vtoi(struct vnode *vp);
440 464
441void xfs_synchronize_atime(xfs_inode_t *); 465void xfs_synchronize_atime(xfs_inode_t *);
442 466
467xfs_bmbt_rec_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
468void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
469 xfs_bmbt_irec_t *);
470void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
471void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t, int);
472void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int);
473void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int);
474void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int);
475void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int);
476void xfs_iext_realloc_direct(xfs_ifork_t *, int);
477void xfs_iext_realloc_indirect(xfs_ifork_t *, int);
478void xfs_iext_indirect_to_direct(xfs_ifork_t *);
479void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
480void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
481void xfs_iext_destroy(xfs_ifork_t *);
482xfs_bmbt_rec_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *);
483xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
484xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
485void xfs_iext_irec_init(xfs_ifork_t *);
486xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int);
487void xfs_iext_irec_remove(xfs_ifork_t *, int);
488void xfs_iext_irec_compact(xfs_ifork_t *);
489void xfs_iext_irec_compact_pages(xfs_ifork_t *);
490void xfs_iext_irec_compact_full(xfs_ifork_t *);
491void xfs_iext_irec_update_extoffs(xfs_ifork_t *, int, int);
492
443#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount)) 493#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
444 494
445#ifdef DEBUG 495#ifdef DEBUG