All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized
@ 2015-12-04 22:15 Jaegeuk Kim
  2015-12-04 22:15 ` [PATCH 2/3] common/config: add mkfs options for f2fs Jaegeuk Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-04 22:15 UTC (permalink / raw)
  To: fstests, linux-f2fs-devel; +Cc: Jaegeuk Kim

The mkfs.f2fs has an option to build a certain sized filesystem by giving
the number of sectors.

So, this patch adds to use that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 common/rc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/rc b/common/rc
index 4c2f42c..ef913b4 100644
--- a/common/rc
+++ b/common/rc
@@ -739,6 +739,10 @@ _scratch_mkfs_sized()
 	$MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
 			   `expr $fssize / 1024`
 	;;
+    f2fs)
+	# mkfs.f2fs requires # of sectors as an input for the size
+	$MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / 512`
+	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
 	;;
-- 
2.4.9 (Apple Git-60)


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

* [PATCH 2/3] common/config: add mkfs options for f2fs
  2015-12-04 22:15 [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Jaegeuk Kim
@ 2015-12-04 22:15 ` Jaegeuk Kim
  2015-12-04 22:15 ` [PATCH 3/3] f2fs/001: introduce a testcaes for -ENOSPC with inline operation Jaegeuk Kim
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-04 22:15 UTC (permalink / raw)
  To: fstests, linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch adds an interface to give mkfs option for f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 common/config | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/config b/common/config
index dca7aad..a534329 100644
--- a/common/config
+++ b/common/config
@@ -352,6 +352,9 @@ _mkfs_opts()
 	jfs)
 		export MKFS_OPTIONS="$JFS_MKFS_OPTIONS -q"
 		;;
+	f2fs)
+		export MKFS_OPTIONS="$F2FS_MKFS_OPTIONS"
+		;;
 	*)
 		;;
 	esac
-- 
2.4.9 (Apple Git-60)


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

