Lines Matching refs:osb
134 int ocfs2_refresh_slot_info(struct ocfs2_super *osb) in ocfs2_refresh_slot_info() argument
137 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_refresh_slot_info()
155 spin_lock(&osb->osb_lock); in ocfs2_refresh_slot_info()
157 spin_unlock(&osb->osb_lock); in ocfs2_refresh_slot_info()
201 static int ocfs2_update_disk_slot(struct ocfs2_super *osb, in ocfs2_update_disk_slot() argument
208 spin_lock(&osb->osb_lock); in ocfs2_update_disk_slot()
213 spin_unlock(&osb->osb_lock); in ocfs2_update_disk_slot()
215 status = ocfs2_write_block(osb, bh, INODE_CACHE(si->si_inode)); in ocfs2_update_disk_slot()
226 static int ocfs2_slot_map_physical_size(struct ocfs2_super *osb, in ocfs2_slot_map_physical_size() argument
232 if (ocfs2_uses_extended_slot_map(osb)) { in ocfs2_slot_map_physical_size()
233 bytes_needed = osb->max_slots * in ocfs2_slot_map_physical_size()
236 bytes_needed = osb->max_slots * sizeof(__le16); in ocfs2_slot_map_physical_size()
289 int ocfs2_node_num_to_slot(struct ocfs2_super *osb, unsigned int node_num) in ocfs2_node_num_to_slot() argument
292 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_node_num_to_slot()
294 spin_lock(&osb->osb_lock); in ocfs2_node_num_to_slot()
296 spin_unlock(&osb->osb_lock); in ocfs2_node_num_to_slot()
301 int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num, in ocfs2_slot_to_node_num_locked() argument
304 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_slot_to_node_num_locked()
306 assert_spin_locked(&osb->osb_lock); in ocfs2_slot_to_node_num_locked()
309 BUG_ON(slot_num >= osb->max_slots); in ocfs2_slot_to_node_num_locked()
340 int ocfs2_clear_slot(struct ocfs2_super *osb, int slot_num) in ocfs2_clear_slot() argument
342 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_clear_slot()
347 spin_lock(&osb->osb_lock); in ocfs2_clear_slot()
349 spin_unlock(&osb->osb_lock); in ocfs2_clear_slot()
351 return ocfs2_update_disk_slot(osb, osb->slot_info, slot_num); in ocfs2_clear_slot()
354 static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, in ocfs2_map_slot_buffers() argument
363 status = ocfs2_slot_map_physical_size(osb, si->si_inode, &bytes); in ocfs2_map_slot_buffers()
375 (osb->sb->s_blocksize / in ocfs2_map_slot_buffers()
378 si->si_slots_per_block = osb->sb->s_blocksize / sizeof(__le16); in ocfs2_map_slot_buffers()
381 BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); in ocfs2_map_slot_buffers()
418 int ocfs2_init_slot_info(struct ocfs2_super *osb) in ocfs2_init_slot_info() argument
425 (sizeof(struct ocfs2_slot) * osb->max_slots), in ocfs2_init_slot_info()
433 si->si_extended = ocfs2_uses_extended_slot_map(osb); in ocfs2_init_slot_info()
434 si->si_num_slots = osb->max_slots; in ocfs2_init_slot_info()
438 inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE, in ocfs2_init_slot_info()
447 status = ocfs2_map_slot_buffers(osb, si); in ocfs2_init_slot_info()
453 osb->slot_info = (struct ocfs2_slot_info *)si; in ocfs2_init_slot_info()
461 void ocfs2_free_slot_info(struct ocfs2_super *osb) in ocfs2_free_slot_info() argument
463 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_free_slot_info()
465 osb->slot_info = NULL; in ocfs2_free_slot_info()
469 int ocfs2_find_slot(struct ocfs2_super *osb) in ocfs2_find_slot() argument
475 si = osb->slot_info; in ocfs2_find_slot()
477 spin_lock(&osb->osb_lock); in ocfs2_find_slot()
484 slot = __ocfs2_node_num_to_slot(si, osb->node_num); in ocfs2_find_slot()
488 slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); in ocfs2_find_slot()
490 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
497 "allocated to this node!\n", slot, osb->dev_str); in ocfs2_find_slot()
499 ocfs2_set_slot(si, slot, osb->node_num); in ocfs2_find_slot()
500 osb->slot_num = slot; in ocfs2_find_slot()
501 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
503 trace_ocfs2_find_slot(osb->slot_num); in ocfs2_find_slot()
505 status = ocfs2_update_disk_slot(osb, si, osb->slot_num); in ocfs2_find_slot()
513 void ocfs2_put_slot(struct ocfs2_super *osb) in ocfs2_put_slot() argument
516 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_put_slot()
521 spin_lock(&osb->osb_lock); in ocfs2_put_slot()
524 slot_num = osb->slot_num; in ocfs2_put_slot()
525 ocfs2_invalidate_slot(si, osb->slot_num); in ocfs2_put_slot()
526 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_put_slot()
527 spin_unlock(&osb->osb_lock); in ocfs2_put_slot()
529 status = ocfs2_update_disk_slot(osb, si, slot_num); in ocfs2_put_slot()
536 ocfs2_free_slot_info(osb); in ocfs2_put_slot()