Re: [f2fs-dev] [PATCH 2/6 v2] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Dave Chinner
On Thu, Jan 08, 2015 at 05:40:06PM -0800, Jaegeuk Kim wrote:
 Change log from v1:
  o introduce FS_IOC_GOINGDOWN ioctl
  o introduce three options: FS_GOING_DOWN_FULLSYNC, FS_GOING_DOWN_METASYNC,
and FS_GOING_DOWN_NOSYNC
.
 diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
 index 3735fa0..f37c699 100644
 --- a/include/uapi/linux/fs.h
 +++ b/include/uapi/linux/fs.h
 @@ -157,6 +157,7 @@ struct inodes_stat_t {
  #define FIFREEZE _IOWR('X', 119, int)/* Freeze */
  #define FITHAW   _IOWR('X', 120, int)/* Thaw */
  #define FITRIM   _IOWR('X', 121, struct fstrim_range)/* Trim 
 */
 +#define FS_IOC_GOINGDOWN _IOR('X', 125, __u32)   /* shutdown */
  
  #define  FS_IOC_GETFLAGS _IOR('f', 1, long)
  #define  FS_IOC_SETFLAGS _IOW('f', 2, long)
 @@ -205,4 +206,11 @@ struct inodes_stat_t {
  #define SYNC_FILE_RANGE_WRITE2
  #define SYNC_FILE_RANGE_WAIT_AFTER   4
  
 +/*
 + * Flags for going down operation used by FS_IOC_GOINGDOWN
 + */
 +#define FS_GOING_DOWN_FULLSYNC   0x0 /* going down with full sync */
 +#define FS_GOING_DOWN_METASYNC   0x1 /* going down with metadata */
 +#define FS_GOING_DOWN_NOSYNC 0x2 /* going down */
 +
  #endif /* _UAPI_LINUX_FS_H */

This is a separate patch - the first patch in the series should
add these definitions and define the XFS ioctl and flags to use them
so we can clearly see there is no change of the existing user API.
There's no need to change the XFS implementation at all.

The second patch then adds the f2fs implementation.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Jaegeuk Kim
On Fri, Jan 09, 2015 at 09:04:12AM +1100, Dave Chinner wrote:
 On Thu, Jan 08, 2015 at 01:21:29PM -0800, Jaegeuk Kim wrote:
  On Fri, Jan 09, 2015 at 07:54:16AM +1100, Dave Chinner wrote:
   On Thu, Jan 08, 2015 at 02:33:17PM -0600, Eric Sandeen wrote:
On 1/8/15 2:18 PM, Jaegeuk Kim wrote:
 On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
 On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
 This patch add an ioctl to shutdown f2fs, which stops all the 
 further block
 writes after this point.

 would it make sense to just re-use the xfs ioctl nr, if the 
 semantics are
 the same?
 
 The semantics are not same for now.
 In order to reuse xfs ioctl, it needs to support options for flushing 
 logs.

the xfs iotl has 3 behaviors optional:

#define XFS_FSOP_GOING_FLAGS_DEFAULT0x0 /* going down */
#define XFS_FSOP_GOING_FLAGS_LOGFLUSH   0x1 /* flush log 
but not data */
#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush 
log nor data */

if f2fs currently supports a subset, you could just -EOPNOTSUPP on the 
others.
   
   No, just do a default shutdown operation if the semantics cannot be
   supported.
   
 - XFS_FSOP_GOING_FLAGS_DEFAULT ==
 consistent on disk before shutdown
 + implemented by freeze/thaw/shutdown sequence
 - XFS_FSOP_GOING_FLAGS_LOGFLUSH ==
 consistent journal on disk before shutdown
 + implemented by journal flush/shutdown sequence
 
 I should point out that this is really consistent metadata on
 disk before shutdown, so it really doesn't matter if your
 filesystem has a journal or not, it can still be implemented.

Agreed. I just implemented these three options for f2fs.

For the f2fs perspective, DEFAULT conducts
 - flushing all the user and dentry blocks
 - checkpointing and then shutdowning fs

LOGFLUSH conducts
 - checkpointing and then shutdowning fs

NOLOGFLUSH conducts
 - shutdowning fs

 
 Perhaps it woul dbe best to rename them for a generic ioctl
 to FS_GOING_DOWN_SYNC, FS_GOING_DOWN_METADATA_METASYNC
 and FS_GOING_DOWN_NOSYNC...

How about FS_GOING_DOWN_FULLSYNC, FS_GOING_DOWN_METASYNC, and
FS_GOING_DOWN_NOSYNC?

Thanks,

 
 Cheers,
 
 Dave.
 -- 
 Dave Chinner
 da...@fromorbit.com

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Dave Chinner
On Thu, Jan 08, 2015 at 01:21:29PM -0800, Jaegeuk Kim wrote:
 On Fri, Jan 09, 2015 at 07:54:16AM +1100, Dave Chinner wrote:
  On Thu, Jan 08, 2015 at 02:33:17PM -0600, Eric Sandeen wrote:
   On 1/8/15 2:18 PM, Jaegeuk Kim wrote:
On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
This patch add an ioctl to shutdown f2fs, which stops all the further 
block
writes after this point.
   
would it make sense to just re-use the xfs ioctl nr, if the semantics 
are
the same?

The semantics are not same for now.
In order to reuse xfs ioctl, it needs to support options for flushing 
logs.
   
   the xfs iotl has 3 behaviors optional:
   
   #define XFS_FSOP_GOING_FLAGS_DEFAULT0x0 /* going down */
   #define XFS_FSOP_GOING_FLAGS_LOGFLUSH   0x1 /* flush log but 
   not data */
   #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush 
   log nor data */
   
   if f2fs currently supports a subset, you could just -EOPNOTSUPP on the 
   others.
  
  No, just do a default shutdown operation if the semantics cannot be
  supported.
  
  - XFS_FSOP_GOING_FLAGS_DEFAULT ==
  consistent on disk before shutdown
  + implemented by freeze/thaw/shutdown sequence
  - XFS_FSOP_GOING_FLAGS_LOGFLUSH ==
  consistent journal on disk before shutdown
  + implemented by journal flush/shutdown sequence

I should point out that this is really consistent metadata on
disk before shutdown, so it really doesn't matter if your
filesystem has a journal or not, it can still be implemented.

Perhaps it woul dbe best to rename them for a generic ioctl
to FS_GOING_DOWN_SYNC, FS_GOING_DOWN_METADATA_METASYNC
and FS_GOING_DOWN_NOSYNC...

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 2/2 v2] xfs/087: move to shared/087

2015-01-08 Thread Jaegeuk Kim
This patch moves xfs/087 to shared/.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 tests/shared/087 | 169 ++
 tests/shared/087.out | 389 +++
 tests/shared/group   |   1 +
 tests/xfs/087| 169 --
 tests/xfs/087.out| 389 ---
 tests/xfs/group  |   1 -
 6 files changed, 559 insertions(+), 559 deletions(-)
 create mode 100755 tests/shared/087
 create mode 100644 tests/shared/087.out
 delete mode 100755 tests/xfs/087
 delete mode 100644 tests/xfs/087.out

diff --git a/tests/shared/087 b/tests/shared/087
new file mode 100755
index 000..337a9ff
--- /dev/null
+++ b/tests/shared/087
@@ -0,0 +1,169 @@
+#! /bin/bash
+# FS QA Test No. 087
+#
+# * like 086 but want to create more/different kinds of metadata
+#   and so will use fsstress
+# * also can interrupt metadata with godown
+#
+#---
+# Copyright (c) 2000-2004 Silicon Graphics, Inc.  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/quota
+
+_do_meta()
+{
+out=$SCRATCH_MNT/fsstress
+count=1
+param=-p 4 -z -f rmdir=10 -f link=10 -f creat=10 -f mkdir=10 \
+   -f rename=30 -f stat=30 -f unlink=30 -f truncate=20
+_echofull calling fsstress $param -m8 -n $count
+FSSTRESS_ARGS=`_scale_fsstress_args $param $FSSTRESS_AVOID -m 8 -n $count 
-d $out`
+if ! $FSSTRESS_PROG $FSSTRESS_ARGS $seqres.full 21
+then
+   _echofull fsstress failed
+fi
+}
+
+# real QA test starts here
+_supported_fs xfs f2fs
+_supported_os IRIX Linux
+
+rm -f $seqres.full $tmp.*
+_require_scratch
+
+if [ $FSTYP == xfs ]; then
+_require_v2log
+_require_xfs_quota
+fi
+
+echo *** init FS
+umount $SCRATCH_DEV /dev/null 21
+
+cat $tmp.seq.params EOF
+# mkfs-opt mount-opt
+# --
+  version=2logbsize=32k
+  version=2,su=4096logbsize=32k
+  version=2,su=32768   logbsize=32k
+  version=2logbsize=64k
+  version=2,su=64k logbsize=64k
+  version=2logbsize=128k
+  version=2,su=128klogbsize=128k
+  version=2logbsize=256k
+  version=2,su=256klogbsize=256k
+EOF
+
+cat $tmp.seq.params \
+| while read mkfs mnt restofline
+do
+if [ $mkfs = # ]; then
+   continue
+fi
+
+echo --- mkfs=$mkfs, mnt=$mnt ---
+
+if [ $FSTYP == xfs ]; then
+export MKFS_OPTIONS=-l $mkfs
+export MOUNT_OPTIONS=-o $mnt
+fi
+
+# mkfs the FS
+_echofull mkfs
+_scratch_mkfs $seqres.full 21
+if [ $? -ne 0 ] ; then
+   _echofull mkfs failed: $MKFS_OPTIONS
+   continue
+fi
+
+# mount the FS
+_echofull mount
+if ! _scratch_mount $seqres.full 21; then
+   _echofull mount failed: $MOUNT_OPTIONS
+   continue
+fi
+
+# create the metadata
+_do_meta
+
+# check before on what FS should look like
+_echofull ls -RF SCRATCH_MNT
+ls -RF $SCRATCH_MNT $tmp.ls1
+
+_echofull godown
+src/godown -v -f $SCRATCH_MNT  $seqres.full
+
+_echofull unmount
+umount $SCRATCH_DEV $seqres.full 21 \
+   || _fail umount failed
+
+_echofull logprint after going down...
+if [ $FSTYP == xfs ]; then
+_print_logstate
+else
+   echo dirty log
+fi
+
+_full logprint headers
+if [ $FSTYP == xfs ]; then
+_scratch_xfs_logprint -n $seqres.full 21
+fi
+
+_echofull mount with replay
+_scratch_mount $seqres.full 21 \
+   || _fail mount failed: $MOUNT_OPTIONS
+
+# check on what FS looks like after log recovery
+_echofull ls -RF SCRATCH_MNT
+ls -RF $SCRATCH_MNT $tmp.ls2
+
+_echofull diff ls before and after
+diff -us $tmp.ls1 $tmp.ls2 | sed s#$tmp#TMP#g
+
+_echofull unmount
+umount $SCRATCH_MNT
+
+_echofull logprint after mount and replay...
+if [ $FSTYP == xfs ]; then
+_print_logstate
+else
+   echo 

[f2fs-dev] [PATCH 1/2 v2] xfs/087: test f2fs selectively

2015-01-08 Thread Jaegeuk Kim
This patch add the f2fs support for xfs/087 with goingdown.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 tests/xfs/087 | 38 +++---
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/tests/xfs/087 b/tests/xfs/087
index 3a3fb49..9dc81c7 100755
--- a/tests/xfs/087
+++ b/tests/xfs/087
@@ -54,13 +54,16 @@ _do_meta()
 }
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs xfs f2fs
 _supported_os IRIX Linux
 
 rm -f $seqres.full $tmp.*
 _require_scratch
-_require_v2log 
-_require_xfs_quota
+
+if [ $FSTYP == xfs ]; then
+_require_v2log
+_require_xfs_quota
+fi
 
 echo *** init FS
 umount $SCRATCH_DEV /dev/null 21
@@ -87,12 +90,15 @@ do
 fi
 
 echo --- mkfs=$mkfs, mnt=$mnt ---
-export MKFS_OPTIONS=-l $mkfs
-export MOUNT_OPTIONS=-o $mnt
+
+if [ $FSTYP == xfs ]; then
+export MKFS_OPTIONS=-l $mkfs
+export MOUNT_OPTIONS=-o $mnt
+fi
 
 # mkfs the FS
 _echofull mkfs
-_scratch_mkfs_xfs $seqres.full 21
+_scratch_mkfs $seqres.full 21
 if [ $? -ne 0 ] ; then 
_echofull mkfs failed: $MKFS_OPTIONS
continue
@@ -100,7 +106,7 @@ do
 
 # mount the FS
 _echofull mount
-if ! _scratch_mount -o uquota $seqres.full 21; then
+if ! _scratch_mount $seqres.full 21; then
_echofull mount failed: $MOUNT_OPTIONS
continue
 fi
@@ -120,13 +126,19 @@ do
|| _fail umount failed
 
 _echofull logprint after going down...
-_print_logstate
+if [ $FSTYP == xfs ]; then
+_print_logstate
+else
+   echo dirty log
+fi
 
 _full logprint headers
-_scratch_xfs_logprint -n $seqres.full 21
+if [ $FSTYP == xfs ]; then
+_scratch_xfs_logprint -n $seqres.full 21
+fi
 
 _echofull mount with replay
-_scratch_mount -o uquota $seqres.full 21 \
+_scratch_mount $seqres.full 21 \
|| _fail mount failed: $MOUNT_OPTIONS
 
 # check on what FS looks like after log recovery
@@ -140,7 +152,11 @@ do
 umount $SCRATCH_MNT
 
 _echofull logprint after mount and replay...
-_print_logstate
+if [ $FSTYP == xfs ]; then
+_print_logstate
+else
+   echo clean log
+fi
 
 if _check_scratch_fs; then
_echofull filesystem is checked ok
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 3/6] f2fs: free radix_tree_nodes used by nat_set entries

