diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-08-15 15:34:14 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:06 -0400 |
commit | db69e0ebae944690de89851315404f483e6464e0 (patch) | |
tree | 2c95462bfc86b0ab34d3ee1ab5675b060d896430 /fs | |
parent | 2db04966ae9a3eeb57f28df9aac4e77d5b287cb1 (diff) |
Btrfs: Init address_space->writeback_index properly
The writeback_index field is used by write_cache_pages to pick up where
writeback on a given inode left off. But, it is never set to a sane
value, so writeback can often start at a random offset in the file.
Kernels 2.6.28 and higher will have this fixed, but for everyone else,
we also fill in the value in btrfs.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a26d365111e5..33b990878d84 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1833,6 +1833,7 @@ static int btrfs_init_locked_inode(struct inode *inode, void *p) | |||
1833 | inode->i_ino = args->ino; | 1833 | inode->i_ino = args->ino; |
1834 | BTRFS_I(inode)->root = args->root; | 1834 | BTRFS_I(inode)->root = args->root; |
1835 | BTRFS_I(inode)->delalloc_bytes = 0; | 1835 | BTRFS_I(inode)->delalloc_bytes = 0; |
1836 | inode->i_mapping->writeback_index = 0; | ||
1836 | BTRFS_I(inode)->disk_i_size = 0; | 1837 | BTRFS_I(inode)->disk_i_size = 0; |
1837 | BTRFS_I(inode)->index_cnt = (u64)-1; | 1838 | BTRFS_I(inode)->index_cnt = (u64)-1; |
1838 | extent_map_tree_init(&BTRFS_I(inode)->extent_tree, GFP_NOFS); | 1839 | extent_map_tree_init(&BTRFS_I(inode)->extent_tree, GFP_NOFS); |
@@ -2239,6 +2240,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
2239 | mutex_init(&BTRFS_I(inode)->csum_mutex); | 2240 | mutex_init(&BTRFS_I(inode)->csum_mutex); |
2240 | mutex_init(&BTRFS_I(inode)->extent_mutex); | 2241 | mutex_init(&BTRFS_I(inode)->extent_mutex); |
2241 | BTRFS_I(inode)->delalloc_bytes = 0; | 2242 | BTRFS_I(inode)->delalloc_bytes = 0; |
2243 | inode->i_mapping->writeback_index = 0; | ||
2242 | BTRFS_I(inode)->disk_i_size = 0; | 2244 | BTRFS_I(inode)->disk_i_size = 0; |
2243 | BTRFS_I(inode)->root = root; | 2245 | BTRFS_I(inode)->root = root; |
2244 | 2246 | ||
@@ -2486,6 +2488,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
2486 | mutex_init(&BTRFS_I(inode)->extent_mutex); | 2488 | mutex_init(&BTRFS_I(inode)->extent_mutex); |
2487 | BTRFS_I(inode)->delalloc_bytes = 0; | 2489 | BTRFS_I(inode)->delalloc_bytes = 0; |
2488 | BTRFS_I(inode)->disk_i_size = 0; | 2490 | BTRFS_I(inode)->disk_i_size = 0; |
2491 | inode->i_mapping->writeback_index = 0; | ||
2489 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 2492 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
2490 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); | 2493 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); |
2491 | } | 2494 | } |
@@ -3549,6 +3552,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
3549 | mutex_init(&BTRFS_I(inode)->extent_mutex); | 3552 | mutex_init(&BTRFS_I(inode)->extent_mutex); |
3550 | BTRFS_I(inode)->delalloc_bytes = 0; | 3553 | BTRFS_I(inode)->delalloc_bytes = 0; |
3551 | BTRFS_I(inode)->disk_i_size = 0; | 3554 | BTRFS_I(inode)->disk_i_size = 0; |
3555 | inode->i_mapping->writeback_index = 0; | ||
3552 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 3556 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
3553 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); | 3557 | btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree); |
3554 | } | 3558 | } |