Lines Matching refs:osb
97 static void ocfs2_delete_osb(struct ocfs2_super *osb);
103 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb);
104 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb);
105 static void ocfs2_release_system_inodes(struct ocfs2_super *osb);
106 static int ocfs2_check_volume(struct ocfs2_super *osb);
121 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
122 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
123 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
212 static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) in ocfs2_osb_dump() argument
214 struct ocfs2_cluster_connection *cconn = osb->cconn; in ocfs2_osb_dump()
215 struct ocfs2_recovery_map *rm = osb->recovery_map; in ocfs2_osb_dump()
216 struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan; in ocfs2_osb_dump()
222 "Device", osb->dev_str, osb->uuid_str, in ocfs2_osb_dump()
223 osb->fs_generation, osb->vol_label); in ocfs2_osb_dump()
227 atomic_read(&osb->vol_state), osb->osb_flags); in ocfs2_osb_dump()
231 osb->sb->s_blocksize, osb->s_clustersize); in ocfs2_osb_dump()
236 "Features", osb->s_feature_compat, in ocfs2_osb_dump()
237 osb->s_feature_incompat, osb->s_feature_ro_compat); in ocfs2_osb_dump()
241 osb->s_mount_opt, osb->s_atime_quantum); in ocfs2_osb_dump()
247 (*osb->osb_cluster_stack == '\0' ? in ocfs2_osb_dump()
248 "o2cb" : osb->osb_cluster_stack), in ocfs2_osb_dump()
254 spin_lock_irqsave(&osb->dc_task_lock, flags); in ocfs2_osb_dump()
258 (osb->dc_task ? task_pid_nr(osb->dc_task) : -1), in ocfs2_osb_dump()
259 osb->blocked_lock_count, osb->dc_wake_sequence, in ocfs2_osb_dump()
260 osb->dc_work_sequence); in ocfs2_osb_dump()
261 spin_unlock_irqrestore(&osb->dc_task_lock, flags); in ocfs2_osb_dump()
263 spin_lock(&osb->osb_lock); in ocfs2_osb_dump()
266 (osb->recovery_thread_task ? in ocfs2_osb_dump()
267 task_pid_nr(osb->recovery_thread_task) : -1)); in ocfs2_osb_dump()
276 spin_unlock(&osb->osb_lock); in ocfs2_osb_dump()
280 (osb->commit_task ? task_pid_nr(osb->commit_task) : -1), in ocfs2_osb_dump()
281 osb->osb_commit_interval); in ocfs2_osb_dump()
285 "Journal", osb->journal->j_state, in ocfs2_osb_dump()
286 osb->journal->j_trans_id, in ocfs2_osb_dump()
287 atomic_read(&osb->journal->j_num_trans)); in ocfs2_osb_dump()
293 atomic_read(&osb->alloc_stats.bitmap_data), in ocfs2_osb_dump()
294 atomic_read(&osb->alloc_stats.local_data), in ocfs2_osb_dump()
295 atomic_read(&osb->alloc_stats.bg_allocs), in ocfs2_osb_dump()
296 atomic_read(&osb->alloc_stats.moves), in ocfs2_osb_dump()
297 atomic_read(&osb->alloc_stats.bg_extends)); in ocfs2_osb_dump()
302 "LocalAlloc", osb->local_alloc_state, in ocfs2_osb_dump()
303 (unsigned long long)osb->la_last_gd, in ocfs2_osb_dump()
304 osb->local_alloc_bits, osb->local_alloc_default_bits); in ocfs2_osb_dump()
306 spin_lock(&osb->osb_lock); in ocfs2_osb_dump()
310 osb->s_inode_steal_slot, in ocfs2_osb_dump()
311 atomic_read(&osb->s_num_inodes_stolen), in ocfs2_osb_dump()
312 osb->s_meta_steal_slot, in ocfs2_osb_dump()
313 atomic_read(&osb->s_num_meta_stolen)); in ocfs2_osb_dump()
314 spin_unlock(&osb->osb_lock); in ocfs2_osb_dump()
328 for (i = 0; i < osb->max_slots; ++i) { in ocfs2_osb_dump()
332 (i == osb->slot_num ? '*' : ' '), in ocfs2_osb_dump()
333 i, osb->slot_recovery_generations[i]); in ocfs2_osb_dump()
341 struct ocfs2_super *osb = inode->i_private; in ocfs2_osb_debug_open() local
348 i_size_write(inode, ocfs2_osb_dump(osb, buf, PAGE_SIZE)); in ocfs2_osb_debug_open()
396 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_sync_fs() local
398 if (ocfs2_is_hard_readonly(osb)) in ocfs2_sync_fs()
402 status = ocfs2_flush_truncate_log(osb); in ocfs2_sync_fs()
406 ocfs2_schedule_truncate_log_flush(osb, 0); in ocfs2_sync_fs()
409 if (jbd2_journal_start_commit(osb->journal->j_journal, in ocfs2_sync_fs()
412 jbd2_log_wait_commit(osb->journal->j_journal, in ocfs2_sync_fs()
418 static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino) in ocfs2_need_system_inode() argument
420 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA) in ocfs2_need_system_inode()
424 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA) in ocfs2_need_system_inode()
431 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) in ocfs2_init_global_system_inodes() argument
437 new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0); in ocfs2_init_global_system_inodes()
443 osb->root_inode = new; in ocfs2_init_global_system_inodes()
445 new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0); in ocfs2_init_global_system_inodes()
451 osb->sys_root_inode = new; in ocfs2_init_global_system_inodes()
455 if (!ocfs2_need_system_inode(osb, i)) in ocfs2_init_global_system_inodes()
457 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); in ocfs2_init_global_system_inodes()
459 ocfs2_release_system_inodes(osb); in ocfs2_init_global_system_inodes()
460 status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL; in ocfs2_init_global_system_inodes()
476 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) in ocfs2_init_local_system_inodes() argument
485 if (!ocfs2_need_system_inode(osb, i)) in ocfs2_init_local_system_inodes()
487 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); in ocfs2_init_local_system_inodes()
489 ocfs2_release_system_inodes(osb); in ocfs2_init_local_system_inodes()
490 status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL; in ocfs2_init_local_system_inodes()
492 status, i, osb->slot_num); in ocfs2_init_local_system_inodes()
505 static void ocfs2_release_system_inodes(struct ocfs2_super *osb) in ocfs2_release_system_inodes() argument
511 inode = osb->global_system_inodes[i]; in ocfs2_release_system_inodes()
514 osb->global_system_inodes[i] = NULL; in ocfs2_release_system_inodes()
518 inode = osb->sys_root_inode; in ocfs2_release_system_inodes()
521 osb->sys_root_inode = NULL; in ocfs2_release_system_inodes()
524 inode = osb->root_inode; in ocfs2_release_system_inodes()
527 osb->root_inode = NULL; in ocfs2_release_system_inodes()
530 if (!osb->local_system_inodes) in ocfs2_release_system_inodes()
533 for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) { in ocfs2_release_system_inodes()
534 if (osb->local_system_inodes[i]) { in ocfs2_release_system_inodes()
535 iput(osb->local_system_inodes[i]); in ocfs2_release_system_inodes()
536 osb->local_system_inodes[i] = NULL; in ocfs2_release_system_inodes()
540 kfree(osb->local_system_inodes); in ocfs2_release_system_inodes()
541 osb->local_system_inodes = NULL; in ocfs2_release_system_inodes()
608 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_remount() local
621 if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) { in ocfs2_remount()
627 if ((osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK) != in ocfs2_remount()
636 if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64) && in ocfs2_remount()
647 ret = ocfs2_susp_quotas(osb, 0); in ocfs2_remount()
653 spin_lock(&osb->osb_lock); in ocfs2_remount()
654 if (osb->osb_flags & OCFS2_OSB_HARD_RO) { in ocfs2_remount()
662 osb->osb_flags |= OCFS2_OSB_SOFT_RO; in ocfs2_remount()
664 if (osb->osb_flags & OCFS2_OSB_ERROR_FS) { in ocfs2_remount()
679 osb->osb_flags &= ~OCFS2_OSB_SOFT_RO; in ocfs2_remount()
681 trace_ocfs2_remount(sb->s_flags, osb->osb_flags, *flags); in ocfs2_remount()
683 spin_unlock(&osb->osb_lock); in ocfs2_remount()
687 ret = ocfs2_susp_quotas(osb, 1); in ocfs2_remount()
689 ret = ocfs2_enable_quotas(osb); in ocfs2_remount()
692 spin_lock(&osb->osb_lock); in ocfs2_remount()
694 osb->osb_flags |= OCFS2_OSB_SOFT_RO; in ocfs2_remount()
695 spin_unlock(&osb->osb_lock); in ocfs2_remount()
704 osb->s_mount_opt = parsed_options.mount_opt; in ocfs2_remount()
705 osb->s_atime_quantum = parsed_options.atime_quantum; in ocfs2_remount()
706 osb->preferred_slot = parsed_options.slot; in ocfs2_remount()
708 osb->osb_commit_interval = parsed_options.commit_interval; in ocfs2_remount()
710 if (!ocfs2_is_hard_readonly(osb)) in ocfs2_remount()
711 ocfs2_set_journal_params(osb); in ocfs2_remount()
714 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? in ocfs2_remount()
807 static int ocfs2_verify_heartbeat(struct ocfs2_super *osb) in ocfs2_verify_heartbeat() argument
811 if (osb->s_mount_opt & hb_enabled) { in ocfs2_verify_heartbeat()
812 if (ocfs2_mount_local(osb)) { in ocfs2_verify_heartbeat()
817 if (ocfs2_userspace_stack(osb)) { in ocfs2_verify_heartbeat()
822 if (((osb->s_mount_opt & OCFS2_MOUNT_HB_GLOBAL) && in ocfs2_verify_heartbeat()
823 !ocfs2_cluster_o2cb_global_heartbeat(osb)) || in ocfs2_verify_heartbeat()
824 ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) && in ocfs2_verify_heartbeat()
825 ocfs2_cluster_o2cb_global_heartbeat(osb))) { in ocfs2_verify_heartbeat()
831 if (!(osb->s_mount_opt & hb_enabled)) { in ocfs2_verify_heartbeat()
832 if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb) && in ocfs2_verify_heartbeat()
833 !ocfs2_userspace_stack(osb)) { in ocfs2_verify_heartbeat()
848 static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, in ocfs2_verify_userspace_stack() argument
851 if (!ocfs2_userspace_stack(osb) && mopt->cluster_stack[0]) { in ocfs2_verify_userspace_stack()
858 if (ocfs2_userspace_stack(osb) && in ocfs2_verify_userspace_stack()
859 strncmp(osb->osb_cluster_stack, mopt->cluster_stack, in ocfs2_verify_userspace_stack()
865 osb->osb_cluster_stack); in ocfs2_verify_userspace_stack()
872 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) in ocfs2_susp_quotas() argument
875 struct super_block *sb = osb->sb; in ocfs2_susp_quotas()
903 static int ocfs2_enable_quotas(struct ocfs2_super *osb) in ocfs2_enable_quotas() argument
906 struct super_block *sb = osb->sb; in ocfs2_enable_quotas()
920 inode[type] = ocfs2_get_system_file_inode(osb, ino[type], in ocfs2_enable_quotas()
921 osb->slot_num); in ocfs2_enable_quotas()
936 ocfs2_disable_quotas(osb); in ocfs2_enable_quotas()
943 static void ocfs2_disable_quotas(struct ocfs2_super *osb) in ocfs2_disable_quotas() argument
947 struct super_block *sb = osb->sb; in ocfs2_disable_quotas()
975 struct ocfs2_super *osb = NULL; in ocfs2_fill_super() local
1000 osb = OCFS2_SB(sb); in ocfs2_fill_super()
1006 osb->s_mount_opt = parsed_options.mount_opt; in ocfs2_fill_super()
1007 osb->s_atime_quantum = parsed_options.atime_quantum; in ocfs2_fill_super()
1008 osb->preferred_slot = parsed_options.slot; in ocfs2_fill_super()
1009 osb->osb_commit_interval = parsed_options.commit_interval; in ocfs2_fill_super()
1011 ocfs2_la_set_sizes(osb, parsed_options.localalloc_opt); in ocfs2_fill_super()
1012 osb->osb_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1013 osb->osb_dir_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1015 osb->osb_dir_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1017 osb->osb_dir_resv_level = parsed_options.dir_resv_level; in ocfs2_fill_super()
1019 status = ocfs2_verify_userspace_stack(osb, &parsed_options); in ocfs2_fill_super()
1026 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? SB_POSIXACL : 0); in ocfs2_fill_super()
1040 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) { in ocfs2_fill_super()
1047 status = ocfs2_check_journals_nolocks(osb); in ocfs2_fill_super()
1056 ocfs2_set_ro_flag(osb, 1); in ocfs2_fill_super()
1060 "Recovery will be skipped.\n", osb->dev_str); in ocfs2_fill_super()
1063 if (!ocfs2_is_hard_readonly(osb)) { in ocfs2_fill_super()
1065 ocfs2_set_ro_flag(osb, 0); in ocfs2_fill_super()
1068 status = ocfs2_verify_heartbeat(osb); in ocfs2_fill_super()
1072 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, in ocfs2_fill_super()
1075 debugfs_create_file("fs_state", S_IFREG|S_IRUSR, osb->osb_debug_root, in ocfs2_fill_super()
1076 osb, &ocfs2_osb_debug_fops); in ocfs2_fill_super()
1078 if (ocfs2_meta_ecc(osb)) in ocfs2_fill_super()
1079 ocfs2_blockcheck_stats_debugfs_install( &osb->osb_ecc_stats, in ocfs2_fill_super()
1080 osb->osb_debug_root); in ocfs2_fill_super()
1086 if (osb->root_inode) in ocfs2_fill_super()
1087 inode = igrab(osb->root_inode); in ocfs2_fill_super()
1094 osb->osb_dev_kset = kset_create_and_add(sb->s_id, NULL, in ocfs2_fill_super()
1096 if (!osb->osb_dev_kset) { in ocfs2_fill_super()
1104 if (ocfs2_filecheck_create_sysfs(osb)) { in ocfs2_fill_super()
1119 ocfs2_complete_mount_recovery(osb); in ocfs2_fill_super()
1121 if (ocfs2_mount_local(osb)) in ocfs2_fill_super()
1124 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); in ocfs2_fill_super()
1128 osb->dev_str, nodestr, osb->slot_num, in ocfs2_fill_super()
1129 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : in ocfs2_fill_super()
1132 atomic_set(&osb->vol_state, VOLUME_MOUNTED); in ocfs2_fill_super()
1133 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1139 status = ocfs2_enable_quotas(osb); in ocfs2_fill_super()
1144 atomic_set(&osb->vol_state, VOLUME_DISABLED); in ocfs2_fill_super()
1145 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1150 ocfs2_complete_quota_recovery(osb); in ocfs2_fill_super()
1153 atomic_set(&osb->vol_state, VOLUME_MOUNTED_QUOTAS); in ocfs2_fill_super()
1154 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1157 ocfs2_orphan_scan_start(osb); in ocfs2_fill_super()
1162 atomic_set(&osb->vol_state, VOLUME_DISABLED); in ocfs2_fill_super()
1163 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1164 ocfs2_free_replay_slots(osb); in ocfs2_fill_super()
1169 debugfs_remove_recursive(osb->osb_debug_root); in ocfs2_fill_super()
1171 ocfs2_release_system_inodes(osb); in ocfs2_fill_super()
1172 kfree(osb->recovery_map); in ocfs2_fill_super()
1173 ocfs2_delete_osb(osb); in ocfs2_fill_super()
1174 kfree(osb); in ocfs2_fill_super()
1472 struct ocfs2_super *osb = OCFS2_SB(root->d_sb); in ocfs2_show_options() local
1473 unsigned long opts = osb->s_mount_opt; in ocfs2_show_options()
1503 if (osb->preferred_slot != OCFS2_INVALID_SLOT) in ocfs2_show_options()
1504 seq_printf(s, ",preferred_slot=%d", osb->preferred_slot); in ocfs2_show_options()
1506 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum); in ocfs2_show_options()
1508 if (osb->osb_commit_interval) in ocfs2_show_options()
1510 (unsigned) (osb->osb_commit_interval / HZ)); in ocfs2_show_options()
1512 local_alloc_megs = osb->local_alloc_bits >> (20 - osb->s_clustersize_bits); in ocfs2_show_options()
1513 if (local_alloc_megs != ocfs2_la_default_mb(osb)) in ocfs2_show_options()
1519 if (osb->osb_cluster_stack[0]) in ocfs2_show_options()
1520 seq_show_option(s, "cluster_stack", osb->osb_cluster_stack); in ocfs2_show_options()
1544 if (osb->osb_resv_level != OCFS2_DEFAULT_RESV_LEVEL) in ocfs2_show_options()
1545 seq_printf(s, ",resv_level=%d", osb->osb_resv_level); in ocfs2_show_options()
1547 if (osb->osb_dir_resv_level != osb->osb_resv_level) in ocfs2_show_options()
1548 seq_printf(s, ",dir_resv_level=%d", osb->osb_resv_level); in ocfs2_show_options()
1613 struct ocfs2_super *osb; in ocfs2_statfs() local
1622 osb = OCFS2_SB(dentry->d_sb); in ocfs2_statfs()
1624 inode = ocfs2_get_system_file_inode(osb, in ocfs2_statfs()
1648 (osb->s_clustersize >> osb->sb->s_blocksize_bits); in ocfs2_statfs()
1650 (osb->s_clustersize >> osb->sb->s_blocksize_bits); in ocfs2_statfs()
1654 buf->f_fsid.val[0] = crc32_le(0, osb->uuid_str, OCFS2_VOL_UUID_LEN) in ocfs2_statfs()
1656 buf->f_fsid.val[1] = crc32_le(0, osb->uuid_str + OCFS2_VOL_UUID_LEN, in ocfs2_statfs()
1782 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_mount_volume() local
1784 if (ocfs2_is_hard_readonly(osb)) in ocfs2_mount_volume()
1787 mutex_init(&osb->obs_trim_fs_mutex); in ocfs2_mount_volume()
1789 status = ocfs2_dlm_init(osb); in ocfs2_mount_volume()
1792 if (status == -EBADR && ocfs2_userspace_stack(osb)) in ocfs2_mount_volume()
1798 status = ocfs2_super_lock(osb, 1); in ocfs2_mount_volume()
1805 status = ocfs2_find_slot(osb); in ocfs2_mount_volume()
1812 status = ocfs2_init_local_system_inodes(osb); in ocfs2_mount_volume()
1818 status = ocfs2_check_volume(osb); in ocfs2_mount_volume()
1824 status = ocfs2_truncate_log_init(osb); in ocfs2_mount_volume()
1830 ocfs2_super_unlock(osb, 1); in ocfs2_mount_volume()
1834 ocfs2_free_replay_slots(osb); in ocfs2_mount_volume()
1836 if (osb->local_alloc_state == OCFS2_LA_ENABLED) in ocfs2_mount_volume()
1837 ocfs2_shutdown_local_alloc(osb); in ocfs2_mount_volume()
1838 ocfs2_release_system_inodes(osb); in ocfs2_mount_volume()
1840 ocfs2_free_slot_info(osb); in ocfs2_mount_volume()
1841 ocfs2_journal_shutdown(osb); in ocfs2_mount_volume()
1843 ocfs2_super_unlock(osb, 1); in ocfs2_mount_volume()
1845 ocfs2_dlm_shutdown(osb, 0); in ocfs2_mount_volume()
1853 struct ocfs2_super *osb = NULL; in ocfs2_dismount_volume() local
1859 osb = OCFS2_SB(sb); in ocfs2_dismount_volume()
1860 BUG_ON(!osb); in ocfs2_dismount_volume()
1864 ocfs2_filecheck_remove_sysfs(osb); in ocfs2_dismount_volume()
1866 kset_unregister(osb->osb_dev_kset); in ocfs2_dismount_volume()
1869 ocfs2_orphan_scan_stop(osb); in ocfs2_dismount_volume()
1871 ocfs2_disable_quotas(osb); in ocfs2_dismount_volume()
1874 WARN_ON(!llist_empty(&osb->dquot_drop_list)); in ocfs2_dismount_volume()
1876 cancel_work_sync(&osb->dquot_drop_work); in ocfs2_dismount_volume()
1878 ocfs2_shutdown_local_alloc(osb); in ocfs2_dismount_volume()
1880 ocfs2_truncate_log_shutdown(osb); in ocfs2_dismount_volume()
1883 ocfs2_recovery_exit(osb); in ocfs2_dismount_volume()
1887 ocfs2_purge_refcount_trees(osb); in ocfs2_dismount_volume()
1891 if (osb->cconn) { in ocfs2_dismount_volume()
1892 tmp = ocfs2_super_lock(osb, 1); in ocfs2_dismount_volume()
1899 if (osb->slot_num != OCFS2_INVALID_SLOT) in ocfs2_dismount_volume()
1900 ocfs2_put_slot(osb); in ocfs2_dismount_volume()
1902 if (osb->cconn) in ocfs2_dismount_volume()
1903 ocfs2_super_unlock(osb, 1); in ocfs2_dismount_volume()
1905 ocfs2_release_system_inodes(osb); in ocfs2_dismount_volume()
1907 ocfs2_journal_shutdown(osb); in ocfs2_dismount_volume()
1915 if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str && in ocfs2_dismount_volume()
1916 !ocfs2_is_hard_readonly(osb)) in ocfs2_dismount_volume()
1919 ocfs2_dlm_shutdown(osb, hangup_needed); in ocfs2_dismount_volume()
1921 ocfs2_blockcheck_stats_debugfs_remove(&osb->osb_ecc_stats); in ocfs2_dismount_volume()
1922 debugfs_remove_recursive(osb->osb_debug_root); in ocfs2_dismount_volume()
1925 ocfs2_cluster_hangup(osb->uuid_str, strlen(osb->uuid_str)); in ocfs2_dismount_volume()
1927 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); in ocfs2_dismount_volume()
1929 if (ocfs2_mount_local(osb)) in ocfs2_dismount_volume()
1932 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); in ocfs2_dismount_volume()
1935 osb->dev_str, nodestr); in ocfs2_dismount_volume()
1937 ocfs2_delete_osb(osb); in ocfs2_dismount_volume()
1938 kfree(osb); in ocfs2_dismount_volume()
1943 static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uuid, in ocfs2_setup_osb_uuid() argument
1951 osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL); in ocfs2_setup_osb_uuid()
1952 if (osb->uuid_str == NULL) in ocfs2_setup_osb_uuid()
1955 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) { in ocfs2_setup_osb_uuid()
1970 static int ocfs2_journal_addressable(struct ocfs2_super *osb) in ocfs2_journal_addressable() argument
1974 ocfs2_clusters_to_blocks(osb->sb, in ocfs2_journal_addressable()
1975 osb->osb_clusters_at_boot) - 1; in ocfs2_journal_addressable()
1983 if (!(OCFS2_HAS_COMPAT_FEATURE(osb->sb, in ocfs2_journal_addressable()
1985 jbd2_journal_check_used_features(osb->journal->j_journal, 0, 0, in ocfs2_journal_addressable()
2006 struct ocfs2_super *osb; in ocfs2_initialize_super() local
2009 osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL); in ocfs2_initialize_super()
2010 if (!osb) { in ocfs2_initialize_super()
2016 sb->s_fs_info = osb; in ocfs2_initialize_super()
2033 osb->osb_dx_mask = (1 << (cbits - bbits)) - 1; in ocfs2_initialize_super()
2036 osb->osb_dx_seed[i] = le32_to_cpu(di->id2.i_super.s_dx_seed[i]); in ocfs2_initialize_super()
2037 osb->osb_dx_seed[3] = le32_to_cpu(di->id2.i_super.s_uuid_hash); in ocfs2_initialize_super()
2039 osb->sb = sb; in ocfs2_initialize_super()
2040 osb->s_sectsize_bits = blksize_bits(sector_size); in ocfs2_initialize_super()
2041 BUG_ON(!osb->s_sectsize_bits); in ocfs2_initialize_super()
2043 spin_lock_init(&osb->dc_task_lock); in ocfs2_initialize_super()
2044 init_waitqueue_head(&osb->dc_event); in ocfs2_initialize_super()
2045 osb->dc_work_sequence = 0; in ocfs2_initialize_super()
2046 osb->dc_wake_sequence = 0; in ocfs2_initialize_super()
2047 INIT_LIST_HEAD(&osb->blocked_lock_list); in ocfs2_initialize_super()
2048 osb->blocked_lock_count = 0; in ocfs2_initialize_super()
2049 spin_lock_init(&osb->osb_lock); in ocfs2_initialize_super()
2050 spin_lock_init(&osb->osb_xattr_lock); in ocfs2_initialize_super()
2051 ocfs2_init_steal_slots(osb); in ocfs2_initialize_super()
2053 mutex_init(&osb->system_file_mutex); in ocfs2_initialize_super()
2055 atomic_set(&osb->alloc_stats.moves, 0); in ocfs2_initialize_super()
2056 atomic_set(&osb->alloc_stats.local_data, 0); in ocfs2_initialize_super()
2057 atomic_set(&osb->alloc_stats.bitmap_data, 0); in ocfs2_initialize_super()
2058 atomic_set(&osb->alloc_stats.bg_allocs, 0); in ocfs2_initialize_super()
2059 atomic_set(&osb->alloc_stats.bg_extends, 0); in ocfs2_initialize_super()
2062 osb->osb_ecc_stats = *stats; in ocfs2_initialize_super()
2064 ocfs2_init_node_maps(osb); in ocfs2_initialize_super()
2066 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", in ocfs2_initialize_super()
2067 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); in ocfs2_initialize_super()
2069 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); in ocfs2_initialize_super()
2070 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { in ocfs2_initialize_super()
2072 osb->max_slots); in ocfs2_initialize_super()
2077 ocfs2_orphan_scan_init(osb); in ocfs2_initialize_super()
2079 status = ocfs2_recovery_init(osb); in ocfs2_initialize_super()
2086 init_waitqueue_head(&osb->checkpoint_event); in ocfs2_initialize_super()
2088 osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; in ocfs2_initialize_super()
2090 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_initialize_super()
2092 osb->s_xattr_inline_size = le16_to_cpu( in ocfs2_initialize_super()
2095 osb->local_alloc_state = OCFS2_LA_UNUSED; in ocfs2_initialize_super()
2096 osb->local_alloc_bh = NULL; in ocfs2_initialize_super()
2097 INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); in ocfs2_initialize_super()
2099 init_waitqueue_head(&osb->osb_mount_event); in ocfs2_initialize_super()
2101 ocfs2_resmap_init(osb, &osb->osb_la_resmap); in ocfs2_initialize_super()
2103 osb->vol_label = kmalloc(OCFS2_MAX_VOL_LABEL_LEN, GFP_KERNEL); in ocfs2_initialize_super()
2104 if (!osb->vol_label) { in ocfs2_initialize_super()
2110 osb->slot_recovery_generations = in ocfs2_initialize_super()
2111 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations), in ocfs2_initialize_super()
2113 if (!osb->slot_recovery_generations) { in ocfs2_initialize_super()
2119 init_waitqueue_head(&osb->osb_wipe_event); in ocfs2_initialize_super()
2120 osb->osb_orphan_wipes = kcalloc(osb->max_slots, in ocfs2_initialize_super()
2121 sizeof(*osb->osb_orphan_wipes), in ocfs2_initialize_super()
2123 if (!osb->osb_orphan_wipes) { in ocfs2_initialize_super()
2129 osb->osb_rf_lock_tree = RB_ROOT; in ocfs2_initialize_super()
2131 osb->s_feature_compat = in ocfs2_initialize_super()
2133 osb->s_feature_ro_compat = in ocfs2_initialize_super()
2135 osb->s_feature_incompat = in ocfs2_initialize_super()
2138 if ((i = OCFS2_HAS_INCOMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_INCOMPAT_SUPP))) { in ocfs2_initialize_super()
2144 …if (!sb_rdonly(osb->sb) && (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP… in ocfs2_initialize_super()
2151 if (ocfs2_clusterinfo_valid(osb)) { in ocfs2_initialize_super()
2158 osb->osb_stackflags = in ocfs2_initialize_super()
2160 memcpy(osb->osb_cluster_stack, in ocfs2_initialize_super()
2163 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) { in ocfs2_initialize_super()
2167 osb->osb_cluster_stack); in ocfs2_initialize_super()
2171 memcpy(osb->osb_cluster_name, in ocfs2_initialize_super()
2177 osb->osb_cluster_stack[0] = '\0'; in ocfs2_initialize_super()
2180 get_random_bytes(&osb->s_next_generation, sizeof(u32)); in ocfs2_initialize_super()
2187 status = ocfs2_journal_alloc(osb); in ocfs2_initialize_super()
2191 INIT_WORK(&osb->dquot_drop_work, ocfs2_drop_dquot_refs); in ocfs2_initialize_super()
2192 init_llist_head(&osb->dquot_drop_list); in ocfs2_initialize_super()
2195 osb->s_clustersize_bits = in ocfs2_initialize_super()
2197 osb->s_clustersize = 1 << osb->s_clustersize_bits; in ocfs2_initialize_super()
2199 if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE || in ocfs2_initialize_super()
2200 osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) { in ocfs2_initialize_super()
2202 osb->s_clustersize); in ocfs2_initialize_super()
2207 total_blocks = ocfs2_clusters_to_blocks(osb->sb, in ocfs2_initialize_super()
2210 status = generic_check_addressable(osb->sb->s_blocksize_bits, in ocfs2_initialize_super()
2219 if (ocfs2_setup_osb_uuid(osb, di->id2.i_super.s_uuid, in ocfs2_initialize_super()
2226 strscpy(osb->vol_label, di->id2.i_super.s_label, in ocfs2_initialize_super()
2228 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); in ocfs2_initialize_super()
2229 osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno); in ocfs2_initialize_super()
2230 osb->first_cluster_group_blkno = in ocfs2_initialize_super()
2232 osb->fs_generation = le32_to_cpu(di->i_fs_generation); in ocfs2_initialize_super()
2233 osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash); in ocfs2_initialize_super()
2234 trace_ocfs2_initialize_super(osb->vol_label, osb->uuid_str, in ocfs2_initialize_super()
2235 (unsigned long long)osb->root_blkno, in ocfs2_initialize_super()
2236 (unsigned long long)osb->system_dir_blkno, in ocfs2_initialize_super()
2237 osb->s_clustersize_bits); in ocfs2_initialize_super()
2239 osb->osb_dlm_debug = ocfs2_new_dlm_debug(); in ocfs2_initialize_super()
2240 if (!osb->osb_dlm_debug) { in ocfs2_initialize_super()
2246 atomic_set(&osb->vol_state, VOLUME_INIT); in ocfs2_initialize_super()
2249 status = ocfs2_init_global_system_inodes(osb); in ocfs2_initialize_super()
2258 inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE, in ocfs2_initialize_super()
2266 osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno; in ocfs2_initialize_super()
2267 osb->osb_clusters_at_boot = OCFS2_I(inode)->ip_clusters; in ocfs2_initialize_super()
2270 osb->bitmap_cpg = ocfs2_group_bitmap_size(sb, 0, in ocfs2_initialize_super()
2271 osb->s_feature_incompat) * 8; in ocfs2_initialize_super()
2273 status = ocfs2_init_slot_info(osb); in ocfs2_initialize_super()
2279 osb->ocfs2_wq = alloc_ordered_workqueue("ocfs2_wq", WQ_MEM_RECLAIM); in ocfs2_initialize_super()
2280 if (!osb->ocfs2_wq) { in ocfs2_initialize_super()
2289 ocfs2_free_slot_info(osb); in ocfs2_initialize_super()
2291 ocfs2_release_system_inodes(osb); in ocfs2_initialize_super()
2293 ocfs2_put_dlm_debug(osb->osb_dlm_debug); in ocfs2_initialize_super()
2295 kfree(osb->uuid_str); in ocfs2_initialize_super()
2297 kfree(osb->journal); in ocfs2_initialize_super()
2299 kfree(osb->osb_orphan_wipes); in ocfs2_initialize_super()
2301 kfree(osb->slot_recovery_generations); in ocfs2_initialize_super()
2303 kfree(osb->vol_label); in ocfs2_initialize_super()
2305 kfree(osb->recovery_map); in ocfs2_initialize_super()
2307 kfree(osb); in ocfs2_initialize_super()
2383 static int ocfs2_check_volume(struct ocfs2_super *osb) in ocfs2_check_volume() argument
2393 status = ocfs2_journal_init(osb, &dirty); in ocfs2_check_volume()
2401 status = ocfs2_journal_addressable(osb); in ocfs2_check_volume()
2409 status = ocfs2_journal_wipe(osb->journal, 0); in ocfs2_check_volume()
2416 "unmounted cleanly, recovering it.\n", osb->dev_str); in ocfs2_check_volume()
2419 local = ocfs2_mount_local(osb); in ocfs2_check_volume()
2422 status = ocfs2_journal_load(osb->journal, local, dirty); in ocfs2_check_volume()
2428 if (osb->s_mount_opt & OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT) in ocfs2_check_volume()
2429 jbd2_journal_set_features(osb->journal->j_journal, in ocfs2_check_volume()
2433 jbd2_journal_clear_features(osb->journal->j_journal, in ocfs2_check_volume()
2439 status = ocfs2_begin_local_alloc_recovery(osb, in ocfs2_check_volume()
2440 osb->slot_num, in ocfs2_check_volume()
2450 status = ocfs2_load_local_alloc(osb); in ocfs2_check_volume()
2459 osb->local_alloc_copy = local_alloc; in ocfs2_check_volume()
2466 status = ocfs2_mark_dead_nodes(osb); in ocfs2_check_volume()
2472 status = ocfs2_compute_replay_slots(osb); in ocfs2_check_volume()
2490 static void ocfs2_delete_osb(struct ocfs2_super *osb) in ocfs2_delete_osb() argument
2495 if (osb->ocfs2_wq) in ocfs2_delete_osb()
2496 destroy_workqueue(osb->ocfs2_wq); in ocfs2_delete_osb()
2498 ocfs2_free_slot_info(osb); in ocfs2_delete_osb()
2500 kfree(osb->osb_orphan_wipes); in ocfs2_delete_osb()
2501 kfree(osb->slot_recovery_generations); in ocfs2_delete_osb()
2507 kfree(osb->journal); in ocfs2_delete_osb()
2508 kfree(osb->local_alloc_copy); in ocfs2_delete_osb()
2509 kfree(osb->uuid_str); in ocfs2_delete_osb()
2510 kfree(osb->vol_label); in ocfs2_delete_osb()
2511 ocfs2_put_dlm_debug(osb->osb_dlm_debug); in ocfs2_delete_osb()
2512 memset(osb, 0, sizeof(struct ocfs2_super)); in ocfs2_delete_osb()
2523 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_handle_error() local
2526 ocfs2_set_osb_flag(osb, OCFS2_OSB_ERROR_FS); in ocfs2_handle_error()
2530 if (osb->s_mount_opt & OCFS2_MOUNT_ERRORS_PANIC) { in ocfs2_handle_error()
2533 } else if (osb->s_mount_opt & OCFS2_MOUNT_ERRORS_CONT) { in ocfs2_handle_error()
2538 if (sb_rdonly(sb) && (ocfs2_is_soft_readonly(osb) || ocfs2_is_hard_readonly(osb))) in ocfs2_handle_error()
2543 ocfs2_set_ro_flag(osb, 0); in ocfs2_handle_error()