Commit debe436e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 updates from Ted Ts'o:
 "Only bug fixes and cleanups for ext4 this merge window.

  Of note are fixes for the combination of the inline_data and
  fast_commit fixes, and more accurately calculating when to schedule
  additional lazy inode table init, especially when CONFIG_HZ is 100HZ"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix error code saved on super block during file system abort
  ext4: inline data inode fast commit replay fixes
  ext4: commit inline data during fast commit
  ext4: scope ret locally in ext4_try_to_trim_range()
  ext4: remove an unused variable warning with CONFIG_QUOTA=n
  ext4: fix boolreturn.cocci warnings in fs/ext4/name.c
  ext4: prevent getting empty inode buffer
  ext4: move ext4_fill_raw_inode() related functions
  ext4: factor out ext4_fill_raw_inode()
  ext4: prevent partial update of the extent blocks
  ext4: check for inconsistent extents between index and leaf block
  ext4: check for out-of-order index extents in ext4_valid_extent_entries()
  ext4: convert from atomic_t to refcount_t on ext4_io_end->count
  ext4: refresh the ext4_ext_path struct after dropping i_data_sem.
  ext4: ensure enough credits in ext4_ext_shift_path_extents
  ext4: correct the left/middle/right debug message for binsearch
  ext4: fix lazy initialization next schedule time computation in more granular unit
  Revert "ext4: enforce buffer head state assertion in ext4_da_map_blocks"
