diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-01-18 12:44:20 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-02-05 13:37:14 -0500 |
commit | e5dab552c82ce416d7be867b1e5a0fa585dcf590 (patch) | |
tree | 3719a33f1bd5a29785e4ca35982d9610dd5a1a63 /fs/gfs2/glock.c | |
parent | fee852e374fb367c5436b1226eb93b35f8355ed9 (diff) |
[GFS2] Remove the "greedy" function from glock.[ch]
The "greedy" code was an attempt to retain glocks for a minimum length
of time when they relate to mmap()ed files. The current implementation
of this feature is not, however, ideal in that it required allocating
memory in order to do this and its overly complicated.
It also misses the mark by ignoring the other I/O operations which are
just as likely to suffer from the same problem. So the plan is to remove
this now and then add the functionality back as part of the glock state
machine at a later date (and thus take into account all the possible
users of this feature)
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 5341e03b873f..90847e0957bb 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -34,11 +34,6 @@ | |||
34 | #include "super.h" | 34 | #include "super.h" |
35 | #include "util.h" | 35 | #include "util.h" |
36 | 36 | ||
37 | struct greedy { | ||
38 | struct gfs2_holder gr_gh; | ||
39 | struct delayed_work gr_work; | ||
40 | }; | ||
41 | |||
42 | struct gfs2_gl_hash_bucket { | 37 | struct gfs2_gl_hash_bucket { |
43 | struct hlist_head hb_list; | 38 | struct hlist_head hb_list; |
44 | }; | 39 | }; |
@@ -618,30 +613,6 @@ static int rq_demote(struct gfs2_holder *gh) | |||
618 | } | 613 | } |
619 | 614 | ||
620 | /** | 615 | /** |
621 | * rq_greedy - process a queued request to drop greedy status | ||
622 | * @gh: the glock holder | ||
623 | * | ||
624 | * Returns: 1 if the queue is blocked | ||
625 | */ | ||
626 | |||
627 | static int rq_greedy(struct gfs2_holder *gh) | ||
628 | { | ||
629 | struct gfs2_glock *gl = gh->gh_gl; | ||
630 | |||
631 | list_del_init(&gh->gh_list); | ||
632 | /* gh->gh_error never examined. */ | ||
633 | clear_bit(GLF_GREEDY, &gl->gl_flags); | ||
634 | spin_unlock(&gl->gl_spin); | ||
635 | |||
636 | gfs2_holder_uninit(gh); | ||
637 | kfree(container_of(gh, struct greedy, gr_gh)); | ||
638 | |||
639 | spin_lock(&gl->gl_spin); | ||
640 | |||
641 | return 0; | ||
642 | } | ||
643 | |||
644 | /** | ||
645 | * run_queue - process holder structures on a glock | 616 | * run_queue - process holder structures on a glock |
646 | * @gl: the glock | 617 | * @gl: the glock |
647 | * | 618 | * |
@@ -671,8 +642,6 @@ static void run_queue(struct gfs2_glock *gl) | |||
671 | 642 | ||
672 | if (test_bit(HIF_DEMOTE, &gh->gh_iflags)) | 643 | if (test_bit(HIF_DEMOTE, &gh->gh_iflags)) |
673 | blocked = rq_demote(gh); | 644 | blocked = rq_demote(gh); |
674 | else if (test_bit(HIF_GREEDY, &gh->gh_iflags)) | ||
675 | blocked = rq_greedy(gh); | ||
676 | else | 645 | else |
677 | gfs2_assert_warn(gl->gl_sbd, 0); | 646 | gfs2_assert_warn(gl->gl_sbd, 0); |
678 | 647 | ||
@@ -1336,68 +1305,6 @@ void gfs2_glock_dq(struct gfs2_holder *gh) | |||
1336 | spin_unlock(&gl->gl_spin); | 1305 | spin_unlock(&gl->gl_spin); |
1337 | } | 1306 | } |
1338 | 1307 | ||
1339 | static void greedy_work(struct work_struct *work) | ||
1340 | { | ||
1341 | struct greedy *gr = container_of(work, struct greedy, gr_work.work); | ||
1342 | struct gfs2_holder *gh = &gr->gr_gh; | ||
1343 | struct gfs2_glock *gl = gh->gh_gl; | ||
1344 | const struct gfs2_glock_operations *glops = gl->gl_ops; | ||
1345 | |||
1346 | clear_bit(GLF_SKIP_WAITERS2, &gl->gl_flags); | ||
1347 | |||
1348 | if (glops->go_greedy) | ||
1349 | glops->go_greedy(gl); | ||
1350 | |||
1351 | spin_lock(&gl->gl_spin); | ||
1352 | |||
1353 | if (list_empty(&gl->gl_waiters2)) { | ||
1354 | clear_bit(GLF_GREEDY, &gl->gl_flags); | ||
1355 | spin_unlock(&gl->gl_spin); | ||
1356 | gfs2_holder_uninit(gh); | ||
1357 | kfree(gr); | ||
1358 | } else { | ||
1359 | gfs2_glock_hold(gl); | ||
1360 | list_add_tail(&gh->gh_list, &gl->gl_waiters2); | ||
1361 | run_queue(gl); | ||
1362 | spin_unlock(&gl->gl_spin); | ||
1363 | gfs2_glock_put(gl); | ||
1364 | } | ||
1365 | } | ||
1366 | |||
1367 | /** | ||
1368 | * gfs2_glock_be_greedy - | ||
1369 | * @gl: | ||
1370 | * @time: | ||
1371 | * | ||
1372 | * Returns: 0 if go_greedy will be called, 1 otherwise | ||
1373 | */ | ||
1374 | |||
1375 | int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time) | ||
1376 | { | ||
1377 | struct greedy *gr; | ||
1378 | struct gfs2_holder *gh; | ||
1379 | |||
1380 | if (!time || gl->gl_sbd->sd_args.ar_localcaching || | ||
1381 | test_and_set_bit(GLF_GREEDY, &gl->gl_flags)) | ||
1382 | return 1; | ||
1383 | |||
1384 | gr = kmalloc(sizeof(struct greedy), GFP_KERNEL); | ||
1385 | if (!gr) { | ||
1386 | clear_bit(GLF_GREEDY, &gl->gl_flags); | ||
1387 | return 1; | ||
1388 | } | ||
1389 | gh = &gr->gr_gh; | ||
1390 | |||
1391 | gfs2_holder_init(gl, 0, 0, gh); | ||
1392 | set_bit(HIF_GREEDY, &gh->gh_iflags); | ||
1393 | INIT_DELAYED_WORK(&gr->gr_work, greedy_work); | ||
1394 | |||
1395 | set_bit(GLF_SKIP_WAITERS2, &gl->gl_flags); | ||
1396 | schedule_delayed_work(&gr->gr_work, time); | ||
1397 | |||
1398 | return 0; | ||
1399 | } | ||
1400 | |||
1401 | /** | 1308 | /** |
1402 | * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it | 1309 | * gfs2_glock_dq_uninit - dequeue a holder from a glock and initialize it |
1403 | * @gh: the holder structure | 1310 | * @gh: the holder structure |