diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/dlmglue.c | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index c8177d025d25..399d6e24b8db 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -268,9 +268,6 @@ static int ocfs2_meta_lock_update(struct inode *inode, | |||
268 | struct buffer_head **bh); | 268 | struct buffer_head **bh); |
269 | static void ocfs2_drop_osb_locks(struct ocfs2_super *osb); | 269 | static void ocfs2_drop_osb_locks(struct ocfs2_super *osb); |
270 | static inline int ocfs2_highest_compat_lock_level(int level); | 270 | static inline int ocfs2_highest_compat_lock_level(int level); |
271 | static inline int ocfs2_can_downconvert_meta_lock(struct inode *inode, | ||
272 | struct ocfs2_lock_res *lockres, | ||
273 | int new_level); | ||
274 | 271 | ||
275 | static void ocfs2_build_lock_name(enum ocfs2_lock_type type, | 272 | static void ocfs2_build_lock_name(enum ocfs2_lock_type type, |
276 | u64 blkno, | 273 | u64 blkno, |
@@ -2538,106 +2535,6 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
2538 | return ret; | 2535 | return ret; |
2539 | } | 2536 | } |
2540 | 2537 | ||
2541 | static inline int ocfs2_can_downconvert_meta_lock(struct inode *inode, | ||
2542 | struct ocfs2_lock_res *lockres, | ||
2543 | int new_level) | ||
2544 | { | ||
2545 | int ret; | ||
2546 | |||
2547 | mlog_entry_void(); | ||
2548 | |||
2549 | BUG_ON(new_level != LKM_NLMODE && new_level != LKM_PRMODE); | ||
2550 | |||
2551 | if (lockres->l_flags & OCFS2_LOCK_REFRESHING) { | ||
2552 | ret = 0; | ||
2553 | mlog(0, "lockres %s currently being refreshed -- backing " | ||
2554 | "off!\n", lockres->l_name); | ||
2555 | } else if (new_level == LKM_PRMODE) | ||
2556 | ret = !lockres->l_ex_holders && | ||
2557 | ocfs2_inode_fully_checkpointed(inode); | ||
2558 | else /* Must be NLMODE we're converting to. */ | ||
2559 | ret = !lockres->l_ro_holders && !lockres->l_ex_holders && | ||
2560 | ocfs2_inode_fully_checkpointed(inode); | ||
2561 | |||
2562 | mlog_exit(ret); | ||
2563 | return ret; | ||
2564 | } | ||
2565 | |||
2566 | static int ocfs2_do_unblock_meta(struct inode *inode, | ||
2567 | int *requeue) | ||
2568 | { | ||
2569 | int new_level; | ||
2570 | int set_lvb = 0; | ||
2571 | int ret = 0; | ||
2572 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_meta_lockres; | ||
2573 | unsigned long flags; | ||
2574 | |||
2575 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
2576 | |||
2577 | mlog_entry_void(); | ||
2578 | |||
2579 | spin_lock_irqsave(&lockres->l_lock, flags); | ||
2580 | |||
2581 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); | ||
2582 | |||
2583 | mlog(0, "l_level=%d, l_blocking=%d\n", lockres->l_level, | ||
2584 | lockres->l_blocking); | ||
2585 | |||
2586 | BUG_ON(lockres->l_level != LKM_EXMODE && | ||
2587 | lockres->l_level != LKM_PRMODE); | ||
2588 | |||
2589 | if (lockres->l_flags & OCFS2_LOCK_BUSY) { | ||
2590 | *requeue = 1; | ||
2591 | ret = ocfs2_prepare_cancel_convert(osb, lockres); | ||
2592 | spin_unlock_irqrestore(&lockres->l_lock, flags); | ||
2593 | if (ret) { | ||
2594 | ret = ocfs2_cancel_convert(osb, lockres); | ||
2595 | if (ret < 0) | ||
2596 | mlog_errno(ret); | ||
2597 | } | ||
2598 | goto leave; | ||
2599 | } | ||
2600 | |||
2601 | new_level = ocfs2_highest_compat_lock_level(lockres->l_blocking); | ||
2602 | |||
2603 | mlog(0, "l_level=%d, l_blocking=%d, new_level=%d\n", | ||
2604 | lockres->l_level, lockres->l_blocking, new_level); | ||
2605 | |||
2606 | if (ocfs2_can_downconvert_meta_lock(inode, lockres, new_level)) { | ||
2607 | if (lockres->l_level == LKM_EXMODE) | ||
2608 | set_lvb = 1; | ||
2609 | |||
2610 | /* If the lock hasn't been refreshed yet (rare), then | ||
2611 | * our memory inode values are old and we skip | ||
2612 | * stuffing the lvb. There's no need to actually clear | ||
2613 | * out the lvb here as it's value is still valid. */ | ||
2614 | if (!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) { | ||
2615 | if (set_lvb) | ||
2616 | __ocfs2_stuff_meta_lvb(inode); | ||
2617 | } else | ||
2618 | mlog(0, "lockres %s: downconverting stale lock!\n", | ||
2619 | lockres->l_name); | ||
2620 | |||
2621 | mlog(0, "calling ocfs2_downconvert_lock with l_level=%d, " | ||
2622 | "l_blocking=%d, new_level=%d\n", | ||
2623 | lockres->l_level, lockres->l_blocking, new_level); | ||
2624 | |||
2625 | ocfs2_prepare_downconvert(lockres, new_level); | ||
2626 | spin_unlock_irqrestore(&lockres->l_lock, flags); | ||
2627 | ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb); | ||
2628 | goto leave; | ||
2629 | } | ||
2630 | if (!ocfs2_inode_fully_checkpointed(inode)) | ||
2631 | ocfs2_start_checkpoint(osb); | ||
2632 | |||
2633 | *requeue = 1; | ||
2634 | spin_unlock_irqrestore(&lockres->l_lock, flags); | ||
2635 | ret = 0; | ||
2636 | leave: | ||
2637 | mlog_exit(ret); | ||
2638 | return ret; | ||
2639 | } | ||
2640 | |||
2641 | static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, | 2538 | static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, |
2642 | struct ocfs2_lock_res *lockres, | 2539 | struct ocfs2_lock_res *lockres, |
2643 | struct ocfs2_unblock_ctl *ctl, | 2540 | struct ocfs2_unblock_ctl *ctl, |