* [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later @ 2018-11-29 1:52 Jaegeuk Kim 2018-11-30 1:50 ` [f2fs-dev] " Chao Yu 2018-12-05 19:29 ` Pavel Machek 0 siblings, 2 replies; 7+ messages in thread From: Jaegeuk Kim @ 2018-11-29 1:52 UTC (permalink / raw) To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by setting a NEED_FSCK flag. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/f2fs.h | 1 + fs/f2fs/file.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index aa500239baf2..7cec897146a3 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ #if defined(__KERNEL__) && defined(CONFIG_COMPAT) /* diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ff82350a2c55..ca9bdbb8651b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) f2fs_stop_checkpoint(sbi, false); set_sbi_flag(sbi, SBI_IS_SHUTDOWN); break; + case F2FS_GOING_DOWN_NEED_FSCK: + set_sbi_flag(sbi, SBI_NEED_FSCK); + /* do checkpoint only */ + ret = f2fs_sync_fs(sb, 1); + if (ret) + goto out; + break; default: ret = -EINVAL; goto out; -- 2.19.0.605.g01d371f741-goog ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-11-29 1:52 [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later Jaegeuk Kim @ 2018-11-30 1:50 ` Chao Yu 2018-11-30 20:36 ` Jaegeuk Kim 2018-12-05 19:29 ` Pavel Machek 1 sibling, 1 reply; 7+ messages in thread From: Chao Yu @ 2018-11-30 1:50 UTC (permalink / raw) To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel On 2018/11/29 9:52, Jaegeuk Kim wrote: > This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by > setting a NEED_FSCK flag. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > fs/f2fs/f2fs.h | 1 + > fs/f2fs/file.c | 7 +++++++ > 2 files changed, 8 insertions(+) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index aa500239baf2..7cec897146a3 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, > #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ > #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ > #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ > +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ Why not add a new ioctl interface for this? F2FS_GOING_DOWN_ prefix implies filesystem will shutdown, IMO, we'd better to keep all sub-interfaces being consistent in f2fs_ioc_shutdown(). > > #if defined(__KERNEL__) && defined(CONFIG_COMPAT) > /* > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index ff82350a2c55..ca9bdbb8651b 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) > f2fs_stop_checkpoint(sbi, false); > set_sbi_flag(sbi, SBI_IS_SHUTDOWN); > break; > + case F2FS_GOING_DOWN_NEED_FSCK: > + set_sbi_flag(sbi, SBI_NEED_FSCK); > + /* do checkpoint only */ > + ret = f2fs_sync_fs(sb, 1); > + if (ret) > + goto out; In large-sized image, it may take long time to trigger full scan during boot, so I'd like to ask how often we set this flag? Thanks, > + break; > default: > ret = -EINVAL; > goto out; > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-11-30 1:50 ` [f2fs-dev] " Chao Yu @ 2018-11-30 20:36 ` Jaegeuk Kim 2018-12-07 9:53 ` Chao Yu 0 siblings, 1 reply; 7+ messages in thread From: Jaegeuk Kim @ 2018-11-30 20:36 UTC (permalink / raw) To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel On 11/30, Chao Yu wrote: > On 2018/11/29 9:52, Jaegeuk Kim wrote: > > This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by > > setting a NEED_FSCK flag. > > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > > --- > > fs/f2fs/f2fs.h | 1 + > > fs/f2fs/file.c | 7 +++++++ > > 2 files changed, 8 insertions(+) > > > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > index aa500239baf2..7cec897146a3 100644 > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, > > #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ > > #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ > > #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ > > +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ > > Why not add a new ioctl interface for this? F2FS_GOING_DOWN_ prefix implies > filesystem will shutdown, IMO, we'd better to keep all sub-interfaces being > consistent in f2fs_ioc_shutdown(). I'm thinking to use this for QA as device shutdown tests. > > > > > #if defined(__KERNEL__) && defined(CONFIG_COMPAT) > > /* > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index ff82350a2c55..ca9bdbb8651b 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) > > f2fs_stop_checkpoint(sbi, false); > > set_sbi_flag(sbi, SBI_IS_SHUTDOWN); > > break; > > + case F2FS_GOING_DOWN_NEED_FSCK: > > + set_sbi_flag(sbi, SBI_NEED_FSCK); > > + /* do checkpoint only */ > > + ret = f2fs_sync_fs(sb, 1); > > + if (ret) > > + goto out; > > In large-sized image, it may take long time to trigger full scan during > boot, so I'd like to ask how often we set this flag? Based on the use of shutdown ioctl, I'll use this for testing purpose, so it won't be used for regular cases. > > Thanks, > > > + break; > > default: > > ret = -EINVAL; > > goto out; > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-11-30 20:36 ` Jaegeuk Kim @ 2018-12-07 9:53 ` Chao Yu 2018-12-13 3:56 ` Jaegeuk Kim 0 siblings, 1 reply; 7+ messages in thread From: Chao Yu @ 2018-12-07 9:53 UTC (permalink / raw) To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel On 2018/12/1 4:36, Jaegeuk Kim wrote: > On 11/30, Chao Yu wrote: >> On 2018/11/29 9:52, Jaegeuk Kim wrote: >>> This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by >>> setting a NEED_FSCK flag. >>> >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> >>> --- >>> fs/f2fs/f2fs.h | 1 + >>> fs/f2fs/file.c | 7 +++++++ >>> 2 files changed, 8 insertions(+) >>> >>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >>> index aa500239baf2..7cec897146a3 100644 >>> --- a/fs/f2fs/f2fs.h >>> +++ b/fs/f2fs/f2fs.h >>> @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, >>> #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ >>> #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ >>> #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ >>> +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ >> >> Why not add a new ioctl interface for this? F2FS_GOING_DOWN_ prefix implies >> filesystem will shutdown, IMO, we'd better to keep all sub-interfaces being >> consistent in f2fs_ioc_shutdown(). > > I'm thinking to use this for QA as device shutdown tests. > >> >>> >>> #if defined(__KERNEL__) && defined(CONFIG_COMPAT) >>> /* >>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >>> index ff82350a2c55..ca9bdbb8651b 100644 >>> --- a/fs/f2fs/file.c >>> +++ b/fs/f2fs/file.c >>> @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) >>> f2fs_stop_checkpoint(sbi, false); >>> set_sbi_flag(sbi, SBI_IS_SHUTDOWN); >>> break; >>> + case F2FS_GOING_DOWN_NEED_FSCK: >>> + set_sbi_flag(sbi, SBI_NEED_FSCK); >>> + /* do checkpoint only */ >>> + ret = f2fs_sync_fs(sb, 1); >>> + if (ret) >>> + goto out; >> >> In large-sized image, it may take long time to trigger full scan during >> boot, so I'd like to ask how often we set this flag? > > Based on the use of shutdown ioctl, I'll use this for testing purpose, so it > won't be used for regular cases. How about adding some commit messages or comments on F2FS_GOING_DOWN_NEED_FSCK marco definition to give a bit hint for f2fs developers to know the usage of the interface? Thanks, > >> >> Thanks, >> >>> + break; >>> default: >>> ret = -EINVAL; >>> goto out; >>> > > . > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-12-07 9:53 ` Chao Yu @ 2018-12-13 3:56 ` Jaegeuk Kim 2018-12-13 6:30 ` Chao Yu 0 siblings, 1 reply; 7+ messages in thread From: Jaegeuk Kim @ 2018-12-13 3:56 UTC (permalink / raw) To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel On 12/07, Chao Yu wrote: > On 2018/12/1 4:36, Jaegeuk Kim wrote: > > On 11/30, Chao Yu wrote: > >> On 2018/11/29 9:52, Jaegeuk Kim wrote: > >>> This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by > >>> setting a NEED_FSCK flag. > >>> > >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > >>> --- > >>> fs/f2fs/f2fs.h | 1 + > >>> fs/f2fs/file.c | 7 +++++++ > >>> 2 files changed, 8 insertions(+) > >>> > >>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > >>> index aa500239baf2..7cec897146a3 100644 > >>> --- a/fs/f2fs/f2fs.h > >>> +++ b/fs/f2fs/f2fs.h > >>> @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, > >>> #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ > >>> #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ > >>> #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ > >>> +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ > >> > >> Why not add a new ioctl interface for this? F2FS_GOING_DOWN_ prefix implies > >> filesystem will shutdown, IMO, we'd better to keep all sub-interfaces being > >> consistent in f2fs_ioc_shutdown(). > > > > I'm thinking to use this for QA as device shutdown tests. > > > >> > >>> > >>> #if defined(__KERNEL__) && defined(CONFIG_COMPAT) > >>> /* > >>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > >>> index ff82350a2c55..ca9bdbb8651b 100644 > >>> --- a/fs/f2fs/file.c > >>> +++ b/fs/f2fs/file.c > >>> @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) > >>> f2fs_stop_checkpoint(sbi, false); > >>> set_sbi_flag(sbi, SBI_IS_SHUTDOWN); > >>> break; > >>> + case F2FS_GOING_DOWN_NEED_FSCK: > >>> + set_sbi_flag(sbi, SBI_NEED_FSCK); > >>> + /* do checkpoint only */ > >>> + ret = f2fs_sync_fs(sb, 1); > >>> + if (ret) > >>> + goto out; > >> > >> In large-sized image, it may take long time to trigger full scan during > >> boot, so I'd like to ask how often we set this flag? > > > > Based on the use of shutdown ioctl, I'll use this for testing purpose, so it > > won't be used for regular cases. > > How about adding some commit messages or comments on > F2FS_GOING_DOWN_NEED_FSCK marco definition to give a bit hint for f2fs > developers to know the usage of the interface? Done. :P https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev > > Thanks, > > > > >> > >> Thanks, > >> > >>> + break; > >>> default: > >>> ret = -EINVAL; > >>> goto out; > >>> > > > > . > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-12-13 3:56 ` Jaegeuk Kim @ 2018-12-13 6:30 ` Chao Yu 0 siblings, 0 replies; 7+ messages in thread From: Chao Yu @ 2018-12-13 6:30 UTC (permalink / raw) To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel On 2018/12/13 11:56, Jaegeuk Kim wrote: > On 12/07, Chao Yu wrote: >> On 2018/12/1 4:36, Jaegeuk Kim wrote: >>> On 11/30, Chao Yu wrote: >>>> On 2018/11/29 9:52, Jaegeuk Kim wrote: >>>>> This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by >>>>> setting a NEED_FSCK flag. >>>>> >>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> >>>>> --- >>>>> fs/f2fs/f2fs.h | 1 + >>>>> fs/f2fs/file.c | 7 +++++++ >>>>> 2 files changed, 8 insertions(+) >>>>> >>>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >>>>> index aa500239baf2..7cec897146a3 100644 >>>>> --- a/fs/f2fs/f2fs.h >>>>> +++ b/fs/f2fs/f2fs.h >>>>> @@ -417,6 +417,7 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, >>>>> #define F2FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ >>>>> #define F2FS_GOING_DOWN_NOSYNC 0x2 /* going down */ >>>>> #define F2FS_GOING_DOWN_METAFLUSH 0x3 /* going down with meta flush */ >>>>> +#define F2FS_GOING_DOWN_NEED_FSCK 0x4 /* going down to trigger fsck */ >>>> >>>> Why not add a new ioctl interface for this? F2FS_GOING_DOWN_ prefix implies >>>> filesystem will shutdown, IMO, we'd better to keep all sub-interfaces being >>>> consistent in f2fs_ioc_shutdown(). >>> >>> I'm thinking to use this for QA as device shutdown tests. >>> >>>> >>>>> >>>>> #if defined(__KERNEL__) && defined(CONFIG_COMPAT) >>>>> /* >>>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >>>>> index ff82350a2c55..ca9bdbb8651b 100644 >>>>> --- a/fs/f2fs/file.c >>>>> +++ b/fs/f2fs/file.c >>>>> @@ -1966,6 +1966,13 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) >>>>> f2fs_stop_checkpoint(sbi, false); >>>>> set_sbi_flag(sbi, SBI_IS_SHUTDOWN); >>>>> break; >>>>> + case F2FS_GOING_DOWN_NEED_FSCK: >>>>> + set_sbi_flag(sbi, SBI_NEED_FSCK); >>>>> + /* do checkpoint only */ >>>>> + ret = f2fs_sync_fs(sb, 1); >>>>> + if (ret) >>>>> + goto out; >>>> >>>> In large-sized image, it may take long time to trigger full scan during >>>> boot, so I'd like to ask how often we set this flag? >>> >>> Based on the use of shutdown ioctl, I'll use this for testing purpose, so it >>> won't be used for regular cases. >> >> How about adding some commit messages or comments on >> F2FS_GOING_DOWN_NEED_FSCK marco definition to give a bit hint for f2fs >> developers to know the usage of the interface? > > Done. :P > > https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev Looks good to me now. ;) Reviewed-by: Chao Yu <yuchao0@huawei.com> Thanks, > >> >> Thanks, >> >>> >>>> >>>> Thanks, >>>> >>>>> + break; >>>>> default: >>>>> ret = -EINVAL; >>>>> goto out; >>>>> >>> >>> . >>> > > . > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later 2018-11-29 1:52 [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later Jaegeuk Kim 2018-11-30 1:50 ` [f2fs-dev] " Chao Yu @ 2018-12-05 19:29 ` Pavel Machek 1 sibling, 0 replies; 7+ messages in thread From: Pavel Machek @ 2018-12-05 19:29 UTC (permalink / raw) To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel On Wed 2018-11-28 17:52:57, Jaegeuk Kim wrote: > This adds an option in ioctl(F2FS_IOC_SHUTDOWN) in order to trigger fsck by > setting a NEED_FSCK flag. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> I don't expect to use it too often, but it makes sense. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-13 6:30 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-29 1:52 [PATCH] f2fs: add an ioctl() to explicitly trigger fsck later Jaegeuk Kim 2018-11-30 1:50 ` [f2fs-dev] " Chao Yu 2018-11-30 20:36 ` Jaegeuk Kim 2018-12-07 9:53 ` Chao Yu 2018-12-13 3:56 ` Jaegeuk Kim 2018-12-13 6:30 ` Chao Yu 2018-12-05 19:29 ` Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).