Lines Matching refs:osb
116 int ocfs2_refresh_slot_info(struct ocfs2_super *osb) in ocfs2_refresh_slot_info() argument
119 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_refresh_slot_info()
137 spin_lock(&osb->osb_lock); in ocfs2_refresh_slot_info()
139 spin_unlock(&osb->osb_lock); in ocfs2_refresh_slot_info()
183 static int ocfs2_update_disk_slot(struct ocfs2_super *osb, in ocfs2_update_disk_slot() argument
190 spin_lock(&osb->osb_lock); in ocfs2_update_disk_slot()
195 spin_unlock(&osb->osb_lock); in ocfs2_update_disk_slot()
197 status = ocfs2_write_block(osb, bh, INODE_CACHE(si->si_inode)); in ocfs2_update_disk_slot()
208 static int ocfs2_slot_map_physical_size(struct ocfs2_super *osb, in ocfs2_slot_map_physical_size() argument
214 if (ocfs2_uses_extended_slot_map(osb)) { in ocfs2_slot_map_physical_size()
215 bytes_needed = osb->max_slots * in ocfs2_slot_map_physical_size()
218 bytes_needed = osb->max_slots * sizeof(__le16); in ocfs2_slot_map_physical_size()
273 int ocfs2_node_num_to_slot(struct ocfs2_super *osb, unsigned int node_num) in ocfs2_node_num_to_slot() argument
276 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_node_num_to_slot()
278 spin_lock(&osb->osb_lock); in ocfs2_node_num_to_slot()
280 spin_unlock(&osb->osb_lock); in ocfs2_node_num_to_slot()
285 int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num, in ocfs2_slot_to_node_num_locked() argument
288 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_slot_to_node_num_locked()
290 assert_spin_locked(&osb->osb_lock); in ocfs2_slot_to_node_num_locked()
293 BUG_ON(slot_num >= osb->max_slots); in ocfs2_slot_to_node_num_locked()
323 int ocfs2_clear_slot(struct ocfs2_super *osb, int slot_num) in ocfs2_clear_slot() argument
325 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_clear_slot()
330 spin_lock(&osb->osb_lock); in ocfs2_clear_slot()
332 spin_unlock(&osb->osb_lock); in ocfs2_clear_slot()
334 return ocfs2_update_disk_slot(osb, osb->slot_info, slot_num); in ocfs2_clear_slot()
337 static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, in ocfs2_map_slot_buffers() argument
346 status = ocfs2_slot_map_physical_size(osb, si->si_inode, &bytes); in ocfs2_map_slot_buffers()
358 (osb->sb->s_blocksize / in ocfs2_map_slot_buffers()
361 si->si_slots_per_block = osb->sb->s_blocksize / sizeof(__le16); in ocfs2_map_slot_buffers()
364 BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); in ocfs2_map_slot_buffers()
401 int ocfs2_init_slot_info(struct ocfs2_super *osb) in ocfs2_init_slot_info() argument
407 si = kzalloc(struct_size(si, si_slots, osb->max_slots), GFP_KERNEL); in ocfs2_init_slot_info()
414 si->si_extended = ocfs2_uses_extended_slot_map(osb); in ocfs2_init_slot_info()
415 si->si_num_slots = osb->max_slots; in ocfs2_init_slot_info()
417 inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE, in ocfs2_init_slot_info()
426 status = ocfs2_map_slot_buffers(osb, si); in ocfs2_init_slot_info()
432 osb->slot_info = (struct ocfs2_slot_info *)si; in ocfs2_init_slot_info()
440 void ocfs2_free_slot_info(struct ocfs2_super *osb) in ocfs2_free_slot_info() argument
442 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_free_slot_info()
444 osb->slot_info = NULL; in ocfs2_free_slot_info()
448 int ocfs2_find_slot(struct ocfs2_super *osb) in ocfs2_find_slot() argument
454 si = osb->slot_info; in ocfs2_find_slot()
456 spin_lock(&osb->osb_lock); in ocfs2_find_slot()
459 if (ocfs2_mount_local(osb)) in ocfs2_find_slot()
467 slot = __ocfs2_node_num_to_slot(si, osb->node_num); in ocfs2_find_slot()
471 slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); in ocfs2_find_slot()
473 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
481 slot, osb->dev_str); in ocfs2_find_slot()
484 ocfs2_set_slot(si, slot, osb->node_num); in ocfs2_find_slot()
485 osb->slot_num = slot; in ocfs2_find_slot()
486 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
488 trace_ocfs2_find_slot(osb->slot_num); in ocfs2_find_slot()
490 status = ocfs2_update_disk_slot(osb, si, osb->slot_num); in ocfs2_find_slot()
497 spin_lock(&osb->osb_lock); in ocfs2_find_slot()
498 ocfs2_invalidate_slot(si, osb->slot_num); in ocfs2_find_slot()
499 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_find_slot()
500 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
507 void ocfs2_put_slot(struct ocfs2_super *osb) in ocfs2_put_slot() argument
510 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_put_slot()
515 spin_lock(&osb->osb_lock); in ocfs2_put_slot()
518 slot_num = osb->slot_num; in ocfs2_put_slot()
519 ocfs2_invalidate_slot(si, osb->slot_num); in ocfs2_put_slot()
520 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_put_slot()
521 spin_unlock(&osb->osb_lock); in ocfs2_put_slot()
523 status = ocfs2_update_disk_slot(osb, si, slot_num); in ocfs2_put_slot()
527 ocfs2_free_slot_info(osb); in ocfs2_put_slot()