diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 82be4e475cd4..cf3e84860dbf 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1581,12 +1581,6 @@ int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc) trace_f2fs_write_checkpoint(sbi->sb, cpc->reason, "start block_ops"); - /* - * checkpoint will maintain the xattr consistency of dirs, - * so we can remove them from tracking list when do_checkpoint - */ - f2fs_clear_xattr_set_ilist(sbi); - err = block_operations(sbi); if (err) goto out; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 88dbb414638e..a64b80663085 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -735,7 +735,6 @@ struct f2fs_inode_info { struct task_struct *inmem_task; /* store inmemory task */ struct mutex inmem_lock; /* lock for inmemory pages */ struct extent_tree *extent_tree; /* cached extent_tree entry */ - struct list_head xattr_dirty_list; /* list for xattr changed inodes */ /* avoid racing between foreground op and gc */ struct rw_semaphore i_gc_rwsem[2]; @@ -1061,7 +1060,6 @@ enum cp_reason_type { CP_FASTBOOT_MODE, CP_SPEC_LOG_NUM, CP_RECOVER_DIR, - CP_PARENT_XATTR_SET, }; enum iostat_type { @@ -1258,8 +1256,6 @@ struct f2fs_sb_info { struct list_head fsync_node_list; /* node list head */ unsigned int fsync_seg_id; /* sequence id */ unsigned int fsync_node_num; /* number of node entries */ - spinlock_t xattr_set_dir_ilist_lock; /* lock for dir inode list*/ - struct list_head xattr_set_dir_ilist; /* xattr changed dir inode list */ /* for orphan inode, use 0'th array */ unsigned int max_orphans; /* max orphan inodes */ @@ -3507,14 +3503,6 @@ int f2fs_inline_data_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, __u64 start, __u64 len); -/* - * xattr.c - */ -void f2fs_inode_xattr_set(struct inode *inode); -void f2fs_remove_xattr_set_inode(struct inode *inode); -void f2fs_clear_xattr_set_ilist(struct f2fs_sb_info *sbi); -int f2fs_parent_inode_xattr_set(struct inode *inode); - /* * shrinker.c */ diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 8a0a53be41d7..87cf23c7a7f0 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -163,8 +163,6 @@ static inline enum cp_reason_type need_do_checkpoint(struct inode *inode) cp_reason = CP_HARDLINK; else if (is_sbi_flag_set(sbi, SBI_NEED_CP)) cp_reason = CP_SB_NEED_CP; - else if (f2fs_parent_inode_xattr_set(inode)) - cp_reason = CP_PARENT_XATTR_SET; else if (file_wrong_pino(inode)) cp_reason = CP_WRONG_PINO; else if (!f2fs_space_for_roll_forward(sbi)) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index aee8ff40eea2..9b0c1770f7e7 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -656,8 +656,6 @@ void f2fs_evict_inode(struct inode *inode) f2fs_destroy_extent_tree(inode); - f2fs_remove_xattr_set_inode(inode); - if (inode->i_nlink || is_bad_inode(inode)) goto no_delete; diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index e977af181f10..0208d257c206 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2817,15 +2817,6 @@ static unsigned int __issue_discard_cmd_range(struct f2fs_sb_info *sbi, if (fatal_signal_pending(current)) break; - - /* - * If the trim thread is running and we receive the SCREEN_ON - * event, we will send SIGUSR1 singnal to teriminate the trim - * thread. So if there is a SIGUSR1 signal pending in current - * thread, we need stop issuing discard commands and return. - */ - if (signal_pending(current) && sigismember(¤t->pending.signal, SIGUSR1)) - break; } blk_finish_plug(&plug); @@ -2880,6 +2871,15 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range) if (err) goto out; + /* + * We filed discard candidates, but actually we don't need to wait for + * all of them, since they'll be issued in idle time along with runtime + * discard option. User configuration looks like using runtime discard + * or periodic fstrim instead of it. + */ + if (f2fs_realtime_discard_enable(sbi)) + goto out; + start_block = START_BLOCK(sbi, start_segno); end_block = START_BLOCK(sbi, end_segno + 1); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 480fd0b4d5f8..0e7ae4d799e4 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -875,7 +875,6 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb) init_rwsem(&fi->i_gc_rwsem[WRITE]); init_rwsem(&fi->i_mmap_sem); init_rwsem(&fi->i_xattr_sem); - INIT_LIST_HEAD(&fi->xattr_dirty_list); /* Will be used by directory only */ fi->i_dir_level = F2FS_SB(sb)->dir_level; @@ -3340,9 +3339,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) } mutex_init(&sbi->flush_lock); - INIT_LIST_HEAD(&sbi->xattr_set_dir_ilist); - spin_lock_init(&sbi->xattr_set_dir_ilist_lock); - f2fs_init_extent_cache_info(sbi); f2fs_init_ino_entry_info(sbi); diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index ec88515cf9a9..296b3189448a 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -112,28 +112,6 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler, return 0; } -static struct inode *get_parent_inode(struct inode *inode) -{ - struct inode *dir = NULL; - struct dentry *dentry, *parent; - - dentry = d_find_alias(inode); - if (!dentry) - goto out; - - parent = dget_parent(dentry); - if (!parent) - goto out_dput; - - dir = igrab(d_inode(parent)); - dput(parent); - -out_dput: - dput(dentry); -out: - return dir; -} - #ifdef CONFIG_F2FS_FS_SECURITY static int f2fs_initxattrs(struct inode *inode, const struct xattr *xattr_array, void *page) @@ -751,7 +729,7 @@ static int __f2fs_setxattr(struct inode *inode, int index, f2fs_set_encrypted_inode(inode); f2fs_mark_inode_dirty_sync(inode, true); if (!error && S_ISDIR(inode->i_mode)) - f2fs_inode_xattr_set(inode); + set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP); exit: kvfree(base_addr); return error; @@ -791,51 +769,3 @@ int f2fs_setxattr(struct inode *inode, int index, const char *name, f2fs_update_time(sbi, REQ_TIME); return err; } - -void f2fs_inode_xattr_set(struct inode *inode) -{ - struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - struct f2fs_inode_info *fi = F2FS_I(inode); - - spin_lock(&sbi->xattr_set_dir_ilist_lock); - if (list_empty(&fi->xattr_dirty_list)) - list_add_tail(&fi->xattr_dirty_list, &sbi->xattr_set_dir_ilist); - spin_unlock(&sbi->xattr_set_dir_ilist_lock); -} - -void f2fs_remove_xattr_set_inode(struct inode *inode) -{ - struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - struct f2fs_inode_info *fi = F2FS_I(inode); - - spin_lock(&sbi->xattr_set_dir_ilist_lock); - if (!list_empty(&fi->xattr_dirty_list)) - list_del_init(&fi->xattr_dirty_list); - spin_unlock(&sbi->xattr_set_dir_ilist_lock); -} - -void f2fs_clear_xattr_set_ilist(struct f2fs_sb_info *sbi) -{ - struct list_head *pos, *n; - - spin_lock(&sbi->xattr_set_dir_ilist_lock); - list_for_each_safe(pos, n, &sbi->xattr_set_dir_ilist) - list_del_init(pos); - spin_unlock(&sbi->xattr_set_dir_ilist_lock); -} - -int f2fs_parent_inode_xattr_set(struct inode *inode) -{ - struct f2fs_sb_info *sbi = F2FS_I_SB(inode); - struct inode *dir = get_parent_inode(inode); - int ret = 0; - - if (dir) { - spin_lock(&sbi->xattr_set_dir_ilist_lock); - ret = !list_empty(&F2FS_I(dir)->xattr_dirty_list); - spin_unlock(&sbi->xattr_set_dir_ilist_lock); - iput(dir); - } - - return ret; -} diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index d0e6742510df..52b84e9ac33b 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -141,8 +141,7 @@ TRACE_DEFINE_ENUM(CP_PAUSE); { CP_NODE_NEED_CP, "node needs cp" }, \ { CP_FASTBOOT_MODE, "fastboot mode" }, \ { CP_SPEC_LOG_NUM, "log type is 2" }, \ - { CP_RECOVER_DIR, "dir needs recovery" }, \ - { CP_PARENT_XATTR_SET, "parent xattr is set" }) + { CP_RECOVER_DIR, "dir needs recovery" }) #define show_shutdown_mode(type) \ __print_symbolic(type, \