summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 19:01:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 08:31:18 -0700
commit1088dcf4c3a0a27fdad5214781d5084b11405238 (patch)
tree4d08f45ff4867d629e5ad4e94e0362e897ffa1e1 /fs
parent76068c4ff1cc03d9d24d17fd9e6a1475bc2f6730 (diff)
downloadlinux-3.10-1088dcf4c3a0a27fdad5214781d5084b11405238.tar.gz
linux-3.10-1088dcf4c3a0a27fdad5214781d5084b11405238.tar.bz2
linux-3.10-1088dcf4c3a0a27fdad5214781d5084b11405238.zip
nilfs2: remove timedwait ioctl command
This removes NILFS_IOCTL_TIMEDWAIT command from ioctl interface along with the related flags and wait queue. The command is terrible because it just sleeps in the ioctl. I prefer to avoid this by devising means of event polling in userland program. By reconsidering the userland GC daemon, I found this is possible without changing behaviour of the daemon and sacrificing efficiency. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/ioctl.c95
-rw-r--r--fs/nilfs2/segment.c5
-rw-r--r--fs/nilfs2/the_nilfs.c1
-rw-r--r--fs/nilfs2/the_nilfs.h6
4 files changed, 2 insertions, 105 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 9e4d9e64c8f..85a291ccc1b 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -578,62 +578,9 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
unsigned int cmd, void __user *argp)
{
- int ret;
-
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
-
- ret = nilfs_clean_segments(inode->i_sb, argp);
- clear_nilfs_cond_nongc_write(NILFS_SB(inode->i_sb)->s_nilfs);
- return ret;
-}
-
-static int nilfs_ioctl_test_cond(struct the_nilfs *nilfs, int cond)
-{
- return (cond & NILFS_TIMEDWAIT_SEG_WRITE) &&
- nilfs_cond_nongc_write(nilfs);
-}
-
-static void nilfs_ioctl_clear_cond(struct the_nilfs *nilfs, int cond)
-{
- if (cond & NILFS_TIMEDWAIT_SEG_WRITE)
- clear_nilfs_cond_nongc_write(nilfs);
-}
-
-static int nilfs_ioctl_timedwait(struct inode *inode, struct file *filp,
- unsigned int cmd, void __user *argp)
-{
- struct the_nilfs *nilfs = NILFS_SB(inode->i_sb)->s_nilfs;
- struct nilfs_wait_cond wc;
- long ret;
-
- if (!capable(CAP_SYS_ADMIN))
- return -EPERM;
- if (copy_from_user(&wc, argp, sizeof(wc)))
- return -EFAULT;
-
- unlock_kernel();
- ret = wc.wc_flags ?
- wait_event_interruptible_timeout(
- nilfs->ns_cleanerd_wq,
- nilfs_ioctl_test_cond(nilfs, wc.wc_cond),
- timespec_to_jiffies(&wc.wc_timeout)) :
- wait_event_interruptible(
- nilfs->ns_cleanerd_wq,
- nilfs_ioctl_test_cond(nilfs, wc.wc_cond));
- lock_kernel();
- nilfs_ioctl_clear_cond(nilfs, wc.wc_cond);
-
- if (ret > 0) {
- jiffies_to_timespec(ret, &wc.wc_timeout);
- if (copy_to_user(argp, &wc, sizeof(wc)))
- return -EFAULT;
- return 0;
- }
- if (ret != 0)
- return -EINTR;
-
- return wc.wc_flags ? -ETIME : 0;
+ return nilfs_clean_segments(inode->i_sb, argp);
}
static int nilfs_ioctl_sync(struct inode *inode, struct file *filp,
@@ -679,8 +626,6 @@ int nilfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return nilfs_ioctl_get_bdescs(inode, filp, cmd, argp);
case NILFS_IOCTL_CLEAN_SEGMENTS:
return nilfs_ioctl_clean_segments(inode, filp, cmd, argp);
- case NILFS_IOCTL_TIMEDWAIT:
- return nilfs_ioctl_timedwait(inode, filp, cmd, argp);
case NILFS_IOCTL_SYNC:
return nilfs_ioctl_sync(inode, filp, cmd, argp);
default:
@@ -871,41 +816,6 @@ nilfs_compat_ioctl_clean_segments(struct inode *inode, struct file *filp,
inode, filp, cmd, (unsigned long)uargv);
}
-static int
-nilfs_compat_ioctl_timedwait(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
-{
- struct nilfs_wait_cond __user *uwcond;
- struct nilfs_wait_cond32 __user *uwcond32;
- struct timespec ts;
- int cond, flags, ret;
-
- uwcond = compat_alloc_user_space(sizeof(struct nilfs_wait_cond));
- uwcond32 = compat_ptr(arg);
- if (get_user(cond, &uwcond32->wc_cond) ||
- put_user(cond, &uwcond->wc_cond) ||
- get_user(flags, &uwcond32->wc_flags) ||
- put_user(flags, &uwcond->wc_flags) ||
- get_user(ts.tv_sec, &uwcond32->wc_timeout.tv_sec) ||
- get_user(ts.tv_nsec, &uwcond32->wc_timeout.tv_nsec) ||
- put_user(ts.tv_sec, &uwcond->wc_timeout.tv_sec) ||
- put_user(ts.tv_nsec, &uwcond->wc_timeout.tv_nsec))
- return -EFAULT;
-
- ret = nilfs_compat_locked_ioctl(inode, filp, cmd,
- (unsigned long)uwcond);
- if (ret < 0)
- return ret;
-
- if (get_user(ts.tv_sec, &uwcond->wc_timeout.tv_sec) ||
- get_user(ts.tv_nsec, &uwcond->wc_timeout.tv_nsec) ||
- put_user(ts.tv_sec, &uwcond32->wc_timeout.tv_sec) ||
- put_user(ts.tv_nsec, &uwcond32->wc_timeout.tv_nsec))
- return -EFAULT;
-
- return 0;
-}
-
static int nilfs_compat_ioctl_sync(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
@@ -943,9 +853,6 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
case NILFS_IOCTL32_CLEAN_SEGMENTS:
return nilfs_compat_ioctl_clean_segments(
inode, filp, NILFS_IOCTL_CLEAN_SEGMENTS, arg);
- case NILFS_IOCTL32_TIMEDWAIT:
- return nilfs_compat_ioctl_timedwait(
- inode, filp, NILFS_IOCTL_TIMEDWAIT, arg);
case NILFS_IOCTL_SYNC:
return nilfs_compat_ioctl_sync(inode, filp, cmd, arg);
default:
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 6d66c5cb7b5..5db12d774a0 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2114,11 +2114,8 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
nilfs_drop_collected_inodes(&sci->sc_gc_inodes);
if (update_sr)
nilfs_commit_gcdat_inode(nilfs);
- } else {
+ } else
nilfs->ns_nongc_ctime = sci->sc_seg_ctime;
- set_nilfs_cond_nongc_write(nilfs);
- wake_up(&nilfs->ns_cleanerd_wq);
- }
sci->sc_nblk_inc += sci->sc_nblk_this_inc;
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 852e0bf3a3c..69b62558622 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -73,7 +73,6 @@ struct the_nilfs *alloc_nilfs(struct block_device *bdev)
nilfs->ns_gc_inodes_h = NULL;
INIT_LIST_HEAD(&nilfs->ns_used_segments);
init_rwsem(&nilfs->ns_segctor_sem);
- init_waitqueue_head(&nilfs->ns_cleanerd_wq);
return nilfs;
}
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 9cd3c113f05..75da3730696 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -37,7 +37,6 @@ enum {
THE_NILFS_LOADED, /* Roll-back/roll-forward has done and
the latest checkpoint was loaded */
THE_NILFS_DISCONTINUED, /* 'next' pointer chain has broken */
- THE_NILFS_COND_NONGC_WRITE, /* Condition to wake up cleanerd */
};
/**
@@ -74,7 +73,6 @@ enum {
* @ns_gc_dat: shadow inode of the DAT file inode for GC
* @ns_gc_inodes: dummy inodes to keep live blocks
* @ns_gc_inodes_h: hash list to keep dummy inode holding live blocks
- * @ns_cleanerd_wq: wait queue for cleanerd
* @ns_blocksize_bits: bit length of block size
* @ns_nsegments: number of segments in filesystem
* @ns_blocks_per_segment: number of blocks per segment
@@ -151,9 +149,6 @@ struct the_nilfs {
struct list_head ns_gc_inodes;
struct hlist_head *ns_gc_inodes_h;
- /* cleanerd */
- wait_queue_head_t ns_cleanerd_wq;
-
/* Disk layout information (static) */
unsigned int ns_blocksize_bits;
unsigned long ns_nsegments;
@@ -186,7 +181,6 @@ static inline int nilfs_##name(struct the_nilfs *nilfs) \
THE_NILFS_FNS(INIT, init)
THE_NILFS_FNS(LOADED, loaded)
THE_NILFS_FNS(DISCONTINUED, discontinued)
-THE_NILFS_FNS(COND_NONGC_WRITE, cond_nongc_write)
void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64);
struct the_nilfs *alloc_nilfs(struct block_device *);