2015-01-08 Thread Jaegeuk Kim
In the normal case, the radix_tree_nodes are freed successfully.
But, when cp_error was detected, we should destroy them forcefully.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 fs/f2fs/node.c | 21 +++--
 fs/f2fs/node.h |  1 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 9bed016..d7c1436 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1894,7 +1894,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi)
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
struct f2fs_summary_block *sum = curseg-sum_blk;
-   struct nat_entry_set *setvec[NATVEC_SIZE];
+   struct nat_entry_set *setvec[SETVEC_SIZE];
struct nat_entry_set *set, *tmp;
unsigned int found;
nid_t set_idx = 0;
@@ -1911,7 +1911,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi)
remove_nats_in_journal(sbi);
 
while ((found = __gang_lookup_nat_set(nm_i,
-   set_idx, NATVEC_SIZE, setvec))) {
+   set_idx, SETVEC_SIZE, setvec))) {
unsigned idx;
set_idx = setvec[found - 1]-set + 1;
for (idx = 0; idx  found; idx++)
@@ -1991,6 +1991,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct free_nid *i, *next_i;
struct nat_entry *natvec[NATVEC_SIZE];
+   struct nat_entry_set *setvec[SETVEC_SIZE];
nid_t nid = 0;
unsigned int found;
 
@@ -2015,11 +2016,27 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
while ((found = __gang_lookup_nat_cache(nm_i,
nid, NATVEC_SIZE, natvec))) {
unsigned idx;
+
nid = nat_get_nid(natvec[found - 1]) + 1;
for (idx = 0; idx  found; idx++)
__del_from_nat_cache(nm_i, natvec[idx]);
}
f2fs_bug_on(sbi, nm_i-nat_cnt);
+
+   /* destroy nat set cache */
+   nid = 0;
+   while ((found = __gang_lookup_nat_set(nm_i,
+   nid, SETVEC_SIZE, setvec))) {
+   unsigned idx;
+
+   nid = setvec[found - 1]-set + 1;
+   for (idx = 0; idx  found; idx++) {
+   /* entry_cnt is not zero, when cp_error was occurred */
+   f2fs_bug_on(sbi, !list_empty(setvec[idx]-entry_list));
+   radix_tree_delete(nm_i-nat_set_root, 
setvec[idx]-set);
+   kmem_cache_free(nat_entry_set_slab, setvec[idx]);
+   }
+   }
up_write(nm_i-nat_tree_lock);
 
kfree(nm_i-nat_bitmap);
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index cac8a3d..f405bbf 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -25,6 +25,7 @@
 
 /* vector size for gang look-up from nat cache that consists of radix tree */
 #define NATVEC_SIZE64
+#define SETVEC_SIZE32
 
 /* return value for read_node_page */
 #define LOCKED_PAGE1
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Jaegeuk Kim
This patch add an ioctl to shutdown f2fs, which stops all the further block
writes after this point.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 fs/f2fs/f2fs.h |  1 +
 fs/f2fs/file.c | 14 ++
 2 files changed, 15 insertions(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ba30218..febad35 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -209,6 +209,7 @@ static inline bool __has_cursum_space(struct 
f2fs_summary_block *sum, int size,
 #define F2FS_IOC_START_VOLATILE_WRITE  _IO(F2FS_IOCTL_MAGIC, 3)
 #define F2FS_IOC_RELEASE_VOLATILE_WRITE_IO(F2FS_IOCTL_MAGIC, 4)
 #define F2FS_IOC_ABORT_VOLATILE_WRITE  _IO(F2FS_IOCTL_MAGIC, 5)
+#define F2FS_IOC_GOINGDOWN _IO(F2FS_IOCTL_MAGIC, 6)
 
 #if defined(__KERNEL__)  defined(CONFIG_COMPAT)
 /*
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 5df3367..de2f669 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1020,6 +1020,18 @@ static int f2fs_ioc_abort_volatile_write(struct file 
*filp)
return ret;
 }
 
+static int f2fs_ioc_goingdown(struct file *filp)
+{
+   struct inode *inode = file_inode(filp);
+   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EPERM;
+
+   f2fs_stop_checkpoint(sbi);
+   return 0;
+}
+
 static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg)
 {
struct inode *inode = file_inode(filp);
@@ -1067,6 +1079,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
return f2fs_ioc_release_volatile_write(filp);
case F2FS_IOC_ABORT_VOLATILE_WRITE:
return f2fs_ioc_abort_volatile_write(filp);
+   case F2FS_IOC_GOINGDOWN:
+   return f2fs_ioc_goingdown(filp);
case FITRIM:
return f2fs_ioc_fitrim(filp, arg);
default:
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 4/6] f2fs: add nat/sit entries into status

2015-01-08 Thread Jaegeuk Kim
This patch adds NAT/SIT entry informations.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 fs/f2fs/debug.c | 8 +---
 fs/f2fs/f2fs.h  | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index dd7835b..1f0fb58 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -57,7 +57,9 @@ static void update_general_status(struct f2fs_sb_info *sbi)
si-node_pages = NODE_MAPPING(sbi)-nrpages;
si-meta_pages = META_MAPPING(sbi)-nrpages;
si-nats = NM_I(sbi)-nat_cnt;
-   si-sits = SIT_I(sbi)-dirty_sentries;
+   si-dirty_nats = NM_I(sbi)-dirty_nat_cnt;
+   si-sits = MAIN_SEGS(sbi);
+   si-dirty_sits = SIT_I(sbi)-dirty_sentries;
si-fnids = NM_I(sbi)-fcnt;
si-bg_gc = sbi-bg_gc;
si-util_free = (int)(free_user_blocks(sbi)  sbi-log_blocks_per_seg)
@@ -260,8 +262,8 @@ static int stat_show(struct seq_file *s, void *v)
   si-ndirty_dent, si-ndirty_dirs);
seq_printf(s,   - meta: %4d in %4d\n,
   si-ndirty_meta, si-meta_pages);
-   seq_printf(s,   - NATs: %9d\n  - SITs: %9d\n,
-  si-nats, si-sits);
+   seq_printf(s,   - NATs: %9d/%9d\n  - SITs: %9d/%9d\n,
+  si-dirty_nats, si-nats, si-dirty_sits, si-sits);
seq_printf(s,   - free_nids: %9d\n,
   si-fnids);
seq_puts(s, \nDistribution of User Blocks:);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index febad35..d39b230 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1513,7 +1513,7 @@ struct f2fs_stat_info {
int main_area_segs, main_area_sections, main_area_zones;
int hit_ext, total_ext;
int ndirty_node, ndirty_dent, ndirty_dirs, ndirty_meta;
-   int nats, sits, fnids;
+   int nats, dirty_nats, sits, dirty_sits, fnids;
int total_count, utilization;
int bg_gc, inline_inode, inline_dir, inmem_pages;
unsigned int valid_count, valid_node_count, valid_inode_count;
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 6/6] f2fs: add f2fs_destroy_trace_ios to free radix tree

2015-01-08 Thread Jaegeuk Kim
This patch removes radix tree after finishing tracing IOs.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 fs/f2fs/super.c |  1 +
 fs/f2fs/trace.c | 37 +
 fs/f2fs/trace.h |  2 ++
 3 files changed, 40 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index e6f035c..0e97974 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1272,6 +1272,7 @@ static void __exit exit_f2fs_fs(void)
destroy_node_manager_caches();
destroy_inodecache();
kset_unregister(f2fs_kset);
+   f2fs_destroy_trace_ios();
 }
 
 module_init(init_f2fs_fs)
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index 92fa38a..b3570dc 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -11,6 +11,7 @@
 #include linux/fs.h
 #include linux/f2fs_fs.h
 #include linux/sched.h
+#include linux/radix-tree.h
 
 #include f2fs.h
 #include trace.h
@@ -120,3 +121,39 @@ void f2fs_build_trace_ios(void)
 {
spin_lock_init(pids_lock);
 }
+
+#define PIDVEC_SIZE128
+static unsigned int gang_lookup_pids(pid_t *results, unsigned long first_index,
+   unsigned int max_items)
+{
+   struct radix_tree_iter iter;
+   void **slot;
+   unsigned int ret = 0;
+
+   if (unlikely(!max_items))
+   return 0;
+
+   radix_tree_for_each_slot(slot, pids, iter, first_index) {
+   results[ret] = iter.index;
+   if (++ret == PIDVEC_SIZE)
+   break;
+   }
+   return ret;
+}
+
+void f2fs_destroy_trace_ios(void)
+{
+   pid_t pid[PIDVEC_SIZE];
+   pid_t next_pid = 0;
+   unsigned int found;
+
+   spin_lock(pids_lock);
+   while ((found = gang_lookup_pids(pid, next_pid, PIDVEC_SIZE))) {
+   unsigned idx;
+
+   next_pid = pid[found - 1] + 1;
+   for (idx = 0; idx  found; idx++)
+   radix_tree_delete(pids, pid[idx]);
+   }
+   spin_unlock(pids_lock);
+}
diff --git a/fs/f2fs/trace.h b/fs/f2fs/trace.h
index eb39fa0..1041dbe 100644
--- a/fs/f2fs/trace.h
+++ b/fs/f2fs/trace.h
@@ -35,10 +35,12 @@ struct last_io_info {
 extern void f2fs_trace_pid(struct page *);
 extern void f2fs_trace_ios(struct page *, struct f2fs_io_info *, int);
 extern void f2fs_build_trace_ios(void);
+extern void f2fs_destroy_trace_ios(void);
 #else
 #define f2fs_trace_pid(p)
 #define f2fs_trace_ios(p, i, n)
 #define f2fs_build_trace_ios()
+#define f2fs_destroy_trace_ios()
 
 #endif
 #endif /* __F2FS_TRACE_H__ */
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH 2/2] f2fs/087: test power failure test using godown

2015-01-08 Thread Jaegeuk Kim
This patch adds f2fs/087 to test power failure by using godown.

Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
---
 tests/f2fs/087 | 88 ++
 tests/f2fs/087.out | 21 +
 tests/f2fs/group   |  1 +
 3 files changed, 110 insertions(+)
 create mode 100644 tests/f2fs/087
 create mode 100644 tests/f2fs/087.out
 create mode 100644 tests/f2fs/group

diff --git a/tests/f2fs/087 b/tests/f2fs/087
new file mode 100644
index 000..9410b9f
--- /dev/null
+++ b/tests/f2fs/087
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 087
+#
+# * use godown likewise xfs/087
+#
+#---
+# Copyright (c) 2015 Jaegeuk Kim
+#
+# 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
+
+# real QA test starts here
+_supported_fs f2fs
+_supported_os Linux
+
+rm -f $seqres.full $tmp.*
+_require_scratch
+
+_run_fsstress()
+{
+   out=$SCRATCH_MNT/fsstress
+   count=$((5000*$i))
+   echo $count
+   param=-p 4 -z -f sync=1 -f write=30 -f rmdir=10 -f link=10 -f creat=10 
-f mkdir=10 -f rename=30 -f stat=30 -f unlink=30 -f truncate=20
+   echo calling fsstress $param -m8 -n $count $seqres.full
+   FSSTRESS_ARGS=`_scale_fsstress_args $param $FSSTRESS_AVOID -m 8 -n 
$count -d $out`
+   if ! $FSSTRESS_PROG $FSSTRESS_ARGS $seqres.full 21
+   then
+   echo fsstress failed
+   fi
+}
+
+# mkfs the FS
+_scratch_mkfs $seqres.full 21
+if [ $? -ne 0 ] ; then
+   echo mkfs failed: $MKFS_OPTIONS
+fi
+
+i=1
+LOOP=10
+for i in $(seq 1 ${LOOP}); do
+   echo ** mount $seqres.full
+   if ! _scratch_mount $seqres.full 21; then
+   echo mount failed: $MOUNT_OPTIONS
+   fi
+
+   _run_fsstress
+
+   echo ** godown $seqres.full
+   src/godown -v -f $SCRATCH_MNT -s 1 $seqres.full
+
+   umount $SCRATCH_DEV /dev/null 21
+
+   if _check_scratch_fs; then
+   echo filesystem is checked ok
+   else
+   echo filesystem is NOT ok
+   fi
+done
+
+status=0
+exit
diff --git a/tests/f2fs/087.out b/tests/f2fs/087.out
new file mode 100644
index 000..14bb897
--- /dev/null
+++ b/tests/f2fs/087.out
@@ -0,0 +1,21 @@
+QA output created by 087
+5000
+filesystem is checked ok
+1
+filesystem is checked ok
+15000
+filesystem is checked ok
+2
+filesystem is checked ok
+25000
+filesystem is checked ok
+3
+filesystem is checked ok
+35000
+filesystem is checked ok
+4
+filesystem is checked ok
+45000
+filesystem is checked ok
+5
+filesystem is checked ok
diff --git a/tests/f2fs/group b/tests/f2fs/group
new file mode 100644
index 000..dd069d3
--- /dev/null
+++ b/tests/f2fs/group
@@ -0,0 +1 @@
+087 auto stress
-- 
2.1.1


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 1/2] src/godown: support f2fs triggering specific ioctl

2015-01-08 Thread Eric Sandeen
On 1/8/15 12:31 PM, Jaegeuk Kim wrote:
 This patch triggers the F2FS-related ioctl for godown.

hohum, wouldn't it be a whole lot easier to just re-use the XFS ioctl
number in f2fs?  Then you wouldn't have to duplicate all this code.

If you really want your own unique ioctl number, what about
just doing statfs on the target, and if f_type returns F2FS_SUPER_MAGIC,
swictch the ioctl nr to F2FS_IOC_GOINGDOWN.

Then if not F2FS_SUPER_MAGIC, leave the ioctl nr at XFS_IOC_GOINGDOWN, and
if it fails, it fails (other filesystems might support the original nr.)

And then you can probably just add f2fs to the existing testcase,
and move it to tests/shared?

-Eric

 Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
 ---
  src/godown.c | 88 
 
  1 file changed, 65 insertions(+), 23 deletions(-)
 
 diff --git a/src/godown.c b/src/godown.c
 index b140a41..b44790b 100644
 --- a/src/godown.c
 +++ b/src/godown.c
 @@ -19,33 +19,82 @@
  #include syslog.h
  #include global.h
  
 +#define F2FS_IOCTL_MAGIC 0xf5
 +#define F2FS_IOC_GOINGDOWN   _IO(F2FS_IOCTL_MAGIC, 6)
 +
 +enum ftypes {
 + XFS_FS,
 + F2FS_FS,
 +};
 +
  static char *xprogname;
 +static char *mnt_dir;
 +static int verbose_opt = 0;
 +static int flushlog_opt = 0;
  
 +static enum ftypes fs = XFS_FS;
  
  static void
  usage(void)
  {
 - fprintf(stderr, usage: %s [-f] [-v] mnt-dir\n, xprogname);
 + fprintf(stderr, usage: %s [-f] [-v] [-s 0/1] mnt-dir\n, xprogname);
 +}
 +
 +static int
 +xfs_goingdown(int fd)
 +{
 + int flag;
 +
 + flag = (flushlog_opt ? XFS_FSOP_GOING_FLAGS_LOGFLUSH
 + : XFS_FSOP_GOING_FLAGS_NOLOGFLUSH);
 + if (verbose_opt) {
 + printf(Calling XFS_IOC_GOINGDOWN\n);
 + }
 +
 + syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
 + mnt_dir);
 + if ((xfsctl(mnt_dir, fd, XFS_IOC_GOINGDOWN, flag)) == -1) {
 + fprintf(stderr, %s: error on xfsctl(GOINGDOWN) of \%s\: 
 %s\n,
 + xprogname, mnt_dir, strerror(errno));
 + return 1;
 + }
 + return 0;
 +}
 +
 +static int
 +f2fs_goingdown(int fd)
 +{
 + if (verbose_opt) {
 + printf(Calling F2FS_IOC_GOINGDOWN\n);
 + }
 + syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
 + mnt_dir);
 + if ((ioctl(fd, F2FS_IOC_GOINGDOWN)) == -1) {
 + fprintf(stderr, %s: error on ioctl(GOINGDOWN) of \%s\: %s\n,
 + xprogname, mnt_dir, strerror(errno));
 + return 1;
 + }
 + return 0;
 +
  }
  
  int
  main(int argc, char *argv[])
  {
 - int c;
 - int flag;
 - int flushlog_opt = 0;
 - int verbose_opt = 0;
 + int c, fd;
   struct stat st;
 - char *mnt_dir;
 - int fd;
 + int ret = 0;
  
   xprogname = argv[0];
  
 - while ((c = getopt(argc, argv, fv)) != -1) {
 + while ((c = getopt(argc, argv, fs:v)) != -1) {
   switch (c) {
   case 'f':
   flushlog_opt = 1;
   break;
 + case 's':
 + fs = atoi(optarg);
 + break;
   case 'v':
   verbose_opt = 1;
   break;
 @@ -94,10 +143,6 @@ main(int argc, char *argv[])
   }
  #endif
  
 -
 - flag = (flushlog_opt ? XFS_FSOP_GOING_FLAGS_LOGFLUSH 
 - : XFS_FSOP_GOING_FLAGS_NOLOGFLUSH);
 -
   if (verbose_opt) {
   printf(Opening \%s\\n, mnt_dir);
   }
 @@ -107,18 +152,15 @@ main(int argc, char *argv[])
   return 1;
   }
  
 - if (verbose_opt) {
 - printf(Calling XFS_IOC_GOINGDOWN\n);
 + switch (fs) {
 + case XFS_FS:
 + ret = xfs_goingdown(fd);
 + break;
 + case F2FS_FS:
 + ret = f2fs_goingdown(fd);
 + break;
   }
 - syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
 - mnt_dir);
 - if ((xfsctl(mnt_dir, fd, XFS_IOC_GOINGDOWN, flag)) == -1) {
 - fprintf(stderr, %s: error on xfsctl(GOINGDOWN) of \%s\: 
 %s\n,
 - xprogname, mnt_dir, strerror(errno));
 - return 1;
 - }
 -
   close(fd);
  
 - return 0;
 + return ret;
  }
 


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net

Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Jaegeuk Kim
On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
 On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
  This patch add an ioctl to shutdown f2fs, which stops all the further block
  writes after this point.
 
 would it make sense to just re-use the xfs ioctl nr, if the semantics are
 the same?

The semantics are not same for now.
In order to reuse xfs ioctl, it needs to support options for flushing logs.

Thanks,

 
 That way any test using it will just work on f2fs...
 
 -Eric
 
  Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
  ---
   fs/f2fs/f2fs.h |  1 +
   fs/f2fs/file.c | 14 ++
   2 files changed, 15 insertions(+)
  
  diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
  index ba30218..febad35 100644
  --- a/fs/f2fs/f2fs.h
  +++ b/fs/f2fs/f2fs.h
  @@ -209,6 +209,7 @@ static inline bool __has_cursum_space(struct 
  f2fs_summary_block *sum, int size,
   #define F2FS_IOC_START_VOLATILE_WRITE  _IO(F2FS_IOCTL_MAGIC, 3)
   #define F2FS_IOC_RELEASE_VOLATILE_WRITE_IO(F2FS_IOCTL_MAGIC, 4)
   #define F2FS_IOC_ABORT_VOLATILE_WRITE  _IO(F2FS_IOCTL_MAGIC, 5)
  +#define F2FS_IOC_GOINGDOWN _IO(F2FS_IOCTL_MAGIC, 6)
   
   #if defined(__KERNEL__)  defined(CONFIG_COMPAT)
   /*
  diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
  index 5df3367..de2f669 100644
  --- a/fs/f2fs/file.c
  +++ b/fs/f2fs/file.c
  @@ -1020,6 +1020,18 @@ static int f2fs_ioc_abort_volatile_write(struct file 
  *filp)
  return ret;
   }
   
  +static int f2fs_ioc_goingdown(struct file *filp)
  +{
  +   struct inode *inode = file_inode(filp);
  +   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
  +
  +   if (!capable(CAP_SYS_ADMIN))
  +   return -EPERM;
  +
  +   f2fs_stop_checkpoint(sbi);
  +   return 0;
  +}
  +
   static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg)
   {
  struct inode *inode = file_inode(filp);
  @@ -1067,6 +1079,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, 
  unsigned long arg)
  return f2fs_ioc_release_volatile_write(filp);
  case F2FS_IOC_ABORT_VOLATILE_WRITE:
  return f2fs_ioc_abort_volatile_write(filp);
  +   case F2FS_IOC_GOINGDOWN:
  +   return f2fs_ioc_goingdown(filp);
  case FITRIM:
  return f2fs_ioc_fitrim(filp, arg);
  default:
  

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Eric Sandeen
On 1/8/15 2:18 PM, Jaegeuk Kim wrote:
 On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
 On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
 This patch add an ioctl to shutdown f2fs, which stops all the further block
 writes after this point.

 would it make sense to just re-use the xfs ioctl nr, if the semantics are
 the same?
 
 The semantics are not same for now.
 In order to reuse xfs ioctl, it needs to support options for flushing logs.

the xfs iotl has 3 behaviors optional:

#define XFS_FSOP_GOING_FLAGS_DEFAULT0x0 /* going down */
#define XFS_FSOP_GOING_FLAGS_LOGFLUSH   0x1 /* flush log but not 
data */
#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor 
data */

if f2fs currently supports a subset, you could just -EOPNOTSUPP on the others.

If the semantics are completely different, maybe it shouldn't share the
name at all.  ;)

Just a thought...

-Eric

 Thanks,
 

 That way any test using it will just work on f2fs...

 -Eric


--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Dave Chinner
On Thu, Jan 08, 2015 at 02:33:17PM -0600, Eric Sandeen wrote:
 On 1/8/15 2:18 PM, Jaegeuk Kim wrote:
  On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
  On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
  This patch add an ioctl to shutdown f2fs, which stops all the further 
  block
  writes after this point.
 
  would it make sense to just re-use the xfs ioctl nr, if the semantics are
  the same?
  
  The semantics are not same for now.
  In order to reuse xfs ioctl, it needs to support options for flushing logs.
 
 the xfs iotl has 3 behaviors optional:
 
 #define XFS_FSOP_GOING_FLAGS_DEFAULT0x0 /* going down */
 #define XFS_FSOP_GOING_FLAGS_LOGFLUSH   0x1 /* flush log but not 
 data */
 #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log 
 nor data */
 
 if f2fs currently supports a subset, you could just -EOPNOTSUPP on the others.

No, just do a default shutdown operation if the semantics cannot be
supported.

- XFS_FSOP_GOING_FLAGS_DEFAULT ==
consistent on disk before shutdown
+ implemented by freeze/thaw/shutdown sequence
- XFS_FSOP_GOING_FLAGS_LOGFLUSH ==
consistent journal on disk before shutdown
+ implemented by journal flush/shutdown sequence
- XFS_FSOP_GOING_FLAGS_NOLOGFLUSH ==
nothing consistent on disk before shutdown
+ just a shutdown call.

f2fs can at least support XFS_FSOP_GOING_FLAGS_DEFAULT and
XFS_FSOP_GOING_FLAGS_NOLOGFLUSH

 If the semantics are completely different, maybe it shouldn't share the
 name at all.  ;)

