the real needs of just_schedule
Subsystems (3)
PATCH 1/2 the real needs of just_schedule
there are some situations which really need a just schedule, with int return value;
and this should be moved into lib/ in the future.
--- fs/inode.c | 2 +- include/linux/writeback.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
fs/inode.c +1 -1
@@ -1291,7 +1291,7 @@ int inode_needs_sync(struct inode *inode)EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) +int just_schedule (void *word) {schedule ();return 0 ;
include/linux/writeback.h +12 -4
@@ -67,23 +67,31 @@ struct writeback_control {/* * fs/fs-writeback.c -*/ +*/ void writeback_inodes (struct writeback_control *wbc); -int inode_wait (void *);void sync_inodes_sb (struct super_block *,int wait);void sync_inodes (int wait); +/* +* fs/inode.c +* +* there are some situations which really need a just schedule, +* with int return value; +* and this should be moved into lib/ in the future. +*/ +int just_schedule (void *); +/* writeback.h requires fs.h; it, too, is not included from here. */ static inline void wait_on_inode (struct inode *inode) {might_sleep (); -wait_on_bit (&inode->i_state, __I_LOCK, inode_wait, +wait_on_bit (&inode->i_state, __I_LOCK, just_schedule,TASK_UNINTERRUPTIBLE ); }static inline void inode_sync_wait (struct inode *inode) {might_sleep (); -wait_on_bit (&inode->i_state, __I_SYNC, inode_wait, +wait_on_bit (&inode->i_state, __I_SYNC, just_schedule,TASK_UNINTERRUPTIBLE ); }
Signature · 1 line
1.5.5.1
PATCH 2/2 remove the duplicates of just_schedule
Accroding to the former patch, just_schedule is available from fs/inode.c
--- fs/gfs2/glock.c | 7 +------ fs/gfs2/locking/dlm/lock.c | 9 ++------- fs/gfs2/locking/dlm/lock_dlm.h | 1 + 3 files changed, 4 insertions(+), 13 deletions(-)
fs/gfs2/glock.c +1 -6
@@ -29,6 +29,7 @@#include <linux/freezer.h> #include <linux/workqueue.h> #include <linux/jiffies.h> +#include <linux/writeback.h> #include "gfs2.h" #include "incore.h"
@@ -454,12 +455,6 @@ static void gfs2_holder_wake(struct gfs2_holder *gh)wake_up_bit (&gh->gh_iflags,HIF_WAIT ); } -static int just_schedule (void *word) -{ -schedule (); -return 0 ; -} -static void wait_on_holder (struct gfs2_holder *gh) {might_sleep ();
fs/gfs2/locking/dlm/lock.c +2 -7
@@ -399,12 +399,6 @@ static void gdlm_del_lvb(struct gdlm_lock *lp) lp->lksb.sb_lvbptr =NULL ; } -static int gdlm_ast_wait (void *word) -{ -schedule (); -return 0 ; -} -/* This can do a synchronous dlm request (requiring a lock_dlm thread to get the completion) because gfs won't call hold_lvb() during a callback (from the context of a lock_dlm thread). */
@@ -433,7 +427,8 @@ static int hold_null_lock(struct gdlm_lock *lp)set_bit (LFL_AST_WAIT , &lpn->flags);gdlm_do_lock (lpn); -wait_on_bit (&lpn->flags,LFL_AST_WAIT , gdlm_ast_wait,TASK_UNINTERRUPTIBLE ); +wait_on_bit (&lpn->flags,LFL_AST_WAIT , just_schedule, +TASK_UNINTERRUPTIBLE ); error = lpn->lksb.sb_status;if (error) { printk(KERN_INFO "lock_dlm: hold_null_lock dlm error %d\n",
fs/gfs2/locking/dlm/lock_dlm.h +1 -0
@@ -22,6 +22,7 @@#include <linux/kobject.h> #include <linux/fcntl.h> #include <linux/wait.h> +#include <linux/writeback.h> #include <net/sock.h> #include <linux/dlm.h>
Signature · 1 line
1.5.5.1
Hi,
Quoted 37 lines · Denis Cheng
there are some situations which really need a just schedule, with int return value;
and this should be moved intolib/in the future.Signed-off-by Denis Cheng <[email protected]>--- fs/inode.c | 2 +- include/linux/writeback.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)fs/inode.c +1
-1@@ -1291,7 +1291,7 @@ int inode_needs_sync(struct inode *inode)EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) +int just_schedule (void *word) {schedule ();return 0 ;include/linux/writeback.h +1
-2@@ -67,23 +67,31 @@ struct writeback_control {/* * fs/fs-writeback.c -*/ +*/ void writeback_inodes (struct writeback_control *wbc); -int inode_wait (void *);void sync_inodes_sb (struct super_block *,int wait);void sync_inodes (int wait);
include/linux/writeback.h struct writeback_control { · line 83
Quoted 10 lines
include/linux/writeback.h +9
-0+/* +* fs/inode.c +* +* there are some situations which really need a just schedule, +* with int return value; +* and this should be moved into lib/ in the future. +*/ +int just_schedule (void *); +
Why is now not a good time? :-)
The patches look ok to me otherwise, but I wonder whether I should put them in my tree (since they affect core code) or whether they'd be better in -mm and/or linux-next?
Steve.
Quoted 52 lines · Steven Whitehouse
Hi,
Quoted 37 lines · Denis Cheng
there are some situations which really need a just schedule, with int return value;
and this should be moved intolib/in the future.Signed-off-by Denis Cheng <[email protected]>--- fs/inode.c | 2 +- include/linux/writeback.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)fs/inode.c +1
-1@@ -1291,7 +1291,7 @@ int inode_needs_sync(struct inode *inode)EXPORT_SYMBOL (inode_needs_sync); -int inode_wait (void *word) +int just_schedule (void *word) {schedule ();return 0 ;include/linux/writeback.h +1
-2@@ -67,23 +67,31 @@ struct writeback_control {/* * fs/fs-writeback.c -*/ +*/ void writeback_inodes (struct writeback_control *wbc); -int inode_wait (void *);void sync_inodes_sb (struct super_block *,int wait);void sync_inodes (int wait);include/linux/writeback.h struct writeback_control { · line 83
Quoted 10 lines
include/linux/writeback.h +9
-0+/* +* fs/inode.c +* +* there are some situations which really need a just schedule, +* with int return value; +* and this should be moved into lib/ in the future. +*/ +int just_schedule (void *); +Why is now not a good time? :-)
Quoted 3 lines
The patches look ok to me otherwise, but I wonder whether I should put them in my tree (since they affect core code) or whether they'd be better in -mm and/or linux-next?
The inode_wait in fs core code(fs/inode.c) is really just_schedule, so is the gdlm_ast_wait, and they are all fs related code;
But inode_wait is not a better name for its work, instead just_schedule won.
So I should ask for opinions from fs core crew,
BTW, today I did a grep among the whole kernel tree and found that just_schedule is also useful to other code, such as:
key_wait_bit(security/keys/request_key.c:25)
It's also really a just_schedule.
So just_schedule should go to lib/ ? Or we just append it into kernel/sched.c?
Quoted 2 lines
Steve.
Signature · 1 line
Denis Cheng