* [PATCH 3/3] f2fs/001: introduce a testcaes for -ENOSPC with inline operation
  2015-12-04 22:15 [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Jaegeuk Kim
  2015-12-04 22:15 ` [PATCH 2/3] common/config: add mkfs options for f2fs Jaegeuk Kim
@ 2015-12-04 22:15 ` Jaegeuk Kim
  2015-12-05 13:11 ` [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Chao Yu
  2015-12-08  0:16 ` [PATCH 1/3 v2] " Jaegeuk Kim
  3 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-04 22:15 UTC (permalink / raw)
  To: fstests, linux-f2fs-devel; +Cc: Jaegeuk Kim

This patch introduces f2fs/001 to test -ENOSPC when inline operation was
activated.

Inline_data feature is described in:
  http://lwn.net/Articles/573408/

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 tests/f2fs/001     | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/f2fs/001.out | 21 +++++++++++++
 tests/f2fs/group   |  6 ++++
 3 files changed, 113 insertions(+)
 create mode 100755 tests/f2fs/001
 create mode 100644 tests/f2fs/001.out
 create mode 100644 tests/f2fs/group

diff --git a/tests/f2fs/001 b/tests/f2fs/001
new file mode 100755
index 0000000..9c4425a
--- /dev/null
+++ b/tests/f2fs/001
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. f2fs/001
+#
+# Test inline_data behaviors when filesystem is full.
+#
+# The inline_data feature was introduced in ext4 and f2fs as follows.
+#  ext4 : http://lwn.net/Articles/468678/
+#  f2fs : http://lwn.net/Articles/573408/
+#
+# The basic idea is embedding small-sized file's data into relatively large
+# inode space.
+# In ext4, up to 132 bytes of data can be stored in 256 bytes-sized inode.
+# In f2fs, up to 3.4KB of data can be embedded into 4KB-sized inode block.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 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 "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+_supported_fs f2fs
+_supported_os Linux
+_require_scratch
+
+testfile=$SCRATCH_MNT/testfile
+dummyfile=$SCRATCH_MNT/dummyfile
+
+# build 4GB filesystem
+_scratch_mkfs_sized $((4 * 1024 * 1024 * 1024)) > /dev/null 2>&1
+_scratch_mount
+
+echo "==== create small file ===="
+$XFS_IO_PROG -t -f -c "pwrite -S 0x58 0 40" $testfile | _filter_xfs_io
+
+# -ENOSPC should be triggered
+echo "==== Fullfill the partition ===="
+$XFS_IO_PROG -t -f -c "falloc 0 5g" $dummyfile | _filter_xfs_io
+
+# -ENOSPC should be triggered without any panic
+echo "==== change i_size & write data ===="
+$XFS_IO_PROG							\
+	-c "truncate 96"					\
+	-c "pwrite -S 0x58 8192 4096"				\
+$testfile | _filter_xfs_io
+
+echo "==== check data contents ===="
+hexdump -C $testfile
+_scratch_remount
+hexdump -C $testfile
+
+rm $testfile
+rm $dummyfile
+
+status=0
+exit
diff --git a/tests/f2fs/001.out b/tests/f2fs/001.out
new file mode 100644
index 0000000..593f82a
--- /dev/null
+++ b/tests/f2fs/001.out
@@ -0,0 +1,21 @@
+QA output created by 001
+==== create small file ====
+wrote 40/40 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+==== Fullfill the partition ====
+fallocate: No space left on device
+==== change i_size & write data ====
+pwrite64: No space left on device
+==== check data contents ====
+00000000  58 58 58 58 58 58 58 58  58 58 58 58 58 58 58 58  |XXXXXXXXXXXXXXXX|
+*
+00000020  58 58 58 58 58 58 58 58  00 00 00 00 00 00 00 00  |XXXXXXXX........|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00000060
+00000000  58 58 58 58 58 58 58 58  58 58 58 58 58 58 58 58  |XXXXXXXXXXXXXXXX|
+*
+00000020  58 58 58 58 58 58 58 58  00 00 00 00 00 00 00 00  |XXXXXXXX........|
+00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
+*
+00000060
diff --git a/tests/f2fs/group b/tests/f2fs/group
new file mode 100644
index 0000000..daba9a3
--- /dev/null
+++ b/tests/f2fs/group
@@ -0,0 +1,6 @@
+# QA groups control file
+# Defines test groups and nominal group owners
+# - do not start group names with a digit
+# - comment line before each group is "new" description
+#
+001 auto quick rw
-- 
2.4.9 (Apple Git-60)


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

* Re: [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized
  2015-12-04 22:15 [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Jaegeuk Kim
  2015-12-04 22:15 ` [PATCH 2/3] common/config: add mkfs options for f2fs Jaegeuk Kim
  2015-12-04 22:15 ` [PATCH 3/3] f2fs/001: introduce a testcaes for -ENOSPC with inline operation Jaegeuk Kim
@ 2015-12-05 13:11 ` Chao Yu
  2015-12-08  0:08   ` Jaegeuk Kim
  2015-12-08  0:16 ` [PATCH 1/3 v2] " Jaegeuk Kim
  3 siblings, 1 reply; 6+ messages in thread
From: Chao Yu @ 2015-12-05 13:11 UTC (permalink / raw)
  To: Jaegeuk Kim, fstests, linux-f2fs-devel

Hi Jaegeuk,

On 12/5/15 6:15 AM, Jaegeuk Kim wrote:
> The mkfs.f2fs has an option to build a certain sized filesystem by giving
> the number of sectors.
> 
> So, this patch adds to use that.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  common/rc | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 4c2f42c..ef913b4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -739,6 +739,10 @@ _scratch_mkfs_sized()
>  	$MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
>  			   `expr $fssize / 1024`
>  	;;
> +    f2fs)
> +	# mkfs.f2fs requires # of sectors as an input for the size
> +	$MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / 512`

In mkfs.f2fs, we will calculate fs size based on real sector size of block
device and the input sectors, so if sector size of block device is not 512, our
fs size calculated will be incorrect.

How about fixing it for supporting different sector size?

Thanks,

> +	;;
>      *)
>  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
>  	;;
> 

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

* Re: [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized
  2015-12-05 13:11 ` [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Chao Yu
@ 2015-12-08  0:08   ` Jaegeuk Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-08  0:08 UTC (permalink / raw)
  To: Chao Yu; +Cc: fstests, linux-f2fs-devel

Hi Chao,

On Sat, Dec 05, 2015 at 09:11:31PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> On 12/5/15 6:15 AM, Jaegeuk Kim wrote:
> > The mkfs.f2fs has an option to build a certain sized filesystem by giving
> > the number of sectors.
> > 
> > So, this patch adds to use that.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  common/rc | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/common/rc b/common/rc
> > index 4c2f42c..ef913b4 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -739,6 +739,10 @@ _scratch_mkfs_sized()
> >  	$MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
> >  			   `expr $fssize / 1024`
> >  	;;
> > +    f2fs)
> > +	# mkfs.f2fs requires # of sectors as an input for the size
> > +	$MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / 512`
> 
> In mkfs.f2fs, we will calculate fs size based on real sector size of block
> device and the input sectors, so if sector size of block device is not 512, our
> fs size calculated will be incorrect.
> 
> How about fixing it for supporting different sector size?

Sure, I'll resend v2.

Thanks,

> 
> Thanks,
> 
> > +	;;
> >      *)
> >  	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
> >  	;;
> > 

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

* Re: [PATCH 1/3 v2] common/rc: support f2fs for _scratch_mkfs_sized
  2015-12-04 22:15 [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Jaegeuk Kim
                   ` (2 preceding siblings ...)
  2015-12-05 13:11 ` [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Chao Yu
@ 2015-12-08  0:16 ` Jaegeuk Kim
  3 siblings, 0 replies; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-08  0:16 UTC (permalink / raw)
  To: fstests, linux-f2fs-devel

Change log from v1:
 o adjust different sector sizes

-- >8 --
>From 5b2c77d3acaf11bac5489ec697c2ec53f261afeb Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Fri, 20 Mar 2015 15:37:10 -0700
Subject: [PATCH] common/rc: support f2fs for _scratch_mkfs_sized

The mkfs.f2fs has an option to build a certain sized filesystem by giving
the number of sectors.

So, this patch adds to use that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 common/rc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/rc b/common/rc
index 4c2f42c..b25d173 100644
--- a/common/rc
+++ b/common/rc
@@ -739,6 +739,11 @@ _scratch_mkfs_sized()
 	$MKFS_REISER4_PROG $MKFS_OPTIONS -y -b $blocksize $SCRATCH_DEV \
 			   `expr $fssize / 1024`
 	;;
+    f2fs)
+	# mkfs.f2fs requires # of sectors as an input for the size
+	sector_size=`blockdev --getss $SCRATCH_DEV`
+	$MKFS_F2FS_PROG $MKFS_OPTIONS $SCRATCH_DEV `expr $fssize / $sector_size`
+	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
 	;;
-- 
2.4.9 (Apple Git-60)


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

end of thread, other threads:[~2015-12-08  0:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04 22:15 [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Jaegeuk Kim
2015-12-04 22:15 ` [PATCH 2/3] common/config: add mkfs options for f2fs Jaegeuk Kim
2015-12-04 22:15 ` [PATCH 3/3] f2fs/001: introduce a testcaes for -ENOSPC with inline operation Jaegeuk Kim
2015-12-05 13:11 ` [f2fs-dev] [PATCH 1/3] common/rc: support f2fs for _scratch_mkfs_sized Chao Yu
2015-12-08  0:08   ` Jaegeuk Kim
2015-12-08  0:16 ` [PATCH 1/3 v2] " Jaegeuk Kim

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.