Lines Matching refs:osb
99 static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
334 static int ocfs2_lock_create(struct ocfs2_super *osb,
340 static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
343 static inline void ocfs2_cluster_unlock(struct ocfs2_super *osb, in ocfs2_cluster_unlock() argument
347 __ocfs2_cluster_unlock(osb, lockres, level, _RET_IP_); in ocfs2_cluster_unlock()
354 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
368 static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
372 static void ocfs2_drop_osb_locks(struct ocfs2_super *osb);
376 static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
381 static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb,
383 static int ocfs2_cancel_convert(struct ocfs2_super *osb,
511 static void ocfs2_lock_res_init_common(struct ocfs2_super *osb, in ocfs2_lock_res_init_common() argument
529 ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug); in ocfs2_lock_res_init_common()
659 struct ocfs2_super *osb) in ocfs2_super_lock_res_init() argument
666 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_SUPER, in ocfs2_super_lock_res_init()
667 &ocfs2_super_lops, osb); in ocfs2_super_lock_res_init()
671 struct ocfs2_super *osb) in ocfs2_rename_lock_res_init() argument
677 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_RENAME, in ocfs2_rename_lock_res_init()
678 &ocfs2_rename_lops, osb); in ocfs2_rename_lock_res_init()
682 struct ocfs2_super *osb) in ocfs2_nfs_sync_lock_res_init() argument
688 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_NFS_SYNC, in ocfs2_nfs_sync_lock_res_init()
689 &ocfs2_nfs_sync_lops, osb); in ocfs2_nfs_sync_lock_res_init()
692 static void ocfs2_nfs_sync_lock_init(struct ocfs2_super *osb) in ocfs2_nfs_sync_lock_init() argument
694 ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb); in ocfs2_nfs_sync_lock_init()
695 init_rwsem(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock_init()
698 void ocfs2_trim_fs_lock_res_init(struct ocfs2_super *osb) in ocfs2_trim_fs_lock_res_init() argument
700 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock_res_init()
703 mutex_lock(&osb->obs_trim_fs_mutex); in ocfs2_trim_fs_lock_res_init()
707 ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_TRIM_FS, in ocfs2_trim_fs_lock_res_init()
708 &ocfs2_trim_fs_lops, osb); in ocfs2_trim_fs_lock_res_init()
711 void ocfs2_trim_fs_lock_res_uninit(struct ocfs2_super *osb) in ocfs2_trim_fs_lock_res_uninit() argument
713 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock_res_uninit()
715 ocfs2_simple_drop_lockres(osb, lockres); in ocfs2_trim_fs_lock_res_uninit()
718 mutex_unlock(&osb->obs_trim_fs_mutex); in ocfs2_trim_fs_lock_res_uninit()
722 struct ocfs2_super *osb) in ocfs2_orphan_scan_lock_res_init() argument
726 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_ORPHAN_SCAN, in ocfs2_orphan_scan_lock_res_init()
727 &ocfs2_orphan_scan_lops, osb); in ocfs2_orphan_scan_lock_res_init()
757 struct ocfs2_super *osb, u64 ref_blkno, in ocfs2_refcount_lock_res_init() argument
763 ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_REFCOUNT, in ocfs2_refcount_lock_res_init()
764 &ocfs2_refcount_block_lops, osb); in ocfs2_refcount_lock_res_init()
1069 struct ocfs2_super *osb) in __lockres_clear_pending() argument
1089 ocfs2_wake_downconvert_thread(osb); in __lockres_clear_pending()
1095 struct ocfs2_super *osb) in lockres_clear_pending() argument
1100 __lockres_clear_pending(lockres, generation, osb); in lockres_clear_pending()
1117 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_blocking_ast() local
1137 ocfs2_schedule_blocked_lock(osb, lockres); in ocfs2_blocking_ast()
1142 ocfs2_wake_downconvert_thread(osb); in ocfs2_blocking_ast()
1148 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_locking_ast() local
1205 __lockres_clear_pending(lockres, lockres->l_pending_gen, osb); in ocfs2_locking_ast()
1309 static int ocfs2_lock_create(struct ocfs2_super *osb, in ocfs2_lock_create() argument
1334 ret = ocfs2_dlm_lock(osb->cconn, in ocfs2_lock_create()
1340 lockres_clear_pending(lockres, gen, osb); in ocfs2_lock_create()
1469 static int __ocfs2_cluster_lock(struct ocfs2_super *osb, in __ocfs2_cluster_lock() argument
1478 int wait, catch_signals = !(osb->s_mount_opt & OCFS2_MOUNT_NOINTR); in __ocfs2_cluster_lock()
1582 ret = ocfs2_dlm_lock(osb->cconn, in __ocfs2_cluster_lock()
1588 lockres_clear_pending(lockres, gen, osb); in __ocfs2_cluster_lock()
1624 ocfs2_wake_downconvert_thread(osb); in __ocfs2_cluster_lock()
1672 static inline int ocfs2_cluster_lock(struct ocfs2_super *osb, in ocfs2_cluster_lock() argument
1678 return __ocfs2_cluster_lock(osb, lockres, level, lkm_flags, arg_flags, in ocfs2_cluster_lock()
1683 static void __ocfs2_cluster_unlock(struct ocfs2_super *osb, in __ocfs2_cluster_unlock() argument
1692 ocfs2_downconvert_on_unlock(osb, lockres); in __ocfs2_cluster_unlock()
1700 static int ocfs2_create_new_lock(struct ocfs2_super *osb, in ocfs2_create_new_lock() argument
1714 return ocfs2_lock_create(osb, lockres, level, lkm_flags); in ocfs2_create_new_lock()
1726 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_create_new_inode_locks() local
1740 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_rw_lockres, 1, 1); in ocfs2_create_new_inode_locks()
1750 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_inode_lockres, 1, 0); in ocfs2_create_new_inode_locks()
1756 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0); in ocfs2_create_new_inode_locks()
1768 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_rw_lock() local
1774 if (ocfs2_mount_local(osb)) in ocfs2_rw_lock()
1781 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_rw_lock()
1792 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_try_rw_lock() local
1798 if (ocfs2_mount_local(osb)) in ocfs2_try_rw_lock()
1805 status = ocfs2_cluster_lock(osb, lockres, level, DLM_LKF_NOQUEUE, 0); in ocfs2_try_rw_lock()
1813 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_rw_unlock() local
1819 if (!ocfs2_mount_local(osb)) in ocfs2_rw_unlock()
1820 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_rw_unlock()
1830 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_open_lock() local
1835 if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) in ocfs2_open_lock()
1840 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_PR, 0, 0); in ocfs2_open_lock()
1852 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_try_open_lock() local
1858 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_try_open_lock()
1864 if (ocfs2_mount_local(osb)) in ocfs2_try_open_lock()
1877 status = ocfs2_cluster_lock(osb, lockres, level, DLM_LKF_NOQUEUE, 0); in ocfs2_try_open_lock()
1889 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_open_unlock() local
1894 if (ocfs2_mount_local(osb)) in ocfs2_open_unlock()
1898 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_PR); in ocfs2_open_unlock()
1900 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_open_unlock()
1910 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_flock_handle_signal() local
1919 ret = ocfs2_prepare_cancel_convert(osb, lockres); in ocfs2_flock_handle_signal()
1922 ret = ocfs2_cancel_convert(osb, lockres); in ocfs2_flock_handle_signal()
1981 struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb); in ocfs2_file_lock() local
2004 ret = ocfs2_lock_create(osb, lockres, DLM_LOCK_NL, 0); in ocfs2_file_lock()
2026 ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags, in ocfs2_file_lock()
2077 struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb); in ocfs2_file_unlock() local
2103 ret = ocfs2_downconvert_lock(osb, lockres, DLM_LOCK_NL, 0, gen); in ocfs2_file_unlock()
2114 static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, in ocfs2_downconvert_on_unlock() argument
2138 ocfs2_wake_downconvert_thread(osb); in ocfs2_downconvert_on_unlock()
2317 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_lock_update() local
2319 if (ocfs2_mount_local(osb)) in ocfs2_inode_lock_update()
2425 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_lock_full_nested() local
2436 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_inode_lock_full_nested()
2443 ocfs2_mount_local(osb)) in ocfs2_inode_lock_full_nested()
2447 ocfs2_wait_for_recovery(osb); in ocfs2_inode_lock_full_nested()
2455 status = __ocfs2_cluster_lock(osb, lockres, level, dlm_flags, in ocfs2_inode_lock_full_nested()
2471 ocfs2_wait_for_recovery(osb); in ocfs2_inode_lock_full_nested()
2612 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_unlock() local
2618 if (!ocfs2_is_hard_readonly(osb) && in ocfs2_inode_unlock()
2619 !ocfs2_mount_local(osb)) in ocfs2_inode_unlock()
2620 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_inode_unlock()
2740 int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno) in ocfs2_orphan_scan_lock() argument
2746 if (ocfs2_is_hard_readonly(osb)) in ocfs2_orphan_scan_lock()
2749 if (ocfs2_mount_local(osb)) in ocfs2_orphan_scan_lock()
2752 lockres = &osb->osb_orphan_scan.os_lockres; in ocfs2_orphan_scan_lock()
2753 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, 0, 0); in ocfs2_orphan_scan_lock()
2762 *seqno = osb->osb_orphan_scan.os_seqno + 1; in ocfs2_orphan_scan_lock()
2767 void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno) in ocfs2_orphan_scan_unlock() argument
2772 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) { in ocfs2_orphan_scan_unlock()
2773 lockres = &osb->osb_orphan_scan.os_lockres; in ocfs2_orphan_scan_unlock()
2777 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_orphan_scan_unlock()
2781 int ocfs2_super_lock(struct ocfs2_super *osb, in ocfs2_super_lock() argument
2786 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; in ocfs2_super_lock()
2788 if (ocfs2_is_hard_readonly(osb)) in ocfs2_super_lock()
2791 if (ocfs2_mount_local(osb)) in ocfs2_super_lock()
2794 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_super_lock()
2806 status = ocfs2_refresh_slot_info(osb); in ocfs2_super_lock()
2811 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_super_lock()
2820 void ocfs2_super_unlock(struct ocfs2_super *osb, in ocfs2_super_unlock() argument
2824 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; in ocfs2_super_unlock()
2826 if (!ocfs2_mount_local(osb)) in ocfs2_super_unlock()
2827 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_super_unlock()
2830 int ocfs2_rename_lock(struct ocfs2_super *osb) in ocfs2_rename_lock() argument
2833 struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; in ocfs2_rename_lock()
2835 if (ocfs2_is_hard_readonly(osb)) in ocfs2_rename_lock()
2838 if (ocfs2_mount_local(osb)) in ocfs2_rename_lock()
2841 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, 0, 0); in ocfs2_rename_lock()
2848 void ocfs2_rename_unlock(struct ocfs2_super *osb) in ocfs2_rename_unlock() argument
2850 struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; in ocfs2_rename_unlock()
2852 if (!ocfs2_mount_local(osb)) in ocfs2_rename_unlock()
2853 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_rename_unlock()
2856 int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex) in ocfs2_nfs_sync_lock() argument
2859 struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres; in ocfs2_nfs_sync_lock()
2861 if (ocfs2_is_hard_readonly(osb)) in ocfs2_nfs_sync_lock()
2865 down_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2867 down_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2869 if (ocfs2_mount_local(osb)) in ocfs2_nfs_sync_lock()
2872 status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, in ocfs2_nfs_sync_lock()
2878 up_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2880 up_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2886 void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex) in ocfs2_nfs_sync_unlock() argument
2888 struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres; in ocfs2_nfs_sync_unlock()
2890 if (!ocfs2_mount_local(osb)) in ocfs2_nfs_sync_unlock()
2891 ocfs2_cluster_unlock(osb, lockres, in ocfs2_nfs_sync_unlock()
2894 up_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_unlock()
2896 up_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_unlock()
2899 int ocfs2_trim_fs_lock(struct ocfs2_super *osb, in ocfs2_trim_fs_lock() argument
2904 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock()
2909 if (ocfs2_is_hard_readonly(osb)) in ocfs2_trim_fs_lock()
2912 if (ocfs2_mount_local(osb)) in ocfs2_trim_fs_lock()
2915 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, in ocfs2_trim_fs_lock()
2940 void ocfs2_trim_fs_unlock(struct ocfs2_super *osb, in ocfs2_trim_fs_unlock() argument
2944 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_unlock()
2946 if (ocfs2_mount_local(osb)) in ocfs2_trim_fs_unlock()
2960 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_trim_fs_unlock()
2968 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); in ocfs2_dentry_lock() local
2972 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_dentry_lock()
2978 if (ocfs2_mount_local(osb)) in ocfs2_dentry_lock()
2981 ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0); in ocfs2_dentry_lock()
2992 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); in ocfs2_dentry_unlock() local
2994 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) in ocfs2_dentry_unlock()
2995 ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); in ocfs2_dentry_unlock()
3271 struct ocfs2_super *osb; in ocfs2_dlm_debug_open() local
3279 osb = inode->i_private; in ocfs2_dlm_debug_open()
3280 ocfs2_get_dlm_debug(osb->osb_dlm_debug); in ocfs2_dlm_debug_open()
3281 priv->p_dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_debug_open()
3297 static void ocfs2_dlm_init_debug(struct ocfs2_super *osb) in ocfs2_dlm_init_debug() argument
3299 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_init_debug()
3302 osb->osb_debug_root, osb, &ocfs2_dlm_debug_fops); in ocfs2_dlm_init_debug()
3304 debugfs_create_u32("locking_filter", 0600, osb->osb_debug_root, in ocfs2_dlm_init_debug()
3309 static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb) in ocfs2_dlm_shutdown_debug() argument
3311 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_shutdown_debug()
3317 int ocfs2_dlm_init(struct ocfs2_super *osb) in ocfs2_dlm_init() argument
3322 if (ocfs2_mount_local(osb)) { in ocfs2_dlm_init()
3323 osb->node_num = 0; in ocfs2_dlm_init()
3327 ocfs2_dlm_init_debug(osb); in ocfs2_dlm_init()
3330 osb->dc_task = kthread_run(ocfs2_downconvert_thread, osb, "ocfs2dc-%s", in ocfs2_dlm_init()
3331 osb->uuid_str); in ocfs2_dlm_init()
3332 if (IS_ERR(osb->dc_task)) { in ocfs2_dlm_init()
3333 status = PTR_ERR(osb->dc_task); in ocfs2_dlm_init()
3334 osb->dc_task = NULL; in ocfs2_dlm_init()
3340 status = ocfs2_cluster_connect(osb->osb_cluster_stack, in ocfs2_dlm_init()
3341 osb->osb_cluster_name, in ocfs2_dlm_init()
3342 strlen(osb->osb_cluster_name), in ocfs2_dlm_init()
3343 osb->uuid_str, in ocfs2_dlm_init()
3344 strlen(osb->uuid_str), in ocfs2_dlm_init()
3345 &lproto, ocfs2_do_node_down, osb, in ocfs2_dlm_init()
3352 status = ocfs2_cluster_this_node(conn, &osb->node_num); in ocfs2_dlm_init()
3362 ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb); in ocfs2_dlm_init()
3363 ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb); in ocfs2_dlm_init()
3364 ocfs2_nfs_sync_lock_init(osb); in ocfs2_dlm_init()
3365 ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb); in ocfs2_dlm_init()
3367 osb->cconn = conn; in ocfs2_dlm_init()
3370 ocfs2_dlm_shutdown_debug(osb); in ocfs2_dlm_init()
3371 if (osb->dc_task) in ocfs2_dlm_init()
3372 kthread_stop(osb->dc_task); in ocfs2_dlm_init()
3378 void ocfs2_dlm_shutdown(struct ocfs2_super *osb, in ocfs2_dlm_shutdown() argument
3381 ocfs2_drop_osb_locks(osb); in ocfs2_dlm_shutdown()
3389 if (osb->dc_task) { in ocfs2_dlm_shutdown()
3390 kthread_stop(osb->dc_task); in ocfs2_dlm_shutdown()
3391 osb->dc_task = NULL; in ocfs2_dlm_shutdown()
3394 ocfs2_lock_res_free(&osb->osb_super_lockres); in ocfs2_dlm_shutdown()
3395 ocfs2_lock_res_free(&osb->osb_rename_lockres); in ocfs2_dlm_shutdown()
3396 ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres); in ocfs2_dlm_shutdown()
3397 ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres); in ocfs2_dlm_shutdown()
3399 ocfs2_cluster_disconnect(osb->cconn, hangup_pending); in ocfs2_dlm_shutdown()
3400 osb->cconn = NULL; in ocfs2_dlm_shutdown()
3402 ocfs2_dlm_shutdown_debug(osb); in ocfs2_dlm_shutdown()
3405 static int ocfs2_drop_lock(struct ocfs2_super *osb, in ocfs2_drop_lock() argument
3472 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags); in ocfs2_drop_lock()
3487 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
3496 void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb, in ocfs2_mark_lockres_freeing() argument
3507 if (lockres->l_flags & OCFS2_LOCK_QUEUED && current == osb->dc_task) { in ocfs2_mark_lockres_freeing()
3526 spin_lock_irqsave(&osb->dc_task_lock, flags2); in ocfs2_mark_lockres_freeing()
3528 osb->blocked_lock_count--; in ocfs2_mark_lockres_freeing()
3529 spin_unlock_irqrestore(&osb->dc_task_lock, flags2); in ocfs2_mark_lockres_freeing()
3538 ocfs2_process_blocked_lock(osb, lockres); in ocfs2_mark_lockres_freeing()
3556 void ocfs2_simple_drop_lockres(struct ocfs2_super *osb, in ocfs2_simple_drop_lockres() argument
3561 ocfs2_mark_lockres_freeing(osb, lockres); in ocfs2_simple_drop_lockres()
3562 ret = ocfs2_drop_lock(osb, lockres); in ocfs2_simple_drop_lockres()
3567 static void ocfs2_drop_osb_locks(struct ocfs2_super *osb) in ocfs2_drop_osb_locks() argument
3569 ocfs2_simple_drop_lockres(osb, &osb->osb_super_lockres); in ocfs2_drop_osb_locks()
3570 ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres); in ocfs2_drop_osb_locks()
3571 ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres); in ocfs2_drop_osb_locks()
3572 ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres); in ocfs2_drop_osb_locks()
3635 static int ocfs2_downconvert_lock(struct ocfs2_super *osb, in ocfs2_downconvert_lock() argument
3653 if (ocfs2_userspace_stack(osb) && in ocfs2_downconvert_lock()
3660 ret = ocfs2_dlm_lock(osb->cconn, in ocfs2_downconvert_lock()
3666 lockres_clear_pending(lockres, generation, osb); in ocfs2_downconvert_lock()
3679 static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb, in ocfs2_prepare_cancel_convert() argument
3708 static int ocfs2_cancel_convert(struct ocfs2_super *osb, in ocfs2_cancel_convert() argument
3713 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, in ocfs2_cancel_convert()
3725 static int ocfs2_unblock_lock(struct ocfs2_super *osb, in ocfs2_unblock_lock() argument
3781 ret = ocfs2_prepare_cancel_convert(osb, lockres); in ocfs2_unblock_lock()
3784 ret = ocfs2_cancel_convert(osb, lockres); in ocfs2_unblock_lock()
3907 ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb, in ocfs2_unblock_lock()
4010 static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, in ocfs2_dentry_post_unlock() argument
4014 ocfs2_dentry_lock_put(osb, dl); in ocfs2_dentry_post_unlock()
4169 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); in ocfs2_qinfo_unlock() local
4172 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) in ocfs2_qinfo_unlock()
4173 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_qinfo_unlock()
4224 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); in ocfs2_qinfo_lock() local
4229 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_qinfo_lock()
4234 if (ocfs2_mount_local(osb)) in ocfs2_qinfo_lock()
4237 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_qinfo_lock()
4258 struct ocfs2_super *osb = lockres->l_priv; in ocfs2_refcount_lock() local
4261 if (ocfs2_is_hard_readonly(osb)) in ocfs2_refcount_lock()
4264 if (ocfs2_mount_local(osb)) in ocfs2_refcount_lock()
4267 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_refcount_lock()
4278 struct ocfs2_super *osb = lockres->l_priv; in ocfs2_refcount_unlock() local
4280 if (!ocfs2_mount_local(osb)) in ocfs2_refcount_unlock()
4281 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_refcount_unlock()
4284 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb, in ocfs2_process_blocked_lock() argument
4310 status = ocfs2_unblock_lock(osb, lockres, &ctl); in ocfs2_process_blocked_lock()
4319 ocfs2_schedule_blocked_lock(osb, lockres); in ocfs2_process_blocked_lock()
4327 lockres->l_ops->post_unlock(osb, lockres); in ocfs2_process_blocked_lock()
4330 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, in ocfs2_schedule_blocked_lock() argument
4348 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_schedule_blocked_lock()
4351 &osb->blocked_lock_list); in ocfs2_schedule_blocked_lock()
4352 osb->blocked_lock_count++; in ocfs2_schedule_blocked_lock()
4354 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_schedule_blocked_lock()
4357 static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) in ocfs2_downconvert_thread_do_work() argument
4363 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4366 osb->dc_work_sequence = osb->dc_wake_sequence; in ocfs2_downconvert_thread_do_work()
4368 processed = osb->blocked_lock_count; in ocfs2_downconvert_thread_do_work()
4375 while (processed && !list_empty(&osb->blocked_lock_list)) { in ocfs2_downconvert_thread_do_work()
4376 lockres = list_entry(osb->blocked_lock_list.next, in ocfs2_downconvert_thread_do_work()
4379 osb->blocked_lock_count--; in ocfs2_downconvert_thread_do_work()
4380 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4385 ocfs2_process_blocked_lock(osb, lockres); in ocfs2_downconvert_thread_do_work()
4387 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4389 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4392 static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb) in ocfs2_downconvert_thread_lists_empty() argument
4397 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_lists_empty()
4398 if (list_empty(&osb->blocked_lock_list)) in ocfs2_downconvert_thread_lists_empty()
4401 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_lists_empty()
4405 static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb) in ocfs2_downconvert_thread_should_wake() argument
4410 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_should_wake()
4411 if (osb->dc_work_sequence != osb->dc_wake_sequence) in ocfs2_downconvert_thread_should_wake()
4413 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_should_wake()
4420 struct ocfs2_super *osb = arg; in ocfs2_downconvert_thread() local
4425 ocfs2_downconvert_thread_lists_empty(osb))) { in ocfs2_downconvert_thread()
4427 wait_event_interruptible(osb->dc_event, in ocfs2_downconvert_thread()
4428 ocfs2_downconvert_thread_should_wake(osb) || in ocfs2_downconvert_thread()
4433 ocfs2_downconvert_thread_do_work(osb); in ocfs2_downconvert_thread()
4436 osb->dc_task = NULL; in ocfs2_downconvert_thread()
4440 void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb) in ocfs2_wake_downconvert_thread() argument
4444 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_wake_downconvert_thread()
4447 osb->dc_wake_sequence++; in ocfs2_wake_downconvert_thread()
4448 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_wake_downconvert_thread()
4449 wake_up(&osb->dc_event); in ocfs2_wake_downconvert_thread()