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.h52
1 files changed, 47 insertions, 5 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 740b73fabd2f..3c1df1d642fa 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,9 +89,10 @@ 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_imap() and xfs_dilocate().
@@ -438,13 +467,26 @@ xfs_bmbt_rec_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
438void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, 467void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
439 xfs_bmbt_irec_t *); 468 xfs_bmbt_irec_t *);
440void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); 469void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
470void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t, int);
441void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int); 471void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int);
442void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int); 472void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int);
443void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int); 473void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int);
474void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int);
444void xfs_iext_realloc_direct(xfs_ifork_t *, int); 475void xfs_iext_realloc_direct(xfs_ifork_t *, int);
476void xfs_iext_realloc_indirect(xfs_ifork_t *, int);
477void xfs_iext_indirect_to_direct(xfs_ifork_t *);
445void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); 478void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
446void xfs_iext_inline_to_direct(xfs_ifork_t *, int); 479void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
447void xfs_iext_destroy(xfs_ifork_t *); 480void xfs_iext_destroy(xfs_ifork_t *);
481xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
482xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
483void xfs_iext_irec_init(xfs_ifork_t *);
484xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int);
485void xfs_iext_irec_remove(xfs_ifork_t *, int);
486void xfs_iext_irec_compact(xfs_ifork_t *);
487void xfs_iext_irec_compact_pages(xfs_ifork_t *);
488void xfs_iext_irec_compact_full(xfs_ifork_t *);
489void xfs_iext_irec_update_extoffs(xfs_ifork_t *, int, int);
448 490
449#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount)) 491#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
450 492