Lines Matching refs:osb
98 static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
333 static int ocfs2_lock_create(struct ocfs2_super *osb,
339 static void __ocfs2_cluster_unlock(struct ocfs2_super *osb,
342 static inline void ocfs2_cluster_unlock(struct ocfs2_super *osb, in ocfs2_cluster_unlock() argument
346 __ocfs2_cluster_unlock(osb, lockres, level, _RET_IP_); in ocfs2_cluster_unlock()
353 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
367 static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb,
371 static void ocfs2_drop_osb_locks(struct ocfs2_super *osb);
375 static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
380 static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb,
382 static int ocfs2_cancel_convert(struct ocfs2_super *osb,
510 static void ocfs2_lock_res_init_common(struct ocfs2_super *osb, in ocfs2_lock_res_init_common() argument
528 ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug); in ocfs2_lock_res_init_common()
658 struct ocfs2_super *osb) in ocfs2_super_lock_res_init() argument
665 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_SUPER, in ocfs2_super_lock_res_init()
666 &ocfs2_super_lops, osb); in ocfs2_super_lock_res_init()
670 struct ocfs2_super *osb) in ocfs2_rename_lock_res_init() argument
676 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_RENAME, in ocfs2_rename_lock_res_init()
677 &ocfs2_rename_lops, osb); in ocfs2_rename_lock_res_init()
681 struct ocfs2_super *osb) in ocfs2_nfs_sync_lock_res_init() argument
687 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_NFS_SYNC, in ocfs2_nfs_sync_lock_res_init()
688 &ocfs2_nfs_sync_lops, osb); in ocfs2_nfs_sync_lock_res_init()
691 static void ocfs2_nfs_sync_lock_init(struct ocfs2_super *osb) in ocfs2_nfs_sync_lock_init() argument
693 ocfs2_nfs_sync_lock_res_init(&osb->osb_nfs_sync_lockres, osb); in ocfs2_nfs_sync_lock_init()
694 init_rwsem(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock_init()
697 void ocfs2_trim_fs_lock_res_init(struct ocfs2_super *osb) in ocfs2_trim_fs_lock_res_init() argument
699 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock_res_init()
702 mutex_lock(&osb->obs_trim_fs_mutex); in ocfs2_trim_fs_lock_res_init()
706 ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_TRIM_FS, in ocfs2_trim_fs_lock_res_init()
707 &ocfs2_trim_fs_lops, osb); in ocfs2_trim_fs_lock_res_init()
710 void ocfs2_trim_fs_lock_res_uninit(struct ocfs2_super *osb) in ocfs2_trim_fs_lock_res_uninit() argument
712 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock_res_uninit()
714 ocfs2_simple_drop_lockres(osb, lockres); in ocfs2_trim_fs_lock_res_uninit()
717 mutex_unlock(&osb->obs_trim_fs_mutex); in ocfs2_trim_fs_lock_res_uninit()
721 struct ocfs2_super *osb) in ocfs2_orphan_scan_lock_res_init() argument
725 ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_ORPHAN_SCAN, in ocfs2_orphan_scan_lock_res_init()
726 &ocfs2_orphan_scan_lops, osb); in ocfs2_orphan_scan_lock_res_init()
756 struct ocfs2_super *osb, u64 ref_blkno, in ocfs2_refcount_lock_res_init() argument
762 ocfs2_lock_res_init_common(osb, lockres, OCFS2_LOCK_TYPE_REFCOUNT, in ocfs2_refcount_lock_res_init()
763 &ocfs2_refcount_block_lops, osb); in ocfs2_refcount_lock_res_init()
1068 struct ocfs2_super *osb) in __lockres_clear_pending() argument
1088 ocfs2_wake_downconvert_thread(osb); in __lockres_clear_pending()
1094 struct ocfs2_super *osb) in lockres_clear_pending() argument
1099 __lockres_clear_pending(lockres, generation, osb); in lockres_clear_pending()
1116 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_blocking_ast() local
1136 ocfs2_schedule_blocked_lock(osb, lockres); in ocfs2_blocking_ast()
1141 ocfs2_wake_downconvert_thread(osb); in ocfs2_blocking_ast()
1147 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_locking_ast() local
1204 __lockres_clear_pending(lockres, lockres->l_pending_gen, osb); in ocfs2_locking_ast()
1308 static int ocfs2_lock_create(struct ocfs2_super *osb, in ocfs2_lock_create() argument
1333 ret = ocfs2_dlm_lock(osb->cconn, in ocfs2_lock_create()
1339 lockres_clear_pending(lockres, gen, osb); in ocfs2_lock_create()
1468 static int __ocfs2_cluster_lock(struct ocfs2_super *osb, in __ocfs2_cluster_lock() argument
1477 int wait, catch_signals = !(osb->s_mount_opt & OCFS2_MOUNT_NOINTR); in __ocfs2_cluster_lock()
1581 ret = ocfs2_dlm_lock(osb->cconn, in __ocfs2_cluster_lock()
1587 lockres_clear_pending(lockres, gen, osb); in __ocfs2_cluster_lock()
1623 ocfs2_wake_downconvert_thread(osb); in __ocfs2_cluster_lock()
1671 static inline int ocfs2_cluster_lock(struct ocfs2_super *osb, in ocfs2_cluster_lock() argument
1677 return __ocfs2_cluster_lock(osb, lockres, level, lkm_flags, arg_flags, in ocfs2_cluster_lock()
1682 static void __ocfs2_cluster_unlock(struct ocfs2_super *osb, in __ocfs2_cluster_unlock() argument
1691 ocfs2_downconvert_on_unlock(osb, lockres); in __ocfs2_cluster_unlock()
1699 static int ocfs2_create_new_lock(struct ocfs2_super *osb, in ocfs2_create_new_lock() argument
1713 return ocfs2_lock_create(osb, lockres, level, lkm_flags); in ocfs2_create_new_lock()
1725 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_create_new_inode_locks() local
1739 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_rw_lockres, 1, 1); in ocfs2_create_new_inode_locks()
1749 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_inode_lockres, 1, 0); in ocfs2_create_new_inode_locks()
1755 ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0); in ocfs2_create_new_inode_locks()
1767 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_rw_lock() local
1773 if (ocfs2_mount_local(osb)) in ocfs2_rw_lock()
1780 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_rw_lock()
1791 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_try_rw_lock() local
1797 if (ocfs2_mount_local(osb)) in ocfs2_try_rw_lock()
1804 status = ocfs2_cluster_lock(osb, lockres, level, DLM_LKF_NOQUEUE, 0); in ocfs2_try_rw_lock()
1812 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_rw_unlock() local
1818 if (!ocfs2_mount_local(osb)) in ocfs2_rw_unlock()
1819 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_rw_unlock()
1829 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_open_lock() local
1834 if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) in ocfs2_open_lock()
1839 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_PR, 0, 0); in ocfs2_open_lock()
1851 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_try_open_lock() local
1857 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_try_open_lock()
1863 if (ocfs2_mount_local(osb)) in ocfs2_try_open_lock()
1876 status = ocfs2_cluster_lock(osb, lockres, level, DLM_LKF_NOQUEUE, 0); in ocfs2_try_open_lock()
1888 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_open_unlock() local
1893 if (ocfs2_mount_local(osb)) in ocfs2_open_unlock()
1897 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_PR); in ocfs2_open_unlock()
1899 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_open_unlock()
1909 struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); in ocfs2_flock_handle_signal() local
1918 ret = ocfs2_prepare_cancel_convert(osb, lockres); in ocfs2_flock_handle_signal()
1921 ret = ocfs2_cancel_convert(osb, lockres); in ocfs2_flock_handle_signal()
1980 struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb); in ocfs2_file_lock() local
2003 ret = ocfs2_lock_create(osb, lockres, DLM_LOCK_NL, 0); in ocfs2_file_lock()
2025 ret = ocfs2_dlm_lock(osb->cconn, level, &lockres->l_lksb, lkm_flags, in ocfs2_file_lock()
2076 struct ocfs2_super *osb = OCFS2_SB(file->f_mapping->host->i_sb); in ocfs2_file_unlock() local
2102 ret = ocfs2_downconvert_lock(osb, lockres, DLM_LOCK_NL, 0, gen); in ocfs2_file_unlock()
2113 static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, in ocfs2_downconvert_on_unlock() argument
2137 ocfs2_wake_downconvert_thread(osb); in ocfs2_downconvert_on_unlock()
2321 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_lock_update() local
2323 if (ocfs2_mount_local(osb)) in ocfs2_inode_lock_update()
2434 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_lock_full_nested() local
2445 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_inode_lock_full_nested()
2452 ocfs2_mount_local(osb)) in ocfs2_inode_lock_full_nested()
2456 ocfs2_wait_for_recovery(osb); in ocfs2_inode_lock_full_nested()
2464 status = __ocfs2_cluster_lock(osb, lockres, level, dlm_flags, in ocfs2_inode_lock_full_nested()
2480 ocfs2_wait_for_recovery(osb); in ocfs2_inode_lock_full_nested()
2621 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); in ocfs2_inode_unlock() local
2627 if (!ocfs2_is_hard_readonly(osb) && in ocfs2_inode_unlock()
2628 !ocfs2_mount_local(osb)) in ocfs2_inode_unlock()
2629 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_inode_unlock()
2749 int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno) in ocfs2_orphan_scan_lock() argument
2755 if (ocfs2_is_hard_readonly(osb)) in ocfs2_orphan_scan_lock()
2758 if (ocfs2_mount_local(osb)) in ocfs2_orphan_scan_lock()
2761 lockres = &osb->osb_orphan_scan.os_lockres; in ocfs2_orphan_scan_lock()
2762 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, 0, 0); in ocfs2_orphan_scan_lock()
2771 *seqno = osb->osb_orphan_scan.os_seqno + 1; in ocfs2_orphan_scan_lock()
2776 void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno) in ocfs2_orphan_scan_unlock() argument
2781 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) { in ocfs2_orphan_scan_unlock()
2782 lockres = &osb->osb_orphan_scan.os_lockres; in ocfs2_orphan_scan_unlock()
2786 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_orphan_scan_unlock()
2790 int ocfs2_super_lock(struct ocfs2_super *osb, in ocfs2_super_lock() argument
2795 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; in ocfs2_super_lock()
2797 if (ocfs2_is_hard_readonly(osb)) in ocfs2_super_lock()
2800 if (ocfs2_mount_local(osb)) in ocfs2_super_lock()
2803 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_super_lock()
2815 status = ocfs2_refresh_slot_info(osb); in ocfs2_super_lock()
2820 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_super_lock()
2829 void ocfs2_super_unlock(struct ocfs2_super *osb, in ocfs2_super_unlock() argument
2833 struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; in ocfs2_super_unlock()
2835 if (!ocfs2_mount_local(osb)) in ocfs2_super_unlock()
2836 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_super_unlock()
2839 int ocfs2_rename_lock(struct ocfs2_super *osb) in ocfs2_rename_lock() argument
2842 struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; in ocfs2_rename_lock()
2844 if (ocfs2_is_hard_readonly(osb)) in ocfs2_rename_lock()
2847 if (ocfs2_mount_local(osb)) in ocfs2_rename_lock()
2850 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, 0, 0); in ocfs2_rename_lock()
2857 void ocfs2_rename_unlock(struct ocfs2_super *osb) in ocfs2_rename_unlock() argument
2859 struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres; in ocfs2_rename_unlock()
2861 if (!ocfs2_mount_local(osb)) in ocfs2_rename_unlock()
2862 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_rename_unlock()
2865 int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex) in ocfs2_nfs_sync_lock() argument
2868 struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres; in ocfs2_nfs_sync_lock()
2870 if (ocfs2_is_hard_readonly(osb)) in ocfs2_nfs_sync_lock()
2874 down_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2876 down_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2878 if (ocfs2_mount_local(osb)) in ocfs2_nfs_sync_lock()
2881 status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, in ocfs2_nfs_sync_lock()
2887 up_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2889 up_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_lock()
2895 void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex) in ocfs2_nfs_sync_unlock() argument
2897 struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres; in ocfs2_nfs_sync_unlock()
2899 if (!ocfs2_mount_local(osb)) in ocfs2_nfs_sync_unlock()
2900 ocfs2_cluster_unlock(osb, lockres, in ocfs2_nfs_sync_unlock()
2903 up_write(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_unlock()
2905 up_read(&osb->nfs_sync_rwlock); in ocfs2_nfs_sync_unlock()
2908 int ocfs2_trim_fs_lock(struct ocfs2_super *osb, in ocfs2_trim_fs_lock() argument
2913 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_lock()
2918 if (ocfs2_is_hard_readonly(osb)) in ocfs2_trim_fs_lock()
2921 if (ocfs2_mount_local(osb)) in ocfs2_trim_fs_lock()
2924 status = ocfs2_cluster_lock(osb, lockres, DLM_LOCK_EX, in ocfs2_trim_fs_lock()
2949 void ocfs2_trim_fs_unlock(struct ocfs2_super *osb, in ocfs2_trim_fs_unlock() argument
2953 struct ocfs2_lock_res *lockres = &osb->osb_trim_fs_lockres; in ocfs2_trim_fs_unlock()
2955 if (ocfs2_mount_local(osb)) in ocfs2_trim_fs_unlock()
2969 ocfs2_cluster_unlock(osb, lockres, DLM_LOCK_EX); in ocfs2_trim_fs_unlock()
2977 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); in ocfs2_dentry_lock() local
2981 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_dentry_lock()
2987 if (ocfs2_mount_local(osb)) in ocfs2_dentry_lock()
2990 ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0); in ocfs2_dentry_lock()
3001 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); in ocfs2_dentry_unlock() local
3003 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) in ocfs2_dentry_unlock()
3004 ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); in ocfs2_dentry_unlock()
3278 struct ocfs2_super *osb; in ocfs2_dlm_debug_open() local
3286 osb = inode->i_private; in ocfs2_dlm_debug_open()
3287 ocfs2_get_dlm_debug(osb->osb_dlm_debug); in ocfs2_dlm_debug_open()
3288 priv->p_dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_debug_open()
3304 static void ocfs2_dlm_init_debug(struct ocfs2_super *osb) in ocfs2_dlm_init_debug() argument
3306 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_init_debug()
3309 osb->osb_debug_root, osb, &ocfs2_dlm_debug_fops); in ocfs2_dlm_init_debug()
3311 debugfs_create_u32("locking_filter", 0600, osb->osb_debug_root, in ocfs2_dlm_init_debug()
3316 static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb) in ocfs2_dlm_shutdown_debug() argument
3318 struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug; in ocfs2_dlm_shutdown_debug()
3324 int ocfs2_dlm_init(struct ocfs2_super *osb) in ocfs2_dlm_init() argument
3329 if (ocfs2_mount_local(osb)) { in ocfs2_dlm_init()
3330 osb->node_num = 0; in ocfs2_dlm_init()
3334 ocfs2_dlm_init_debug(osb); in ocfs2_dlm_init()
3337 osb->dc_task = kthread_run(ocfs2_downconvert_thread, osb, "ocfs2dc-%s", in ocfs2_dlm_init()
3338 osb->uuid_str); in ocfs2_dlm_init()
3339 if (IS_ERR(osb->dc_task)) { in ocfs2_dlm_init()
3340 status = PTR_ERR(osb->dc_task); in ocfs2_dlm_init()
3341 osb->dc_task = NULL; in ocfs2_dlm_init()
3347 status = ocfs2_cluster_connect(osb->osb_cluster_stack, in ocfs2_dlm_init()
3348 osb->osb_cluster_name, in ocfs2_dlm_init()
3349 strlen(osb->osb_cluster_name), in ocfs2_dlm_init()
3350 osb->uuid_str, in ocfs2_dlm_init()
3351 strlen(osb->uuid_str), in ocfs2_dlm_init()
3352 &lproto, ocfs2_do_node_down, osb, in ocfs2_dlm_init()
3359 status = ocfs2_cluster_this_node(conn, &osb->node_num); in ocfs2_dlm_init()
3369 ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb); in ocfs2_dlm_init()
3370 ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb); in ocfs2_dlm_init()
3371 ocfs2_nfs_sync_lock_init(osb); in ocfs2_dlm_init()
3372 ocfs2_orphan_scan_lock_res_init(&osb->osb_orphan_scan.os_lockres, osb); in ocfs2_dlm_init()
3374 osb->cconn = conn; in ocfs2_dlm_init()
3377 ocfs2_dlm_shutdown_debug(osb); in ocfs2_dlm_init()
3378 if (osb->dc_task) in ocfs2_dlm_init()
3379 kthread_stop(osb->dc_task); in ocfs2_dlm_init()
3385 void ocfs2_dlm_shutdown(struct ocfs2_super *osb, in ocfs2_dlm_shutdown() argument
3388 ocfs2_drop_osb_locks(osb); in ocfs2_dlm_shutdown()
3396 if (osb->dc_task) { in ocfs2_dlm_shutdown()
3397 kthread_stop(osb->dc_task); in ocfs2_dlm_shutdown()
3398 osb->dc_task = NULL; in ocfs2_dlm_shutdown()
3401 ocfs2_lock_res_free(&osb->osb_super_lockres); in ocfs2_dlm_shutdown()
3402 ocfs2_lock_res_free(&osb->osb_rename_lockres); in ocfs2_dlm_shutdown()
3403 ocfs2_lock_res_free(&osb->osb_nfs_sync_lockres); in ocfs2_dlm_shutdown()
3404 ocfs2_lock_res_free(&osb->osb_orphan_scan.os_lockres); in ocfs2_dlm_shutdown()
3406 if (osb->cconn) { in ocfs2_dlm_shutdown()
3407 ocfs2_cluster_disconnect(osb->cconn, hangup_pending); in ocfs2_dlm_shutdown()
3408 osb->cconn = NULL; in ocfs2_dlm_shutdown()
3410 ocfs2_dlm_shutdown_debug(osb); in ocfs2_dlm_shutdown()
3414 static int ocfs2_drop_lock(struct ocfs2_super *osb, in ocfs2_drop_lock() argument
3481 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, lkm_flags); in ocfs2_drop_lock()
3496 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
3505 void ocfs2_mark_lockres_freeing(struct ocfs2_super *osb, in ocfs2_mark_lockres_freeing() argument
3516 if (lockres->l_flags & OCFS2_LOCK_QUEUED && current == osb->dc_task) { in ocfs2_mark_lockres_freeing()
3535 spin_lock_irqsave(&osb->dc_task_lock, flags2); in ocfs2_mark_lockres_freeing()
3537 osb->blocked_lock_count--; in ocfs2_mark_lockres_freeing()
3538 spin_unlock_irqrestore(&osb->dc_task_lock, flags2); in ocfs2_mark_lockres_freeing()
3547 ocfs2_process_blocked_lock(osb, lockres); in ocfs2_mark_lockres_freeing()
3565 void ocfs2_simple_drop_lockres(struct ocfs2_super *osb, in ocfs2_simple_drop_lockres() argument
3570 ocfs2_mark_lockres_freeing(osb, lockres); in ocfs2_simple_drop_lockres()
3571 ret = ocfs2_drop_lock(osb, lockres); in ocfs2_simple_drop_lockres()
3576 static void ocfs2_drop_osb_locks(struct ocfs2_super *osb) in ocfs2_drop_osb_locks() argument
3578 ocfs2_simple_drop_lockres(osb, &osb->osb_super_lockres); in ocfs2_drop_osb_locks()
3579 ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres); in ocfs2_drop_osb_locks()
3580 ocfs2_simple_drop_lockres(osb, &osb->osb_nfs_sync_lockres); in ocfs2_drop_osb_locks()
3581 ocfs2_simple_drop_lockres(osb, &osb->osb_orphan_scan.os_lockres); in ocfs2_drop_osb_locks()
3644 static int ocfs2_downconvert_lock(struct ocfs2_super *osb, in ocfs2_downconvert_lock() argument
3662 if (ocfs2_userspace_stack(osb) && in ocfs2_downconvert_lock()
3669 ret = ocfs2_dlm_lock(osb->cconn, in ocfs2_downconvert_lock()
3675 lockres_clear_pending(lockres, generation, osb); in ocfs2_downconvert_lock()
3688 static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb, in ocfs2_prepare_cancel_convert() argument
3717 static int ocfs2_cancel_convert(struct ocfs2_super *osb, in ocfs2_cancel_convert() argument
3722 ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, in ocfs2_cancel_convert()
3734 static int ocfs2_unblock_lock(struct ocfs2_super *osb, in ocfs2_unblock_lock() argument
3790 ret = ocfs2_prepare_cancel_convert(osb, lockres); in ocfs2_unblock_lock()
3793 ret = ocfs2_cancel_convert(osb, lockres); in ocfs2_unblock_lock()
3916 ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb, in ocfs2_unblock_lock()
4030 static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, in ocfs2_dentry_post_unlock() argument
4034 ocfs2_dentry_lock_put(osb, dl); in ocfs2_dentry_post_unlock()
4189 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); in ocfs2_qinfo_unlock() local
4192 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) in ocfs2_qinfo_unlock()
4193 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_qinfo_unlock()
4244 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); in ocfs2_qinfo_lock() local
4249 if (ocfs2_is_hard_readonly(osb)) { in ocfs2_qinfo_lock()
4254 if (ocfs2_mount_local(osb)) in ocfs2_qinfo_lock()
4257 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_qinfo_lock()
4278 struct ocfs2_super *osb = lockres->l_priv; in ocfs2_refcount_lock() local
4281 if (ocfs2_is_hard_readonly(osb)) in ocfs2_refcount_lock()
4284 if (ocfs2_mount_local(osb)) in ocfs2_refcount_lock()
4287 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0); in ocfs2_refcount_lock()
4298 struct ocfs2_super *osb = lockres->l_priv; in ocfs2_refcount_unlock() local
4300 if (!ocfs2_mount_local(osb)) in ocfs2_refcount_unlock()
4301 ocfs2_cluster_unlock(osb, lockres, level); in ocfs2_refcount_unlock()
4304 static void ocfs2_process_blocked_lock(struct ocfs2_super *osb, in ocfs2_process_blocked_lock() argument
4330 status = ocfs2_unblock_lock(osb, lockres, &ctl); in ocfs2_process_blocked_lock()
4339 ocfs2_schedule_blocked_lock(osb, lockres); in ocfs2_process_blocked_lock()
4347 lockres->l_ops->post_unlock(osb, lockres); in ocfs2_process_blocked_lock()
4350 static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, in ocfs2_schedule_blocked_lock() argument
4368 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_schedule_blocked_lock()
4371 &osb->blocked_lock_list); in ocfs2_schedule_blocked_lock()
4372 osb->blocked_lock_count++; in ocfs2_schedule_blocked_lock()
4374 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_schedule_blocked_lock()
4377 static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) in ocfs2_downconvert_thread_do_work() argument
4383 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4386 osb->dc_work_sequence = osb->dc_wake_sequence; in ocfs2_downconvert_thread_do_work()
4388 processed = osb->blocked_lock_count; in ocfs2_downconvert_thread_do_work()
4395 while (processed && !list_empty(&osb->blocked_lock_list)) { in ocfs2_downconvert_thread_do_work()
4396 lockres = list_entry(osb->blocked_lock_list.next, in ocfs2_downconvert_thread_do_work()
4399 osb->blocked_lock_count--; in ocfs2_downconvert_thread_do_work()
4400 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4405 ocfs2_process_blocked_lock(osb, lockres); in ocfs2_downconvert_thread_do_work()
4407 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4409 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_do_work()
4412 static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb) in ocfs2_downconvert_thread_lists_empty() argument
4417 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_lists_empty()
4418 if (list_empty(&osb->blocked_lock_list)) in ocfs2_downconvert_thread_lists_empty()
4421 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_lists_empty()
4425 static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb) in ocfs2_downconvert_thread_should_wake() argument
4430 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_should_wake()
4431 if (osb->dc_work_sequence != osb->dc_wake_sequence) in ocfs2_downconvert_thread_should_wake()
4433 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_downconvert_thread_should_wake()
4440 struct ocfs2_super *osb = arg; in ocfs2_downconvert_thread() local
4445 ocfs2_downconvert_thread_lists_empty(osb))) { in ocfs2_downconvert_thread()
4447 wait_event_interruptible(osb->dc_event, in ocfs2_downconvert_thread()
4448 ocfs2_downconvert_thread_should_wake(osb) || in ocfs2_downconvert_thread()
4453 ocfs2_downconvert_thread_do_work(osb); in ocfs2_downconvert_thread()
4456 osb->dc_task = NULL; in ocfs2_downconvert_thread()
4460 void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb) in ocfs2_wake_downconvert_thread() argument
4464 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_wake_downconvert_thread()
4467 osb->dc_wake_sequence++; in ocfs2_wake_downconvert_thread()
4468 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_wake_downconvert_thread()
4469 wake_up(&osb->dc_event); in ocfs2_wake_downconvert_thread()