parents 6070dcc8 124e7c61
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#ifndef _EXT4_H #ifndef _EXT4_H
#define _EXT4_H #define _EXT4_H
#include <linux/refcount.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/magic.h> #include <linux/magic.h>
...@@ -241,7 +242,7 @@ typedef struct ext4_io_end { ...@@ -241,7 +242,7 @@ typedef struct ext4_io_end {
struct bio *bio; /* Linked list of completed struct bio *bio; /* Linked list of completed
* bios covering the extent */ * bios covering the extent */
unsigned int flag; /* unwritten or not */ unsigned int flag; /* unwritten or not */
atomic_t count; /* reference counter */ refcount_t count; /* reference counter */
struct list_head list_vec; /* list of ext4_io_end_vec */ struct list_head list_vec; /* list of ext4_io_end_vec */
} ext4_io_end_t; } ext4_io_end_t;
......
This diff is collapsed.
...@@ -819,7 +819,9 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc) ...@@ -819,7 +819,9 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc)
if (ret) if (ret)
return ret; return ret;
if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))
inode_len = EXT4_INODE_SIZE(inode->i_sb);
else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
inode_len += ei->i_extra_isize; inode_len += ei->i_extra_isize;
fc_inode.fc_ino = cpu_to_le32(inode->i_ino); fc_inode.fc_ino = cpu_to_le32(inode->i_ino);
...@@ -1524,6 +1526,7 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl, ...@@ -1524,6 +1526,7 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
* crashing. This should be fixed but until then, we calculate * crashing. This should be fixed but until then, we calculate
* the number of blocks the inode. * the number of blocks the inode.
*/ */
if (!ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))
ext4_ext_replay_set_iblocks(inode); ext4_ext_replay_set_iblocks(inode);
inode->i_generation = le32_to_cpu(ext4_raw_inode(&iloc)->i_generation); inode->i_generation = le32_to_cpu(ext4_raw_inode(&iloc)->i_generation);
...@@ -1842,6 +1845,10 @@ static void ext4_fc_set_bitmaps_and_counters(struct super_block *sb) ...@@ -1842,6 +1845,10 @@ static void ext4_fc_set_bitmaps_and_counters(struct super_block *sb)
} }
cur = 0; cur = 0;
end = EXT_MAX_BLOCKS; end = EXT_MAX_BLOCKS;
if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) {
iput(inode);
continue;
}
while (cur < end) { while (cur < end) {
map.m_lblk = cur; map.m_lblk = cur;
map.m_len = end - cur; map.m_len = end - cur;
......
This diff is collapsed.
...@@ -6299,7 +6299,6 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) ...@@ -6299,7 +6299,6 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
{ {
ext4_grpblk_t next, count, free_count; ext4_grpblk_t next, count, free_count;
void *bitmap; void *bitmap;
int ret = 0;
bitmap = e4b->bd_bitmap; bitmap = e4b->bd_bitmap;
start = (e4b->bd_info->bb_first_free > start) ? start = (e4b->bd_info->bb_first_free > start) ?
...@@ -6314,10 +6313,10 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) ...@@ -6314,10 +6313,10 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
next = mb_find_next_bit(bitmap, max + 1, start); next = mb_find_next_bit(bitmap, max + 1, start);
if ((next - start) >= minblocks) { if ((next - start) >= minblocks) {
ret = ext4_trim_extent(sb, start, next - start, e4b); int ret = ext4_trim_extent(sb, start, next - start, e4b);
if (ret && ret != -EOPNOTSUPP) if (ret && ret != -EOPNOTSUPP)
break; break;
ret = 0;
count += next - start; count += next - start;
} }
free_count += next - start; free_count += next - start;
......
...@@ -1439,7 +1439,7 @@ static bool ext4_match(struct inode *parent, ...@@ -1439,7 +1439,7 @@ static bool ext4_match(struct inode *parent,
fname->hinfo.minor_hash != fname->hinfo.minor_hash !=
EXT4_DIRENT_MINOR_HASH(de)) { EXT4_DIRENT_MINOR_HASH(de)) {
return 0; return false;
} }
} }
return !ext4_ci_compare(parent, &cf, de->name, return !ext4_ci_compare(parent, &cf, de->name,
......
...@@ -279,14 +279,14 @@ ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags) ...@@ -279,14 +279,14 @@ ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags)
io_end->inode = inode; io_end->inode = inode;
INIT_LIST_HEAD(&io_end->list); INIT_LIST_HEAD(&io_end->list);
INIT_LIST_HEAD(&io_end->list_vec); INIT_LIST_HEAD(&io_end->list_vec);
atomic_set(&io_end->count, 1); refcount_set(&io_end->count, 1);
} }
return io_end; return io_end;
} }
void ext4_put_io_end_defer(ext4_io_end_t *io_end) void ext4_put_io_end_defer(ext4_io_end_t *io_end)
{ {
if (atomic_dec_and_test(&io_end->count)) { if (refcount_dec_and_test(&io_end->count)) {
if (!(io_end->flag & EXT4_IO_END_UNWRITTEN) || if (!(io_end->flag & EXT4_IO_END_UNWRITTEN) ||
list_empty(&io_end->list_vec)) { list_empty(&io_end->list_vec)) {
ext4_release_io_end(io_end); ext4_release_io_end(io_end);
...@@ -300,7 +300,7 @@ int ext4_put_io_end(ext4_io_end_t *io_end) ...@@ -300,7 +300,7 @@ int ext4_put_io_end(ext4_io_end_t *io_end)
{ {
int err = 0; int err = 0;
if (atomic_dec_and_test(&io_end->count)) { if (refcount_dec_and_test(&io_end->count)) {
if (io_end->flag & EXT4_IO_END_UNWRITTEN) { if (io_end->flag & EXT4_IO_END_UNWRITTEN) {
err = ext4_convert_unwritten_io_end_vec(io_end->handle, err = ext4_convert_unwritten_io_end_vec(io_end->handle,
io_end); io_end);
...@@ -314,7 +314,7 @@ int ext4_put_io_end(ext4_io_end_t *io_end) ...@@ -314,7 +314,7 @@ int ext4_put_io_end(ext4_io_end_t *io_end)
ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end) ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end)
{ {
atomic_inc(&io_end->count); refcount_inc(&io_end->count);
return io_end; return io_end;
} }
......
...@@ -3270,9 +3270,9 @@ static int ext4_run_li_request(struct ext4_li_request *elr) ...@@ -3270,9 +3270,9 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
struct super_block *sb = elr->lr_super; struct super_block *sb = elr->lr_super;
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
ext4_group_t group = elr->lr_next_group; ext4_group_t group = elr->lr_next_group;
unsigned long timeout = 0;
unsigned int prefetch_ios = 0; unsigned int prefetch_ios = 0;
int ret = 0; int ret = 0;
u64 start_time;
if (elr->lr_mode == EXT4_LI_MODE_PREFETCH_BBITMAP) { if (elr->lr_mode == EXT4_LI_MODE_PREFETCH_BBITMAP) {
elr->lr_next_group = ext4_mb_prefetch(sb, group, elr->lr_next_group = ext4_mb_prefetch(sb, group,
...@@ -3309,14 +3309,13 @@ static int ext4_run_li_request(struct ext4_li_request *elr) ...@@ -3309,14 +3309,13 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
ret = 1; ret = 1;
if (!ret) { if (!ret) {
timeout = jiffies; start_time = ktime_get_real_ns();
ret = ext4_init_inode_table(sb, group, ret = ext4_init_inode_table(sb, group,
elr->lr_timeout ? 0 : 1); elr->lr_timeout ? 0 : 1);
trace_ext4_lazy_itable_init(sb, group); trace_ext4_lazy_itable_init(sb, group);
if (elr->lr_timeout == 0) { if (elr->lr_timeout == 0) {
timeout = (jiffies - timeout) * elr->lr_timeout = nsecs_to_jiffies((ktime_get_real_ns() - start_time) *
EXT4_SB(elr->lr_super)->s_li_wait_mult; EXT4_SB(elr->lr_super)->s_li_wait_mult);
elr->lr_timeout = timeout;
} }
elr->lr_next_sched = jiffies + elr->lr_timeout; elr->lr_next_sched = jiffies + elr->lr_timeout;
elr->lr_next_group = group + 1; elr->lr_next_group = group + 1;
...@@ -5734,10 +5733,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -5734,10 +5733,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
unsigned long old_sb_flags, vfs_flags; unsigned long old_sb_flags, vfs_flags;
struct ext4_mount_options old_opts; struct ext4_mount_options old_opts;
int enable_quota = 0;
ext4_group_t g; ext4_group_t g;
int err = 0; int err = 0;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
int enable_quota = 0;
int i, j; int i, j;
char *to_free[EXT4_MAXQUOTAS]; char *to_free[EXT4_MAXQUOTAS];
#endif #endif
...@@ -5828,7 +5827,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -5828,7 +5827,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
} }
if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED)) if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED))
ext4_abort(sb, EXT4_ERR_ESHUTDOWN, "Abort forced by user"); ext4_abort(sb, ESHUTDOWN, "Abort forced by user");
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
...@@ -5942,7 +5941,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -5942,7 +5941,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
err = -EROFS; err = -EROFS;
goto restore_opts; goto restore_opts;
} }
#ifdef CONFIG_QUOTA
enable_quota = 1; enable_quota = 1;
#endif
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment