diff options
author | J. Bruce Fields <bfields@redhat.com> | 2010-08-26 13:22:27 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-08-26 13:22:27 -0400 |
commit | f632265d0ffb5acf331252d98c64939849d96bb2 (patch) | |
tree | 31187d9a726bf1ca6ca12e26ad8e7c609eaf4d8b /fs/fscache/page.c | |
parent | 7d94784293096c0a46897acdb83be5abd9278ece (diff) | |
parent | da5cabf80e2433131bf0ed8993abc0f7ea618c73 (diff) |
Merge commit 'v2.6.36-rc1' into HEAD
Diffstat (limited to 'fs/fscache/page.c')
-rw-r--r-- | fs/fscache/page.c | 72 |
1 files changed, 24 insertions, 48 deletions
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 47aefd376e54..41c441c2058d 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -105,7 +105,7 @@ bool __fscache_maybe_release_page(struct fscache_cookie *cookie, | |||
105 | 105 | ||
106 | page_busy: | 106 | page_busy: |
107 | /* we might want to wait here, but that could deadlock the allocator as | 107 | /* we might want to wait here, but that could deadlock the allocator as |
108 | * the slow-work threads writing to the cache may all end up sleeping | 108 | * the work threads writing to the cache may all end up sleeping |
109 | * on memory allocation */ | 109 | * on memory allocation */ |
110 | fscache_stat(&fscache_n_store_vmscan_busy); | 110 | fscache_stat(&fscache_n_store_vmscan_busy); |
111 | return false; | 111 | return false; |
@@ -188,9 +188,8 @@ int __fscache_attr_changed(struct fscache_cookie *cookie) | |||
188 | return -ENOMEM; | 188 | return -ENOMEM; |
189 | } | 189 | } |
190 | 190 | ||
191 | fscache_operation_init(op, NULL); | 191 | fscache_operation_init(op, fscache_attr_changed_op, NULL); |
192 | fscache_operation_init_slow(op, fscache_attr_changed_op); | 192 | op->flags = FSCACHE_OP_ASYNC | (1 << FSCACHE_OP_EXCLUSIVE); |
193 | op->flags = FSCACHE_OP_SLOW | (1 << FSCACHE_OP_EXCLUSIVE); | ||
194 | fscache_set_op_name(op, "Attr"); | 193 | fscache_set_op_name(op, "Attr"); |
195 | 194 | ||
196 | spin_lock(&cookie->lock); | 195 | spin_lock(&cookie->lock); |
@@ -218,24 +217,6 @@ nobufs: | |||
218 | EXPORT_SYMBOL(__fscache_attr_changed); | 217 | EXPORT_SYMBOL(__fscache_attr_changed); |
219 | 218 | ||
220 | /* | 219 | /* |
221 | * handle secondary execution given to a retrieval op on behalf of the | ||
222 | * cache | ||
223 | */ | ||
224 | static void fscache_retrieval_work(struct work_struct *work) | ||
225 | { | ||
226 | struct fscache_retrieval *op = | ||
227 | container_of(work, struct fscache_retrieval, op.fast_work); | ||
228 | unsigned long start; | ||
229 | |||
230 | _enter("{OP%x}", op->op.debug_id); | ||
231 | |||
232 | start = jiffies; | ||
233 | op->op.processor(&op->op); | ||
234 | fscache_hist(fscache_ops_histogram, start); | ||
235 | fscache_put_operation(&op->op); | ||
236 | } | ||
237 | |||
238 | /* | ||
239 | * release a retrieval op reference | 220 | * release a retrieval op reference |
240 | */ | 221 | */ |
241 | static void fscache_release_retrieval_op(struct fscache_operation *_op) | 222 | static void fscache_release_retrieval_op(struct fscache_operation *_op) |
@@ -269,13 +250,12 @@ static struct fscache_retrieval *fscache_alloc_retrieval( | |||
269 | return NULL; | 250 | return NULL; |
270 | } | 251 | } |
271 | 252 | ||
272 | fscache_operation_init(&op->op, fscache_release_retrieval_op); | 253 | fscache_operation_init(&op->op, NULL, fscache_release_retrieval_op); |
273 | op->op.flags = FSCACHE_OP_MYTHREAD | (1 << FSCACHE_OP_WAITING); | 254 | op->op.flags = FSCACHE_OP_MYTHREAD | (1 << FSCACHE_OP_WAITING); |
274 | op->mapping = mapping; | 255 | op->mapping = mapping; |
275 | op->end_io_func = end_io_func; | 256 | op->end_io_func = end_io_func; |
276 | op->context = context; | 257 | op->context = context; |
277 | op->start_time = jiffies; | 258 | op->start_time = jiffies; |
278 | INIT_WORK(&op->op.fast_work, fscache_retrieval_work); | ||
279 | INIT_LIST_HEAD(&op->to_do); | 259 | INIT_LIST_HEAD(&op->to_do); |
280 | fscache_set_op_name(&op->op, "Retr"); | 260 | fscache_set_op_name(&op->op, "Retr"); |
281 | return op; | 261 | return op; |
@@ -710,30 +690,26 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
710 | goto superseded; | 690 | goto superseded; |
711 | } | 691 | } |
712 | 692 | ||
713 | if (page) { | 693 | radix_tree_tag_set(&cookie->stores, page->index, |
714 | radix_tree_tag_set(&cookie->stores, page->index, | 694 | FSCACHE_COOKIE_STORING_TAG); |
715 | FSCACHE_COOKIE_STORING_TAG); | 695 | radix_tree_tag_clear(&cookie->stores, page->index, |
716 | radix_tree_tag_clear(&cookie->stores, page->index, | 696 | FSCACHE_COOKIE_PENDING_TAG); |
717 | FSCACHE_COOKIE_PENDING_TAG); | ||
718 | } | ||
719 | 697 | ||
720 | spin_unlock(&cookie->stores_lock); | 698 | spin_unlock(&cookie->stores_lock); |
721 | spin_unlock(&object->lock); | 699 | spin_unlock(&object->lock); |
722 | 700 | ||
723 | if (page) { | 701 | fscache_set_op_state(&op->op, "Store"); |
724 | fscache_set_op_state(&op->op, "Store"); | 702 | fscache_stat(&fscache_n_store_pages); |
725 | fscache_stat(&fscache_n_store_pages); | 703 | fscache_stat(&fscache_n_cop_write_page); |
726 | fscache_stat(&fscache_n_cop_write_page); | 704 | ret = object->cache->ops->write_page(op, page); |
727 | ret = object->cache->ops->write_page(op, page); | 705 | fscache_stat_d(&fscache_n_cop_write_page); |
728 | fscache_stat_d(&fscache_n_cop_write_page); | 706 | fscache_set_op_state(&op->op, "EndWrite"); |
729 | fscache_set_op_state(&op->op, "EndWrite"); | 707 | fscache_end_page_write(object, page); |
730 | fscache_end_page_write(object, page); | 708 | if (ret < 0) { |
731 | if (ret < 0) { | 709 | fscache_set_op_state(&op->op, "Abort"); |
732 | fscache_set_op_state(&op->op, "Abort"); | 710 | fscache_abort_object(object); |
733 | fscache_abort_object(object); | 711 | } else { |
734 | } else { | 712 | fscache_enqueue_operation(&op->op); |
735 | fscache_enqueue_operation(&op->op); | ||
736 | } | ||
737 | } | 713 | } |
738 | 714 | ||
739 | _leave(""); | 715 | _leave(""); |
@@ -799,9 +775,9 @@ int __fscache_write_page(struct fscache_cookie *cookie, | |||
799 | if (!op) | 775 | if (!op) |
800 | goto nomem; | 776 | goto nomem; |
801 | 777 | ||
802 | fscache_operation_init(&op->op, fscache_release_write_op); | 778 | fscache_operation_init(&op->op, fscache_write_op, |
803 | fscache_operation_init_slow(&op->op, fscache_write_op); | 779 | fscache_release_write_op); |
804 | op->op.flags = FSCACHE_OP_SLOW | (1 << FSCACHE_OP_WAITING); | 780 | op->op.flags = FSCACHE_OP_ASYNC | (1 << FSCACHE_OP_WAITING); |
805 | fscache_set_op_name(&op->op, "Write1"); | 781 | fscache_set_op_name(&op->op, "Write1"); |
806 | 782 | ||
807 | ret = radix_tree_preload(gfp & ~__GFP_HIGHMEM); | 783 | ret = radix_tree_preload(gfp & ~__GFP_HIGHMEM); |
@@ -856,7 +832,7 @@ int __fscache_write_page(struct fscache_cookie *cookie, | |||
856 | fscache_stat(&fscache_n_store_ops); | 832 | fscache_stat(&fscache_n_store_ops); |
857 | fscache_stat(&fscache_n_stores_ok); | 833 | fscache_stat(&fscache_n_stores_ok); |
858 | 834 | ||
859 | /* the slow work queue now carries its own ref on the object */ | 835 | /* the work queue now carries its own ref on the object */ |
860 | fscache_put_operation(&op->op); | 836 | fscache_put_operation(&op->op); |
861 | _leave(" = 0"); | 837 | _leave(" = 0"); |
862 | return 0; | 838 | return 0; |