Lines Matching refs:osb

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