summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-08-16 22:05:14 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-08-16 22:05:14 -0400
commit7869a4a6c5caa7b2e5c41ccaf46eb3371f88eea7 (patch)
tree1c55037a6b090b843b7f8669686dfdbbfd9ceb70 /fs/ext4/ext4.h
parent107a7bd31ac003e42c0f966aa8e5b26947de6024 (diff)
ext4: add support for extent pre-caching
Add a new fiemap flag which forces the all of the extents in an inode to be cached in the extent_status tree. This is critically important when using AIO to a preallocated file, since if we need to read in blocks from the extent tree, the io_submit(2) system call becomes synchronous, and the AIO is no longer "A", which is bad. In addition, for most files which have an external leaf tree block, the cost of caching the information in the extent status tree will be less than caching the entire 4k block in the buffer cache. So it is generally a win to keep the extent information cached. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index c74b1948feb0..635135e6148e 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -561,15 +561,16 @@ enum {
561#define EXT4_GET_BLOCKS_NO_PUT_HOLE 0x0200 561#define EXT4_GET_BLOCKS_NO_PUT_HOLE 0x0200
562 562
563/* 563/*
564 * The bit position of this flag must not overlap with any of the 564 * The bit position of these flags must not overlap with any of the
565 * EXT4_GET_BLOCKS_*. It is used by ext4_ext_find_extent(), 565 * EXT4_GET_BLOCKS_*. They are used by ext4_ext_find_extent(),
566 * read_extent_tree_block(), ext4_split_extent_at(), 566 * read_extent_tree_block(), ext4_split_extent_at(),
567 * ext4_ext_insert_extent(), and ext4_ext_create_new_leaf() to 567 * ext4_ext_insert_extent(), and ext4_ext_create_new_leaf().
568 * indicate that the we shouldn't be caching the extents when reading 568 * EXT4_EX_NOCACHE is used to indicate that the we shouldn't be
569 * from the extent tree while a truncate or punch hole operation 569 * caching the extents when reading from the extent tree while a
570 * is in progress. 570 * truncate or punch hole operation is in progress.
571 */ 571 */
572#define EXT4_EX_NOCACHE 0x0400 572#define EXT4_EX_NOCACHE 0x0400
573#define EXT4_EX_FORCE_CACHE 0x0800
573 574
574/* 575/*
575 * Flags used by ext4_free_blocks 576 * Flags used by ext4_free_blocks
@@ -601,6 +602,7 @@ enum {
601#define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent) 602#define EXT4_IOC_MOVE_EXT _IOWR('f', 15, struct move_extent)
602#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) 603#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
603#define EXT4_IOC_SWAP_BOOT _IO('f', 17) 604#define EXT4_IOC_SWAP_BOOT _IO('f', 17)
605#define EXT4_IOC_PRECACHE_EXTENTS _IO('f', 18)
604 606
605#if defined(__KERNEL__) && defined(CONFIG_COMPAT) 607#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
606/* 608/*
@@ -1386,6 +1388,7 @@ enum {
1386 nolocking */ 1388 nolocking */
1387 EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */ 1389 EXT4_STATE_MAY_INLINE_DATA, /* may have in-inode data */
1388 EXT4_STATE_ORDERED_MODE, /* data=ordered mode */ 1390 EXT4_STATE_ORDERED_MODE, /* data=ordered mode */
1391 EXT4_STATE_EXT_PRECACHED, /* extents have been precached */
1389}; 1392};
1390 1393
1391#define EXT4_INODE_BIT_FNS(name, field, offset) \ 1394#define EXT4_INODE_BIT_FNS(name, field, offset) \
@@ -2705,7 +2708,7 @@ extern int ext4_find_delalloc_range(struct inode *inode,
2705extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk); 2708extern int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk);
2706extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 2709extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
2707 __u64 start, __u64 len); 2710 __u64 start, __u64 len);
2708 2711extern int ext4_ext_precache(struct inode *inode);
2709 2712
2710/* move_extent.c */ 2713/* move_extent.c */
2711extern void ext4_double_down_write_data_sem(struct inode *first, 2714extern void ext4_double_down_write_data_sem(struct inode *first,