Lines Matching refs:osb

118 static void ocfs2_delete_osb(struct ocfs2_super *osb);
124 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb);
125 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb);
126 static void ocfs2_release_system_inodes(struct ocfs2_super *osb);
127 static int ocfs2_check_volume(struct ocfs2_super *osb);
142 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
143 static int ocfs2_enable_quotas(struct ocfs2_super *osb);
144 static void ocfs2_disable_quotas(struct ocfs2_super *osb);
231 static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) in ocfs2_osb_dump() argument
233 struct ocfs2_cluster_connection *cconn = osb->cconn; in ocfs2_osb_dump()
234 struct ocfs2_recovery_map *rm = osb->recovery_map; in ocfs2_osb_dump()
235 struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan; in ocfs2_osb_dump()
240 "Device", osb->dev_str, osb->uuid_str, in ocfs2_osb_dump()
241 osb->fs_generation, osb->vol_label); in ocfs2_osb_dump()
245 atomic_read(&osb->vol_state), osb->osb_flags); in ocfs2_osb_dump()
249 osb->sb->s_blocksize, osb->s_clustersize); in ocfs2_osb_dump()
254 "Features", osb->s_feature_compat, in ocfs2_osb_dump()
255 osb->s_feature_incompat, osb->s_feature_ro_compat); in ocfs2_osb_dump()
259 osb->s_mount_opt, osb->s_atime_quantum); in ocfs2_osb_dump()
265 (*osb->osb_cluster_stack == '\0' ? in ocfs2_osb_dump()
266 "o2cb" : osb->osb_cluster_stack), in ocfs2_osb_dump()
272 spin_lock(&osb->dc_task_lock); in ocfs2_osb_dump()
276 (osb->dc_task ? task_pid_nr(osb->dc_task) : -1), in ocfs2_osb_dump()
277 osb->blocked_lock_count, osb->dc_wake_sequence, in ocfs2_osb_dump()
278 osb->dc_work_sequence); in ocfs2_osb_dump()
279 spin_unlock(&osb->dc_task_lock); in ocfs2_osb_dump()
281 spin_lock(&osb->osb_lock); in ocfs2_osb_dump()
284 (osb->recovery_thread_task ? in ocfs2_osb_dump()
285 task_pid_nr(osb->recovery_thread_task) : -1)); in ocfs2_osb_dump()
294 spin_unlock(&osb->osb_lock); in ocfs2_osb_dump()
298 (osb->commit_task ? task_pid_nr(osb->commit_task) : -1), in ocfs2_osb_dump()
299 osb->osb_commit_interval); in ocfs2_osb_dump()
303 "Journal", osb->journal->j_state, in ocfs2_osb_dump()
304 osb->journal->j_trans_id, in ocfs2_osb_dump()
305 atomic_read(&osb->journal->j_num_trans)); in ocfs2_osb_dump()
311 atomic_read(&osb->alloc_stats.bitmap_data), in ocfs2_osb_dump()
312 atomic_read(&osb->alloc_stats.local_data), in ocfs2_osb_dump()
313 atomic_read(&osb->alloc_stats.bg_allocs), in ocfs2_osb_dump()
314 atomic_read(&osb->alloc_stats.moves), in ocfs2_osb_dump()
315 atomic_read(&osb->alloc_stats.bg_extends)); in ocfs2_osb_dump()
320 "LocalAlloc", osb->local_alloc_state, in ocfs2_osb_dump()
321 (unsigned long long)osb->la_last_gd, in ocfs2_osb_dump()
322 osb->local_alloc_bits, osb->local_alloc_default_bits); in ocfs2_osb_dump()
324 spin_lock(&osb->osb_lock); in ocfs2_osb_dump()
328 osb->s_inode_steal_slot, in ocfs2_osb_dump()
329 atomic_read(&osb->s_num_inodes_stolen), in ocfs2_osb_dump()
330 osb->s_meta_steal_slot, in ocfs2_osb_dump()
331 atomic_read(&osb->s_num_meta_stolen)); in ocfs2_osb_dump()
332 spin_unlock(&osb->osb_lock); in ocfs2_osb_dump()
346 for (i = 0; i < osb->max_slots; ++i) { in ocfs2_osb_dump()
350 (i == osb->slot_num ? '*' : ' '), in ocfs2_osb_dump()
351 i, osb->slot_recovery_generations[i]); in ocfs2_osb_dump()
359 struct ocfs2_super *osb = inode->i_private; in ocfs2_osb_debug_open() local
366 i_size_write(inode, ocfs2_osb_dump(osb, buf, PAGE_SIZE)); in ocfs2_osb_debug_open()
414 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_sync_fs() local
416 if (ocfs2_is_hard_readonly(osb)) in ocfs2_sync_fs()
420 status = ocfs2_flush_truncate_log(osb); in ocfs2_sync_fs()
424 ocfs2_schedule_truncate_log_flush(osb, 0); in ocfs2_sync_fs()
436 static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino) in ocfs2_need_system_inode() argument
438 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA) in ocfs2_need_system_inode()
442 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA) in ocfs2_need_system_inode()
449 static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) in ocfs2_init_global_system_inodes() argument
455 new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0); in ocfs2_init_global_system_inodes()
461 osb->root_inode = new; in ocfs2_init_global_system_inodes()
463 new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE, 0); in ocfs2_init_global_system_inodes()
469 osb->sys_root_inode = new; in ocfs2_init_global_system_inodes()
473 if (!ocfs2_need_system_inode(osb, i)) in ocfs2_init_global_system_inodes()
475 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); in ocfs2_init_global_system_inodes()
477 ocfs2_release_system_inodes(osb); in ocfs2_init_global_system_inodes()
495 static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) in ocfs2_init_local_system_inodes() argument
504 if (!ocfs2_need_system_inode(osb, i)) in ocfs2_init_local_system_inodes()
506 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); in ocfs2_init_local_system_inodes()
508 ocfs2_release_system_inodes(osb); in ocfs2_init_local_system_inodes()
511 status, i, osb->slot_num); in ocfs2_init_local_system_inodes()
524 static void ocfs2_release_system_inodes(struct ocfs2_super *osb) in ocfs2_release_system_inodes() argument
530 inode = osb->global_system_inodes[i]; in ocfs2_release_system_inodes()
533 osb->global_system_inodes[i] = NULL; in ocfs2_release_system_inodes()
537 inode = osb->sys_root_inode; in ocfs2_release_system_inodes()
540 osb->sys_root_inode = NULL; in ocfs2_release_system_inodes()
543 inode = osb->root_inode; in ocfs2_release_system_inodes()
546 osb->root_inode = NULL; in ocfs2_release_system_inodes()
549 if (!osb->local_system_inodes) in ocfs2_release_system_inodes()
552 for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) { in ocfs2_release_system_inodes()
553 if (osb->local_system_inodes[i]) { in ocfs2_release_system_inodes()
554 iput(osb->local_system_inodes[i]); in ocfs2_release_system_inodes()
555 osb->local_system_inodes[i] = NULL; in ocfs2_release_system_inodes()
559 kfree(osb->local_system_inodes); in ocfs2_release_system_inodes()
560 osb->local_system_inodes = NULL; in ocfs2_release_system_inodes()
643 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_remount() local
656 if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) { in ocfs2_remount()
662 if ((osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK) != in ocfs2_remount()
671 if (!(osb->s_mount_opt & OCFS2_MOUNT_INODE64) && in ocfs2_remount()
682 ret = ocfs2_susp_quotas(osb, 0); in ocfs2_remount()
688 spin_lock(&osb->osb_lock); in ocfs2_remount()
689 if (osb->osb_flags & OCFS2_OSB_HARD_RO) { in ocfs2_remount()
697 osb->osb_flags |= OCFS2_OSB_SOFT_RO; in ocfs2_remount()
699 if (osb->osb_flags & OCFS2_OSB_ERROR_FS) { in ocfs2_remount()
714 osb->osb_flags &= ~OCFS2_OSB_SOFT_RO; in ocfs2_remount()
716 trace_ocfs2_remount(sb->s_flags, osb->osb_flags, *flags); in ocfs2_remount()
718 spin_unlock(&osb->osb_lock); in ocfs2_remount()
722 ret = ocfs2_susp_quotas(osb, 1); in ocfs2_remount()
724 ret = ocfs2_enable_quotas(osb); in ocfs2_remount()
727 spin_lock(&osb->osb_lock); in ocfs2_remount()
729 osb->osb_flags |= OCFS2_OSB_SOFT_RO; in ocfs2_remount()
730 spin_unlock(&osb->osb_lock); in ocfs2_remount()
739 osb->s_mount_opt = parsed_options.mount_opt; in ocfs2_remount()
740 osb->s_atime_quantum = parsed_options.atime_quantum; in ocfs2_remount()
741 osb->preferred_slot = parsed_options.slot; in ocfs2_remount()
743 osb->osb_commit_interval = parsed_options.commit_interval; in ocfs2_remount()
745 if (!ocfs2_is_hard_readonly(osb)) in ocfs2_remount()
746 ocfs2_set_journal_params(osb); in ocfs2_remount()
749 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? in ocfs2_remount()
842 static int ocfs2_verify_heartbeat(struct ocfs2_super *osb) in ocfs2_verify_heartbeat() argument
846 if (osb->s_mount_opt & hb_enabled) { in ocfs2_verify_heartbeat()
847 if (ocfs2_mount_local(osb)) { in ocfs2_verify_heartbeat()
852 if (ocfs2_userspace_stack(osb)) { in ocfs2_verify_heartbeat()
857 if (((osb->s_mount_opt & OCFS2_MOUNT_HB_GLOBAL) && in ocfs2_verify_heartbeat()
858 !ocfs2_cluster_o2cb_global_heartbeat(osb)) || in ocfs2_verify_heartbeat()
859 ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) && in ocfs2_verify_heartbeat()
860 ocfs2_cluster_o2cb_global_heartbeat(osb))) { in ocfs2_verify_heartbeat()
866 if (!(osb->s_mount_opt & hb_enabled)) { in ocfs2_verify_heartbeat()
867 if (!ocfs2_mount_local(osb) && !ocfs2_is_hard_readonly(osb) && in ocfs2_verify_heartbeat()
868 !ocfs2_userspace_stack(osb)) { in ocfs2_verify_heartbeat()
883 static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, in ocfs2_verify_userspace_stack() argument
886 if (!ocfs2_userspace_stack(osb) && mopt->cluster_stack[0]) { in ocfs2_verify_userspace_stack()
893 if (ocfs2_userspace_stack(osb) && in ocfs2_verify_userspace_stack()
894 strncmp(osb->osb_cluster_stack, mopt->cluster_stack, in ocfs2_verify_userspace_stack()
900 osb->osb_cluster_stack); in ocfs2_verify_userspace_stack()
907 static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) in ocfs2_susp_quotas() argument
910 struct super_block *sb = osb->sb; in ocfs2_susp_quotas()
938 static int ocfs2_enable_quotas(struct ocfs2_super *osb) in ocfs2_enable_quotas() argument
941 struct super_block *sb = osb->sb; in ocfs2_enable_quotas()
955 inode[type] = ocfs2_get_system_file_inode(osb, ino[type], in ocfs2_enable_quotas()
956 osb->slot_num); in ocfs2_enable_quotas()
971 ocfs2_disable_quotas(osb); in ocfs2_enable_quotas()
978 static void ocfs2_disable_quotas(struct ocfs2_super *osb) in ocfs2_disable_quotas() argument
982 struct super_block *sb = osb->sb; in ocfs2_disable_quotas()
1011 struct ocfs2_super *osb = NULL; in ocfs2_fill_super() local
1031 osb = OCFS2_SB(sb); in ocfs2_fill_super()
1043 osb->s_mount_opt = parsed_options.mount_opt; in ocfs2_fill_super()
1044 osb->s_atime_quantum = parsed_options.atime_quantum; in ocfs2_fill_super()
1045 osb->preferred_slot = parsed_options.slot; in ocfs2_fill_super()
1046 osb->osb_commit_interval = parsed_options.commit_interval; in ocfs2_fill_super()
1048 ocfs2_la_set_sizes(osb, parsed_options.localalloc_opt); in ocfs2_fill_super()
1049 osb->osb_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1050 osb->osb_dir_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1052 osb->osb_dir_resv_level = parsed_options.resv_level; in ocfs2_fill_super()
1054 osb->osb_dir_resv_level = parsed_options.dir_resv_level; in ocfs2_fill_super()
1056 status = ocfs2_verify_userspace_stack(osb, &parsed_options); in ocfs2_fill_super()
1063 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); in ocfs2_fill_super()
1077 if (osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) { in ocfs2_fill_super()
1084 status = ocfs2_check_journals_nolocks(osb); in ocfs2_fill_super()
1095 ocfs2_set_ro_flag(osb, 1); in ocfs2_fill_super()
1099 "Recovery will be skipped.\n", osb->dev_str); in ocfs2_fill_super()
1102 if (!ocfs2_is_hard_readonly(osb)) { in ocfs2_fill_super()
1104 ocfs2_set_ro_flag(osb, 0); in ocfs2_fill_super()
1107 status = ocfs2_verify_heartbeat(osb); in ocfs2_fill_super()
1113 osb->osb_debug_root = debugfs_create_dir(osb->uuid_str, in ocfs2_fill_super()
1115 if (!osb->osb_debug_root) { in ocfs2_fill_super()
1121 osb->osb_ctxt = debugfs_create_file("fs_state", S_IFREG|S_IRUSR, in ocfs2_fill_super()
1122 osb->osb_debug_root, in ocfs2_fill_super()
1123 osb, in ocfs2_fill_super()
1125 if (!osb->osb_ctxt) { in ocfs2_fill_super()
1131 if (ocfs2_meta_ecc(osb)) { in ocfs2_fill_super()
1133 &osb->osb_ecc_stats, in ocfs2_fill_super()
1134 osb->osb_debug_root); in ocfs2_fill_super()
1147 if (osb->root_inode) in ocfs2_fill_super()
1148 inode = igrab(osb->root_inode); in ocfs2_fill_super()
1165 ocfs2_complete_mount_recovery(osb); in ocfs2_fill_super()
1167 if (ocfs2_mount_local(osb)) in ocfs2_fill_super()
1170 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); in ocfs2_fill_super()
1174 osb->dev_str, nodestr, osb->slot_num, in ocfs2_fill_super()
1175 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : in ocfs2_fill_super()
1178 atomic_set(&osb->vol_state, VOLUME_MOUNTED); in ocfs2_fill_super()
1179 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1185 status = ocfs2_enable_quotas(osb); in ocfs2_fill_super()
1190 atomic_set(&osb->vol_state, VOLUME_DISABLED); in ocfs2_fill_super()
1191 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1196 ocfs2_complete_quota_recovery(osb); in ocfs2_fill_super()
1199 atomic_set(&osb->vol_state, VOLUME_MOUNTED_QUOTAS); in ocfs2_fill_super()
1200 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1203 ocfs2_orphan_scan_start(osb); in ocfs2_fill_super()
1210 if (osb) { in ocfs2_fill_super()
1211 atomic_set(&osb->vol_state, VOLUME_DISABLED); in ocfs2_fill_super()
1212 wake_up(&osb->osb_mount_event); in ocfs2_fill_super()
1507 struct ocfs2_super *osb = OCFS2_SB(root->d_sb); in ocfs2_show_options() local
1508 unsigned long opts = osb->s_mount_opt; in ocfs2_show_options()
1536 if (osb->preferred_slot != OCFS2_INVALID_SLOT) in ocfs2_show_options()
1537 seq_printf(s, ",preferred_slot=%d", osb->preferred_slot); in ocfs2_show_options()
1539 seq_printf(s, ",atime_quantum=%u", osb->s_atime_quantum); in ocfs2_show_options()
1541 if (osb->osb_commit_interval) in ocfs2_show_options()
1543 (unsigned) (osb->osb_commit_interval / HZ)); in ocfs2_show_options()
1545 local_alloc_megs = osb->local_alloc_bits >> (20 - osb->s_clustersize_bits); in ocfs2_show_options()
1546 if (local_alloc_megs != ocfs2_la_default_mb(osb)) in ocfs2_show_options()
1552 if (osb->osb_cluster_stack[0]) in ocfs2_show_options()
1553 seq_show_option_n(s, "cluster_stack", osb->osb_cluster_stack, in ocfs2_show_options()
1578 if (osb->osb_resv_level != OCFS2_DEFAULT_RESV_LEVEL) in ocfs2_show_options()
1579 seq_printf(s, ",resv_level=%d", osb->osb_resv_level); in ocfs2_show_options()
1581 if (osb->osb_dir_resv_level != osb->osb_resv_level) in ocfs2_show_options()
1582 seq_printf(s, ",dir_resv_level=%d", osb->osb_resv_level); in ocfs2_show_options()
1665 struct ocfs2_super *osb; in ocfs2_statfs() local
1674 osb = OCFS2_SB(dentry->d_sb); in ocfs2_statfs()
1676 inode = ocfs2_get_system_file_inode(osb, in ocfs2_statfs()
1700 (osb->s_clustersize >> osb->sb->s_blocksize_bits); in ocfs2_statfs()
1702 (osb->s_clustersize >> osb->sb->s_blocksize_bits); in ocfs2_statfs()
1706 buf->f_fsid.val[0] = crc32_le(0, osb->uuid_str, OCFS2_VOL_UUID_LEN) in ocfs2_statfs()
1708 buf->f_fsid.val[1] = crc32_le(0, osb->uuid_str + OCFS2_VOL_UUID_LEN, in ocfs2_statfs()
1845 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_mount_volume() local
1847 if (ocfs2_is_hard_readonly(osb)) in ocfs2_mount_volume()
1850 status = ocfs2_dlm_init(osb); in ocfs2_mount_volume()
1856 status = ocfs2_super_lock(osb, 1); in ocfs2_mount_volume()
1864 status = ocfs2_find_slot(osb); in ocfs2_mount_volume()
1871 status = ocfs2_init_local_system_inodes(osb); in ocfs2_mount_volume()
1877 status = ocfs2_check_volume(osb); in ocfs2_mount_volume()
1883 status = ocfs2_truncate_log_init(osb); in ocfs2_mount_volume()
1889 ocfs2_super_unlock(osb, 1); in ocfs2_mount_volume()
1897 struct ocfs2_super *osb = NULL; in ocfs2_dismount_volume() local
1903 osb = OCFS2_SB(sb); in ocfs2_dismount_volume()
1904 BUG_ON(!osb); in ocfs2_dismount_volume()
1906 debugfs_remove(osb->osb_ctxt); in ocfs2_dismount_volume()
1909 ocfs2_orphan_scan_stop(osb); in ocfs2_dismount_volume()
1911 ocfs2_disable_quotas(osb); in ocfs2_dismount_volume()
1914 WARN_ON(!llist_empty(&osb->dquot_drop_list)); in ocfs2_dismount_volume()
1916 cancel_work_sync(&osb->dquot_drop_work); in ocfs2_dismount_volume()
1918 ocfs2_shutdown_local_alloc(osb); in ocfs2_dismount_volume()
1920 ocfs2_truncate_log_shutdown(osb); in ocfs2_dismount_volume()
1923 ocfs2_recovery_exit(osb); in ocfs2_dismount_volume()
1925 ocfs2_journal_shutdown(osb); in ocfs2_dismount_volume()
1929 ocfs2_purge_refcount_trees(osb); in ocfs2_dismount_volume()
1933 if (osb->cconn) { in ocfs2_dismount_volume()
1934 tmp = ocfs2_super_lock(osb, 1); in ocfs2_dismount_volume()
1941 if (osb->slot_num != OCFS2_INVALID_SLOT) in ocfs2_dismount_volume()
1942 ocfs2_put_slot(osb); in ocfs2_dismount_volume()
1944 if (osb->cconn) in ocfs2_dismount_volume()
1945 ocfs2_super_unlock(osb, 1); in ocfs2_dismount_volume()
1947 ocfs2_release_system_inodes(osb); in ocfs2_dismount_volume()
1955 if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str && in ocfs2_dismount_volume()
1956 !ocfs2_is_hard_readonly(osb)) in ocfs2_dismount_volume()
1959 if (osb->cconn) in ocfs2_dismount_volume()
1960 ocfs2_dlm_shutdown(osb, hangup_needed); in ocfs2_dismount_volume()
1962 ocfs2_blockcheck_stats_debugfs_remove(&osb->osb_ecc_stats); in ocfs2_dismount_volume()
1963 debugfs_remove(osb->osb_debug_root); in ocfs2_dismount_volume()
1966 ocfs2_cluster_hangup(osb->uuid_str, strlen(osb->uuid_str)); in ocfs2_dismount_volume()
1968 atomic_set(&osb->vol_state, VOLUME_DISMOUNTED); in ocfs2_dismount_volume()
1970 if (ocfs2_mount_local(osb)) in ocfs2_dismount_volume()
1973 snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); in ocfs2_dismount_volume()
1976 osb->dev_str, nodestr); in ocfs2_dismount_volume()
1978 ocfs2_delete_osb(osb); in ocfs2_dismount_volume()
1979 kfree(osb); in ocfs2_dismount_volume()
1984 static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uuid, in ocfs2_setup_osb_uuid() argument
1992 osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN * 2 + 1, GFP_KERNEL); in ocfs2_setup_osb_uuid()
1993 if (osb->uuid_str == NULL) in ocfs2_setup_osb_uuid()
1996 for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) { in ocfs2_setup_osb_uuid()
2011 static int ocfs2_journal_addressable(struct ocfs2_super *osb) in ocfs2_journal_addressable() argument
2015 ocfs2_clusters_to_blocks(osb->sb, in ocfs2_journal_addressable()
2016 osb->osb_clusters_at_boot) - 1; in ocfs2_journal_addressable()
2024 if (!(OCFS2_HAS_COMPAT_FEATURE(osb->sb, in ocfs2_journal_addressable()
2026 jbd2_journal_check_used_features(osb->journal->j_journal, 0, 0, in ocfs2_journal_addressable()
2048 struct ocfs2_super *osb; in ocfs2_initialize_super() local
2051 osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL); in ocfs2_initialize_super()
2052 if (!osb) { in ocfs2_initialize_super()
2058 sb->s_fs_info = osb; in ocfs2_initialize_super()
2075 osb->osb_dx_mask = (1 << (cbits - bbits)) - 1; in ocfs2_initialize_super()
2078 osb->osb_dx_seed[i] = le32_to_cpu(di->id2.i_super.s_dx_seed[i]); in ocfs2_initialize_super()
2079 osb->osb_dx_seed[3] = le32_to_cpu(di->id2.i_super.s_uuid_hash); in ocfs2_initialize_super()
2081 osb->sb = sb; in ocfs2_initialize_super()
2083 osb->s_sectsize_bits = blksize_bits(sector_size); in ocfs2_initialize_super()
2084 BUG_ON(!osb->s_sectsize_bits); in ocfs2_initialize_super()
2086 spin_lock_init(&osb->dc_task_lock); in ocfs2_initialize_super()
2087 init_waitqueue_head(&osb->dc_event); in ocfs2_initialize_super()
2088 osb->dc_work_sequence = 0; in ocfs2_initialize_super()
2089 osb->dc_wake_sequence = 0; in ocfs2_initialize_super()
2090 INIT_LIST_HEAD(&osb->blocked_lock_list); in ocfs2_initialize_super()
2091 osb->blocked_lock_count = 0; in ocfs2_initialize_super()
2092 spin_lock_init(&osb->osb_lock); in ocfs2_initialize_super()
2093 spin_lock_init(&osb->osb_xattr_lock); in ocfs2_initialize_super()
2094 ocfs2_init_steal_slots(osb); in ocfs2_initialize_super()
2096 mutex_init(&osb->system_file_mutex); in ocfs2_initialize_super()
2098 atomic_set(&osb->alloc_stats.moves, 0); in ocfs2_initialize_super()
2099 atomic_set(&osb->alloc_stats.local_data, 0); in ocfs2_initialize_super()
2100 atomic_set(&osb->alloc_stats.bitmap_data, 0); in ocfs2_initialize_super()
2101 atomic_set(&osb->alloc_stats.bg_allocs, 0); in ocfs2_initialize_super()
2102 atomic_set(&osb->alloc_stats.bg_extends, 0); in ocfs2_initialize_super()
2105 osb->osb_ecc_stats = *stats; in ocfs2_initialize_super()
2107 ocfs2_init_node_maps(osb); in ocfs2_initialize_super()
2109 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", in ocfs2_initialize_super()
2110 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); in ocfs2_initialize_super()
2112 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); in ocfs2_initialize_super()
2113 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { in ocfs2_initialize_super()
2115 osb->max_slots); in ocfs2_initialize_super()
2120 ocfs2_orphan_scan_init(osb); in ocfs2_initialize_super()
2122 status = ocfs2_recovery_init(osb); in ocfs2_initialize_super()
2129 init_waitqueue_head(&osb->checkpoint_event); in ocfs2_initialize_super()
2131 osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; in ocfs2_initialize_super()
2133 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_initialize_super()
2135 osb->s_xattr_inline_size = le16_to_cpu( in ocfs2_initialize_super()
2138 osb->local_alloc_state = OCFS2_LA_UNUSED; in ocfs2_initialize_super()
2139 osb->local_alloc_bh = NULL; in ocfs2_initialize_super()
2140 INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); in ocfs2_initialize_super()
2142 init_waitqueue_head(&osb->osb_mount_event); in ocfs2_initialize_super()
2144 status = ocfs2_resmap_init(osb, &osb->osb_la_resmap); in ocfs2_initialize_super()
2150 osb->vol_label = kmalloc(OCFS2_MAX_VOL_LABEL_LEN, GFP_KERNEL); in ocfs2_initialize_super()
2151 if (!osb->vol_label) { in ocfs2_initialize_super()
2157 osb->slot_recovery_generations = in ocfs2_initialize_super()
2158 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations), in ocfs2_initialize_super()
2160 if (!osb->slot_recovery_generations) { in ocfs2_initialize_super()
2166 init_waitqueue_head(&osb->osb_wipe_event); in ocfs2_initialize_super()
2167 osb->osb_orphan_wipes = kcalloc(osb->max_slots, in ocfs2_initialize_super()
2168 sizeof(*osb->osb_orphan_wipes), in ocfs2_initialize_super()
2170 if (!osb->osb_orphan_wipes) { in ocfs2_initialize_super()
2176 osb->osb_rf_lock_tree = RB_ROOT; in ocfs2_initialize_super()
2178 osb->s_feature_compat = in ocfs2_initialize_super()
2180 osb->s_feature_ro_compat = in ocfs2_initialize_super()
2182 osb->s_feature_incompat = in ocfs2_initialize_super()
2185 if ((i = OCFS2_HAS_INCOMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_INCOMPAT_SUPP))) { in ocfs2_initialize_super()
2191 if (!(osb->sb->s_flags & MS_RDONLY) && in ocfs2_initialize_super()
2192 (i = OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, ~OCFS2_FEATURE_RO_COMPAT_SUPP))) { in ocfs2_initialize_super()
2199 if (ocfs2_clusterinfo_valid(osb)) { in ocfs2_initialize_super()
2200 osb->osb_stackflags = in ocfs2_initialize_super()
2202 strlcpy(osb->osb_cluster_stack, in ocfs2_initialize_super()
2205 if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) { in ocfs2_initialize_super()
2209 osb->osb_cluster_stack); in ocfs2_initialize_super()
2213 strlcpy(osb->osb_cluster_name, in ocfs2_initialize_super()
2219 osb->osb_cluster_stack[0] = '\0'; in ocfs2_initialize_super()
2222 get_random_bytes(&osb->s_next_generation, sizeof(u32)); in ocfs2_initialize_super()
2239 osb->journal = journal; in ocfs2_initialize_super()
2240 journal->j_osb = osb; in ocfs2_initialize_super()
2251 INIT_WORK(&osb->dquot_drop_work, ocfs2_drop_dquot_refs); in ocfs2_initialize_super()
2252 init_llist_head(&osb->dquot_drop_list); in ocfs2_initialize_super()
2255 osb->s_clustersize_bits = in ocfs2_initialize_super()
2257 osb->s_clustersize = 1 << osb->s_clustersize_bits; in ocfs2_initialize_super()
2259 if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE || in ocfs2_initialize_super()
2260 osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) { in ocfs2_initialize_super()
2262 osb->s_clustersize); in ocfs2_initialize_super()
2267 total_blocks = ocfs2_clusters_to_blocks(osb->sb, in ocfs2_initialize_super()
2270 status = generic_check_addressable(osb->sb->s_blocksize_bits, in ocfs2_initialize_super()
2279 if (ocfs2_setup_osb_uuid(osb, di->id2.i_super.s_uuid, in ocfs2_initialize_super()
2286 strlcpy(osb->vol_label, di->id2.i_super.s_label, in ocfs2_initialize_super()
2288 osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno); in ocfs2_initialize_super()
2289 osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno); in ocfs2_initialize_super()
2290 osb->first_cluster_group_blkno = in ocfs2_initialize_super()
2292 osb->fs_generation = le32_to_cpu(di->i_fs_generation); in ocfs2_initialize_super()
2293 osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash); in ocfs2_initialize_super()
2294 trace_ocfs2_initialize_super(osb->vol_label, osb->uuid_str, in ocfs2_initialize_super()
2295 (unsigned long long)osb->root_blkno, in ocfs2_initialize_super()
2296 (unsigned long long)osb->system_dir_blkno, in ocfs2_initialize_super()
2297 osb->s_clustersize_bits); in ocfs2_initialize_super()
2299 osb->osb_dlm_debug = ocfs2_new_dlm_debug(); in ocfs2_initialize_super()
2300 if (!osb->osb_dlm_debug) { in ocfs2_initialize_super()
2306 atomic_set(&osb->vol_state, VOLUME_INIT); in ocfs2_initialize_super()
2309 status = ocfs2_init_global_system_inodes(osb); in ocfs2_initialize_super()
2318 inode = ocfs2_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE, in ocfs2_initialize_super()
2326 osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno; in ocfs2_initialize_super()
2327 osb->osb_clusters_at_boot = OCFS2_I(inode)->ip_clusters; in ocfs2_initialize_super()
2330 osb->bitmap_cpg = ocfs2_group_bitmap_size(sb, 0, in ocfs2_initialize_super()
2331 osb->s_feature_incompat) * 8; in ocfs2_initialize_super()
2333 status = ocfs2_init_slot_info(osb); in ocfs2_initialize_super()
2415 static int ocfs2_check_volume(struct ocfs2_super *osb) in ocfs2_check_volume() argument
2425 status = ocfs2_journal_init(osb->journal, &dirty); in ocfs2_check_volume()
2433 status = ocfs2_journal_addressable(osb); in ocfs2_check_volume()
2441 status = ocfs2_journal_wipe(osb->journal, 0); in ocfs2_check_volume()
2448 "unmounted cleanly, recovering it.\n", osb->dev_str); in ocfs2_check_volume()
2451 local = ocfs2_mount_local(osb); in ocfs2_check_volume()
2454 status = ocfs2_journal_load(osb->journal, local, dirty); in ocfs2_check_volume()
2460 if (osb->s_mount_opt & OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT) in ocfs2_check_volume()
2461 jbd2_journal_set_features(osb->journal->j_journal, in ocfs2_check_volume()
2465 jbd2_journal_clear_features(osb->journal->j_journal, in ocfs2_check_volume()
2471 status = ocfs2_begin_local_alloc_recovery(osb, in ocfs2_check_volume()
2472 osb->slot_num, in ocfs2_check_volume()
2482 status = ocfs2_load_local_alloc(osb); in ocfs2_check_volume()
2491 osb->dirty = 1; in ocfs2_check_volume()
2492 osb->local_alloc_copy = local_alloc; in ocfs2_check_volume()
2499 status = ocfs2_mark_dead_nodes(osb); in ocfs2_check_volume()
2505 status = ocfs2_compute_replay_slots(osb); in ocfs2_check_volume()
2523 static void ocfs2_delete_osb(struct ocfs2_super *osb) in ocfs2_delete_osb() argument
2527 ocfs2_free_slot_info(osb); in ocfs2_delete_osb()
2529 kfree(osb->osb_orphan_wipes); in ocfs2_delete_osb()
2530 kfree(osb->slot_recovery_generations); in ocfs2_delete_osb()
2536 kfree(osb->journal); in ocfs2_delete_osb()
2537 kfree(osb->local_alloc_copy); in ocfs2_delete_osb()
2538 kfree(osb->uuid_str); in ocfs2_delete_osb()
2539 kfree(osb->vol_label); in ocfs2_delete_osb()
2540 ocfs2_put_dlm_debug(osb->osb_dlm_debug); in ocfs2_delete_osb()
2541 memset(osb, 0, sizeof(struct ocfs2_super)); in ocfs2_delete_osb()
2548 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_handle_error() local
2550 if (osb->s_mount_opt & OCFS2_MOUNT_ERRORS_PANIC) in ocfs2_handle_error()
2554 ocfs2_set_osb_flag(osb, OCFS2_OSB_ERROR_FS); in ocfs2_handle_error()
2557 (ocfs2_is_soft_readonly(osb) || in ocfs2_handle_error()
2558 ocfs2_is_hard_readonly(osb))) in ocfs2_handle_error()
2565 ocfs2_set_ro_flag(osb, 0); in ocfs2_handle_error()