The semantics are quite clear and generic - when you look at what
they actually mean rather than looking at the implementation.
There's no need for new ioctls here.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 2/6] f2fs: support goingdown for fs shutdown

2015-01-08 Thread Jaegeuk Kim
On Fri, Jan 09, 2015 at 07:54:16AM +1100, Dave Chinner wrote:
 On Thu, Jan 08, 2015 at 02:33:17PM -0600, Eric Sandeen wrote:
  On 1/8/15 2:18 PM, Jaegeuk Kim wrote:
   On Thu, Jan 08, 2015 at 01:54:20PM -0600, Eric Sandeen wrote:
   On 1/8/15 12:10 PM, Jaegeuk Kim wrote:
   This patch add an ioctl to shutdown f2fs, which stops all the further 
   block
   writes after this point.
  
   would it make sense to just re-use the xfs ioctl nr, if the semantics are
   the same?
   
   The semantics are not same for now.
   In order to reuse xfs ioctl, it needs to support options for flushing 
   logs.
  
  the xfs iotl has 3 behaviors optional:
  
  #define XFS_FSOP_GOING_FLAGS_DEFAULT0x0 /* going down */
  #define XFS_FSOP_GOING_FLAGS_LOGFLUSH   0x1 /* flush log but 
  not data */
  #define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log 
  nor data */
  
  if f2fs currently supports a subset, you could just -EOPNOTSUPP on the 
  others.
 
 No, just do a default shutdown operation if the semantics cannot be
 supported.
 
   - XFS_FSOP_GOING_FLAGS_DEFAULT ==
   consistent on disk before shutdown
   + implemented by freeze/thaw/shutdown sequence
   - XFS_FSOP_GOING_FLAGS_LOGFLUSH ==
   consistent journal on disk before shutdown
   + implemented by journal flush/shutdown sequence
   - XFS_FSOP_GOING_FLAGS_NOLOGFLUSH ==
   nothing consistent on disk before shutdown
   + just a shutdown call.
 
 f2fs can at least support XFS_FSOP_GOING_FLAGS_DEFAULT and
 XFS_FSOP_GOING_FLAGS_NOLOGFLUSH
 
  If the semantics are completely different, maybe it shouldn't share the
  name at all.  ;)
 
 The semantics are quite clear and generic - when you look at what
 they actually mean rather than looking at the implementation.
 There's no need for new ioctls here.

