All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
@ 2015-10-09  0:29 Jaegeuk Kim
  2015-10-09  0:29 ` [PATCH 2/2] Revert "f2fs: do not skip dentry block writes" Jaegeuk Kim
  2015-10-12  9:01   ` Chao Yu
  0 siblings, 2 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2015-10-09  0:29 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
SSA blocks and then blocks all the writes.
This can be used by power-failure tests.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/f2fs.h | 1 +
 fs/f2fs/file.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index aad4720..f05ae22 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -250,6 +250,7 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int size,
 #define F2FS_GOING_DOWN_FULLSYNC	0x0	/* going down with full sync */
 #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 */
 
 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
 /*
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index b3985a6..6d3cfd5 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1498,6 +1498,10 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
 	case F2FS_GOING_DOWN_NOSYNC:
 		f2fs_stop_checkpoint(sbi);
 		break;
+	case F2FS_GOING_DOWN_METAFLUSH:
+		sync_meta_pages(sbi, META, LONG_MAX);
+		f2fs_stop_checkpoint(sbi);
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
2.1.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] Revert "f2fs: do not skip dentry block writes"
  2015-10-09  0:29 [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure Jaegeuk Kim
@ 2015-10-09  0:29 ` Jaegeuk Kim
  2015-10-12  9:01   ` Chao Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2015-10-09  0:29 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

The periodic checkpoint can resolve the previous issue.
So, now we can use this again to improve the reported performance regression:

https://lkml.org/lkml/2015/10/8/20

This reverts commit 15bec0ff5a9ba6d203178fa8772259df6207942a.
---
 fs/f2fs/data.c    | 5 +++++
 fs/f2fs/node.c    | 5 +++++
 fs/f2fs/node.h    | 1 +
 fs/f2fs/segment.h | 4 +++-
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index a903423..bc04e92 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1340,6 +1340,11 @@ static int f2fs_write_data_pages(struct address_space *mapping,
 	if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE)
 		return 0;
 
+	if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE &&
+			get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
+			available_free_memory(sbi, DIRTY_DENTS))
+		goto skip_write;
+
 	/* during POR, we don't need to trigger writepage at all. */
 	if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
 		goto skip_write;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 1fe49ca..4d9bedf 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -52,6 +52,11 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int type)
 		mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >>
 							PAGE_CACHE_SHIFT;
 		res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2);
