26 #include <linux/types.h>
27 #include <linux/slab.h>
63 unsigned int node_num);
73 int slot_num,
unsigned int node_num)
78 si->
si_slots[slot_num].sl_node_num = node_num;
92 (slotno < si->si_num_slots);
95 ocfs2_set_slot(si, slotno,
98 ocfs2_invalidate_slot(si, slotno);
116 ocfs2_invalidate_slot(si, i);
129 ocfs2_update_slot_info_extended(si);
131 ocfs2_update_slot_info_old(si);
145 trace_ocfs2_refresh_slot_info(si->
si_blocks);
156 ocfs2_update_slot_info(si);
165 static void ocfs2_update_disk_slot_extended(
struct ocfs2_slot_info *si,
167 struct buffer_head **bh)
180 *bh = si->
si_bh[blkind];
185 struct buffer_head **bh)
201 static int ocfs2_update_disk_slot(
struct ocfs2_super *osb,
206 struct buffer_head *bh;
210 ocfs2_update_disk_slot_extended(si, slot_num, &bh);
212 ocfs2_update_disk_slot_old(si, slot_num, &bh);
226 static int ocfs2_slot_map_physical_size(
struct ocfs2_super *osb,
228 unsigned long long *
bytes)
230 unsigned long long bytes_needed;
232 if (ocfs2_uses_extended_slot_map(osb)) {
238 if (bytes_needed > i_size_read(inode)) {
240 "Slot map file is too small! (size %llu, needed %llu)\n",
241 i_size_read(inode), bytes_needed);
245 *bytes = bytes_needed;
252 unsigned int node_num)
258 (node_num == si->
si_slots[i].sl_node_num)) {
272 if ((preferred >= 0) && (preferred < si->si_num_slots)) {
273 if (!si->
si_slots[preferred].sl_valid) {
295 slot = __ocfs2_node_num_to_slot(si, node_num);
302 unsigned int *node_num)
311 if (!si->
si_slots[slot_num].sl_valid)
314 *node_num = si->
si_slots[slot_num].sl_node_num;
330 brelse(si->
si_bh[i]);
348 ocfs2_invalidate_slot(si, slot_num);
351 return ocfs2_update_disk_slot(osb, osb->
slot_info, slot_num);
354 static int ocfs2_map_slot_buffers(
struct ocfs2_super *osb,
359 unsigned long long blocks, bytes = 0;
361 struct buffer_head *bh;
363 status = ocfs2_slot_map_physical_size(osb, si->
si_inode, &bytes);
367 blocks = ocfs2_blocks_for_bytes(si->
si_inode->i_sb, bytes);
375 (osb->
sb->s_blocksize /
383 trace_ocfs2_map_slot_buffers(bytes, si->
si_blocks);
401 trace_ocfs2_map_slot_buffers_block((
unsigned long long)blkno, i);
421 struct inode *inode =
NULL;
433 si->
si_extended = ocfs2_uses_extended_slot_map(osb);
447 status = ocfs2_map_slot_buffers(osb, si);
455 if (status < 0 && si)
456 __ocfs2_free_slot_info(si);
466 __ocfs2_free_slot_info(si);
478 ocfs2_update_slot_info(si);
484 slot = __ocfs2_node_num_to_slot(si, osb->
node_num);
497 "allocated to this node!\n", slot, osb->
dev_str);
499 ocfs2_set_slot(si, slot, osb->
node_num);
503 trace_ocfs2_find_slot(osb->
slot_num);
505 status = ocfs2_update_disk_slot(osb, si, osb->
slot_num);
522 ocfs2_update_slot_info(si);
525 ocfs2_invalidate_slot(si, osb->
slot_num);
529 status = ocfs2_update_disk_slot(osb, si, slot_num);