I'll check it out.
Thank you, Dave and Eric. :)

 
 Cheers,
 
 Dave.
 -- 
 Dave Chinner
 da...@fromorbit.com

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH f2fs] f2fs: pids_lock can be static

2015-01-08 Thread kbuild test robot
fs/f2fs/trace.c:19:12: sparse: symbol 'pids_lock' was not declared. Should it 
be static?

Signed-off-by: Fengguang Wu fengguang...@intel.com
---
 trace.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index 92fa38a..517dfe5 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -16,7 +16,7 @@
 #include trace.h
 
 RADIX_TREE(pids, GFP_ATOMIC);
-spinlock_t pids_lock;
+static spinlock_t pids_lock;
 struct last_io_info last_io;
 
 static inline void __print_last_io(void)

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [f2fs:linux-3.4 31/33] fs/f2fs/trace.c:19:12: sparse: symbol 'pids_lock' was not declared. Should it be static?

2015-01-08 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs linux-3.4
head:   a725baf7b8472a0b97dc12ed4d1c147cad2f3e8c
commit: 37a78eb5019798c94d4543c48e1d6490a552e1c7 [31/33] f2fs: add spin_lock to 
cover radix operations in IO tracer
reproduce:
  # apt-get install sparse
  git checkout 37a78eb5019798c94d4543c48e1d6490a552e1c7
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by )

 fs/f2fs/trace.c:19:12: sparse: symbol 'pids_lock' was not declared. Should 
 it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH 1/2] src/godown: support f2fs triggering specific ioctl