+	} else if (type == DIRTY_DENTS) {
+		if (sbi->sb->s_bdi->wb.dirty_exceeded)
+			return false;
+		mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
+		res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
 	} else if (type == INO_ENTRIES) {
 		int i;
 
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 51c62ed..7427e95 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -118,6 +118,7 @@ static inline void raw_nat_from_node_info(struct f2fs_nat_entry *raw_ne,
 enum mem_type {
 	FREE_NIDS,	/* indicates the free nid list */
 	NAT_ENTRIES,	/* indicates the cached nat entry */
+	DIRTY_DENTS,	/* indicates dirty dentry pages */
 	INO_ENTRIES,	/* indicates inode entries */
 	EXTENT_CACHE,	/* indicates extent cache */
 	BASE_CHECK,	/* check kernel status */
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index e9afb58..ee44d34 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -699,7 +699,9 @@ static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
 	if (sbi->sb->s_bdi->wb.dirty_exceeded)
 		return 0;
 
-	if (type == NODE)
+	if (type == DATA)
+		return sbi->blocks_per_seg;
+	else if (type == NODE)
 		return 3 * sbi->blocks_per_seg;
 	else if (type == META)
 		return MAX_BIO_BLOCKS(sbi);
-- 
2.1.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
  2015-10-09  0:29 [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure Jaegeuk Kim
@ 2015-10-12  9:01   ` Chao Yu
  2015-10-12  9:01   ` Chao Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Chao Yu @ 2015-10-12  9:01 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Friday, October 09, 2015 8:29 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> 
> This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
> SSA blocks and then blocks all the writes.
> This can be used by power-failure tests.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Good idea! I test power-failure case by changing src/godown to use new
macro, until now, I didn't catch any consistent problem. :)

Reviewed-by: Chao Yu <chao2.yu@samsung.com>

Thanks,

> ---
>  fs/f2fs/f2fs.h | 1 +
>  fs/f2fs/file.c | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index aad4720..f05ae22 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -250,6 +250,7 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int
> size,
>  #define F2FS_GOING_DOWN_FULLSYNC	0x0	/* going down with full sync */
>  #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 */
> 
>  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
>  /*
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index b3985a6..6d3cfd5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1498,6 +1498,10 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
>  	case F2FS_GOING_DOWN_NOSYNC:
>  		f2fs_stop_checkpoint(sbi);
>  		break;
> +	case F2FS_GOING_DOWN_METAFLUSH:
> +		sync_meta_pages(sbi, META, LONG_MAX);
> +		f2fs_stop_checkpoint(sbi);
> +		break;
>  	default:
>  		return -EINVAL;
>  	}
> --
> 2.1.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
@ 2015-10-12  9:01   ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2015-10-12  9:01 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Friday, October 09, 2015 8:29 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> 
> This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
> SSA blocks and then blocks all the writes.
> This can be used by power-failure tests.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Good idea! I test power-failure case by changing src/godown to use new
macro, until now, I didn't catch any consistent problem. :)

Reviewed-by: Chao Yu <chao2.yu@samsung.com>

Thanks,

> ---
>  fs/f2fs/f2fs.h | 1 +
>  fs/f2fs/file.c | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index aad4720..f05ae22 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -250,6 +250,7 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int
> size,
>  #define F2FS_GOING_DOWN_FULLSYNC	0x0	/* going down with full sync */
>  #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 */
> 
>  #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
>  /*
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index b3985a6..6d3cfd5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1498,6 +1498,10 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
>  	case F2FS_GOING_DOWN_NOSYNC:
>  		f2fs_stop_checkpoint(sbi);
>  		break;
> +	case F2FS_GOING_DOWN_METAFLUSH:
> +		sync_meta_pages(sbi, META, LONG_MAX);
> +		f2fs_stop_checkpoint(sbi);
> +		break;
>  	default:
>  		return -EINVAL;
>  	}
> --
> 2.1.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
  2015-10-12  9:01   ` Chao Yu
  (?)
@ 2015-10-12 20:37   ` Jaegeuk Kim
  2015-10-13  3:30       ` Chao Yu
  -1 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2015-10-12 20:37 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

On Mon, Oct 12, 2015 at 05:01:29PM +0800, Chao Yu wrote:
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Friday, October 09, 2015 8:29 AM
> > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > linux-f2fs-devel@lists.sourceforge.net
> > Cc: Jaegeuk Kim
> > Subject: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> > 
> > This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
> > SSA blocks and then blocks all the writes.
> > This can be used by power-failure tests.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> 
> Good idea! I test power-failure case by changing src/godown to use new
> macro, until now, I didn't catch any consistent problem. :)
> 
> Reviewed-by: Chao Yu <chao2.yu@samsung.com>

Yeah, I could reproduce the original issue with xfstests like below too.
(Added "-n" to issue METAFLUSH in godown.)

---
 tests/f2fs/002     | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/002.out |  5 ++++
 tests/f2fs/group   |  1 +
 3 files changed, 91 insertions(+)
 create mode 100755 tests/f2fs/002
 create mode 100644 tests/f2fs/002.out

diff --git a/tests/f2fs/002 b/tests/f2fs/002
new file mode 100755
index 0000000..f3decbd
--- /dev/null
+++ b/tests/f2fs/002
@@ -0,0 +1,85 @@
+#! /bin/bash
+# FS QA Test No. f2fs/002
+#
+# This test detects a f2fs-specific issue which is resolved by:
+#    f2fs: fix SSA updates resulting in corruption
+# The purpose is to check whether filesystem metadata becomes inconsistent
+# after fcollapse was called.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Jaegeuk Kim.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/log
+. ./common/punch
+
+# real QA test starts here
+_supported_fs f2fs
+_supported_os Linux
+
+rm -f $seqres.full
+rm -f $tmp.log
+
+_require_scratch
+_require_scratch_shutdown
+_require_xfs_io_command "fcollapse"
+
+_scratch_mkfs > /dev/null 2>&1
+
+# collapse without sync
+_run_test()
+{
+	testfile=$SCRATCH_MNT/$1.$seq.$$
+
+	_scratch_mount
+
+	$XFS_IO_PROG -f -c "pwrite 0 5m" -c fsync $testfile > /dev/null
+	[ $1 -eq 1 ] && sync
+	$XFS_IO_PROG -c "fcollapse 64k 2m" $testfile > /dev/null
+
+	echo "godown"
+	src/godown -v -n $SCRATCH_MNT >> $seqres.full
+
+	echo "unmount"
+	umount $SCRATCH_MNT
+
+	# curious if FS consistent at start
+	_check_scratch_fs $SCRATCH_DEV
+	[ $? -ne 0 ] && _fatal "fsck failed"
+}
+
+# run without sync
+_run_test 0
+
+# run with sync
+_run_test 1
+
+status=0
+exit
diff --git a/tests/f2fs/002.out b/tests/f2fs/002.out
new file mode 100644
index 0000000..bbbf710
--- /dev/null
+++ b/tests/f2fs/002.out
@@ -0,0 +1,5 @@
+QA output created by 002
+godown
+unmount
+godown
+unmount
diff --git a/tests/f2fs/group b/tests/f2fs/group
index daba9a3..ff2305b 100644
--- a/tests/f2fs/group
+++ b/tests/f2fs/group
@@ -4,3 +4,4 @@
 # - comment line before each group is "new" description
 #
 001 auto quick rw
+002 auto quick rw
-- 
2.1.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
  2015-10-12 20:37   ` [f2fs-dev] " Jaegeuk Kim
@ 2015-10-13  3:30       ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2015-10-13  3:30 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, October 13, 2015 4:37 AM
> To: Chao Yu
> Cc: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> 
> On Mon, Oct 12, 2015 at 05:01:29PM +0800, Chao Yu wrote:
> > > -----Original Message-----
> > > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > > Sent: Friday, October 09, 2015 8:29 AM
> > > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > > linux-f2fs-devel@lists.sourceforge.net
> > > Cc: Jaegeuk Kim
> > > Subject: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> > >
> > > This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
> > > SSA blocks and then blocks all the writes.
> > > This can be used by power-failure tests.
> > >
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >
> > Good idea! I test power-failure case by changing src/godown to use new
> > macro, until now, I didn't catch any consistent problem. :)
> >
> > Reviewed-by: Chao Yu <chao2.yu@samsung.com>
> 
> Yeah, I could reproduce the original issue with xfstests like below too.
> (Added "-n" to issue METAFLUSH in godown.)

Ah, looks good! Thanks for sharing me this test. :)

Thanks,

> 
> ---
>  tests/f2fs/002     | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/f2fs/002.out |  5 ++++
>  tests/f2fs/group   |  1 +
>  3 files changed, 91 insertions(+)
>  create mode 100755 tests/f2fs/002
>  create mode 100644 tests/f2fs/002.out
> 
> diff --git a/tests/f2fs/002 b/tests/f2fs/002
> new file mode 100755
> index 0000000..f3decbd
> --- /dev/null
> +++ b/tests/f2fs/002
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. f2fs/002
> +#
> +# This test detects a f2fs-specific issue which is resolved by:
> +#    f2fs: fix SSA updates resulting in corruption
> +# The purpose is to check whether filesystem metadata becomes inconsistent
> +# after fcollapse was called.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2015 Jaegeuk Kim.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/log
> +. ./common/punch
> +
> +# real QA test starts here
> +_supported_fs f2fs
> +_supported_os Linux
> +
> +rm -f $seqres.full
> +rm -f $tmp.log
> +
> +_require_scratch
> +_require_scratch_shutdown
> +_require_xfs_io_command "fcollapse"
> +
> +_scratch_mkfs > /dev/null 2>&1
> +
> +# collapse without sync
> +_run_test()
> +{
> +	testfile=$SCRATCH_MNT/$1.$seq.$$
> +
> +	_scratch_mount
> +
> +	$XFS_IO_PROG -f -c "pwrite 0 5m" -c fsync $testfile > /dev/null
> +	[ $1 -eq 1 ] && sync
> +	$XFS_IO_PROG -c "fcollapse 64k 2m" $testfile > /dev/null
> +
> +	echo "godown"
> +	src/godown -v -n $SCRATCH_MNT >> $seqres.full
> +
> +	echo "unmount"
> +	umount $SCRATCH_MNT
> +
> +	# curious if FS consistent at start
> +	_check_scratch_fs $SCRATCH_DEV
> +	[ $? -ne 0 ] && _fatal "fsck failed"
> +}
> +
> +# run without sync
> +_run_test 0
> +
> +# run with sync
> +_run_test 1
> +
> +status=0
> +exit
> diff --git a/tests/f2fs/002.out b/tests/f2fs/002.out
> new file mode 100644
> index 0000000..bbbf710
> --- /dev/null
> +++ b/tests/f2fs/002.out
> @@ -0,0 +1,5 @@
> +QA output created by 002
> +godown
> +unmount
> +godown
> +unmount
> diff --git a/tests/f2fs/group b/tests/f2fs/group
> index daba9a3..ff2305b 100644
> --- a/tests/f2fs/group
> +++ b/tests/f2fs/group
> @@ -4,3 +4,4 @@
>  # - comment line before each group is "new" description
>  #
>  001 auto quick rw
> +002 auto quick rw
> --
> 2.1.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
@ 2015-10-13  3:30       ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2015-10-13  3:30 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, October 13, 2015 4:37 AM
> To: Chao Yu
> Cc: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> 
> On Mon, Oct 12, 2015 at 05:01:29PM +0800, Chao Yu wrote:
> > > -----Original Message-----
> > > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > > Sent: Friday, October 09, 2015 8:29 AM
> > > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > > linux-f2fs-devel@lists.sourceforge.net
> > > Cc: Jaegeuk Kim
> > > Subject: [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure
> > >
> > > This patch introduces F2FS_GOING_DOWN_METAFLUSH which flushes meta pages like
> > > SSA blocks and then blocks all the writes.
> > > This can be used by power-failure tests.
> > >
> > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >
> > Good idea! I test power-failure case by changing src/godown to use new
> > macro, until now, I didn't catch any consistent problem. :)
> >
> > Reviewed-by: Chao Yu <chao2.yu@samsung.com>
> 
> Yeah, I could reproduce the original issue with xfstests like below too.
> (Added "-n" to issue METAFLUSH in godown.)

Ah, looks good! Thanks for sharing me this test. :)

Thanks,

> 
> ---
>  tests/f2fs/002     | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/f2fs/002.out |  5 ++++
>  tests/f2fs/group   |  1 +
>  3 files changed, 91 insertions(+)
>  create mode 100755 tests/f2fs/002
>  create mode 100644 tests/f2fs/002.out
> 
> diff --git a/tests/f2fs/002 b/tests/f2fs/002
> new file mode 100755
> index 0000000..f3decbd
> --- /dev/null
> +++ b/tests/f2fs/002
> @@ -0,0 +1,85 @@
> +#! /bin/bash
> +# FS QA Test No. f2fs/002
> +#
> +# This test detects a f2fs-specific issue which is resolved by:
> +#    f2fs: fix SSA updates resulting in corruption
> +# The purpose is to check whether filesystem metadata becomes inconsistent
> +# after fcollapse was called.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2015 Jaegeuk Kim.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/log
> +. ./common/punch
> +
> +# real QA test starts here
> +_supported_fs f2fs
> +_supported_os Linux
> +
> +rm -f $seqres.full
> +rm -f $tmp.log
> +
> +_require_scratch
> +_require_scratch_shutdown
> +_require_xfs_io_command "fcollapse"
> +
> +_scratch_mkfs > /dev/null 2>&1
> +
> +# collapse without sync
> +_run_test()
> +{
> +	testfile=$SCRATCH_MNT/$1.$seq.$$
> +
> +	_scratch_mount
> +
> +	$XFS_IO_PROG -f -c "pwrite 0 5m" -c fsync $testfile > /dev/null
> +	[ $1 -eq 1 ] && sync
> +	$XFS_IO_PROG -c "fcollapse 64k 2m" $testfile > /dev/null
> +
> +	echo "godown"
> +	src/godown -v -n $SCRATCH_MNT >> $seqres.full
> +
> +	echo "unmount"
> +	umount $SCRATCH_MNT
> +
> +	# curious if FS consistent at start
> +	_check_scratch_fs $SCRATCH_DEV
> +	[ $? -ne 0 ] && _fatal "fsck failed"
> +}
> +
> +# run without sync
> +_run_test 0
> +
> +# run with sync
> +_run_test 1
> +
> +status=0
> +exit
> diff --git a/tests/f2fs/002.out b/tests/f2fs/002.out
> new file mode 100644
> index 0000000..bbbf710
> --- /dev/null
> +++ b/tests/f2fs/002.out
> @@ -0,0 +1,5 @@
> +QA output created by 002
> +godown
> +unmount
> +godown
> +unmount
> diff --git a/tests/f2fs/group b/tests/f2fs/group
> index daba9a3..ff2305b 100644
> --- a/tests/f2fs/group
> +++ b/tests/f2fs/group
> @@ -4,3 +4,4 @@
>  # - comment line before each group is "new" description
>  #
>  001 auto quick rw
> +002 auto quick rw
> --
> 2.1.1


------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-13  3:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09  0:29 [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure Jaegeuk Kim
2015-10-09  0:29 ` [PATCH 2/2] Revert "f2fs: do not skip dentry block writes" Jaegeuk Kim
2015-10-12  9:01 ` [f2fs-dev] [PATCH 1/2] f2fs: add F2FS_GOING_DOWN_METAFLUSH to test power-failure Chao Yu
2015-10-12  9:01   ` Chao Yu
2015-10-12 20:37   ` [f2fs-dev] " Jaegeuk Kim
2015-10-13  3:30     ` Chao Yu
2015-10-13  3:30       ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.