diff options
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r-- | fs/xfs/xfs_inode.h | 52 |
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 | */ | ||
46 | typedef 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 | ||
32 | typedef struct xfs_ifork { | 59 | typedef 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); | |||
438 | void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, | 467 | void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, |
439 | xfs_bmbt_irec_t *); | 468 | xfs_bmbt_irec_t *); |
440 | void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); | 469 | void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); |
470 | void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t, int); | ||
441 | void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int); | 471 | void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int); |
442 | void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int); | 472 | void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int); |
443 | void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int); | 473 | void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int); |
474 | void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int); | ||
444 | void xfs_iext_realloc_direct(xfs_ifork_t *, int); | 475 | void xfs_iext_realloc_direct(xfs_ifork_t *, int); |
476 | void xfs_iext_realloc_indirect(xfs_ifork_t *, int); | ||
477 | void xfs_iext_indirect_to_direct(xfs_ifork_t *); | ||
445 | void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); | 478 | void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); |
446 | void xfs_iext_inline_to_direct(xfs_ifork_t *, int); | 479 | void xfs_iext_inline_to_direct(xfs_ifork_t *, int); |
447 | void xfs_iext_destroy(xfs_ifork_t *); | 480 | void xfs_iext_destroy(xfs_ifork_t *); |
481 | xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *); | ||
482 | xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int); | ||
483 | void xfs_iext_irec_init(xfs_ifork_t *); | ||
484 | xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int); | ||
485 | void xfs_iext_irec_remove(xfs_ifork_t *, int); | ||
486 | void xfs_iext_irec_compact(xfs_ifork_t *); | ||
487 | void xfs_iext_irec_compact_pages(xfs_ifork_t *); | ||
488 | void xfs_iext_irec_compact_full(xfs_ifork_t *); | ||
489 | void 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 | ||