2015-01-08 Thread Jaegeuk Kim
On Thu, Jan 08, 2015 at 12:44:56PM -0600, Eric Sandeen wrote:
 On 1/8/15 12:31 PM, Jaegeuk Kim wrote:
  This patch triggers the F2FS-related ioctl for godown.
 
 hohum, wouldn't it be a whole lot easier to just re-use the XFS ioctl
 number in f2fs?  Then you wouldn't have to duplicate all this code.

Actually I tried to do like that. But, xfs's goingdown has some specific options
wrt flushing logs which provide some rules on data recovery.

So, I decided to add a new ioctl and a test script, (i.e., f2fs/087) which is
different from xfs/087.

 
 If you really want your own unique ioctl number, what about
 just doing statfs on the target, and if f_type returns F2FS_SUPER_MAGIC,
 swictch the ioctl nr to F2FS_IOC_GOINGDOWN.

Oh, I'll change detecting the file system type.
For the common ioctl, it needs to consider ioctl's format where xfs calls xfsctl
with flushing options while f2fs triggers ioctl without paramter.

 
 Then if not F2FS_SUPER_MAGIC, leave the ioctl nr at XFS_IOC_GOINGDOWN, and
 if it fails, it fails (other filesystems might support the original nr.)
 
 And then you can probably just add f2fs to the existing testcase,
 and move it to tests/shared?

