diff options
| author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-05-18 14:07:56 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-13 12:33:36 +0200 |
| commit | ce4bf7a145953a227e0df5eb00621ac1b2bfdbec (patch) | |
| tree | 6dc541da7c06327f3422e4089bedc0bfdedab896 /fs | |
| parent | 06454c0c919048f609eaaeeaf4d5f36b3644a840 (diff) | |
f2fs: flush pending bios right away when error occurs
Given errors, this patch flushes pending bios as soon as possible.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Conflicts:
fs/f2fs/file.c
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/f2fs/checkpoint.c | 10 | ||||
| -rw-r--r-- | fs/f2fs/data.c | 2 | ||||
| -rw-r--r-- | fs/f2fs/f2fs.h | 7 | ||||
| -rw-r--r-- | fs/f2fs/file.c | 8 | ||||
| -rw-r--r-- | fs/f2fs/inode.c | 2 |
5 files changed, 16 insertions, 13 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index e4fe7f191..934b94d8e 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -26,6 +26,14 @@ static struct kmem_cache *ino_entry_slab; struct kmem_cache *inode_entry_slab; +void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io) +{ + set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); + sbi->sb->s_flags |= MS_RDONLY; + if (!end_io) + f2fs_flush_merged_bios(sbi); +} + /* * We guarantee no failure on the returned page. */ @@ -91,7 +99,7 @@ repeat: * meta page. */ if (unlikely(!PageUptodate(page))) - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); out: mark_page_accessed(page); return page; diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 2d4aeb7c0..31086e0ed 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -69,7 +69,7 @@ static void f2fs_write_end_io(struct bio *bio, int err) if (unlikely(err)) { set_bit(AS_EIO, &page->mapping->flags); - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, true); } end_page_writeback(page); } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e74cb9d4f..4def362e5 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1734,12 +1734,6 @@ static inline bool f2fs_cp_error(struct f2fs_sb_info *sbi) return is_set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); } -static inline void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi) -{ - set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); - sbi->sb->s_flags |= MS_RDONLY; -} - static inline bool is_dot_dotdot(const struct qstr *str) { if (str->len == 1 && str->name[0] == '.') @@ -1984,6 +1978,7 @@ void destroy_segment_manager_caches(void); /* * checkpoint.c */ +void f2fs_stop_checkpoint(struct f2fs_sb_info *, bool); struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t); struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t); struct page *get_tmp_page(struct f2fs_sb_info *, pgoff_t); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7a5f57336..245d76698 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1599,21 +1599,21 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) case FS_GOING_DOWN_FULLSYNC: sb = freeze_bdev(sb->s_bdev); if (sb && !IS_ERR(sb)) { - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); thaw_bdev(sb->s_bdev, sb); } break; case FS_GOING_DOWN_METASYNC: /* do checkpoint only */ f2fs_sync_fs(sb, 1); - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); break; case FS_GOING_DOWN_NOSYNC: - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); break; case FS_GOING_DOWN_METAFLUSH: sync_meta_pages(sbi, META, LONG_MAX); - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); break; default: ret = -EINVAL; diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 767ffefcd..7306d1d5a 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -282,7 +282,7 @@ retry: cond_resched(); goto retry; } else if (err != -ENOENT) { - f2fs_stop_checkpoint(sbi); + f2fs_stop_checkpoint(sbi, false); } return 0; } |
