Commit 60f51d59 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: open code polling loop instead of using l_wait_event()

Two places that LWI_TIMEOUT_INTERVAL() is used, the outcome is a
simple polling loop that polls every second for some event (with a
limit).

So write a simple loop to make this more apparent.
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarPatrick Farrell <paf@cray.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e3382add
...@@ -1984,8 +1984,7 @@ void ll_umount_begin(struct super_block *sb) ...@@ -1984,8 +1984,7 @@ void ll_umount_begin(struct super_block *sb)
struct ll_sb_info *sbi = ll_s2sbi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd; struct obd_device *obd;
struct obd_ioctl_data *ioc_data; struct obd_ioctl_data *ioc_data;
wait_queue_head_t waitq; int cnt = 0;
struct l_wait_info lwi;
CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb, CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
sb->s_count, atomic_read(&sb->s_active)); sb->s_count, atomic_read(&sb->s_active));
...@@ -2021,10 +2020,10 @@ void ll_umount_begin(struct super_block *sb) ...@@ -2021,10 +2020,10 @@ void ll_umount_begin(struct super_block *sb)
* and then continue. For now, we just periodically checking for vfs * and then continue. For now, we just periodically checking for vfs
* to decrement mnt_cnt and hope to finish it within 10sec. * to decrement mnt_cnt and hope to finish it within 10sec.
*/ */
init_waitqueue_head(&waitq); while (cnt < 10 && !may_umount(sbi->ll_mnt.mnt)) {
lwi = LWI_TIMEOUT_INTERVAL(10 * HZ, schedule_timeout_uninterruptible(HZ);
HZ, NULL, NULL); cnt ++;
l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi); }
schedule(); schedule();
} }
......
...@@ -99,8 +99,7 @@ static int lov_check_set(struct lov_obd *lov, int idx) ...@@ -99,8 +99,7 @@ static int lov_check_set(struct lov_obd *lov, int idx)
*/ */
static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
{ {
wait_queue_head_t waitq; int cnt = 0;
struct l_wait_info lwi;
struct lov_tgt_desc *tgt; struct lov_tgt_desc *tgt;
int rc = 0; int rc = 0;
...@@ -125,11 +124,10 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) ...@@ -125,11 +124,10 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
mutex_unlock(&lov->lov_lock); mutex_unlock(&lov->lov_lock);
init_waitqueue_head(&waitq); while (cnt < obd_timeout && !lov_check_set(lov, ost_idx)) {
lwi = LWI_TIMEOUT_INTERVAL(obd_timeout * HZ, schedule_timeout_uninterruptible(HZ);
HZ, NULL, NULL); cnt ++;
}
rc = l_wait_event(waitq, lov_check_set(lov, ost_idx), &lwi);
if (tgt->ltd_active) if (tgt->ltd_active)
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment