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()
271 int ocfs2_node_num_to_slot(struct ocfs2_super *osb, unsigned int node_num) in ocfs2_node_num_to_slot() argument
274 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_node_num_to_slot()
276 spin_lock(&osb->osb_lock); in ocfs2_node_num_to_slot()
278 spin_unlock(&osb->osb_lock); in ocfs2_node_num_to_slot()
283 int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num, in ocfs2_slot_to_node_num_locked() argument
286 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_slot_to_node_num_locked()
288 assert_spin_locked(&osb->osb_lock); in ocfs2_slot_to_node_num_locked()
291 BUG_ON(slot_num >= osb->max_slots); in ocfs2_slot_to_node_num_locked()
321 int ocfs2_clear_slot(struct ocfs2_super *osb, int slot_num) in ocfs2_clear_slot() argument
323 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_clear_slot()
328 spin_lock(&osb->osb_lock); in ocfs2_clear_slot()
330 spin_unlock(&osb->osb_lock); in ocfs2_clear_slot()
332 return ocfs2_update_disk_slot(osb, osb->slot_info, slot_num); in ocfs2_clear_slot()
335 static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, in ocfs2_map_slot_buffers() argument
344 status = ocfs2_slot_map_physical_size(osb, si->si_inode, &bytes); in ocfs2_map_slot_buffers()
356 (osb->sb->s_blocksize / in ocfs2_map_slot_buffers()
359 si->si_slots_per_block = osb->sb->s_blocksize / sizeof(__le16); in ocfs2_map_slot_buffers()
362 BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); in ocfs2_map_slot_buffers()
399 int ocfs2_init_slot_info(struct ocfs2_super *osb) in ocfs2_init_slot_info() argument
405 si = kzalloc(struct_size(si, si_slots, osb->max_slots), GFP_KERNEL); in ocfs2_init_slot_info()
412 si->si_extended = ocfs2_uses_extended_slot_map(osb); in ocfs2_init_slot_info()
413 si->si_num_slots = osb->max_slots; in ocfs2_init_slot_info()
415 inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE, in ocfs2_init_slot_info()
424 status = ocfs2_map_slot_buffers(osb, si); in ocfs2_init_slot_info()
430 osb->slot_info = (struct ocfs2_slot_info *)si; in ocfs2_init_slot_info()
438 void ocfs2_free_slot_info(struct ocfs2_super *osb) in ocfs2_free_slot_info() argument
440 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_free_slot_info()
442 osb->slot_info = NULL; in ocfs2_free_slot_info()
446 int ocfs2_find_slot(struct ocfs2_super *osb) in ocfs2_find_slot() argument
452 si = osb->slot_info; in ocfs2_find_slot()
454 spin_lock(&osb->osb_lock); in ocfs2_find_slot()
461 slot = __ocfs2_node_num_to_slot(si, osb->node_num); in ocfs2_find_slot()
465 slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); in ocfs2_find_slot()
467 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
474 "allocated to this node!\n", slot, osb->dev_str); in ocfs2_find_slot()
476 ocfs2_set_slot(si, slot, osb->node_num); in ocfs2_find_slot()
477 osb->slot_num = slot; in ocfs2_find_slot()
478 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
480 trace_ocfs2_find_slot(osb->slot_num); in ocfs2_find_slot()
482 status = ocfs2_update_disk_slot(osb, si, osb->slot_num); in ocfs2_find_slot()
489 spin_lock(&osb->osb_lock); in ocfs2_find_slot()
490 ocfs2_invalidate_slot(si, osb->slot_num); in ocfs2_find_slot()
491 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_find_slot()
492 spin_unlock(&osb->osb_lock); in ocfs2_find_slot()
499 void ocfs2_put_slot(struct ocfs2_super *osb) in ocfs2_put_slot() argument
502 struct ocfs2_slot_info *si = osb->slot_info; in ocfs2_put_slot()
507 spin_lock(&osb->osb_lock); in ocfs2_put_slot()
510 slot_num = osb->slot_num; in ocfs2_put_slot()
511 ocfs2_invalidate_slot(si, osb->slot_num); in ocfs2_put_slot()
512 osb->slot_num = OCFS2_INVALID_SLOT; in ocfs2_put_slot()
513 spin_unlock(&osb->osb_lock); in ocfs2_put_slot()
515 status = ocfs2_update_disk_slot(osb, si, slot_num); in ocfs2_put_slot()
519 ocfs2_free_slot_info(osb); in ocfs2_put_slot()