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


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