diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-13 03:44:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-13 03:44:22 -0500 |
commit | f8a6b2b9cee298a9663cbe38ce1eb5240987cb62 (patch) | |
tree | b356490269c9e77d164dcc1477792b882fbb8bdb /fs/ocfs2/dcache.c | |
parent | ba1511bf7fbda452138e4096bf10d5a382710f4f (diff) | |
parent | 071a0bc2ceace31266836801510879407a3701fa (diff) |
Merge branch 'linus' into x86/apic
Conflicts:
arch/x86/kernel/acpi/boot.c
arch/x86/mm/fault.c
Diffstat (limited to 'fs/ocfs2/dcache.c')
-rw-r--r-- | fs/ocfs2/dcache.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b1cc7c381e88..e9d7c2038c0f 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "dlmglue.h" | 38 | #include "dlmglue.h" |
39 | #include "file.h" | 39 | #include "file.h" |
40 | #include "inode.h" | 40 | #include "inode.h" |
41 | #include "super.h" | ||
41 | 42 | ||
42 | 43 | ||
43 | static int ocfs2_dentry_revalidate(struct dentry *dentry, | 44 | static int ocfs2_dentry_revalidate(struct dentry *dentry, |
@@ -294,6 +295,34 @@ out_attach: | |||
294 | return ret; | 295 | return ret; |
295 | } | 296 | } |
296 | 297 | ||
298 | static DEFINE_SPINLOCK(dentry_list_lock); | ||
299 | |||
300 | /* We limit the number of dentry locks to drop in one go. We have | ||
301 | * this limit so that we don't starve other users of ocfs2_wq. */ | ||
302 | #define DL_INODE_DROP_COUNT 64 | ||
303 | |||
304 | /* Drop inode references from dentry locks */ | ||
305 | void ocfs2_drop_dl_inodes(struct work_struct *work) | ||
306 | { | ||
307 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
308 | dentry_lock_work); | ||
309 | struct ocfs2_dentry_lock *dl; | ||
310 | int drop_count = DL_INODE_DROP_COUNT; | ||
311 | |||
312 | spin_lock(&dentry_list_lock); | ||
313 | while (osb->dentry_lock_list && drop_count--) { | ||
314 | dl = osb->dentry_lock_list; | ||
315 | osb->dentry_lock_list = dl->dl_next; | ||
316 | spin_unlock(&dentry_list_lock); | ||
317 | iput(dl->dl_inode); | ||
318 | kfree(dl); | ||
319 | spin_lock(&dentry_list_lock); | ||
320 | } | ||
321 | if (osb->dentry_lock_list) | ||
322 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | ||
323 | spin_unlock(&dentry_list_lock); | ||
324 | } | ||
325 | |||
297 | /* | 326 | /* |
298 | * ocfs2_dentry_iput() and friends. | 327 | * ocfs2_dentry_iput() and friends. |
299 | * | 328 | * |
@@ -318,16 +347,23 @@ out_attach: | |||
318 | static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, | 347 | static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, |
319 | struct ocfs2_dentry_lock *dl) | 348 | struct ocfs2_dentry_lock *dl) |
320 | { | 349 | { |
321 | iput(dl->dl_inode); | ||
322 | ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); | 350 | ocfs2_simple_drop_lockres(osb, &dl->dl_lockres); |
323 | ocfs2_lock_res_free(&dl->dl_lockres); | 351 | ocfs2_lock_res_free(&dl->dl_lockres); |
324 | kfree(dl); | 352 | |
353 | /* We leave dropping of inode reference to ocfs2_wq as that can | ||
354 | * possibly lead to inode deletion which gets tricky */ | ||
355 | spin_lock(&dentry_list_lock); | ||
356 | if (!osb->dentry_lock_list) | ||
357 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | ||
358 | dl->dl_next = osb->dentry_lock_list; | ||
359 | osb->dentry_lock_list = dl; | ||
360 | spin_unlock(&dentry_list_lock); | ||
325 | } | 361 | } |
326 | 362 | ||
327 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, | 363 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, |
328 | struct ocfs2_dentry_lock *dl) | 364 | struct ocfs2_dentry_lock *dl) |
329 | { | 365 | { |
330 | int unlock = 0; | 366 | int unlock; |
331 | 367 | ||
332 | BUG_ON(dl->dl_count == 0); | 368 | BUG_ON(dl->dl_count == 0); |
333 | 369 | ||