* [PATCH 1/6] f2fs: fix wrong unlock_page call
@ 2015-01-08 18:10 Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 2/6] f2fs: support goingdown for fs shutdown Jaegeuk Kim
` (4 more replies)
0 siblings, 5 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:10 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim
This patch removes wrongly called unlock_page.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/data.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index b48b355..a7b905c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -837,7 +837,6 @@ write:
/* we should bypass data pages to proceed the kworkder jobs */
if (unlikely(f2fs_cp_error(sbi))) {
SetPageError(page);
- unlock_page(page);
goto out;
}
--
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
@ 2015-01-08 18:10 ` Jaegeuk Kim
2015-01-08 19:54 ` Eric Sandeen
2015-01-08 18:10 ` [PATCH 3/6] f2fs: free radix_tree_nodes used by nat_set entries Jaegeuk Kim
` (3 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:10 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: 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 <jaegeuk@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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/6] f2fs: free radix_tree_nodes used by nat_set entries
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 2/6] f2fs: support goingdown for fs shutdown Jaegeuk Kim
@ 2015-01-08 18:10 ` Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 4/6] f2fs: add nat/sit entries into status Jaegeuk Kim
` (2 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:10 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: 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 <jaegeuk@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_SIZE 64
+#define SETVEC_SIZE 32
/* return value for read_node_page */
#define LOCKED_PAGE 1
--
2.1.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/6] f2fs: add nat/sit entries into status
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 2/6] f2fs: support goingdown for fs shutdown Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 3/6] f2fs: free radix_tree_nodes used by nat_set entries Jaegeuk Kim
@ 2015-01-08 18:10 ` Jaegeuk Kim
2015-01-08 18:11 ` [PATCH 5/6] f2fs: add spin_lock to cover radix operations in IO tracer Jaegeuk Kim
2015-01-08 18:11 ` [PATCH 6/6] f2fs: add f2fs_destroy_trace_ios to free radix tree Jaegeuk Kim
4 siblings, 0 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:10 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim
This patch adds NAT/SIT entry informations.
Signed-off-by: Jaegeuk Kim <jaegeuk@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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/6] f2fs: add spin_lock to cover radix operations in IO tracer
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
` (2 preceding siblings ...)
2015-01-08 18:10 ` [PATCH 4/6] f2fs: add nat/sit entries into status Jaegeuk Kim
@ 2015-01-08 18:11 ` Jaegeuk Kim
2015-01-08 18:11 ` [PATCH 6/6] f2fs: add f2fs_destroy_trace_ios to free radix tree Jaegeuk Kim
4 siblings, 0 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:11 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim
This patch adds spin_lock to cover radix tree operations in IO tracer.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/super.c | 2 ++
fs/f2fs/trace.c | 18 +++++++++++++++---
fs/f2fs/trace.h | 2 ++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0ae6a2f..e6f035c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1222,6 +1222,8 @@ static int __init init_f2fs_fs(void)
{
int err;
+ f2fs_build_trace_ios();
+
err = init_inodecache();
if (err)
goto fail;
diff --git a/fs/f2fs/trace.c b/fs/f2fs/trace.c
index 19f5216..92fa38a 100644
--- a/fs/f2fs/trace.c
+++ b/fs/f2fs/trace.c
@@ -15,7 +15,8 @@
#include "f2fs.h"
#include "trace.h"
-RADIX_TREE(pids, GFP_NOIO);
+RADIX_TREE(pids, GFP_ATOMIC);
+spinlock_t pids_lock;
struct last_io_info last_io;
static inline void __print_last_io(void)
@@ -58,9 +59,13 @@ void f2fs_trace_pid(struct page *page)
page->private = pid;
+ if (radix_tree_preload(GFP_NOFS))
+ return;
+
+ spin_lock(&pids_lock);
p = radix_tree_lookup(&pids, pid);
if (p == current)
- return;
+ goto out;
if (p)
radix_tree_delete(&pids, pid);
@@ -69,7 +74,9 @@ void f2fs_trace_pid(struct page *page)
trace_printk("%3x:%3x %4x %-16s\n",
MAJOR(inode->i_sb->s_dev), MINOR(inode->i_sb->s_dev),
pid, current->comm);
-
+out:
+ spin_unlock(&pids_lock);
+ radix_tree_preload_end();
}
void f2fs_trace_ios(struct page *page, struct f2fs_io_info *fio, int flush)
@@ -108,3 +115,8 @@ void f2fs_trace_ios(struct page *page, struct f2fs_io_info *fio, int flush)
last_io.len = 1;
return;
}
+
+void f2fs_build_trace_ios(void)
+{
+ spin_lock_init(&pids_lock);
+}
diff --git a/fs/f2fs/trace.h b/fs/f2fs/trace.h
index aa6663b..eb39fa0 100644
--- a/fs/f2fs/trace.h
+++ b/fs/f2fs/trace.h
@@ -34,9 +34,11 @@ 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);
#else
#define f2fs_trace_pid(p)
#define f2fs_trace_ios(p, i, n)
+#define f2fs_build_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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/6] f2fs: add f2fs_destroy_trace_ios to free radix tree
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
` (3 preceding siblings ...)
2015-01-08 18:11 ` [PATCH 5/6] f2fs: add spin_lock to cover radix operations in IO tracer Jaegeuk Kim
@ 2015-01-08 18:11 ` Jaegeuk Kim
4 siblings, 0 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 18:11 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim
This patch removes radix tree after finishing tracing IOs.
Signed-off-by: Jaegeuk Kim <jaegeuk@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_SIZE 128
+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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 18:10 ` [PATCH 2/6] f2fs: support goingdown for fs shutdown Jaegeuk Kim
@ 2015-01-08 19:54 ` Eric Sandeen
2015-01-08 20:18 ` Jaegeuk Kim
0 siblings, 1 reply; 18+ messages in thread
From: Eric Sandeen @ 2015-01-08 19:54 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-fsdevel, linux-f2fs-devel
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?
That way any test using it will "just work" on f2fs...
-Eric
> Signed-off-by: Jaegeuk Kim <jaegeuk@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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 19:54 ` Eric Sandeen
@ 2015-01-08 20:18 ` Jaegeuk Kim
2015-01-08 20:33 ` Eric Sandeen
0 siblings, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 20:18 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
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 <jaegeuk@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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 20:18 ` Jaegeuk Kim
@ 2015-01-08 20:33 ` Eric Sandeen
2015-01-08 20:54 ` Dave Chinner
0 siblings, 1 reply; 18+ messages in thread
From: Eric Sandeen @ 2015-01-08 20:33 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel
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_DEFAULT 0x0 /* 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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 20:33 ` Eric Sandeen
@ 2015-01-08 20:54 ` Dave Chinner
2015-01-08 21:21 ` Jaegeuk Kim
0 siblings, 1 reply; 18+ messages in thread
From: Dave Chinner @ 2015-01-08 20:54 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Jaegeuk Kim, linux-kernel, linux-fsdevel, linux-f2fs-devel
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_DEFAULT 0x0 /* 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
david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 20:54 ` Dave Chinner
@ 2015-01-08 21:21 ` Jaegeuk Kim
2015-01-08 22:04 ` Dave Chinner
0 siblings, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 21:21 UTC (permalink / raw)
To: Dave Chinner; +Cc: Eric Sandeen, linux-kernel, linux-fsdevel, linux-f2fs-devel
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_DEFAULT 0x0 /* 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
> david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 21:21 ` Jaegeuk Kim
@ 2015-01-08 22:04 ` Dave Chinner
2015-01-08 22:16 ` Jaegeuk Kim
0 siblings, 1 reply; 18+ messages in thread
From: Dave Chinner @ 2015-01-08 22:04 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, linux-f2fs-devel
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_DEFAULT 0x0 /* 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
david@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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6] f2fs: support goingdown for fs shutdown
2015-01-08 22:04 ` Dave Chinner
@ 2015-01-08 22:16 ` Jaegeuk Kim
2015-01-09 1:40 ` [PATCH 2/6 v2] " Jaegeuk Kim
2015-01-09 1:41 ` [PATCH] xfs: use generic FS_IOC_GOINGDOWN for ioctl Jaegeuk Kim
0 siblings, 2 replies; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-08 22:16 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, linux-f2fs-devel
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_DEFAULT 0x0 /* 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
> david@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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/6 v2] f2fs: support goingdown for fs shutdown
2015-01-08 22:16 ` Jaegeuk Kim
@ 2015-01-09 1:40 ` Jaegeuk Kim
2015-01-09 2:24 ` [f2fs-dev] " Dave Chinner
2015-01-09 1:41 ` [PATCH] xfs: use generic FS_IOC_GOINGDOWN for ioctl Jaegeuk Kim
1 sibling, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-09 1:40 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, linux-f2fs-devel
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
This patch add an ioctl to shutdown f2fs, which stops all the further block
writes after this point.
The ioctl, FS_IOC_GOINGDOWN, provides the following three options.
1. FS_GOING_DOWN_FULLSYNC
: this will flush all the data and dentry blocks, and do checkpoint before
shutdown.
2. FS_GOING_DOWN_METASYNC
: this will do checkpoint before shutdown.
3. FS_GOING_DOWN_NOSYNC
: this will trigger shutdown as is.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/file.c | 37 +++++++++++++++++++++++++++++++++++++
include/uapi/linux/fs.h | 8 ++++++++
2 files changed, 45 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 5df3367..474fb91 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1020,6 +1020,41 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp)
return ret;
}
+static int f2fs_ioc_goingdown(struct file *filp, unsigned long arg)
+{
+ struct inode *inode = file_inode(filp);
+ struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+ struct super_block *sb = sbi->sb;
+ __u32 in;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
+ if (get_user(in, (__u32 __user *)arg))
+ return -EFAULT;
+
+ switch (in) {
+ case FS_GOING_DOWN_FULLSYNC:
+ sb = freeze_bdev(sb->s_bdev);
+ if (sb && !IS_ERR(sb)) {
+ f2fs_stop_checkpoint(sbi);
+ thaw_bdev(sb->s_bdev, sb);
+ }
+ break;
+ case FS_GOING_DOWN_METASYNC:
+ /* do checkpoint only */
+ f2fs_sync_fs(sb, 1);
+ f2fs_stop_checkpoint(sbi);
+ break;
+ case FS_GOING_DOWN_NOSYNC:
+ f2fs_stop_checkpoint(sbi);
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
static int f2fs_ioc_fitrim(struct file *filp, unsigned long arg)
{
struct inode *inode = file_inode(filp);
@@ -1067,6 +1102,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 FS_IOC_GOINGDOWN:
+ return f2fs_ioc_goingdown(filp, arg);
case FITRIM:
return f2fs_ioc_fitrim(filp, arg);
default:
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_WRITE 2
#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 */
--
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] xfs: use generic FS_IOC_GOINGDOWN for ioctl
2015-01-08 22:16 ` Jaegeuk Kim
2015-01-09 1:40 ` [PATCH 2/6 v2] " Jaegeuk Kim
@ 2015-01-09 1:41 ` Jaegeuk Kim
2015-01-09 1:48 ` [PATCH v2] " Jaegeuk Kim
1 sibling, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-09 1:41 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, xfs
This patch uses XFS_IOC_GOINGDOWN for a generic ioctl command, FS_IOC_GOINGDOWN.
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/xfs/xfs_fs.h | 2 +-
fs/xfs/xfs_fsops.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index 18dc721..487a92c 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -555,7 +555,7 @@ typedef struct xfs_swapext
#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
-#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)
+#define XFS_IOC_GOINGDOWN FS_IOC_GOINGDOWN
/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index fdc6422..f403664 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -793,7 +793,7 @@ xfs_fs_goingdown(
__uint32_t inflags)
{
switch (inflags) {
- case XFS_FSOP_GOING_FLAGS_DEFAULT: {
+ case FS_GOING_DOWN_FULLSYNC: {
struct super_block *sb = freeze_bdev(mp->m_super->s_bdev);
if (sb && !IS_ERR(sb)) {
@@ -803,10 +803,10 @@ xfs_fs_goingdown(
break;
}
- case XFS_FSOP_GOING_FLAGS_LOGFLUSH:
+ case FS_GOING_DOWN_METASYNC:
xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
break;
- case XFS_FSOP_GOING_FLAGS_NOLOGFLUSH:
+ case FS_GOING_DOWN_NOSYNC:
xfs_force_shutdown(mp,
SHUTDOWN_FORCE_UMOUNT | SHUTDOWN_LOG_IO_ERROR);
break;
--
2.1.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v2] xfs: use generic FS_IOC_GOINGDOWN for ioctl
2015-01-09 1:41 ` [PATCH] xfs: use generic FS_IOC_GOINGDOWN for ioctl Jaegeuk Kim
@ 2015-01-09 1:48 ` Jaegeuk Kim
2015-01-09 2:17 ` Dave Chinner
0 siblings, 1 reply; 18+ messages in thread
From: Jaegeuk Kim @ 2015-01-09 1:48 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, xfs
Change log from v1:
o remove the obsolete options.
-- >8 --
This patch uses XFS_IOC_GOINGDOWN for a generic ioctl command, FS_IOC_GOINGDOWN.
Cc: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/xfs/xfs_fs.h | 9 +--------
fs/xfs/xfs_fsops.c | 6 +++---
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index 18dc721..a44f528 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -482,13 +482,6 @@ typedef struct xfs_swapext
} xfs_swapext_t;
/*
- * Flags for going down operation
- */
-#define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* 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 */
-
-/*
* ioctl commands that are used by Linux filesystems
*/
#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
@@ -555,7 +548,7 @@ typedef struct xfs_swapext
#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
#define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
-#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)
+#define XFS_IOC_GOINGDOWN FS_IOC_GOINGDOWN
/* XFS_IOC_GETFSUUID ---------- deprecated 140 */
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index fdc6422..f403664 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -793,7 +793,7 @@ xfs_fs_goingdown(
__uint32_t inflags)
{
switch (inflags) {
- case XFS_FSOP_GOING_FLAGS_DEFAULT: {
+ case FS_GOING_DOWN_FULLSYNC: {
struct super_block *sb = freeze_bdev(mp->m_super->s_bdev);
if (sb && !IS_ERR(sb)) {
@@ -803,10 +803,10 @@ xfs_fs_goingdown(
break;
}
- case XFS_FSOP_GOING_FLAGS_LOGFLUSH:
+ case FS_GOING_DOWN_METASYNC:
xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
break;
- case XFS_FSOP_GOING_FLAGS_NOLOGFLUSH:
+ case FS_GOING_DOWN_NOSYNC:
xfs_force_shutdown(mp,
SHUTDOWN_FORCE_UMOUNT | SHUTDOWN_LOG_IO_ERROR);
break;
--
2.1.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v2] xfs: use generic FS_IOC_GOINGDOWN for ioctl
2015-01-09 1:48 ` [PATCH v2] " Jaegeuk Kim
@ 2015-01-09 2:17 ` Dave Chinner
0 siblings, 0 replies; 18+ messages in thread
From: Dave Chinner @ 2015-01-09 2:17 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, xfs
On Thu, Jan 08, 2015 at 05:48:33PM -0800, Jaegeuk Kim wrote:
> Change log from v1:
> o remove the obsolete options.
>
> -- >8 --
>
> This patch uses XFS_IOC_GOINGDOWN for a generic ioctl command, FS_IOC_GOINGDOWN.
Please send the initial rename patch and the XFS changing patches as
a linked series to the same mailing lists.
> Cc: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/xfs/xfs_fs.h | 9 +--------
> fs/xfs/xfs_fsops.c | 6 +++---
> 2 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
> index 18dc721..a44f528 100644
> --- a/fs/xfs/xfs_fs.h
> +++ b/fs/xfs/xfs_fs.h
> @@ -482,13 +482,6 @@ typedef struct xfs_swapext
> } xfs_swapext_t;
>
> /*
> - * Flags for going down operation
> - */
> -#define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* 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 */
We are going to need those to remain as we have to support them
forever more.
i.e.
#define XFS_FSOP_GOING_FLAGS_DEFAULT FS_SHUTDOWN_FULLSYNC
#define XFS_FSOP_GOING_FLAGS_LOGFLUSH FS_SHUTDOWN_METASYNC
#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH FS_SHUTDOWN_NOSYNC
> -
> -/*
> * ioctl commands that are used by Linux filesystems
> */
> #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS
> @@ -555,7 +548,7 @@ typedef struct xfs_swapext
> #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)
> #define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
> #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom)
> -#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t)
> +#define XFS_IOC_GOINGDOWN FS_IOC_GOINGDOWN
> /* XFS_IOC_GETFSUUID ---------- deprecated 140 */
Can we call the new ioctl name FS_IOC_SHUTDOWN?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [f2fs-dev] [PATCH 2/6 v2] f2fs: support goingdown for fs shutdown
2015-01-09 1:40 ` [PATCH 2/6 v2] " Jaegeuk Kim
@ 2015-01-09 2:24 ` Dave Chinner
0 siblings, 0 replies; 18+ messages in thread
From: Dave Chinner @ 2015-01-09 2:24 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-fsdevel, Eric Sandeen, linux-kernel, linux-f2fs-devel
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_WRITE 2
> #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
david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2015-01-09 2:24 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 18:10 [PATCH 1/6] f2fs: fix wrong unlock_page call Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 2/6] f2fs: support goingdown for fs shutdown Jaegeuk Kim
2015-01-08 19:54 ` Eric Sandeen
2015-01-08 20:18 ` Jaegeuk Kim
2015-01-08 20:33 ` Eric Sandeen
2015-01-08 20:54 ` Dave Chinner
2015-01-08 21:21 ` Jaegeuk Kim
2015-01-08 22:04 ` Dave Chinner
2015-01-08 22:16 ` Jaegeuk Kim
2015-01-09 1:40 ` [PATCH 2/6 v2] " Jaegeuk Kim
2015-01-09 2:24 ` [f2fs-dev] " Dave Chinner
2015-01-09 1:41 ` [PATCH] xfs: use generic FS_IOC_GOINGDOWN for ioctl Jaegeuk Kim
2015-01-09 1:48 ` [PATCH v2] " Jaegeuk Kim
2015-01-09 2:17 ` Dave Chinner
2015-01-08 18:10 ` [PATCH 3/6] f2fs: free radix_tree_nodes used by nat_set entries Jaegeuk Kim
2015-01-08 18:10 ` [PATCH 4/6] f2fs: add nat/sit entries into status Jaegeuk Kim
2015-01-08 18:11 ` [PATCH 5/6] f2fs: add spin_lock to cover radix operations in IO tracer Jaegeuk Kim
2015-01-08 18:11 ` [PATCH 6/6] f2fs: add f2fs_destroy_trace_ios to free radix tree Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).