Lines Matching refs:osb
118 int ocfs2_refresh_slot_info(struct ocfs2_super *osb)
121 struct ocfs2_slot_info *si = osb->slot_info;
139 spin_lock(&osb->osb_lock);
141 spin_unlock(&osb->osb_lock);
185 static int ocfs2_update_disk_slot(struct ocfs2_super *osb,
192 spin_lock(&osb->osb_lock);
197 spin_unlock(&osb->osb_lock);
199 status = ocfs2_write_block(osb, bh, INODE_CACHE(si->si_inode));
210 static int ocfs2_slot_map_physical_size(struct ocfs2_super *osb,
216 if (ocfs2_uses_extended_slot_map(osb)) {
217 bytes_needed = osb->max_slots *
220 bytes_needed = osb->max_slots * sizeof(__le16);
273 int ocfs2_node_num_to_slot(struct ocfs2_super *osb, unsigned int node_num)
276 struct ocfs2_slot_info *si = osb->slot_info;
278 spin_lock(&osb->osb_lock);
280 spin_unlock(&osb->osb_lock);
285 int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num,
288 struct ocfs2_slot_info *si = osb->slot_info;
290 assert_spin_locked(&osb->osb_lock);
293 BUG_ON(slot_num >= osb->max_slots);
323 int ocfs2_clear_slot(struct ocfs2_super *osb, int slot_num)
325 struct ocfs2_slot_info *si = osb->slot_info;
330 spin_lock(&osb->osb_lock);
332 spin_unlock(&osb->osb_lock);
334 return ocfs2_update_disk_slot(osb, osb->slot_info, slot_num);
337 static int ocfs2_map_slot_buffers(struct ocfs2_super *osb,
346 status = ocfs2_slot_map_physical_size(osb, si->si_inode, &bytes);
358 (osb->sb->s_blocksize /
361 si->si_slots_per_block = osb->sb->s_blocksize / sizeof(__le16);
364 BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks);
401 int ocfs2_init_slot_info(struct ocfs2_super *osb)
407 si = kzalloc(struct_size(si, si_slots, osb->max_slots), GFP_KERNEL);
414 si->si_extended = ocfs2_uses_extended_slot_map(osb);
415 si->si_num_slots = osb->max_slots;
417 inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE,
426 status = ocfs2_map_slot_buffers(osb, si);
432 osb->slot_info = (struct ocfs2_slot_info *)si;
440 void ocfs2_free_slot_info(struct ocfs2_super *osb)
442 struct ocfs2_slot_info *si = osb->slot_info;
444 osb->slot_info = NULL;
448 int ocfs2_find_slot(struct ocfs2_super *osb)
454 si = osb->slot_info;
456 spin_lock(&osb->osb_lock);
463 slot = __ocfs2_node_num_to_slot(si, osb->node_num);
467 slot = __ocfs2_find_empty_slot(si, osb->preferred_slot);
469 spin_unlock(&osb->osb_lock);
476 "allocated to this node!\n", slot, osb->dev_str);
478 ocfs2_set_slot(si, slot, osb->node_num);
479 osb->slot_num = slot;
480 spin_unlock(&osb->osb_lock);
482 trace_ocfs2_find_slot(osb->slot_num);
484 status = ocfs2_update_disk_slot(osb, si, osb->slot_num);
491 spin_lock(&osb->osb_lock);
492 ocfs2_invalidate_slot(si, osb->slot_num);
493 osb->slot_num = OCFS2_INVALID_SLOT;
494 spin_unlock(&osb->osb_lock);
501 void ocfs2_put_slot(struct ocfs2_super *osb)
504 struct ocfs2_slot_info *si = osb->slot_info;
509 spin_lock(&osb->osb_lock);
512 slot_num = osb->slot_num;
513 ocfs2_invalidate_slot(si, osb->slot_num);
514 osb->slot_num = OCFS2_INVALID_SLOT;
515 spin_unlock(&osb->osb_lock);
517 status = ocfs2_update_disk_slot(osb, si, slot_num);
521 ocfs2_free_slot_info(osb);