uptodate.c (6e5a3d7538ad4e46a976862f593faf65750e37cc) | uptodate.c (8cb471e8f82506937fe5e2e9fb0bf90f6b1f1170) |
---|---|
1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * uptodate.c 5 * 6 * Tracking the up-to-date-ness of a local buffer_head with respect to 7 * the cluster. 8 * --- 61 unchanged lines hidden (view full) --- 70 71struct ocfs2_meta_cache_item { 72 struct rb_node c_node; 73 sector_t c_block; 74}; 75 76static struct kmem_cache *ocfs2_uptodate_cachep = NULL; 77 | 1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * uptodate.c 5 * 6 * Tracking the up-to-date-ness of a local buffer_head with respect to 7 * the cluster. 8 * --- 61 unchanged lines hidden (view full) --- 70 71struct ocfs2_meta_cache_item { 72 struct rb_node c_node; 73 sector_t c_block; 74}; 75 76static struct kmem_cache *ocfs2_uptodate_cachep = NULL; 77 |
78static u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci) | 78u64 ocfs2_metadata_cache_owner(struct ocfs2_caching_info *ci) |
79{ 80 BUG_ON(!ci || !ci->ci_ops); 81 82 return ci->ci_ops->co_owner(ci); 83} 84 | 79{ 80 BUG_ON(!ci || !ci->ci_ops); 81 82 return ci->ci_ops->co_owner(ci); 83} 84 |
85struct super_block *ocfs2_metadata_cache_get_super(struct ocfs2_caching_info *ci) 86{ 87 BUG_ON(!ci || !ci->ci_ops); 88 89 return ci->ci_ops->co_get_super(ci); 90} 91 |
|
85static void ocfs2_metadata_cache_lock(struct ocfs2_caching_info *ci) 86{ 87 BUG_ON(!ci || !ci->ci_ops); 88 89 ci->ci_ops->co_cache_lock(ci); 90} 91 92static void ocfs2_metadata_cache_unlock(struct ocfs2_caching_info *ci) 93{ 94 BUG_ON(!ci || !ci->ci_ops); 95 96 ci->ci_ops->co_cache_unlock(ci); 97} 98 | 92static void ocfs2_metadata_cache_lock(struct ocfs2_caching_info *ci) 93{ 94 BUG_ON(!ci || !ci->ci_ops); 95 96 ci->ci_ops->co_cache_lock(ci); 97} 98 99static void ocfs2_metadata_cache_unlock(struct ocfs2_caching_info *ci) 100{ 101 BUG_ON(!ci || !ci->ci_ops); 102 103 ci->ci_ops->co_cache_unlock(ci); 104} 105 |
99static void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci) | 106void ocfs2_metadata_cache_io_lock(struct ocfs2_caching_info *ci) |
100{ 101 BUG_ON(!ci || !ci->ci_ops); 102 103 ci->ci_ops->co_io_lock(ci); 104} 105 | 107{ 108 BUG_ON(!ci || !ci->ci_ops); 109 110 ci->ci_ops->co_io_lock(ci); 111} 112 |
106static void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci) | 113void ocfs2_metadata_cache_io_unlock(struct ocfs2_caching_info *ci) |
107{ 108 BUG_ON(!ci || !ci->ci_ops); 109 110 ci->ci_ops->co_io_unlock(ci); 111} 112 113 114void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, --- 29 unchanged lines hidden (view full) --- 144} 145 146/* Called from locking and called from ocfs2_clear_inode. Dump the 147 * cache for a given inode. 148 * 149 * This function is a few more lines longer than necessary due to some 150 * accounting done here, but I think it's worth tracking down those 151 * bugs sooner -- Mark */ | 114{ 115 BUG_ON(!ci || !ci->ci_ops); 116 117 ci->ci_ops->co_io_unlock(ci); 118} 119 120 121void ocfs2_metadata_cache_init(struct ocfs2_caching_info *ci, --- 29 unchanged lines hidden (view full) --- 151} 152 153/* Called from locking and called from ocfs2_clear_inode. Dump the 154 * cache for a given inode. 155 * 156 * This function is a few more lines longer than necessary due to some 157 * accounting done here, but I think it's worth tracking down those 158 * bugs sooner -- Mark */ |
152void ocfs2_metadata_cache_purge(struct inode *inode) | 159void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci) |
153{ | 160{ |
154 struct ocfs2_inode_info *oi = OCFS2_I(inode); | |
155 unsigned int tree, to_purge, purged; | 161 unsigned int tree, to_purge, purged; |
156 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
157 struct rb_root root = RB_ROOT; 158 159 BUG_ON(!ci || !ci->ci_ops); 160 161 ocfs2_metadata_cache_lock(ci); 162 tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); 163 to_purge = ci->ci_num_cached; 164 --- 53 unchanged lines hidden (view full) --- 218 n = n->rb_right; 219 else 220 return item; 221 } 222 223 return NULL; 224} 225 | 162 struct rb_root root = RB_ROOT; 163 164 BUG_ON(!ci || !ci->ci_ops); 165 166 ocfs2_metadata_cache_lock(ci); 167 tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); 168 to_purge = ci->ci_num_cached; 169 --- 53 unchanged lines hidden (view full) --- 223 n = n->rb_right; 224 else 225 return item; 226 } 227 228 return NULL; 229} 230 |
226static int ocfs2_buffer_cached(struct ocfs2_inode_info *oi, | 231static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, |
227 struct buffer_head *bh) 228{ 229 int index = -1; 230 struct ocfs2_meta_cache_item *item = NULL; | 232 struct buffer_head *bh) 233{ 234 int index = -1; 235 struct ocfs2_meta_cache_item *item = NULL; |
231 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
232 233 ocfs2_metadata_cache_lock(ci); 234 235 mlog(0, "Owner %llu, query block %llu (inline = %u)\n", 236 (unsigned long long)ocfs2_metadata_cache_owner(ci), 237 (unsigned long long) bh->b_blocknr, 238 !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); 239 240 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) | 236 237 ocfs2_metadata_cache_lock(ci); 238 239 mlog(0, "Owner %llu, query block %llu (inline = %u)\n", 240 (unsigned long long)ocfs2_metadata_cache_owner(ci), 241 (unsigned long long) bh->b_blocknr, 242 !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); 243 244 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) |
241 index = ocfs2_search_cache_array(&oi->ip_metadata_cache, 242 bh->b_blocknr); | 245 index = ocfs2_search_cache_array(ci, bh->b_blocknr); |
243 else | 246 else |
244 item = ocfs2_search_cache_tree(&oi->ip_metadata_cache, 245 bh->b_blocknr); | 247 item = ocfs2_search_cache_tree(ci, bh->b_blocknr); |
246 247 ocfs2_metadata_cache_unlock(ci); 248 249 mlog(0, "index = %d, item = %p\n", index, item); 250 251 return (index != -1) || (item != NULL); 252} 253 254/* Warning: even if it returns true, this does *not* guarantee that 255 * the block is stored in our inode metadata cache. 256 * 257 * This can be called under lock_buffer() 258 */ | 248 249 ocfs2_metadata_cache_unlock(ci); 250 251 mlog(0, "index = %d, item = %p\n", index, item); 252 253 return (index != -1) || (item != NULL); 254} 255 256/* Warning: even if it returns true, this does *not* guarantee that 257 * the block is stored in our inode metadata cache. 258 * 259 * This can be called under lock_buffer() 260 */ |
259int ocfs2_buffer_uptodate(struct inode *inode, | 261int ocfs2_buffer_uptodate(struct ocfs2_caching_info *ci, |
260 struct buffer_head *bh) 261{ 262 /* Doesn't matter if the bh is in our cache or not -- if it's 263 * not marked uptodate then we know it can't have correct 264 * data. */ 265 if (!buffer_uptodate(bh)) 266 return 0; 267 268 /* OCFS2 does not allow multiple nodes to be changing the same 269 * block at the same time. */ 270 if (buffer_jbd(bh)) 271 return 1; 272 273 /* Ok, locally the buffer is marked as up to date, now search 274 * our cache to see if we can trust that. */ | 262 struct buffer_head *bh) 263{ 264 /* Doesn't matter if the bh is in our cache or not -- if it's 265 * not marked uptodate then we know it can't have correct 266 * data. */ 267 if (!buffer_uptodate(bh)) 268 return 0; 269 270 /* OCFS2 does not allow multiple nodes to be changing the same 271 * block at the same time. */ 272 if (buffer_jbd(bh)) 273 return 1; 274 275 /* Ok, locally the buffer is marked as up to date, now search 276 * our cache to see if we can trust that. */ |
275 return ocfs2_buffer_cached(OCFS2_I(inode), bh); | 277 return ocfs2_buffer_cached(ci, bh); |
276} 277 | 278} 279 |
278/* | 280/* |
279 * Determine whether a buffer is currently out on a read-ahead request. 280 * ci_io_sem should be held to serialize submitters with the logic here. 281 */ | 281 * Determine whether a buffer is currently out on a read-ahead request. 282 * ci_io_sem should be held to serialize submitters with the logic here. 283 */ |
282int ocfs2_buffer_read_ahead(struct inode *inode, | 284int ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci, |
283 struct buffer_head *bh) 284{ | 285 struct buffer_head *bh) 286{ |
285 return buffer_locked(bh) && ocfs2_buffer_cached(OCFS2_I(inode), bh); | 287 return buffer_locked(bh) && ocfs2_buffer_cached(ci, bh); |
286} 287 288/* Requires ip_lock */ 289static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci, 290 sector_t block) 291{ 292 BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); 293 --- 36 unchanged lines hidden (view full) --- 330 } 331 332 rb_link_node(&new->c_node, parent, p); 333 rb_insert_color(&new->c_node, &ci->ci_cache.ci_tree); 334 ci->ci_num_cached++; 335} 336 337/* co_cache_lock() must be held */ | 288} 289 290/* Requires ip_lock */ 291static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci, 292 sector_t block) 293{ 294 BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); 295 --- 36 unchanged lines hidden (view full) --- 332 } 333 334 rb_link_node(&new->c_node, parent, p); 335 rb_insert_color(&new->c_node, &ci->ci_cache.ci_tree); 336 ci->ci_num_cached++; 337} 338 339/* co_cache_lock() must be held */ |
338static inline int ocfs2_insert_can_use_array(struct ocfs2_inode_info *oi, 339 struct ocfs2_caching_info *ci) | 340static inline int ocfs2_insert_can_use_array(struct ocfs2_caching_info *ci) |
340{ 341 return (ci->ci_flags & OCFS2_CACHE_FL_INLINE) && 342 (ci->ci_num_cached < OCFS2_CACHE_INFO_MAX_ARRAY); 343} 344 345/* tree should be exactly OCFS2_CACHE_INFO_MAX_ARRAY wide. NULL the 346 * pointers in tree after we use them - this allows caller to detect 347 * when to free in case of error. 348 * 349 * The co_cache_lock() must be held. */ | 341{ 342 return (ci->ci_flags & OCFS2_CACHE_FL_INLINE) && 343 (ci->ci_num_cached < OCFS2_CACHE_INFO_MAX_ARRAY); 344} 345 346/* tree should be exactly OCFS2_CACHE_INFO_MAX_ARRAY wide. NULL the 347 * pointers in tree after we use them - this allows caller to detect 348 * when to free in case of error. 349 * 350 * The co_cache_lock() must be held. */ |
350static void ocfs2_expand_cache(struct ocfs2_inode_info *oi, | 351static void ocfs2_expand_cache(struct ocfs2_caching_info *ci, |
351 struct ocfs2_meta_cache_item **tree) 352{ 353 int i; | 352 struct ocfs2_meta_cache_item **tree) 353{ 354 int i; |
354 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
355 356 mlog_bug_on_msg(ci->ci_num_cached != OCFS2_CACHE_INFO_MAX_ARRAY, 357 "Owner %llu, num cached = %u, should be %u\n", 358 (unsigned long long)ocfs2_metadata_cache_owner(ci), 359 ci->ci_num_cached, OCFS2_CACHE_INFO_MAX_ARRAY); 360 mlog_bug_on_msg(!(ci->ci_flags & OCFS2_CACHE_FL_INLINE), 361 "Owner %llu not marked as inline anymore!\n", 362 (unsigned long long)ocfs2_metadata_cache_owner(ci)); --- 15 unchanged lines hidden (view full) --- 378 379 mlog(0, "Expanded %llu to a tree cache: flags 0x%x, num = %u\n", 380 (unsigned long long)ocfs2_metadata_cache_owner(ci), 381 ci->ci_flags, ci->ci_num_cached); 382} 383 384/* Slow path function - memory allocation is necessary. See the 385 * comment above ocfs2_set_buffer_uptodate for more information. */ | 355 356 mlog_bug_on_msg(ci->ci_num_cached != OCFS2_CACHE_INFO_MAX_ARRAY, 357 "Owner %llu, num cached = %u, should be %u\n", 358 (unsigned long long)ocfs2_metadata_cache_owner(ci), 359 ci->ci_num_cached, OCFS2_CACHE_INFO_MAX_ARRAY); 360 mlog_bug_on_msg(!(ci->ci_flags & OCFS2_CACHE_FL_INLINE), 361 "Owner %llu not marked as inline anymore!\n", 362 (unsigned long long)ocfs2_metadata_cache_owner(ci)); --- 15 unchanged lines hidden (view full) --- 378 379 mlog(0, "Expanded %llu to a tree cache: flags 0x%x, num = %u\n", 380 (unsigned long long)ocfs2_metadata_cache_owner(ci), 381 ci->ci_flags, ci->ci_num_cached); 382} 383 384/* Slow path function - memory allocation is necessary. See the 385 * comment above ocfs2_set_buffer_uptodate for more information. */ |
386static void __ocfs2_set_buffer_uptodate(struct ocfs2_inode_info *oi, | 386static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, |
387 sector_t block, 388 int expand_tree) 389{ 390 int i; | 387 sector_t block, 388 int expand_tree) 389{ 390 int i; |
391 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
392 struct ocfs2_meta_cache_item *new = NULL; 393 struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = 394 { NULL, }; 395 396 mlog(0, "Owner %llu, block %llu, expand = %d\n", 397 (unsigned long long)ocfs2_metadata_cache_owner(ci), 398 (unsigned long long)block, expand_tree); 399 --- 15 unchanged lines hidden (view full) --- 415 goto out_free; 416 } 417 418 /* These are initialized in ocfs2_expand_cache! */ 419 } 420 } 421 422 ocfs2_metadata_cache_lock(ci); | 391 struct ocfs2_meta_cache_item *new = NULL; 392 struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = 393 { NULL, }; 394 395 mlog(0, "Owner %llu, block %llu, expand = %d\n", 396 (unsigned long long)ocfs2_metadata_cache_owner(ci), 397 (unsigned long long)block, expand_tree); 398 --- 15 unchanged lines hidden (view full) --- 414 goto out_free; 415 } 416 417 /* These are initialized in ocfs2_expand_cache! */ 418 } 419 } 420 421 ocfs2_metadata_cache_lock(ci); |
423 if (ocfs2_insert_can_use_array(oi, ci)) { | 422 if (ocfs2_insert_can_use_array(ci)) { |
424 mlog(0, "Someone cleared the tree underneath us\n"); 425 /* Ok, items were removed from the cache in between 426 * locks. Detect this and revert back to the fast path */ 427 ocfs2_append_cache_array(ci, block); 428 ocfs2_metadata_cache_unlock(ci); 429 goto out_free; 430 } 431 432 if (expand_tree) | 423 mlog(0, "Someone cleared the tree underneath us\n"); 424 /* Ok, items were removed from the cache in between 425 * locks. Detect this and revert back to the fast path */ 426 ocfs2_append_cache_array(ci, block); 427 ocfs2_metadata_cache_unlock(ci); 428 goto out_free; 429 } 430 431 if (expand_tree) |
433 ocfs2_expand_cache(oi, tree); | 432 ocfs2_expand_cache(ci, tree); |
434 435 __ocfs2_insert_cache_tree(ci, new); 436 ocfs2_metadata_cache_unlock(ci); 437 438 new = NULL; 439out_free: 440 if (new) 441 kmem_cache_free(ocfs2_uptodate_cachep, new); --- 21 unchanged lines hidden (view full) --- 463 * 464 * Note that this function may actually fail to insert the block if 465 * memory cannot be allocated. This is not fatal however (but may 466 * result in a performance penalty) 467 * 468 * Readahead buffers can be passed in here before the I/O request is 469 * completed. 470 */ | 433 434 __ocfs2_insert_cache_tree(ci, new); 435 ocfs2_metadata_cache_unlock(ci); 436 437 new = NULL; 438out_free: 439 if (new) 440 kmem_cache_free(ocfs2_uptodate_cachep, new); --- 21 unchanged lines hidden (view full) --- 462 * 463 * Note that this function may actually fail to insert the block if 464 * memory cannot be allocated. This is not fatal however (but may 465 * result in a performance penalty) 466 * 467 * Readahead buffers can be passed in here before the I/O request is 468 * completed. 469 */ |
471void ocfs2_set_buffer_uptodate(struct inode *inode, | 470void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, |
472 struct buffer_head *bh) 473{ 474 int expand; | 471 struct buffer_head *bh) 472{ 473 int expand; |
475 struct ocfs2_inode_info *oi = OCFS2_I(inode); 476 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
477 478 /* The block may very well exist in our cache already, so avoid 479 * doing any more work in that case. */ | 474 475 /* The block may very well exist in our cache already, so avoid 476 * doing any more work in that case. */ |
480 if (ocfs2_buffer_cached(oi, bh)) | 477 if (ocfs2_buffer_cached(ci, bh)) |
481 return; 482 483 mlog(0, "Owner %llu, inserting block %llu\n", 484 (unsigned long long)ocfs2_metadata_cache_owner(ci), 485 (unsigned long long)bh->b_blocknr); 486 487 /* No need to recheck under spinlock - insertion is guarded by 488 * co_io_lock() */ 489 ocfs2_metadata_cache_lock(ci); | 478 return; 479 480 mlog(0, "Owner %llu, inserting block %llu\n", 481 (unsigned long long)ocfs2_metadata_cache_owner(ci), 482 (unsigned long long)bh->b_blocknr); 483 484 /* No need to recheck under spinlock - insertion is guarded by 485 * co_io_lock() */ 486 ocfs2_metadata_cache_lock(ci); |
490 if (ocfs2_insert_can_use_array(oi, ci)) { | 487 if (ocfs2_insert_can_use_array(ci)) { |
491 /* Fast case - it's an array and there's a free 492 * spot. */ 493 ocfs2_append_cache_array(ci, bh->b_blocknr); 494 ocfs2_metadata_cache_unlock(ci); 495 return; 496 } 497 498 expand = 0; 499 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { 500 /* We need to bump things up to a tree. */ 501 expand = 1; 502 } 503 ocfs2_metadata_cache_unlock(ci); 504 | 488 /* Fast case - it's an array and there's a free 489 * spot. */ 490 ocfs2_append_cache_array(ci, bh->b_blocknr); 491 ocfs2_metadata_cache_unlock(ci); 492 return; 493 } 494 495 expand = 0; 496 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { 497 /* We need to bump things up to a tree. */ 498 expand = 1; 499 } 500 ocfs2_metadata_cache_unlock(ci); 501 |
505 __ocfs2_set_buffer_uptodate(oi, bh->b_blocknr, expand); | 502 __ocfs2_set_buffer_uptodate(ci, bh->b_blocknr, expand); |
506} 507 508/* Called against a newly allocated buffer. Most likely nobody should 509 * be able to read this sort of metadata while it's still being 510 * allocated, but this is careful to take co_io_lock() anyway. */ | 503} 504 505/* Called against a newly allocated buffer. Most likely nobody should 506 * be able to read this sort of metadata while it's still being 507 * allocated, but this is careful to take co_io_lock() anyway. */ |
511void ocfs2_set_new_buffer_uptodate(struct inode *inode, | 508void ocfs2_set_new_buffer_uptodate(struct ocfs2_caching_info *ci, |
512 struct buffer_head *bh) 513{ | 509 struct buffer_head *bh) 510{ |
514 struct ocfs2_inode_info *oi = OCFS2_I(inode); 515 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; 516 | |
517 /* This should definitely *not* exist in our cache */ | 511 /* This should definitely *not* exist in our cache */ |
518 BUG_ON(ocfs2_buffer_cached(oi, bh)); | 512 BUG_ON(ocfs2_buffer_cached(ci, bh)); |
519 520 set_buffer_uptodate(bh); 521 522 ocfs2_metadata_cache_io_lock(ci); | 513 514 set_buffer_uptodate(bh); 515 516 ocfs2_metadata_cache_io_lock(ci); |
523 ocfs2_set_buffer_uptodate(inode, bh); | 517 ocfs2_set_buffer_uptodate(ci, bh); |
524 ocfs2_metadata_cache_io_unlock(ci); 525} 526 527/* Requires ip_lock. */ 528static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, 529 int index) 530{ 531 sector_t *array = ci->ci_cache.ci_array; --- 22 unchanged lines hidden (view full) --- 554{ 555 mlog(0, "remove block %llu from tree\n", 556 (unsigned long long) item->c_block); 557 558 rb_erase(&item->c_node, &ci->ci_cache.ci_tree); 559 ci->ci_num_cached--; 560} 561 | 518 ocfs2_metadata_cache_io_unlock(ci); 519} 520 521/* Requires ip_lock. */ 522static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, 523 int index) 524{ 525 sector_t *array = ci->ci_cache.ci_array; --- 22 unchanged lines hidden (view full) --- 548{ 549 mlog(0, "remove block %llu from tree\n", 550 (unsigned long long) item->c_block); 551 552 rb_erase(&item->c_node, &ci->ci_cache.ci_tree); 553 ci->ci_num_cached--; 554} 555 |
562static void ocfs2_remove_block_from_cache(struct inode *inode, | 556static void ocfs2_remove_block_from_cache(struct ocfs2_caching_info *ci, |
563 sector_t block) 564{ 565 int index; 566 struct ocfs2_meta_cache_item *item = NULL; | 557 sector_t block) 558{ 559 int index; 560 struct ocfs2_meta_cache_item *item = NULL; |
567 struct ocfs2_inode_info *oi = OCFS2_I(inode); 568 struct ocfs2_caching_info *ci = &oi->ip_metadata_cache; | |
569 570 ocfs2_metadata_cache_lock(ci); 571 mlog(0, "Owner %llu, remove %llu, items = %u, array = %u\n", 572 (unsigned long long)ocfs2_metadata_cache_owner(ci), 573 (unsigned long long) block, ci->ci_num_cached, 574 ci->ci_flags & OCFS2_CACHE_FL_INLINE); 575 576 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { --- 11 unchanged lines hidden (view full) --- 588 kmem_cache_free(ocfs2_uptodate_cachep, item); 589} 590 591/* 592 * Called when we remove a chunk of metadata from an inode. We don't 593 * bother reverting things to an inlined array in the case of a remove 594 * which moves us back under the limit. 595 */ | 561 562 ocfs2_metadata_cache_lock(ci); 563 mlog(0, "Owner %llu, remove %llu, items = %u, array = %u\n", 564 (unsigned long long)ocfs2_metadata_cache_owner(ci), 565 (unsigned long long) block, ci->ci_num_cached, 566 ci->ci_flags & OCFS2_CACHE_FL_INLINE); 567 568 if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { --- 11 unchanged lines hidden (view full) --- 580 kmem_cache_free(ocfs2_uptodate_cachep, item); 581} 582 583/* 584 * Called when we remove a chunk of metadata from an inode. We don't 585 * bother reverting things to an inlined array in the case of a remove 586 * which moves us back under the limit. 587 */ |
596void ocfs2_remove_from_cache(struct inode *inode, | 588void ocfs2_remove_from_cache(struct ocfs2_caching_info *ci, |
597 struct buffer_head *bh) 598{ 599 sector_t block = bh->b_blocknr; 600 | 589 struct buffer_head *bh) 590{ 591 sector_t block = bh->b_blocknr; 592 |
601 ocfs2_remove_block_from_cache(inode, block); | 593 ocfs2_remove_block_from_cache(ci, block); |
602} 603 604/* Called when we remove xattr clusters from an inode. */ | 594} 595 596/* Called when we remove xattr clusters from an inode. */ |
605void ocfs2_remove_xattr_clusters_from_cache(struct inode *inode, | 597void ocfs2_remove_xattr_clusters_from_cache(struct ocfs2_caching_info *ci, |
606 sector_t block, 607 u32 c_len) 608{ | 598 sector_t block, 599 u32 c_len) 600{ |
609 unsigned int i, b_len = ocfs2_clusters_to_blocks(inode->i_sb, 1) * c_len; | 601 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 602 unsigned int i, b_len = ocfs2_clusters_to_blocks(sb, 1) * c_len; |
610 611 for (i = 0; i < b_len; i++, block++) | 603 604 for (i = 0; i < b_len; i++, block++) |
612 ocfs2_remove_block_from_cache(inode, block); | 605 ocfs2_remove_block_from_cache(ci, block); |
613} 614 615int __init init_ocfs2_uptodate_cache(void) 616{ 617 ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate", 618 sizeof(struct ocfs2_meta_cache_item), 619 0, SLAB_HWCACHE_ALIGN, NULL); 620 if (!ocfs2_uptodate_cachep) --- 13 unchanged lines hidden --- | 606} 607 608int __init init_ocfs2_uptodate_cache(void) 609{ 610 ocfs2_uptodate_cachep = kmem_cache_create("ocfs2_uptodate", 611 sizeof(struct ocfs2_meta_cache_item), 612 0, SLAB_HWCACHE_ALIGN, NULL); 613 if (!ocfs2_uptodate_cachep) --- 13 unchanged lines hidden --- |