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 | |
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>
-rw-r--r-- | fs/gfs2/glock.c | 93 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 2 | ||||
-rw-r--r-- | fs/gfs2/glops.c | 34 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 9 | ||||
-rw-r--r-- | fs/gfs2/ops_super.c | 2 | ||||
-rw-r--r-- | fs/gfs2/ops_vm.c | 24 | ||||
-rw-r--r-- | fs/gfs2/super.c | 3 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 6 |
8 files changed, 2 insertions, 171 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 |
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index bde02a7061ec..ddc56dc4ec9f 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -92,8 +92,6 @@ int gfs2_glock_poll(struct gfs2_holder *gh); | |||
92 | int gfs2_glock_wait(struct gfs2_holder *gh); | 92 | int gfs2_glock_wait(struct gfs2_holder *gh); |
93 | void gfs2_glock_dq(struct gfs2_holder *gh); | 93 | void gfs2_glock_dq(struct gfs2_holder *gh); |
94 | 94 | ||
95 | int gfs2_glock_be_greedy(struct gfs2_glock *gl, unsigned int time); | ||
96 | |||
97 | void gfs2_glock_dq_uninit(struct gfs2_holder *gh); | 95 | void gfs2_glock_dq_uninit(struct gfs2_holder *gh); |
98 | int gfs2_glock_nq_num(struct gfs2_sbd *sdp, | 96 | int gfs2_glock_nq_num(struct gfs2_sbd *sdp, |
99 | u64 number, const struct gfs2_glock_operations *glops, | 97 | u64 number, const struct gfs2_glock_operations *glops, |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index b068d10bcb6e..e4da26fe406f 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -319,39 +319,6 @@ static void inode_go_unlock(struct gfs2_holder *gh) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * inode_greedy - | ||
323 | * @gl: the glock | ||
324 | * | ||
325 | */ | ||
326 | |||
327 | static void inode_greedy(struct gfs2_glock *gl) | ||
328 | { | ||
329 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
330 | struct gfs2_inode *ip = gl->gl_object; | ||
331 | unsigned int quantum = gfs2_tune_get(sdp, gt_greedy_quantum); | ||
332 | unsigned int max = gfs2_tune_get(sdp, gt_greedy_max); | ||
333 | unsigned int new_time; | ||
334 | |||
335 | spin_lock(&ip->i_spin); | ||
336 | |||
337 | if (time_after(ip->i_last_pfault + quantum, jiffies)) { | ||
338 | new_time = ip->i_greedy + quantum; | ||
339 | if (new_time > max) | ||
340 | new_time = max; | ||
341 | } else { | ||
342 | new_time = ip->i_greedy - quantum; | ||
343 | if (!new_time || new_time > max) | ||
344 | new_time = 1; | ||
345 | } | ||
346 | |||
347 | ip->i_greedy = new_time; | ||
348 | |||
349 | spin_unlock(&ip->i_spin); | ||
350 | |||
351 | iput(&ip->i_inode); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * rgrp_go_demote_ok - Check to see if it's ok to unlock a RG's glock | 322 | * rgrp_go_demote_ok - Check to see if it's ok to unlock a RG's glock |
356 | * @gl: the glock | 323 | * @gl: the glock |
357 | * | 324 | * |
@@ -492,7 +459,6 @@ const struct gfs2_glock_operations gfs2_inode_glops = { | |||
492 | .go_demote_ok = inode_go_demote_ok, | 459 | .go_demote_ok = inode_go_demote_ok, |
493 | .go_lock = inode_go_lock, | 460 | .go_lock = inode_go_lock, |
494 | .go_unlock = inode_go_unlock, | 461 | .go_unlock = inode_go_unlock, |
495 | .go_greedy = inode_greedy, | ||
496 | .go_type = LM_TYPE_INODE, | 462 | .go_type = LM_TYPE_INODE, |
497 | }; | 463 | }; |
498 | 464 | ||
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index a24c4af09ce0..dc024b18ea96 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -111,7 +111,6 @@ struct gfs2_glock_operations { | |||
111 | int (*go_lock) (struct gfs2_holder *gh); | 111 | int (*go_lock) (struct gfs2_holder *gh); |
112 | void (*go_unlock) (struct gfs2_holder *gh); | 112 | void (*go_unlock) (struct gfs2_holder *gh); |
113 | void (*go_callback) (struct gfs2_glock *gl, unsigned int state); | 113 | void (*go_callback) (struct gfs2_glock *gl, unsigned int state); |
114 | void (*go_greedy) (struct gfs2_glock *gl); | ||
115 | const int go_type; | 114 | const int go_type; |
116 | }; | 115 | }; |
117 | 116 | ||
@@ -120,7 +119,6 @@ enum { | |||
120 | HIF_MUTEX = 0, | 119 | HIF_MUTEX = 0, |
121 | HIF_PROMOTE = 1, | 120 | HIF_PROMOTE = 1, |
122 | HIF_DEMOTE = 2, | 121 | HIF_DEMOTE = 2, |
123 | HIF_GREEDY = 3, | ||
124 | 122 | ||
125 | /* States */ | 123 | /* States */ |
126 | HIF_ALLOCED = 4, | 124 | HIF_ALLOCED = 4, |
@@ -149,7 +147,6 @@ enum { | |||
149 | GLF_STICKY = 2, | 147 | GLF_STICKY = 2, |
150 | GLF_DIRTY = 5, | 148 | GLF_DIRTY = 5, |
151 | GLF_SKIP_WAITERS2 = 6, | 149 | GLF_SKIP_WAITERS2 = 6, |
152 | GLF_GREEDY = 7, | ||
153 | }; | 150 | }; |
154 | 151 | ||
155 | struct gfs2_glock { | 152 | struct gfs2_glock { |
@@ -166,7 +163,7 @@ struct gfs2_glock { | |||
166 | unsigned long gl_ip; | 163 | unsigned long gl_ip; |
167 | struct list_head gl_holders; | 164 | struct list_head gl_holders; |
168 | struct list_head gl_waiters1; /* HIF_MUTEX */ | 165 | struct list_head gl_waiters1; /* HIF_MUTEX */ |
169 | struct list_head gl_waiters2; /* HIF_DEMOTE, HIF_GREEDY */ | 166 | struct list_head gl_waiters2; /* HIF_DEMOTE */ |
170 | struct list_head gl_waiters3; /* HIF_PROMOTE */ | 167 | struct list_head gl_waiters3; /* HIF_PROMOTE */ |
171 | 168 | ||
172 | const struct gfs2_glock_operations *gl_ops; | 169 | const struct gfs2_glock_operations *gl_ops; |
@@ -235,7 +232,6 @@ struct gfs2_inode { | |||
235 | 232 | ||
236 | spinlock_t i_spin; | 233 | spinlock_t i_spin; |
237 | struct rw_semaphore i_rw_mutex; | 234 | struct rw_semaphore i_rw_mutex; |
238 | unsigned int i_greedy; | ||
239 | unsigned long i_last_pfault; | 235 | unsigned long i_last_pfault; |
240 | 236 | ||
241 | struct buffer_head *i_cache[GFS2_MAX_META_HEIGHT]; | 237 | struct buffer_head *i_cache[GFS2_MAX_META_HEIGHT]; |
@@ -423,9 +419,6 @@ struct gfs2_tune { | |||
423 | unsigned int gt_complain_secs; | 419 | unsigned int gt_complain_secs; |
424 | unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */ | 420 | unsigned int gt_reclaim_limit; /* Max num of glocks in reclaim list */ |
425 | unsigned int gt_entries_per_readdir; | 421 | unsigned int gt_entries_per_readdir; |
426 | unsigned int gt_greedy_default; | ||
427 | unsigned int gt_greedy_quantum; | ||
428 | unsigned int gt_greedy_max; | ||
429 | unsigned int gt_statfs_quantum; | 422 | unsigned int gt_statfs_quantum; |
430 | unsigned int gt_statfs_slow; | 423 | unsigned int gt_statfs_slow; |
431 | }; | 424 | }; |
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c index c22738cdbf2d..47369d011214 100644 --- a/fs/gfs2/ops_super.c +++ b/fs/gfs2/ops_super.c | |||
@@ -452,14 +452,12 @@ out: | |||
452 | 452 | ||
453 | static struct inode *gfs2_alloc_inode(struct super_block *sb) | 453 | static struct inode *gfs2_alloc_inode(struct super_block *sb) |
454 | { | 454 | { |
455 | struct gfs2_sbd *sdp = sb->s_fs_info; | ||
456 | struct gfs2_inode *ip; | 455 | struct gfs2_inode *ip; |
457 | 456 | ||
458 | ip = kmem_cache_alloc(gfs2_inode_cachep, GFP_KERNEL); | 457 | ip = kmem_cache_alloc(gfs2_inode_cachep, GFP_KERNEL); |
459 | if (ip) { | 458 | if (ip) { |
460 | ip->i_flags = 0; | 459 | ip->i_flags = 0; |
461 | ip->i_gl = NULL; | 460 | ip->i_gl = NULL; |
462 | ip->i_greedy = gfs2_tune_get(sdp, gt_greedy_default); | ||
463 | ip->i_last_pfault = jiffies; | 461 | ip->i_last_pfault = jiffies; |
464 | } | 462 | } |
465 | return &ip->i_inode; | 463 | return &ip->i_inode; |
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c index 45a5f11fc39a..14b380fb0602 100644 --- a/fs/gfs2/ops_vm.c +++ b/fs/gfs2/ops_vm.c | |||
@@ -28,34 +28,13 @@ | |||
28 | #include "trans.h" | 28 | #include "trans.h" |
29 | #include "util.h" | 29 | #include "util.h" |
30 | 30 | ||
31 | static void pfault_be_greedy(struct gfs2_inode *ip) | ||
32 | { | ||
33 | unsigned int time; | ||
34 | |||
35 | spin_lock(&ip->i_spin); | ||
36 | time = ip->i_greedy; | ||
37 | ip->i_last_pfault = jiffies; | ||
38 | spin_unlock(&ip->i_spin); | ||
39 | |||
40 | igrab(&ip->i_inode); | ||
41 | if (gfs2_glock_be_greedy(ip->i_gl, time)) | ||
42 | iput(&ip->i_inode); | ||
43 | } | ||
44 | |||
45 | static struct page *gfs2_private_nopage(struct vm_area_struct *area, | 31 | static struct page *gfs2_private_nopage(struct vm_area_struct *area, |
46 | unsigned long address, int *type) | 32 | unsigned long address, int *type) |
47 | { | 33 | { |
48 | struct gfs2_inode *ip = GFS2_I(area->vm_file->f_mapping->host); | 34 | struct gfs2_inode *ip = GFS2_I(area->vm_file->f_mapping->host); |
49 | struct page *result; | ||
50 | 35 | ||
51 | set_bit(GIF_PAGED, &ip->i_flags); | 36 | set_bit(GIF_PAGED, &ip->i_flags); |
52 | 37 | return filemap_nopage(area, address, type); | |
53 | result = filemap_nopage(area, address, type); | ||
54 | |||
55 | if (result && result != NOPAGE_OOM) | ||
56 | pfault_be_greedy(ip); | ||
57 | |||
58 | return result; | ||
59 | } | 38 | } |
60 | 39 | ||
61 | static int alloc_page_backing(struct gfs2_inode *ip, struct page *page) | 40 | static int alloc_page_backing(struct gfs2_inode *ip, struct page *page) |
@@ -167,7 +146,6 @@ static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area, | |||
167 | set_page_dirty(result); | 146 | set_page_dirty(result); |
168 | } | 147 | } |
169 | 148 | ||
170 | pfault_be_greedy(ip); | ||
171 | out: | 149 | out: |
172 | gfs2_glock_dq_uninit(&i_gh); | 150 | gfs2_glock_dq_uninit(&i_gh); |
173 | 151 | ||
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 3e17dcf35a30..ce5353ac8f3d 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -77,9 +77,6 @@ void gfs2_tune_init(struct gfs2_tune *gt) | |||
77 | gt->gt_complain_secs = 10; | 77 | gt->gt_complain_secs = 10; |
78 | gt->gt_reclaim_limit = 5000; | 78 | gt->gt_reclaim_limit = 5000; |
79 | gt->gt_entries_per_readdir = 32; | 79 | gt->gt_entries_per_readdir = 32; |
80 | gt->gt_greedy_default = HZ / 10; | ||
81 | gt->gt_greedy_quantum = HZ / 40; | ||
82 | gt->gt_greedy_max = HZ / 4; | ||
83 | gt->gt_statfs_quantum = 30; | 80 | gt->gt_statfs_quantum = 30; |
84 | gt->gt_statfs_slow = 0; | 81 | gt->gt_statfs_slow = 0; |
85 | } | 82 | } |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 11206118d983..d01f9f0fda26 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -442,9 +442,6 @@ TUNE_ATTR(new_files_directio, 0); | |||
442 | TUNE_ATTR(quota_simul_sync, 1); | 442 | TUNE_ATTR(quota_simul_sync, 1); |
443 | TUNE_ATTR(quota_cache_secs, 1); | 443 | TUNE_ATTR(quota_cache_secs, 1); |
444 | TUNE_ATTR(stall_secs, 1); | 444 | TUNE_ATTR(stall_secs, 1); |
445 | TUNE_ATTR(greedy_default, 1); | ||
446 | TUNE_ATTR(greedy_quantum, 1); | ||
447 | TUNE_ATTR(greedy_max, 1); | ||
448 | TUNE_ATTR(statfs_quantum, 1); | 445 | TUNE_ATTR(statfs_quantum, 1); |
449 | TUNE_ATTR_DAEMON(scand_secs, scand_process); | 446 | TUNE_ATTR_DAEMON(scand_secs, scand_process); |
450 | TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); | 447 | TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); |
@@ -467,9 +464,6 @@ static struct attribute *tune_attrs[] = { | |||
467 | &tune_attr_quota_simul_sync.attr, | 464 | &tune_attr_quota_simul_sync.attr, |
468 | &tune_attr_quota_cache_secs.attr, | 465 | &tune_attr_quota_cache_secs.attr, |
469 | &tune_attr_stall_secs.attr, | 466 | &tune_attr_stall_secs.attr, |
470 | &tune_attr_greedy_default.attr, | ||
471 | &tune_attr_greedy_quantum.attr, | ||
472 | &tune_attr_greedy_max.attr, | ||
473 | &tune_attr_statfs_quantum.attr, | 467 | &tune_attr_statfs_quantum.attr, |
474 | &tune_attr_scand_secs.attr, | 468 | &tune_attr_scand_secs.attr, |
475 | &tune_attr_recoverd_secs.attr, | 469 | &tune_attr_recoverd_secs.attr, |