diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index f35dba9bf1d9..de3a198f771e 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -42,6 +42,40 @@ | |||
42 | #include <linux/pagevec.h> | 42 | #include <linux/pagevec.h> |
43 | #include <linux/writeback.h> | 43 | #include <linux/writeback.h> |
44 | 44 | ||
45 | |||
46 | /* | ||
47 | * Prime number of hash buckets since address is used as the key. | ||
48 | */ | ||
49 | #define NVSYNC 37 | ||
50 | #define to_ioend_wq(v) (&xfs_ioend_wq[((unsigned long)v) % NVSYNC]) | ||
51 | static wait_queue_head_t xfs_ioend_wq[NVSYNC]; | ||
52 | |||
53 | void __init | ||
54 | xfs_ioend_init(void) | ||
55 | { | ||
56 | int i; | ||
57 | |||
58 | for (i = 0; i < NVSYNC; i++) | ||
59 | init_waitqueue_head(&xfs_ioend_wq[i]); | ||
60 | } | ||
61 | |||
62 | void | ||
63 | xfs_ioend_wait( | ||
64 | xfs_inode_t *ip) | ||
65 | { | ||
66 | wait_queue_head_t *wq = to_ioend_wq(ip); | ||
67 | |||
68 | wait_event(*wq, (atomic_read(&ip->i_iocount) == 0)); | ||
69 | } | ||
70 | |||
71 | STATIC void | ||
72 | xfs_ioend_wake( | ||
73 | xfs_inode_t *ip) | ||
74 | { | ||
75 | if (atomic_dec_and_test(&ip->i_iocount)) | ||
76 | wake_up(to_ioend_wq(ip)); | ||
77 | } | ||
78 | |||
45 | STATIC void | 79 | STATIC void |
46 | xfs_count_page_state( | 80 | xfs_count_page_state( |
47 | struct page *page, | 81 | struct page *page, |
@@ -164,7 +198,7 @@ xfs_destroy_ioend( | |||
164 | __FILE__, __LINE__); | 198 | __FILE__, __LINE__); |
165 | } | 199 | } |
166 | 200 | ||
167 | vn_iowake(ip); | 201 | xfs_ioend_wake(ip); |
168 | mempool_free(ioend, xfs_ioend_pool); | 202 | mempool_free(ioend, xfs_ioend_pool); |
169 | } | 203 | } |
170 | 204 | ||
@@ -516,7 +550,7 @@ xfs_cancel_ioend( | |||
516 | unlock_buffer(bh); | 550 | unlock_buffer(bh); |
517 | } while ((bh = next_bh) != NULL); | 551 | } while ((bh = next_bh) != NULL); |
518 | 552 | ||
519 | vn_iowake(XFS_I(ioend->io_inode)); | 553 | xfs_ioend_wake(XFS_I(ioend->io_inode)); |
520 | mempool_free(ioend, xfs_ioend_pool); | 554 | mempool_free(ioend, xfs_ioend_pool); |
521 | } while ((ioend = next) != NULL); | 555 | } while ((ioend = next) != NULL); |
522 | } | 556 | } |