I can't use the same scripts due to the different options used by xfs's
goingdown.

Thank you for the comments. :)

Thanks,

 
 -Eric
 
  Signed-off-by: Jaegeuk Kim jaeg...@kernel.org
  ---
   src/godown.c | 88 
  
   1 file changed, 65 insertions(+), 23 deletions(-)
  
  diff --git a/src/godown.c b/src/godown.c
  index b140a41..b44790b 100644
  --- a/src/godown.c
  +++ b/src/godown.c
  @@ -19,33 +19,82 @@
   #include syslog.h
   #include global.h
   
  +#define F2FS_IOCTL_MAGIC   0xf5
  +#define F2FS_IOC_GOINGDOWN _IO(F2FS_IOCTL_MAGIC, 6)
  +
  +enum ftypes {
  +   XFS_FS,
  +   F2FS_FS,
  +};
  +
   static char *xprogname;
  +static char *mnt_dir;
  +static int verbose_opt = 0;
  +static int flushlog_opt = 0;
   
  +static enum ftypes fs = XFS_FS;
   
   static void
   usage(void)
   {
  -   fprintf(stderr, usage: %s [-f] [-v] mnt-dir\n, xprogname);
  +   fprintf(stderr, usage: %s [-f] [-v] [-s 0/1] mnt-dir\n, xprogname);
  +}
  +
  +static int
  +xfs_goingdown(int fd)
  +{
  +   int flag;
  +
  +   flag = (flushlog_opt ? XFS_FSOP_GOING_FLAGS_LOGFLUSH
  +   : XFS_FSOP_GOING_FLAGS_NOLOGFLUSH);
  +   if (verbose_opt) {
  +   printf(Calling XFS_IOC_GOINGDOWN\n);
  +   }
  +
  +   syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
  +   mnt_dir);
  +   if ((xfsctl(mnt_dir, fd, XFS_IOC_GOINGDOWN, flag)) == -1) {
  +   fprintf(stderr, %s: error on xfsctl(GOINGDOWN) of \%s\: 
  %s\n,
  +   xprogname, mnt_dir, strerror(errno));
  +   return 1;
  +   }
  +   return 0;
  +}
  +
  +static int
  +f2fs_goingdown(int fd)
  +{
  +   if (verbose_opt) {
  +   printf(Calling F2FS_IOC_GOINGDOWN\n);
  +   }
  +   syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
  +   mnt_dir);
  +   if ((ioctl(fd, F2FS_IOC_GOINGDOWN)) == -1) {
  +   fprintf(stderr, %s: error on ioctl(GOINGDOWN) of \%s\: %s\n,
  +   xprogname, mnt_dir, strerror(errno));
  +   return 1;
  +   }
  +   return 0;
  +
   }
   
   int
   main(int argc, char *argv[])
   {
  -   int c;
  -   int flag;
  -   int flushlog_opt = 0;
  -   int verbose_opt = 0;
  +   int c, fd;
  struct stat st;
  -   char *mnt_dir;
  -   int fd;
  +   int ret = 0;
   
  xprogname = argv[0];
   
  -   while ((c = getopt(argc, argv, fv)) != -1) {
  +   while ((c = getopt(argc, argv, fs:v)) != -1) {
  switch (c) {
  case 'f':
  flushlog_opt = 1;
  break;
  +   case 's':
  +   fs = atoi(optarg);
  +   break;
  case 'v':
  verbose_opt = 1;
  break;
  @@ -94,10 +143,6 @@ main(int argc, char *argv[])
  }
   #endif
   
  -
  -   flag = (flushlog_opt ? XFS_FSOP_GOING_FLAGS_LOGFLUSH 
  -   : XFS_FSOP_GOING_FLAGS_NOLOGFLUSH);
  -
  if (verbose_opt) {
  printf(Opening \%s\\n, mnt_dir);
  }
  @@ -107,18 +152,15 @@ main(int argc, char *argv[])
  return 1;
  }
   
  -   if (verbose_opt) {
  -   printf(Calling XFS_IOC_GOINGDOWN\n);
  +   switch (fs) {
  +   case XFS_FS:
  +   ret = xfs_goingdown(fd);
  +   break;
  +   case F2FS_FS:
  +   ret = f2fs_goingdown(fd);
  +   break;
  }
  -   syslog(LOG_WARNING, xfstests-induced forced shutdown of %s:\n,
  -   mnt_dir);
  -   if ((xfsctl(mnt_dir, fd, XFS_IOC_GOINGDOWN, flag)) == -1) {
  -   fprintf(stderr, %s: error on xfsctl(GOINGDOWN) of \%s\: 
  %s\n,
  -   xprogname, mnt_dir, strerror(errno));
  -   return 1;
  -   }
  -
  close(fd);
   
  -   return 0;