diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e204d8aabe7d..0dd9150c0c04 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2495,6 +2495,20 @@ static int ext4_nonda_switch(struct super_block *sb) | |||
2495 | return 0; | 2495 | return 0; |
2496 | } | 2496 | } |
2497 | 2497 | ||
2498 | /* We always reserve for an inode update; the superblock could be there too */ | ||
2499 | static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len) | ||
2500 | { | ||
2501 | if (likely(EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, | ||
2502 | EXT4_FEATURE_RO_COMPAT_LARGE_FILE))) | ||
2503 | return 1; | ||
2504 | |||
2505 | if (pos + len <= 0x7fffffffULL) | ||
2506 | return 1; | ||
2507 | |||
2508 | /* We might need to update the superblock to set LARGE_FILE */ | ||
2509 | return 2; | ||
2510 | } | ||
2511 | |||
2498 | static int ext4_da_write_begin(struct file *file, struct address_space *mapping, | 2512 | static int ext4_da_write_begin(struct file *file, struct address_space *mapping, |
2499 | loff_t pos, unsigned len, unsigned flags, | 2513 | loff_t pos, unsigned len, unsigned flags, |
2500 | struct page **pagep, void **fsdata) | 2514 | struct page **pagep, void **fsdata) |
@@ -2545,7 +2559,8 @@ retry_grab: | |||
2545 | * of file which has an already mapped buffer. | 2559 | * of file which has an already mapped buffer. |
2546 | */ | 2560 | */ |
2547 | retry_journal: | 2561 | retry_journal: |
2548 | handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, 1); | 2562 | handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, |
2563 | ext4_da_write_credits(inode, pos, len)); | ||
2549 | if (IS_ERR(handle)) { | 2564 | if (IS_ERR(handle)) { |
2550 | page_cache_release(page); | 2565 | page_cache_release(page); |
2551 | return PTR_ERR(handle); | 2566 | return PTR_ERR(handle); |