diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-28 11:54:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-28 11:54:16 -0500 |
commit | a53b75b37aacd85a2f005e80faf44a7c2e3aa0bc (patch) | |
tree | 2180f556a11794a55c78ceffc803b901ea84071a | |
parent | 2b2b15c32ae951c3609c01e74d22d6de64b2595c (diff) | |
parent | d7092ae2973f20a39fee786c47e5edf18ced088f (diff) |
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 update from Ted Ts'o:
"Bug fixes and cleanups for ext4. We also enable the punch hole
functionality for bigalloc file systems"
* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: delete "set but not used" variables
ext4: don't pass freed handle to ext4_walk_page_buffers
ext4: avoid clearing beyond i_blocks when truncating an inline data file
ext4: ext4_inode_is_fast_symlink should use EXT4_CLUSTER_SIZE
ext4: fix a typo in extents.c
ext4: use %pd printk specificer
ext4: standardize error handling in ext4_da_write_inline_data_begin()
ext4: retry allocation when inline->extent conversion failed
ext4: enable punch hole for bigalloc
-rw-r--r-- | fs/ext4/extents.c | 2 | ||||
-rw-r--r-- | fs/ext4/inline.c | 26 | ||||
-rw-r--r-- | fs/ext4/inode.c | 11 | ||||
-rw-r--r-- | fs/ext4/ioctl.c | 6 | ||||
-rw-r--r-- | fs/ext4/namei.c | 5 |
5 files changed, 22 insertions, 28 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3384dc4bed40..10cff4736b11 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3477,7 +3477,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3477 | WARN_ON(map->m_lblk < ee_block); | 3477 | WARN_ON(map->m_lblk < ee_block); |
3478 | /* | 3478 | /* |
3479 | * It is safe to convert extent to initialized via explicit | 3479 | * It is safe to convert extent to initialized via explicit |
3480 | * zeroout only if extent is fully insde i_size or new_size. | 3480 | * zeroout only if extent is fully inside i_size or new_size. |
3481 | */ | 3481 | */ |
3482 | split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; | 3482 | split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; |
3483 | 3483 | ||
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index bae987549dc3..82edf5b93352 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -849,15 +849,16 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, | |||
849 | handle_t *handle; | 849 | handle_t *handle; |
850 | struct page *page; | 850 | struct page *page; |
851 | struct ext4_iloc iloc; | 851 | struct ext4_iloc iloc; |
852 | int retries; | ||
852 | 853 | ||
853 | ret = ext4_get_inode_loc(inode, &iloc); | 854 | ret = ext4_get_inode_loc(inode, &iloc); |
854 | if (ret) | 855 | if (ret) |
855 | return ret; | 856 | return ret; |
856 | 857 | ||
858 | retry_journal: | ||
857 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); | 859 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); |
858 | if (IS_ERR(handle)) { | 860 | if (IS_ERR(handle)) { |
859 | ret = PTR_ERR(handle); | 861 | ret = PTR_ERR(handle); |
860 | handle = NULL; | ||
861 | goto out; | 862 | goto out; |
862 | } | 863 | } |
863 | 864 | ||
@@ -867,7 +868,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, | |||
867 | if (inline_size >= pos + len) { | 868 | if (inline_size >= pos + len) { |
868 | ret = ext4_prepare_inline_data(handle, inode, pos + len); | 869 | ret = ext4_prepare_inline_data(handle, inode, pos + len); |
869 | if (ret && ret != -ENOSPC) | 870 | if (ret && ret != -ENOSPC) |
870 | goto out; | 871 | goto out_journal; |
871 | } | 872 | } |
872 | 873 | ||
873 | if (ret == -ENOSPC) { | 874 | if (ret == -ENOSPC) { |
@@ -875,6 +876,10 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, | |||
875 | inode, | 876 | inode, |
876 | flags, | 877 | flags, |
877 | fsdata); | 878 | fsdata); |
879 | ext4_journal_stop(handle); | ||
880 | if (ret == -ENOSPC && | ||
881 | ext4_should_retry_alloc(inode->i_sb, &retries)) | ||
882 | goto retry_journal; | ||
878 | goto out; | 883 | goto out; |
879 | } | 884 | } |
880 | 885 | ||
@@ -887,7 +892,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, | |||
887 | page = grab_cache_page_write_begin(mapping, 0, flags); | 892 | page = grab_cache_page_write_begin(mapping, 0, flags); |
888 | if (!page) { | 893 | if (!page) { |
889 | ret = -ENOMEM; | 894 | ret = -ENOMEM; |
890 | goto out; | 895 | goto out_journal; |
891 | } | 896 | } |
892 | 897 | ||
893 | down_read(&EXT4_I(inode)->xattr_sem); | 898 | down_read(&EXT4_I(inode)->xattr_sem); |
@@ -904,16 +909,15 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, | |||
904 | 909 | ||
905 | up_read(&EXT4_I(inode)->xattr_sem); | 910 | up_read(&EXT4_I(inode)->xattr_sem); |
906 | *pagep = page; | 911 | *pagep = page; |
907 | handle = NULL; | ||
908 | brelse(iloc.bh); | 912 | brelse(iloc.bh); |
909 | return 1; | 913 | return 1; |
910 | out_release_page: | 914 | out_release_page: |
911 | up_read(&EXT4_I(inode)->xattr_sem); | 915 | up_read(&EXT4_I(inode)->xattr_sem); |
912 | unlock_page(page); | 916 | unlock_page(page); |
913 | page_cache_release(page); | 917 | page_cache_release(page); |
918 | out_journal: | ||
919 | ext4_journal_stop(handle); | ||
914 | out: | 920 | out: |
915 | if (handle) | ||
916 | ext4_journal_stop(handle); | ||
917 | brelse(iloc.bh); | 921 | brelse(iloc.bh); |
918 | return ret; | 922 | return ret; |
919 | } | 923 | } |
@@ -1837,7 +1841,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle, | |||
1837 | { | 1841 | { |
1838 | int error; | 1842 | int error; |
1839 | struct ext4_xattr_entry *entry; | 1843 | struct ext4_xattr_entry *entry; |
1840 | struct ext4_xattr_ibody_header *header; | ||
1841 | struct ext4_inode *raw_inode; | 1844 | struct ext4_inode *raw_inode; |
1842 | struct ext4_iloc iloc; | 1845 | struct ext4_iloc iloc; |
1843 | 1846 | ||
@@ -1846,7 +1849,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle, | |||
1846 | return error; | 1849 | return error; |
1847 | 1850 | ||
1848 | raw_inode = ext4_raw_inode(&iloc); | 1851 | raw_inode = ext4_raw_inode(&iloc); |
1849 | header = IHDR(inode, raw_inode); | ||
1850 | entry = (struct ext4_xattr_entry *)((void *)raw_inode + | 1852 | entry = (struct ext4_xattr_entry *)((void *)raw_inode + |
1851 | EXT4_I(inode)->i_inline_off); | 1853 | EXT4_I(inode)->i_inline_off); |
1852 | if (EXT4_XATTR_LEN(entry->e_name_len) + | 1854 | if (EXT4_XATTR_LEN(entry->e_name_len) + |
@@ -1924,9 +1926,11 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline) | |||
1924 | } | 1926 | } |
1925 | 1927 | ||
1926 | /* Clear the content within i_blocks. */ | 1928 | /* Clear the content within i_blocks. */ |
1927 | if (i_size < EXT4_MIN_INLINE_DATA_SIZE) | 1929 | if (i_size < EXT4_MIN_INLINE_DATA_SIZE) { |
1928 | memset(ext4_raw_inode(&is.iloc)->i_block + i_size, 0, | 1930 | void *p = (void *) ext4_raw_inode(&is.iloc)->i_block; |
1929 | EXT4_MIN_INLINE_DATA_SIZE - i_size); | 1931 | memset(p + i_size, 0, |
1932 | EXT4_MIN_INLINE_DATA_SIZE - i_size); | ||
1933 | } | ||
1930 | 1934 | ||
1931 | EXT4_I(inode)->i_inline_size = i_size < | 1935 | EXT4_I(inode)->i_inline_size = i_size < |
1932 | EXT4_MIN_INLINE_DATA_SIZE ? | 1936 | EXT4_MIN_INLINE_DATA_SIZE ? |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index fe4793e754d1..6e39895a91b8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -144,8 +144,8 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks, | |||
144 | */ | 144 | */ |
145 | static int ext4_inode_is_fast_symlink(struct inode *inode) | 145 | static int ext4_inode_is_fast_symlink(struct inode *inode) |
146 | { | 146 | { |
147 | int ea_blocks = EXT4_I(inode)->i_file_acl ? | 147 | int ea_blocks = EXT4_I(inode)->i_file_acl ? |
148 | (inode->i_sb->s_blocksize >> 9) : 0; | 148 | EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0; |
149 | 149 | ||
150 | return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); | 150 | return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); |
151 | } | 151 | } |
@@ -1772,7 +1772,7 @@ static int __ext4_journalled_writepage(struct page *page, | |||
1772 | ret = err; | 1772 | ret = err; |
1773 | 1773 | ||
1774 | if (!ext4_has_inline_data(inode)) | 1774 | if (!ext4_has_inline_data(inode)) |
1775 | ext4_walk_page_buffers(handle, page_bufs, 0, len, | 1775 | ext4_walk_page_buffers(NULL, page_bufs, 0, len, |
1776 | NULL, bput_one); | 1776 | NULL, bput_one); |
1777 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); | 1777 | ext4_set_inode_state(inode, EXT4_STATE_JDATA); |
1778 | out: | 1778 | out: |
@@ -3501,11 +3501,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) | |||
3501 | if (!S_ISREG(inode->i_mode)) | 3501 | if (!S_ISREG(inode->i_mode)) |
3502 | return -EOPNOTSUPP; | 3502 | return -EOPNOTSUPP; |
3503 | 3503 | ||
3504 | if (EXT4_SB(sb)->s_cluster_ratio > 1) { | ||
3505 | /* TODO: Add support for bigalloc file systems */ | ||
3506 | return -EOPNOTSUPP; | ||
3507 | } | ||
3508 | |||
3509 | trace_ext4_punch_hole(inode, offset, length); | 3504 | trace_ext4_punch_hole(inode, offset, length); |
3510 | 3505 | ||
3511 | /* | 3506 | /* |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 60589b60e9b0..6bea80614d77 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -101,9 +101,8 @@ static long swap_inode_boot_loader(struct super_block *sb, | |||
101 | handle_t *handle; | 101 | handle_t *handle; |
102 | int err; | 102 | int err; |
103 | struct inode *inode_bl; | 103 | struct inode *inode_bl; |
104 | struct ext4_inode_info *ei; | ||
105 | struct ext4_inode_info *ei_bl; | 104 | struct ext4_inode_info *ei_bl; |
106 | struct ext4_sb_info *sbi; | 105 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
107 | 106 | ||
108 | if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) { | 107 | if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) { |
109 | err = -EINVAL; | 108 | err = -EINVAL; |
@@ -115,9 +114,6 @@ static long swap_inode_boot_loader(struct super_block *sb, | |||
115 | goto swap_boot_out; | 114 | goto swap_boot_out; |
116 | } | 115 | } |
117 | 116 | ||
118 | sbi = EXT4_SB(sb); | ||
119 | ei = EXT4_I(inode); | ||
120 | |||
121 | inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO); | 117 | inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO); |
122 | if (IS_ERR(inode_bl)) { | 118 | if (IS_ERR(inode_bl)) { |
123 | err = PTR_ERR(inode_bl); | 119 | err = PTR_ERR(inode_bl); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index e77c1ba6c8af..d050e043e884 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1425,9 +1425,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi | |||
1425 | return ERR_PTR(-EIO); | 1425 | return ERR_PTR(-EIO); |
1426 | } | 1426 | } |
1427 | if (unlikely(ino == dir->i_ino)) { | 1427 | if (unlikely(ino == dir->i_ino)) { |
1428 | EXT4_ERROR_INODE(dir, "'%.*s' linked to parent dir", | 1428 | EXT4_ERROR_INODE(dir, "'%pd' linked to parent dir", |
1429 | dentry->d_name.len, | 1429 | dentry); |
1430 | dentry->d_name.name); | ||
1431 | return ERR_PTR(-EIO); | 1430 | return ERR_PTR(-EIO); |
1432 | } | 1431 | } |
1433 | inode = ext4_iget(dir->i_sb, ino); | 1432 | inode = ext4_iget(dir->i_sb, ino); |