diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 03:19:58 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 03:19:58 -0500 |
| commit | 4fbf888accb39af423f271111d44e8186f053723 (patch) | |
| tree | 4af3dae51450c38009df593ddef04deee2883673 | |
| parent | 7e1a1e9378018aeea2c7e8a3dd2ceb1db1523b0b (diff) | |
| parent | 3f61c0cc706d5c0beee7af17ffeb706403cf513c (diff) | |
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 changes from Ted Ts'o:
"Ext4 updates for 3.13. Mostly bug fixes and cleanups"
* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: add prototypes for macro-generated functions
ext4: return non-zero st_blocks for inline data
ext4: use prandom_u32() instead of get_random_bytes()
ext4: remove unreachable code after ext4_can_extents_be_merged()
ext4: remove unreachable code in ext4_can_extents_be_merged()
ext4: avoid bh leak in retry path of ext4_expand_extra_isize_ea()
ext4: don't count free clusters from a corrupt block group
ext4: fix FITRIM in no journal mode
ext4: drop set but otherwise unused variable from ext4_add_dirent_to_inline()
ext4: change ext4_read_inline_dir() to return 0 on success
ext4: pair trace_ext4_writepages & trace_ext4_writepages_result
ext4: add ratelimiting to ext4 messages
ext4: fix performance regression in ext4_writepages
ext4: fixup kerndoc annotation of mpage_map_and_submit_extent()
ext4: fix assertion in ext4_add_complete_io()
| -rw-r--r-- | fs/ext4/balloc.c | 13 | ||||
| -rw-r--r-- | fs/ext4/ext4.h | 17 | ||||
| -rw-r--r-- | fs/ext4/extents.c | 35 | ||||
| -rw-r--r-- | fs/ext4/ialloc.c | 2 | ||||
| -rw-r--r-- | fs/ext4/inline.c | 3 | ||||
| -rw-r--r-- | fs/ext4/inode.c | 54 | ||||
| -rw-r--r-- | fs/ext4/mballoc.c | 4 | ||||
| -rw-r--r-- | fs/ext4/mmp.c | 2 | ||||
| -rw-r--r-- | fs/ext4/page-io.c | 5 | ||||
| -rw-r--r-- | fs/ext4/super.c | 159 | ||||
| -rw-r--r-- | fs/ext4/xattr.c | 1 |
11 files changed, 168 insertions, 127 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index dc5d572ebd6a..6ea7b1436bbc 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
| @@ -640,6 +640,7 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) | |||
| 640 | struct ext4_group_desc *gdp; | 640 | struct ext4_group_desc *gdp; |
| 641 | ext4_group_t i; | 641 | ext4_group_t i; |
| 642 | ext4_group_t ngroups = ext4_get_groups_count(sb); | 642 | ext4_group_t ngroups = ext4_get_groups_count(sb); |
| 643 | struct ext4_group_info *grp; | ||
| 643 | #ifdef EXT4FS_DEBUG | 644 | #ifdef EXT4FS_DEBUG |
| 644 | struct ext4_super_block *es; | 645 | struct ext4_super_block *es; |
| 645 | ext4_fsblk_t bitmap_count; | 646 | ext4_fsblk_t bitmap_count; |
| @@ -655,7 +656,11 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) | |||
| 655 | gdp = ext4_get_group_desc(sb, i, NULL); | 656 | gdp = ext4_get_group_desc(sb, i, NULL); |
| 656 | if (!gdp) | 657 | if (!gdp) |
| 657 | continue; | 658 | continue; |
| 658 | desc_count += ext4_free_group_clusters(sb, gdp); | 659 | grp = NULL; |
| 660 | if (EXT4_SB(sb)->s_group_info) | ||
| 661 | grp = ext4_get_group_info(sb, i); | ||
| 662 | if (!grp || !EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 663 | desc_count += ext4_free_group_clusters(sb, gdp); | ||
| 659 | brelse(bitmap_bh); | 664 | brelse(bitmap_bh); |
| 660 | bitmap_bh = ext4_read_block_bitmap(sb, i); | 665 | bitmap_bh = ext4_read_block_bitmap(sb, i); |
| 661 | if (bitmap_bh == NULL) | 666 | if (bitmap_bh == NULL) |
| @@ -679,7 +684,11 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) | |||
| 679 | gdp = ext4_get_group_desc(sb, i, NULL); | 684 | gdp = ext4_get_group_desc(sb, i, NULL); |
| 680 | if (!gdp) | 685 | if (!gdp) |
| 681 | continue; | 686 | continue; |
| 682 | desc_count += ext4_free_group_clusters(sb, gdp); | 687 | grp = NULL; |
| 688 | if (EXT4_SB(sb)->s_group_info) | ||
| 689 | grp = ext4_get_group_info(sb, i); | ||
| 690 | if (!grp || !EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 691 | desc_count += ext4_free_group_clusters(sb, gdp); | ||
| 683 | } | 692 | } |
| 684 | 693 | ||
| 685 | return desc_count; | 694 | return desc_count; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index d01d62315f7e..e6185031c1cc 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
| 30 | #include <linux/blockgroup_lock.h> | 30 | #include <linux/blockgroup_lock.h> |
| 31 | #include <linux/percpu_counter.h> | 31 | #include <linux/percpu_counter.h> |
| 32 | #include <linux/ratelimit.h> | ||
| 32 | #include <crypto/hash.h> | 33 | #include <crypto/hash.h> |
| 33 | #ifdef __KERNEL__ | 34 | #ifdef __KERNEL__ |
| 34 | #include <linux/compat.h> | 35 | #include <linux/compat.h> |
| @@ -1314,6 +1315,11 @@ struct ext4_sb_info { | |||
| 1314 | unsigned long s_es_last_sorted; | 1315 | unsigned long s_es_last_sorted; |
| 1315 | struct percpu_counter s_extent_cache_cnt; | 1316 | struct percpu_counter s_extent_cache_cnt; |
| 1316 | spinlock_t s_es_lru_lock ____cacheline_aligned_in_smp; | 1317 | spinlock_t s_es_lru_lock ____cacheline_aligned_in_smp; |
| 1318 | |||
| 1319 | /* Ratelimit ext4 messages. */ | ||
| 1320 | struct ratelimit_state s_err_ratelimit_state; | ||
| 1321 | struct ratelimit_state s_warning_ratelimit_state; | ||
| 1322 | struct ratelimit_state s_msg_ratelimit_state; | ||
| 1317 | }; | 1323 | }; |
| 1318 | 1324 | ||
| 1319 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1325 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
| @@ -1396,7 +1402,18 @@ static inline void ext4_clear_inode_##name(struct inode *inode, int bit) \ | |||
| 1396 | clear_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ | 1402 | clear_bit(bit + (offset), &EXT4_I(inode)->i_##field); \ |
| 1397 | } | 1403 | } |
| 1398 | 1404 | ||
| 1405 | /* Add these declarations here only so that these functions can be | ||
| 1406 | * found by name. Otherwise, they are very hard to locate. */ | ||
| 1407 | static inline int ext4_test_inode_flag(struct inode *inode, int bit); | ||
| 1408 | static inline void ext4_set_inode_flag(struct inode *inode, int bit); | ||
| 1409 | static inline void ext4_clear_inode_flag(struct inode *inode, int bit); | ||
| 1399 | EXT4_INODE_BIT_FNS(flag, flags, 0) | 1410 | EXT4_INODE_BIT_FNS(flag, flags, 0) |
| 1411 | |||
| 1412 | /* Add these declarations here only so that these functions can be | ||
| 1413 | * found by name. Otherwise, they are very hard to locate. */ | ||
| 1414 | static inline int ext4_test_inode_state(struct inode *inode, int bit); | ||
| 1415 | static inline void ext4_set_inode_state(struct inode *inode, int bit); | ||
| 1416 | static inline void ext4_clear_inode_state(struct inode *inode, int bit); | ||
| 1400 | #if (BITS_PER_LONG < 64) | 1417 | #if (BITS_PER_LONG < 64) |
| 1401 | EXT4_INODE_BIT_FNS(state, state_flags, 0) | 1418 | EXT4_INODE_BIT_FNS(state, state_flags, 0) |
| 1402 | 1419 | ||
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 54d52afcdb19..35f65cf4f318 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -1666,7 +1666,7 @@ int | |||
| 1666 | ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, | 1666 | ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, |
| 1667 | struct ext4_extent *ex2) | 1667 | struct ext4_extent *ex2) |
| 1668 | { | 1668 | { |
| 1669 | unsigned short ext1_ee_len, ext2_ee_len, max_len; | 1669 | unsigned short ext1_ee_len, ext2_ee_len; |
| 1670 | 1670 | ||
| 1671 | /* | 1671 | /* |
| 1672 | * Make sure that both extents are initialized. We don't merge | 1672 | * Make sure that both extents are initialized. We don't merge |
| @@ -1677,11 +1677,6 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, | |||
| 1677 | if (ext4_ext_is_uninitialized(ex1) || ext4_ext_is_uninitialized(ex2)) | 1677 | if (ext4_ext_is_uninitialized(ex1) || ext4_ext_is_uninitialized(ex2)) |
| 1678 | return 0; | 1678 | return 0; |
| 1679 | 1679 | ||
| 1680 | if (ext4_ext_is_uninitialized(ex1)) | ||
| 1681 | max_len = EXT_UNINIT_MAX_LEN; | ||
| 1682 | else | ||
| 1683 | max_len = EXT_INIT_MAX_LEN; | ||
| 1684 | |||
| 1685 | ext1_ee_len = ext4_ext_get_actual_len(ex1); | 1680 | ext1_ee_len = ext4_ext_get_actual_len(ex1); |
| 1686 | ext2_ee_len = ext4_ext_get_actual_len(ex2); | 1681 | ext2_ee_len = ext4_ext_get_actual_len(ex2); |
| 1687 | 1682 | ||
| @@ -1694,7 +1689,7 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, | |||
| 1694 | * as an RO_COMPAT feature, refuse to merge to extents if | 1689 | * as an RO_COMPAT feature, refuse to merge to extents if |
| 1695 | * this can result in the top bit of ee_len being set. | 1690 | * this can result in the top bit of ee_len being set. |
| 1696 | */ | 1691 | */ |
| 1697 | if (ext1_ee_len + ext2_ee_len > max_len) | 1692 | if (ext1_ee_len + ext2_ee_len > EXT_INIT_MAX_LEN) |
| 1698 | return 0; | 1693 | return 0; |
| 1699 | #ifdef AGGRESSIVE_TEST | 1694 | #ifdef AGGRESSIVE_TEST |
| 1700 | if (ext1_ee_len >= 4) | 1695 | if (ext1_ee_len >= 4) |
| @@ -1720,7 +1715,6 @@ static int ext4_ext_try_to_merge_right(struct inode *inode, | |||
| 1720 | struct ext4_extent_header *eh; | 1715 | struct ext4_extent_header *eh; |
| 1721 | unsigned int depth, len; | 1716 | unsigned int depth, len; |
| 1722 | int merge_done = 0; | 1717 | int merge_done = 0; |
| 1723 | int uninitialized = 0; | ||
| 1724 | 1718 | ||
| 1725 | depth = ext_depth(inode); | 1719 | depth = ext_depth(inode); |
| 1726 | BUG_ON(path[depth].p_hdr == NULL); | 1720 | BUG_ON(path[depth].p_hdr == NULL); |
| @@ -1730,12 +1724,8 @@ static int ext4_ext_try_to_merge_right(struct inode *inode, | |||
| 1730 | if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) | 1724 | if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) |
| 1731 | break; | 1725 | break; |
| 1732 | /* merge with next extent! */ | 1726 | /* merge with next extent! */ |
| 1733 | if (ext4_ext_is_uninitialized(ex)) | ||
| 1734 | uninitialized = 1; | ||
| 1735 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1727 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
| 1736 | + ext4_ext_get_actual_len(ex + 1)); | 1728 | + ext4_ext_get_actual_len(ex + 1)); |
| 1737 | if (uninitialized) | ||
| 1738 | ext4_ext_mark_uninitialized(ex); | ||
| 1739 | 1729 | ||
| 1740 | if (ex + 1 < EXT_LAST_EXTENT(eh)) { | 1730 | if (ex + 1 < EXT_LAST_EXTENT(eh)) { |
| 1741 | len = (EXT_LAST_EXTENT(eh) - ex - 1) | 1731 | len = (EXT_LAST_EXTENT(eh) - ex - 1) |
| @@ -1890,7 +1880,6 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode, | |||
| 1890 | struct ext4_ext_path *npath = NULL; | 1880 | struct ext4_ext_path *npath = NULL; |
| 1891 | int depth, len, err; | 1881 | int depth, len, err; |
| 1892 | ext4_lblk_t next; | 1882 | ext4_lblk_t next; |
| 1893 | unsigned uninitialized = 0; | ||
| 1894 | int mb_flags = 0; | 1883 | int mb_flags = 0; |
| 1895 | 1884 | ||
| 1896 | if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { | 1885 | if (unlikely(ext4_ext_get_actual_len(newext) == 0)) { |
| @@ -1942,18 +1931,8 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode, | |||
| 1942 | if (err) | 1931 | if (err) |
| 1943 | return err; | 1932 | return err; |
| 1944 | 1933 | ||
| 1945 | /* | ||
| 1946 | * ext4_can_extents_be_merged should have checked | ||
| 1947 | * that either both extents are uninitialized, or | ||
| 1948 | * both aren't. Thus we need to check only one of | ||
| 1949 | * them here. | ||
| 1950 | */ | ||
| 1951 | if (ext4_ext_is_uninitialized(ex)) | ||
| 1952 | uninitialized = 1; | ||
| 1953 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1934 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
| 1954 | + ext4_ext_get_actual_len(newext)); | 1935 | + ext4_ext_get_actual_len(newext)); |
| 1955 | if (uninitialized) | ||
| 1956 | ext4_ext_mark_uninitialized(ex); | ||
| 1957 | eh = path[depth].p_hdr; | 1936 | eh = path[depth].p_hdr; |
| 1958 | nearex = ex; | 1937 | nearex = ex; |
| 1959 | goto merge; | 1938 | goto merge; |
| @@ -1976,20 +1955,10 @@ prepend: | |||
| 1976 | if (err) | 1955 | if (err) |
| 1977 | return err; | 1956 | return err; |
| 1978 | 1957 | ||
| 1979 | /* | ||
| 1980 | * ext4_can_extents_be_merged should have checked | ||
| 1981 | * that either both extents are uninitialized, or | ||
| 1982 | * both aren't. Thus we need to check only one of | ||
| 1983 | * them here. | ||
| 1984 | */ | ||
| 1985 | if (ext4_ext_is_uninitialized(ex)) | ||
| 1986 | uninitialized = 1; | ||
| 1987 | ex->ee_block = newext->ee_block; | 1958 | ex->ee_block = newext->ee_block; |
| 1988 | ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); | 1959 | ext4_ext_store_pblock(ex, ext4_ext_pblock(newext)); |
| 1989 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) | 1960 | ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) |
| 1990 | + ext4_ext_get_actual_len(newext)); | 1961 | + ext4_ext_get_actual_len(newext)); |
| 1991 | if (uninitialized) | ||
| 1992 | ext4_ext_mark_uninitialized(ex); | ||
| 1993 | eh = path[depth].p_hdr; | 1962 | eh = path[depth].p_hdr; |
| 1994 | nearex = ex; | 1963 | nearex = ex; |
| 1995 | goto merge; | 1964 | goto merge; |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 137193ff389b..0ee59a6644e2 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -432,7 +432,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
| 432 | ext4fs_dirhash(qstr->name, qstr->len, &hinfo); | 432 | ext4fs_dirhash(qstr->name, qstr->len, &hinfo); |
| 433 | grp = hinfo.hash; | 433 | grp = hinfo.hash; |
| 434 | } else | 434 | } else |
| 435 | get_random_bytes(&grp, sizeof(grp)); | 435 | grp = prandom_u32(); |
| 436 | parent_group = (unsigned)grp % ngroups; | 436 | parent_group = (unsigned)grp % ngroups; |
| 437 | for (i = 0; i < ngroups; i++) { | 437 | for (i = 0; i < ngroups; i++) { |
| 438 | g = (parent_group + i) % ngroups; | 438 | g = (parent_group + i) % ngroups; |
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index d9ecbf1113a7..bae987549dc3 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
| @@ -994,11 +994,9 @@ static int ext4_add_dirent_to_inline(handle_t *handle, | |||
| 994 | struct inode *dir = dentry->d_parent->d_inode; | 994 | struct inode *dir = dentry->d_parent->d_inode; |
| 995 | const char *name = dentry->d_name.name; | 995 | const char *name = dentry->d_name.name; |
| 996 | int namelen = dentry->d_name.len; | 996 | int namelen = dentry->d_name.len; |
| 997 | unsigned short reclen; | ||
| 998 | int err; | 997 | int err; |
| 999 | struct ext4_dir_entry_2 *de; | 998 | struct ext4_dir_entry_2 *de; |
| 1000 | 999 | ||
| 1001 | reclen = EXT4_DIR_REC_LEN(namelen); | ||
| 1002 | err = ext4_find_dest_de(dir, inode, iloc->bh, | 1000 | err = ext4_find_dest_de(dir, inode, iloc->bh, |
| 1003 | inline_start, inline_size, | 1001 | inline_start, inline_size, |
| 1004 | name, namelen, &de); | 1002 | name, namelen, &de); |
| @@ -1442,6 +1440,7 @@ int ext4_read_inline_dir(struct file *file, | |||
| 1442 | if (ret < 0) | 1440 | if (ret < 0) |
| 1443 | goto out; | 1441 | goto out; |
| 1444 | 1442 | ||
| 1443 | ret = 0; | ||
| 1445 | sb = inode->i_sb; | 1444 | sb = inode->i_sb; |
| 1446 | parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode); | 1445 | parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode); |
| 1447 | offset = ctx->pos; | 1446 | offset = ctx->pos; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e274e9c1171f..075763474118 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -2178,6 +2178,9 @@ static int mpage_map_one_extent(handle_t *handle, struct mpage_da_data *mpd) | |||
| 2178 | * | 2178 | * |
| 2179 | * @handle - handle for journal operations | 2179 | * @handle - handle for journal operations |
| 2180 | * @mpd - extent to map | 2180 | * @mpd - extent to map |
| 2181 | * @give_up_on_write - we set this to true iff there is a fatal error and there | ||
| 2182 | * is no hope of writing the data. The caller should discard | ||
| 2183 | * dirty pages to avoid infinite loops. | ||
| 2181 | * | 2184 | * |
| 2182 | * The function maps extent starting at mpd->lblk of length mpd->len. If it is | 2185 | * The function maps extent starting at mpd->lblk of length mpd->len. If it is |
| 2183 | * delayed, blocks are allocated, if it is unwritten, we may need to convert | 2186 | * delayed, blocks are allocated, if it is unwritten, we may need to convert |
| @@ -2295,6 +2298,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) | |||
| 2295 | struct address_space *mapping = mpd->inode->i_mapping; | 2298 | struct address_space *mapping = mpd->inode->i_mapping; |
| 2296 | struct pagevec pvec; | 2299 | struct pagevec pvec; |
| 2297 | unsigned int nr_pages; | 2300 | unsigned int nr_pages; |
| 2301 | long left = mpd->wbc->nr_to_write; | ||
| 2298 | pgoff_t index = mpd->first_page; | 2302 | pgoff_t index = mpd->first_page; |
| 2299 | pgoff_t end = mpd->last_page; | 2303 | pgoff_t end = mpd->last_page; |
| 2300 | int tag; | 2304 | int tag; |
| @@ -2330,6 +2334,17 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) | |||
| 2330 | if (page->index > end) | 2334 | if (page->index > end) |
| 2331 | goto out; | 2335 | goto out; |
| 2332 | 2336 | ||
| 2337 | /* | ||
| 2338 | * Accumulated enough dirty pages? This doesn't apply | ||
| 2339 | * to WB_SYNC_ALL mode. For integrity sync we have to | ||
| 2340 | * keep going because someone may be concurrently | ||
| 2341 | * dirtying pages, and we might have synced a lot of | ||
| 2342 | * newly appeared dirty pages, but have not synced all | ||
| 2343 | * of the old dirty pages. | ||
| 2344 | */ | ||
| 2345 | if (mpd->wbc->sync_mode == WB_SYNC_NONE && left <= 0) | ||
| 2346 | goto out; | ||
| 2347 | |||
| 2333 | /* If we can't merge this page, we are done. */ | 2348 | /* If we can't merge this page, we are done. */ |
| 2334 | if (mpd->map.m_len > 0 && mpd->next_page != page->index) | 2349 | if (mpd->map.m_len > 0 && mpd->next_page != page->index) |
| 2335 | goto out; | 2350 | goto out; |
| @@ -2364,19 +2379,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) | |||
| 2364 | if (err <= 0) | 2379 | if (err <= 0) |
| 2365 | goto out; | 2380 | goto out; |
| 2366 | err = 0; | 2381 | err = 0; |
| 2367 | 2382 | left--; | |
| 2368 | /* | ||
| 2369 | * Accumulated enough dirty pages? This doesn't apply | ||
| 2370 | * to WB_SYNC_ALL mode. For integrity sync we have to | ||
| 2371 | * keep going because someone may be concurrently | ||
| 2372 | * dirtying pages, and we might have synced a lot of | ||
| 2373 | * newly appeared dirty pages, but have not synced all | ||
| 2374 | * of the old dirty pages. | ||
| 2375 | */ | ||
| 2376 | if (mpd->wbc->sync_mode == WB_SYNC_NONE && | ||
| 2377 | mpd->next_page - mpd->first_page >= | ||
| 2378 | mpd->wbc->nr_to_write) | ||
| 2379 | goto out; | ||
| 2380 | } | 2383 | } |
| 2381 | pagevec_release(&pvec); | 2384 | pagevec_release(&pvec); |
| 2382 | cond_resched(); | 2385 | cond_resched(); |
| @@ -2420,16 +2423,15 @@ static int ext4_writepages(struct address_space *mapping, | |||
| 2420 | * because that could violate lock ordering on umount | 2423 | * because that could violate lock ordering on umount |
| 2421 | */ | 2424 | */ |
| 2422 | if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) | 2425 | if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) |
| 2423 | return 0; | 2426 | goto out_writepages; |
| 2424 | 2427 | ||
| 2425 | if (ext4_should_journal_data(inode)) { | 2428 | if (ext4_should_journal_data(inode)) { |
| 2426 | struct blk_plug plug; | 2429 | struct blk_plug plug; |
| 2427 | int ret; | ||
| 2428 | 2430 | ||
| 2429 | blk_start_plug(&plug); | 2431 | blk_start_plug(&plug); |
| 2430 | ret = write_cache_pages(mapping, wbc, __writepage, mapping); | 2432 | ret = write_cache_pages(mapping, wbc, __writepage, mapping); |
| 2431 | blk_finish_plug(&plug); | 2433 | blk_finish_plug(&plug); |
| 2432 | return ret; | 2434 | goto out_writepages; |
| 2433 | } | 2435 | } |
| 2434 | 2436 | ||
| 2435 | /* | 2437 | /* |
| @@ -2442,8 +2444,10 @@ static int ext4_writepages(struct address_space *mapping, | |||
| 2442 | * *never* be called, so if that ever happens, we would want | 2444 | * *never* be called, so if that ever happens, we would want |
| 2443 | * the stack trace. | 2445 | * the stack trace. |
| 2444 | */ | 2446 | */ |
| 2445 | if (unlikely(sbi->s_mount_flags & EXT4_MF_FS_ABORTED)) | 2447 | if (unlikely(sbi->s_mount_flags & EXT4_MF_FS_ABORTED)) { |
| 2446 | return -EROFS; | 2448 | ret = -EROFS; |
| 2449 | goto out_writepages; | ||
| 2450 | } | ||
| 2447 | 2451 | ||
| 2448 | if (ext4_should_dioread_nolock(inode)) { | 2452 | if (ext4_should_dioread_nolock(inode)) { |
| 2449 | /* | 2453 | /* |
| @@ -4690,6 +4694,15 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 4690 | generic_fillattr(inode, stat); | 4694 | generic_fillattr(inode, stat); |
| 4691 | 4695 | ||
| 4692 | /* | 4696 | /* |
| 4697 | * If there is inline data in the inode, the inode will normally not | ||
| 4698 | * have data blocks allocated (it may have an external xattr block). | ||
| 4699 | * Report at least one sector for such files, so tools like tar, rsync, | ||
| 4700 | * others doen't incorrectly think the file is completely sparse. | ||
| 4701 | */ | ||
| 4702 | if (unlikely(ext4_has_inline_data(inode))) | ||
| 4703 | stat->blocks += (stat->size + 511) >> 9; | ||
| 4704 | |||
| 4705 | /* | ||
| 4693 | * We can't update i_blocks if the block allocation is delayed | 4706 | * We can't update i_blocks if the block allocation is delayed |
| 4694 | * otherwise in the case of system crash before the real block | 4707 | * otherwise in the case of system crash before the real block |
| 4695 | * allocation is done, we will have i_blocks inconsistent with | 4708 | * allocation is done, we will have i_blocks inconsistent with |
| @@ -4700,9 +4713,8 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 4700 | * blocks for this file. | 4713 | * blocks for this file. |
| 4701 | */ | 4714 | */ |
| 4702 | delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb), | 4715 | delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb), |
| 4703 | EXT4_I(inode)->i_reserved_data_blocks); | 4716 | EXT4_I(inode)->i_reserved_data_blocks); |
| 4704 | 4717 | stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits - 9); | |
| 4705 | stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9); | ||
| 4706 | return 0; | 4718 | return 0; |
| 4707 | } | 4719 | } |
| 4708 | 4720 | ||
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index a41e3ba8cfaa..4d113efa024c 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
| @@ -4794,8 +4794,8 @@ do_more: | |||
| 4794 | " group:%d block:%d count:%lu failed" | 4794 | " group:%d block:%d count:%lu failed" |
| 4795 | " with %d", block_group, bit, count, | 4795 | " with %d", block_group, bit, count, |
| 4796 | err); | 4796 | err); |
| 4797 | } | 4797 | } else |
| 4798 | 4798 | EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info); | |
| 4799 | 4799 | ||
| 4800 | ext4_lock_group(sb, block_group); | 4800 | ext4_lock_group(sb, block_group); |
| 4801 | mb_clear_bits(bitmap_bh->b_data, bit, count_clusters); | 4801 | mb_clear_bits(bitmap_bh->b_data, bit, count_clusters); |
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 214461e42a05..04434ad3e8e0 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c | |||
| @@ -259,7 +259,7 @@ static unsigned int mmp_new_seq(void) | |||
| 259 | u32 new_seq; | 259 | u32 new_seq; |
| 260 | 260 | ||
| 261 | do { | 261 | do { |
| 262 | get_random_bytes(&new_seq, sizeof(u32)); | 262 | new_seq = prandom_u32(); |
| 263 | } while (new_seq > EXT4_MMP_SEQ_MAX); | 263 | } while (new_seq > EXT4_MMP_SEQ_MAX); |
| 264 | 264 | ||
| 265 | return new_seq; | 265 | return new_seq; |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index d7d0c7b46ed4..d488f80ee32d 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
| @@ -197,14 +197,15 @@ static void dump_completed_IO(struct inode *inode, struct list_head *head) | |||
| 197 | static void ext4_add_complete_io(ext4_io_end_t *io_end) | 197 | static void ext4_add_complete_io(ext4_io_end_t *io_end) |
| 198 | { | 198 | { |
| 199 | struct ext4_inode_info *ei = EXT4_I(io_end->inode); | 199 | struct ext4_inode_info *ei = EXT4_I(io_end->inode); |
| 200 | struct ext4_sb_info *sbi = EXT4_SB(io_end->inode->i_sb); | ||
| 200 | struct workqueue_struct *wq; | 201 | struct workqueue_struct *wq; |
| 201 | unsigned long flags; | 202 | unsigned long flags; |
| 202 | 203 | ||
| 203 | /* Only reserved conversions from writeback should enter here */ | 204 | /* Only reserved conversions from writeback should enter here */ |
| 204 | WARN_ON(!(io_end->flag & EXT4_IO_END_UNWRITTEN)); | 205 | WARN_ON(!(io_end->flag & EXT4_IO_END_UNWRITTEN)); |
| 205 | WARN_ON(!io_end->handle); | 206 | WARN_ON(!io_end->handle && sbi->s_journal); |
| 206 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); | 207 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); |
| 207 | wq = EXT4_SB(io_end->inode->i_sb)->rsv_conversion_wq; | 208 | wq = sbi->rsv_conversion_wq; |
| 208 | if (list_empty(&ei->i_rsv_conversion_list)) | 209 | if (list_empty(&ei->i_rsv_conversion_list)) |
| 209 | queue_work(wq, &ei->i_rsv_conversion_work); | 210 | queue_work(wq, &ei->i_rsv_conversion_work); |
| 210 | list_add_tail(&io_end->list, &ei->i_rsv_conversion_list); | 211 | list_add_tail(&io_end->list, &ei->i_rsv_conversion_list); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 2c2e6cbc6bed..c977f4e4e63b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -411,20 +411,26 @@ static void ext4_handle_error(struct super_block *sb) | |||
| 411 | sb->s_id); | 411 | sb->s_id); |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | #define ext4_error_ratelimit(sb) \ | ||
| 415 | ___ratelimit(&(EXT4_SB(sb)->s_err_ratelimit_state), \ | ||
| 416 | "EXT4-fs error") | ||
| 417 | |||
| 414 | void __ext4_error(struct super_block *sb, const char *function, | 418 | void __ext4_error(struct super_block *sb, const char *function, |
| 415 | unsigned int line, const char *fmt, ...) | 419 | unsigned int line, const char *fmt, ...) |
| 416 | { | 420 | { |
| 417 | struct va_format vaf; | 421 | struct va_format vaf; |
| 418 | va_list args; | 422 | va_list args; |
| 419 | 423 | ||
| 420 | va_start(args, fmt); | 424 | if (ext4_error_ratelimit(sb)) { |
| 421 | vaf.fmt = fmt; | 425 | va_start(args, fmt); |
| 422 | vaf.va = &args; | 426 | vaf.fmt = fmt; |
| 423 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n", | 427 | vaf.va = &args; |
| 424 | sb->s_id, function, line, current->comm, &vaf); | 428 | printk(KERN_CRIT |
| 425 | va_end(args); | 429 | "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n", |
| 430 | sb->s_id, function, line, current->comm, &vaf); | ||
| 431 | va_end(args); | ||
| 432 | } | ||
| 426 | save_error_info(sb, function, line); | 433 | save_error_info(sb, function, line); |
| 427 | |||
| 428 | ext4_handle_error(sb); | 434 | ext4_handle_error(sb); |
| 429 | } | 435 | } |
| 430 | 436 | ||
| @@ -438,22 +444,23 @@ void __ext4_error_inode(struct inode *inode, const char *function, | |||
| 438 | 444 | ||
| 439 | es->s_last_error_ino = cpu_to_le32(inode->i_ino); | 445 | es->s_last_error_ino = cpu_to_le32(inode->i_ino); |
| 440 | es->s_last_error_block = cpu_to_le64(block); | 446 | es->s_last_error_block = cpu_to_le64(block); |
| 447 | if (ext4_error_ratelimit(inode->i_sb)) { | ||
| 448 | va_start(args, fmt); | ||
| 449 | vaf.fmt = fmt; | ||
| 450 | vaf.va = &args; | ||
| 451 | if (block) | ||
| 452 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: " | ||
| 453 | "inode #%lu: block %llu: comm %s: %pV\n", | ||
| 454 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 455 | block, current->comm, &vaf); | ||
| 456 | else | ||
| 457 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: " | ||
| 458 | "inode #%lu: comm %s: %pV\n", | ||
| 459 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 460 | current->comm, &vaf); | ||
| 461 | va_end(args); | ||
| 462 | } | ||
| 441 | save_error_info(inode->i_sb, function, line); | 463 | save_error_info(inode->i_sb, function, line); |
| 442 | va_start(args, fmt); | ||
| 443 | vaf.fmt = fmt; | ||
| 444 | vaf.va = &args; | ||
| 445 | if (block) | ||
| 446 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: " | ||
| 447 | "inode #%lu: block %llu: comm %s: %pV\n", | ||
| 448 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 449 | block, current->comm, &vaf); | ||
| 450 | else | ||
| 451 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: " | ||
| 452 | "inode #%lu: comm %s: %pV\n", | ||
| 453 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 454 | current->comm, &vaf); | ||
| 455 | va_end(args); | ||
| 456 | |||
| 457 | ext4_handle_error(inode->i_sb); | 464 | ext4_handle_error(inode->i_sb); |
| 458 | } | 465 | } |
| 459 | 466 | ||
| @@ -469,27 +476,28 @@ void __ext4_error_file(struct file *file, const char *function, | |||
| 469 | 476 | ||
| 470 | es = EXT4_SB(inode->i_sb)->s_es; | 477 | es = EXT4_SB(inode->i_sb)->s_es; |
| 471 | es->s_last_error_ino = cpu_to_le32(inode->i_ino); | 478 | es->s_last_error_ino = cpu_to_le32(inode->i_ino); |
| 479 | if (ext4_error_ratelimit(inode->i_sb)) { | ||
| 480 | path = d_path(&(file->f_path), pathname, sizeof(pathname)); | ||
| 481 | if (IS_ERR(path)) | ||
| 482 | path = "(unknown)"; | ||
| 483 | va_start(args, fmt); | ||
| 484 | vaf.fmt = fmt; | ||
| 485 | vaf.va = &args; | ||
| 486 | if (block) | ||
| 487 | printk(KERN_CRIT | ||
| 488 | "EXT4-fs error (device %s): %s:%d: inode #%lu: " | ||
| 489 | "block %llu: comm %s: path %s: %pV\n", | ||
| 490 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 491 | block, current->comm, path, &vaf); | ||
| 492 | else | ||
| 493 | printk(KERN_CRIT | ||
| 494 | "EXT4-fs error (device %s): %s:%d: inode #%lu: " | ||
| 495 | "comm %s: path %s: %pV\n", | ||
| 496 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 497 | current->comm, path, &vaf); | ||
| 498 | va_end(args); | ||
| 499 | } | ||
| 472 | save_error_info(inode->i_sb, function, line); | 500 | save_error_info(inode->i_sb, function, line); |
| 473 | path = d_path(&(file->f_path), pathname, sizeof(pathname)); | ||
| 474 | if (IS_ERR(path)) | ||
| 475 | path = "(unknown)"; | ||
| 476 | va_start(args, fmt); | ||
| 477 | vaf.fmt = fmt; | ||
| 478 | vaf.va = &args; | ||
| 479 | if (block) | ||
| 480 | printk(KERN_CRIT | ||
| 481 | "EXT4-fs error (device %s): %s:%d: inode #%lu: " | ||
| 482 | "block %llu: comm %s: path %s: %pV\n", | ||
| 483 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 484 | block, current->comm, path, &vaf); | ||
| 485 | else | ||
| 486 | printk(KERN_CRIT | ||
| 487 | "EXT4-fs error (device %s): %s:%d: inode #%lu: " | ||
| 488 | "comm %s: path %s: %pV\n", | ||
| 489 | inode->i_sb->s_id, function, line, inode->i_ino, | ||
| 490 | current->comm, path, &vaf); | ||
| 491 | va_end(args); | ||
| 492 | |||
| 493 | ext4_handle_error(inode->i_sb); | 501 | ext4_handle_error(inode->i_sb); |
| 494 | } | 502 | } |
| 495 | 503 | ||
| @@ -543,11 +551,13 @@ void __ext4_std_error(struct super_block *sb, const char *function, | |||
| 543 | (sb->s_flags & MS_RDONLY)) | 551 | (sb->s_flags & MS_RDONLY)) |
| 544 | return; | 552 | return; |
| 545 | 553 | ||
| 546 | errstr = ext4_decode_error(sb, errno, nbuf); | 554 | if (ext4_error_ratelimit(sb)) { |
| 547 | printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n", | 555 | errstr = ext4_decode_error(sb, errno, nbuf); |
| 548 | sb->s_id, function, line, errstr); | 556 | printk(KERN_CRIT "EXT4-fs error (device %s) in %s:%d: %s\n", |
| 549 | save_error_info(sb, function, line); | 557 | sb->s_id, function, line, errstr); |
| 558 | } | ||
| 550 | 559 | ||
| 560 | save_error_info(sb, function, line); | ||
| 551 | ext4_handle_error(sb); | 561 | ext4_handle_error(sb); |
| 552 | } | 562 | } |
| 553 | 563 | ||
| @@ -597,6 +607,9 @@ void __ext4_msg(struct super_block *sb, | |||
| 597 | struct va_format vaf; | 607 | struct va_format vaf; |
| 598 | va_list args; | 608 | va_list args; |
| 599 | 609 | ||
| 610 | if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs")) | ||
| 611 | return; | ||
| 612 | |||
| 600 | va_start(args, fmt); | 613 | va_start(args, fmt); |
| 601 | vaf.fmt = fmt; | 614 | vaf.fmt = fmt; |
| 602 | vaf.va = &args; | 615 | vaf.va = &args; |
| @@ -610,6 +623,10 @@ void __ext4_warning(struct super_block *sb, const char *function, | |||
| 610 | struct va_format vaf; | 623 | struct va_format vaf; |
| 611 | va_list args; | 624 | va_list args; |
| 612 | 625 | ||
| 626 | if (!___ratelimit(&(EXT4_SB(sb)->s_warning_ratelimit_state), | ||
| 627 | "EXT4-fs warning")) | ||
| 628 | return; | ||
| 629 | |||
| 613 | va_start(args, fmt); | 630 | va_start(args, fmt); |
| 614 | vaf.fmt = fmt; | 631 | vaf.fmt = fmt; |
| 615 | vaf.va = &args; | 632 | vaf.va = &args; |
| @@ -633,18 +650,20 @@ __acquires(bitlock) | |||
| 633 | es->s_last_error_block = cpu_to_le64(block); | 650 | es->s_last_error_block = cpu_to_le64(block); |
| 634 | __save_error_info(sb, function, line); | 651 | __save_error_info(sb, function, line); |
| 635 | 652 | ||
| 636 | va_start(args, fmt); | 653 | if (ext4_error_ratelimit(sb)) { |
| 637 | 654 | va_start(args, fmt); | |
| 638 | vaf.fmt = fmt; | 655 | vaf.fmt = fmt; |
| 639 | vaf.va = &args; | 656 | vaf.va = &args; |
| 640 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u, ", | 657 | printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: group %u, ", |
| 641 | sb->s_id, function, line, grp); | 658 | sb->s_id, function, line, grp); |
| 642 | if (ino) | 659 | if (ino) |
| 643 | printk(KERN_CONT "inode %lu: ", ino); | 660 | printk(KERN_CONT "inode %lu: ", ino); |
| 644 | if (block) | 661 | if (block) |
| 645 | printk(KERN_CONT "block %llu:", (unsigned long long) block); | 662 | printk(KERN_CONT "block %llu:", |
| 646 | printk(KERN_CONT "%pV\n", &vaf); | 663 | (unsigned long long) block); |
| 647 | va_end(args); | 664 | printk(KERN_CONT "%pV\n", &vaf); |
| 665 | va_end(args); | ||
| 666 | } | ||
| 648 | 667 | ||
| 649 | if (test_opt(sb, ERRORS_CONT)) { | 668 | if (test_opt(sb, ERRORS_CONT)) { |
| 650 | ext4_commit_super(sb, 0); | 669 | ext4_commit_super(sb, 0); |
| @@ -2606,6 +2625,12 @@ EXT4_RW_ATTR_SBI_UI(mb_group_prealloc, s_mb_group_prealloc); | |||
| 2606 | EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128); | 2625 | EXT4_DEPRECATED_ATTR(max_writeback_mb_bump, 128); |
| 2607 | EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb); | 2626 | EXT4_RW_ATTR_SBI_UI(extent_max_zeroout_kb, s_extent_max_zeroout_kb); |
| 2608 | EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error); | 2627 | EXT4_ATTR(trigger_fs_error, 0200, NULL, trigger_test_error); |
| 2628 | EXT4_RW_ATTR_SBI_UI(err_ratelimit_interval_ms, s_err_ratelimit_state.interval); | ||
| 2629 | EXT4_RW_ATTR_SBI_UI(err_ratelimit_burst, s_err_ratelimit_state.burst); | ||
| 2630 | EXT4_RW_ATTR_SBI_UI(warning_ratelimit_interval_ms, s_warning_ratelimit_state.interval); | ||
| 2631 | EXT4_RW_ATTR_SBI_UI(warning_ratelimit_burst, s_warning_ratelimit_state.burst); | ||
| 2632 | EXT4_RW_ATTR_SBI_UI(msg_ratelimit_interval_ms, s_msg_ratelimit_state.interval); | ||
| 2633 | EXT4_RW_ATTR_SBI_UI(msg_ratelimit_burst, s_msg_ratelimit_state.burst); | ||
| 2609 | 2634 | ||
| 2610 | static struct attribute *ext4_attrs[] = { | 2635 | static struct attribute *ext4_attrs[] = { |
| 2611 | ATTR_LIST(delayed_allocation_blocks), | 2636 | ATTR_LIST(delayed_allocation_blocks), |
| @@ -2623,6 +2648,12 @@ static struct attribute *ext4_attrs[] = { | |||
| 2623 | ATTR_LIST(max_writeback_mb_bump), | 2648 | ATTR_LIST(max_writeback_mb_bump), |
| 2624 | ATTR_LIST(extent_max_zeroout_kb), | 2649 | ATTR_LIST(extent_max_zeroout_kb), |
| 2625 | ATTR_LIST(trigger_fs_error), | 2650 | ATTR_LIST(trigger_fs_error), |
| 2651 | ATTR_LIST(err_ratelimit_interval_ms), | ||
| 2652 | ATTR_LIST(err_ratelimit_burst), | ||
| 2653 | ATTR_LIST(warning_ratelimit_interval_ms), | ||
| 2654 | ATTR_LIST(warning_ratelimit_burst), | ||
| 2655 | ATTR_LIST(msg_ratelimit_interval_ms), | ||
| 2656 | ATTR_LIST(msg_ratelimit_burst), | ||
| 2626 | NULL, | 2657 | NULL, |
| 2627 | }; | 2658 | }; |
| 2628 | 2659 | ||
| @@ -3037,7 +3068,6 @@ static struct ext4_li_request *ext4_li_request_new(struct super_block *sb, | |||
| 3037 | { | 3068 | { |
| 3038 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 3069 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
| 3039 | struct ext4_li_request *elr; | 3070 | struct ext4_li_request *elr; |
| 3040 | unsigned long rnd; | ||
| 3041 | 3071 | ||
| 3042 | elr = kzalloc(sizeof(*elr), GFP_KERNEL); | 3072 | elr = kzalloc(sizeof(*elr), GFP_KERNEL); |
| 3043 | if (!elr) | 3073 | if (!elr) |
| @@ -3052,10 +3082,8 @@ static struct ext4_li_request *ext4_li_request_new(struct super_block *sb, | |||
| 3052 | * spread the inode table initialization requests | 3082 | * spread the inode table initialization requests |
| 3053 | * better. | 3083 | * better. |
| 3054 | */ | 3084 | */ |
| 3055 | get_random_bytes(&rnd, sizeof(rnd)); | 3085 | elr->lr_next_sched = jiffies + (prandom_u32() % |
| 3056 | elr->lr_next_sched = jiffies + (unsigned long)rnd % | 3086 | (EXT4_DEF_LI_MAX_START_DELAY * HZ)); |
| 3057 | (EXT4_DEF_LI_MAX_START_DELAY * HZ); | ||
| 3058 | |||
| 3059 | return elr; | 3087 | return elr; |
| 3060 | } | 3088 | } |
| 3061 | 3089 | ||
| @@ -4118,6 +4146,11 @@ no_journal: | |||
| 4118 | if (es->s_error_count) | 4146 | if (es->s_error_count) |
| 4119 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ | 4147 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ |
| 4120 | 4148 | ||
| 4149 | /* Enable message ratelimiting. Default is 10 messages per 5 secs. */ | ||
| 4150 | ratelimit_state_init(&sbi->s_err_ratelimit_state, 5 * HZ, 10); | ||
| 4151 | ratelimit_state_init(&sbi->s_warning_ratelimit_state, 5 * HZ, 10); | ||
| 4152 | ratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10); | ||
| 4153 | |||
| 4121 | kfree(orig_data); | 4154 | kfree(orig_data); |
| 4122 | return 0; | 4155 | return 0; |
| 4123 | 4156 | ||
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 03e9bebba198..1423c4816a47 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
| @@ -1352,6 +1352,7 @@ retry: | |||
| 1352 | new_extra_isize = s_min_extra_isize; | 1352 | new_extra_isize = s_min_extra_isize; |
| 1353 | kfree(is); is = NULL; | 1353 | kfree(is); is = NULL; |
| 1354 | kfree(bs); bs = NULL; | 1354 | kfree(bs); bs = NULL; |
| 1355 | brelse(bh); | ||
| 1355 | goto retry; | 1356 | goto retry; |
| 1356 | } | 1357 | } |
| 1357 | error = -1; | 1358 | error = -1; |
