f2fs: support configuring fault injection per superblock
Chao Yu
maintainerPATCH 1/1 f2fs: support configuring fault injection per superblock
From: Chao Yu <[email protected]>
Previously, we only support global fault injection configuration, so that when we configure type/rate of fault injection through sysfs, mount option, it will influence all f2fs partition which is being used.
It is not make sence, since it will be not convenient if developer want to test separated partitions with different fault injection rate/type simultaneously, also it's not possible to enable fault injection in one partition and disable fault injection in other one.
Quoted 1 line
From now on, we move global configuration of fault injection in module
into per-superblock, hence injection testing can be more flexible.
--- fs/f2fs/acl.c | 12 ++++---- fs/f2fs/checkpoint.c | 2 +- fs/f2fs/data.c | 2 +- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 78 ++++++++++++++++++++++++---------------------------- fs/f2fs/gc.c | 2 +- fs/f2fs/inline.c | 4 +-- fs/f2fs/inode.c | 2 +- fs/f2fs/node.c | 2 +- fs/f2fs/super.c | 57 ++++++++++---------------------------- 10 files changed, 66 insertions(+), 97 deletions(-)
fs/f2fs/acl.c +7 -5
@@ -109,14 +109,16 @@ fail:return ERR_PTR (-EINVAL ); } -static void *f2fs_acl_to_disk (const struct posix_acl *acl,size_t *size) +static void *f2fs_acl_to_disk (struct f2fs_sb_info *sbi, +const struct posix_acl *acl,size_t *size) {struct f2fs_acl_header *f2fs_acl;struct f2fs_acl_entry *entry;int i; - f2fs_acl =f2fs_kmalloc (sizeof (struct f2fs_acl_header ) + acl->a_count * -sizeof (struct f2fs_acl_entry ),GFP_NOFS ); + f2fs_acl =f2fs_kmalloc (sbi,sizeof (struct f2fs_acl_header ) + + acl->a_count *sizeof (struct f2fs_acl_entry ), +GFP_NOFS );if (!f2fs_acl)return ERR_PTR (-ENOMEM );
@@ -175,7 +177,7 @@ static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type, retval =f2fs_getxattr (inode, name_index,"" ,NULL ,0 , dpage);if (retval >0 ) { - value =f2fs_kmalloc (retval,GFP_F2FS_ZERO ); + value =f2fs_kmalloc (F2FS_I_SB (inode), retval,GFP_F2FS_ZERO );if (!value)return ERR_PTR (-ENOMEM ); retval = f2fs_getxattr(inode, name_index, "", value,
@@ -230,7 +232,7 @@ static int __f2fs_set_acl(struct inode *inode, int type, }if (acl) { - value =f2fs_acl_to_disk (acl, &size); + value =f2fs_acl_to_disk (F2FS_I_SB (inode), acl, &size);if (IS_ERR (value)) {clear_inode_flag (inode,FI_ACL_MODE );return (int )PTR_ERR (value);
fs/f2fs/checkpoint.c +1 -1
@@ -494,7 +494,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)spin_lock (&im->ino_lock);#ifdef CONFIG_F2FS_FAULT_INJECTION -if (time_to_inject (FAULT_ORPHAN )) { +if (time_to_inject (sbi,FAULT_ORPHAN )) {spin_unlock (&im->ino_lock);return -ENOSPC ; }
fs/f2fs/data.c +1 -1
@@ -35,7 +35,7 @@ static void f2fs_read_end_io(struct bio *bio)int i;#ifdef CONFIG_F2FS_FAULT_INJECTION -if (time_to_inject (FAULT_IO )) +if (time_to_inject (F2FS_P_SB (bio->bi_io_vec->bv_page),FAULT_IO )) bio->bi_error = -EIO ;#endif
fs/f2fs/dir.c +1 -1
@@ -545,7 +545,7 @@ int f2fs_add_regular_entry(struct inode *dir, const struct qstr *new_name, start:#ifdef CONFIG_F2FS_FAULT_INJECTION -if (time_to_inject (FAULT_DIR_DEPTH )) +if (time_to_inject (F2FS_I_SB (dir),FAULT_DIR_DEPTH ))return -ENOSPC ;#endif if (unlikely (current_depth ==MAX_DIR_HASH_DEPTH ))
fs/f2fs/f2fs.h +36 -42
119 lines not on this page · raw message
fs/f2fs/gc.c +1 -1
@@ -96,7 +96,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi)dev_t dev = sbi->sb->s_bdev->bd_dev;int err =0 ; - gc_th =f2fs_kmalloc (sizeof (struct f2fs_gc_kthread ),GFP_KERNEL ); + gc_th =f2fs_kmalloc (sbi,sizeof (struct f2fs_gc_kthread ),GFP_KERNEL );if (!gc_th) { err = -ENOMEM ; goto out;
fs/f2fs/inline.c +2 -2
@@ -445,8 +445,8 @@ static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage,struct f2fs_inline_dentry *backup_dentry;int err; - backup_dentry =f2fs_kmalloc (sizeof (struct f2fs_inline_dentry ), -GFP_F2FS_ZERO ); + backup_dentry =f2fs_kmalloc (F2FS_I_SB (dir), +sizeof (struct f2fs_inline_dentry ),GFP_F2FS_ZERO );if (!backup_dentry) {f2fs_put_page (ipage,1 );return -ENOMEM ;
fs/f2fs/inode.c +1 -1
@@ -369,7 +369,7 @@ void f2fs_evict_inode(struct inode *inode) goto no_delete;#ifdef CONFIG_F2FS_FAULT_INJECTION -if (time_to_inject (FAULT_EVICT_INODE )) +if (time_to_inject (sbi,FAULT_EVICT_INODE )) goto no_delete;#endif
fs/f2fs/node.c +1 -1
@@ -1846,7 +1846,7 @@ bool alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid)struct free_nid *i =NULL ; retry:#ifdef CONFIG_F2FS_FAULT_INJECTION -if (time_to_inject (FAULT_ALLOC_NID )) +if (time_to_inject (sbi,FAULT_ALLOC_NID ))return false;#endif if (unlikely (sbi->total_valid_node_count +1 > nm_i->available_nids))
fs/f2fs/super.c +15 -42
120 lines not on this page · raw message
Signature · 1 line
2.7.2