Blame view
fs/ocfs2/slot_map.c
12.2 KB
ccd979bdb [PATCH] OCFS2: Th... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* -*- mode: c; c-basic-offset: 8; -*- * vim: noexpandtab sw=8 ts=8 sts=0: * * slot_map.c * * * * Copyright (C) 2002, 2004 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA. */ #include <linux/types.h> #include <linux/slab.h> #include <linux/highmem.h> |
ccd979bdb [PATCH] OCFS2: Th... |
29 |
|
ccd979bdb [PATCH] OCFS2: Th... |
30 31 32 33 34 35 36 37 38 39 40 |
#include <cluster/masklog.h> #include "ocfs2.h" #include "dlmglue.h" #include "extent_map.h" #include "heartbeat.h" #include "inode.h" #include "slot_map.h" #include "super.h" #include "sysfile.h" |
a8731086e ocfs2: Remove mlo... |
41 |
#include "ocfs2_trace.h" |
ccd979bdb [PATCH] OCFS2: Th... |
42 43 |
#include "buffer_head_io.h" |
fc881fa0d ocfs2: De-magic t... |
44 45 46 47 48 |
struct ocfs2_slot { int sl_valid; unsigned int sl_node_num; }; |
d85b20e4b ocfs2: Make ocfs2... |
49 |
struct ocfs2_slot_info { |
386a2ef85 ocfs2: New slot m... |
50 51 |
int si_extended; int si_slots_per_block; |
d85b20e4b ocfs2: Make ocfs2... |
52 |
struct inode *si_inode; |
1c8d9a6a3 ocfs2: slot_map I... |
53 54 |
unsigned int si_blocks; struct buffer_head **si_bh; |
d85b20e4b ocfs2: Make ocfs2... |
55 |
unsigned int si_num_slots; |
fc881fa0d ocfs2: De-magic t... |
56 |
struct ocfs2_slot *si_slots; |
d85b20e4b ocfs2: Make ocfs2... |
57 |
}; |
fc881fa0d ocfs2: De-magic t... |
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
static int __ocfs2_node_num_to_slot(struct ocfs2_slot_info *si, unsigned int node_num); static void ocfs2_invalidate_slot(struct ocfs2_slot_info *si, int slot_num) { BUG_ON((slot_num < 0) || (slot_num >= si->si_num_slots)); si->si_slots[slot_num].sl_valid = 0; } static void ocfs2_set_slot(struct ocfs2_slot_info *si, int slot_num, unsigned int node_num) { BUG_ON((slot_num < 0) || (slot_num >= si->si_num_slots)); |
fc881fa0d ocfs2: De-magic t... |
72 73 74 75 |
si->si_slots[slot_num].sl_valid = 1; si->si_slots[slot_num].sl_node_num = node_num; } |
ccd979bdb [PATCH] OCFS2: Th... |
76 |
|
386a2ef85 ocfs2: New slot m... |
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
/* This version is for the extended slot map */ static void ocfs2_update_slot_info_extended(struct ocfs2_slot_info *si) { int b, i, slotno; struct ocfs2_slot_map_extended *se; slotno = 0; for (b = 0; b < si->si_blocks; b++) { se = (struct ocfs2_slot_map_extended *)si->si_bh[b]->b_data; for (i = 0; (i < si->si_slots_per_block) && (slotno < si->si_num_slots); i++, slotno++) { if (se->se_slots[i].es_valid) ocfs2_set_slot(si, slotno, le32_to_cpu(se->se_slots[i].es_node_num)); else ocfs2_invalidate_slot(si, slotno); } } } |
d85b20e4b ocfs2: Make ocfs2... |
98 99 100 101 |
/* * Post the slot information on disk into our slot_info struct. * Must be protected by osb_lock. */ |
386a2ef85 ocfs2: New slot m... |
102 |
static void ocfs2_update_slot_info_old(struct ocfs2_slot_info *si) |
ccd979bdb [PATCH] OCFS2: Th... |
103 104 |
{ int i; |
fb86b1f07 ocfs2: Define the... |
105 |
struct ocfs2_slot_map *sm; |
ccd979bdb [PATCH] OCFS2: Th... |
106 |
|
fb86b1f07 ocfs2: Define the... |
107 |
sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data; |
ccd979bdb [PATCH] OCFS2: Th... |
108 |
|
fc881fa0d ocfs2: De-magic t... |
109 |
for (i = 0; i < si->si_num_slots; i++) { |
fb86b1f07 ocfs2: Define the... |
110 |
if (le16_to_cpu(sm->sm_slots[i]) == (u16)OCFS2_INVALID_SLOT) |
fc881fa0d ocfs2: De-magic t... |
111 112 |
ocfs2_invalidate_slot(si, i); else |
fb86b1f07 ocfs2: Define the... |
113 |
ocfs2_set_slot(si, i, le16_to_cpu(sm->sm_slots[i])); |
fc881fa0d ocfs2: De-magic t... |
114 |
} |
ccd979bdb [PATCH] OCFS2: Th... |
115 |
} |
386a2ef85 ocfs2: New slot m... |
116 117 118 119 120 121 122 123 124 125 126 |
static void ocfs2_update_slot_info(struct ocfs2_slot_info *si) { /* * The slot data will have been refreshed when ocfs2_super_lock * was taken. */ if (si->si_extended) ocfs2_update_slot_info_extended(si); else ocfs2_update_slot_info_old(si); } |
8e8a4603b ocfs2: Move slot ... |
127 128 129 130 |
int ocfs2_refresh_slot_info(struct ocfs2_super *osb) { int ret; struct ocfs2_slot_info *si = osb->slot_info; |
8e8a4603b ocfs2: Move slot ... |
131 132 133 |
if (si == NULL) return 0; |
1c8d9a6a3 ocfs2: slot_map I... |
134 135 |
BUG_ON(si->si_blocks == 0); BUG_ON(si->si_bh == NULL); |
a8731086e ocfs2: Remove mlo... |
136 |
trace_ocfs2_refresh_slot_info(si->si_blocks); |
1c8d9a6a3 ocfs2: slot_map I... |
137 138 139 140 141 142 |
/* * We pass -1 as blocknr because we expect all of si->si_bh to * be !NULL. Thus, ocfs2_read_blocks() will ignore blocknr. If * this is not true, the read of -1 (UINT64_MAX) will fail. */ |
8cb471e8f ocfs2: Take the i... |
143 144 |
ret = ocfs2_read_blocks(INODE_CACHE(si->si_inode), -1, si->si_blocks, si->si_bh, OCFS2_BH_IGNORE_CACHE, NULL); |
d85b20e4b ocfs2: Make ocfs2... |
145 146 |
if (ret == 0) { spin_lock(&osb->osb_lock); |
8e8a4603b ocfs2: Move slot ... |
147 |
ocfs2_update_slot_info(si); |
d85b20e4b ocfs2: Make ocfs2... |
148 149 |
spin_unlock(&osb->osb_lock); } |
8e8a4603b ocfs2: Move slot ... |
150 151 152 |
return ret; } |
ccd979bdb [PATCH] OCFS2: Th... |
153 154 |
/* post the our slot info stuff into it's destination bh and write it * out. */ |
386a2ef85 ocfs2: New slot m... |
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
static void ocfs2_update_disk_slot_extended(struct ocfs2_slot_info *si, int slot_num, struct buffer_head **bh) { int blkind = slot_num / si->si_slots_per_block; int slotno = slot_num % si->si_slots_per_block; struct ocfs2_slot_map_extended *se; BUG_ON(blkind >= si->si_blocks); se = (struct ocfs2_slot_map_extended *)si->si_bh[blkind]->b_data; se->se_slots[slotno].es_valid = si->si_slots[slot_num].sl_valid; if (si->si_slots[slot_num].sl_valid) se->se_slots[slotno].es_node_num = cpu_to_le32(si->si_slots[slot_num].sl_node_num); *bh = si->si_bh[blkind]; } static void ocfs2_update_disk_slot_old(struct ocfs2_slot_info *si, int slot_num, struct buffer_head **bh) |
ccd979bdb [PATCH] OCFS2: Th... |
176 |
{ |
386a2ef85 ocfs2: New slot m... |
177 |
int i; |
fb86b1f07 ocfs2: Define the... |
178 |
struct ocfs2_slot_map *sm; |
ccd979bdb [PATCH] OCFS2: Th... |
179 |
|
fb86b1f07 ocfs2: Define the... |
180 |
sm = (struct ocfs2_slot_map *)si->si_bh[0]->b_data; |
fc881fa0d ocfs2: De-magic t... |
181 182 |
for (i = 0; i < si->si_num_slots; i++) { if (si->si_slots[i].sl_valid) |
fb86b1f07 ocfs2: Define the... |
183 |
sm->sm_slots[i] = |
fc881fa0d ocfs2: De-magic t... |
184 185 |
cpu_to_le16(si->si_slots[i].sl_node_num); else |
fb86b1f07 ocfs2: Define the... |
186 |
sm->sm_slots[i] = cpu_to_le16(OCFS2_INVALID_SLOT); |
fc881fa0d ocfs2: De-magic t... |
187 |
} |
386a2ef85 ocfs2: New slot m... |
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
*bh = si->si_bh[0]; } static int ocfs2_update_disk_slot(struct ocfs2_super *osb, struct ocfs2_slot_info *si, int slot_num) { int status; struct buffer_head *bh; spin_lock(&osb->osb_lock); if (si->si_extended) ocfs2_update_disk_slot_extended(si, slot_num, &bh); else ocfs2_update_disk_slot_old(si, slot_num, &bh); |
d85b20e4b ocfs2: Make ocfs2... |
203 |
spin_unlock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
204 |
|
8cb471e8f ocfs2: Take the i... |
205 |
status = ocfs2_write_block(osb, bh, INODE_CACHE(si->si_inode)); |
ccd979bdb [PATCH] OCFS2: Th... |
206 207 208 209 210 |
if (status < 0) mlog_errno(status); return status; } |
1c8d9a6a3 ocfs2: slot_map I... |
211 212 213 214 215 216 217 218 219 |
/* * Calculate how many bytes are needed by the slot map. Returns * an error if the slot map file is too small. */ static int ocfs2_slot_map_physical_size(struct ocfs2_super *osb, struct inode *inode, unsigned long long *bytes) { unsigned long long bytes_needed; |
386a2ef85 ocfs2: New slot m... |
220 221 222 223 224 225 |
if (ocfs2_uses_extended_slot_map(osb)) { bytes_needed = osb->max_slots * sizeof(struct ocfs2_extended_slot); } else { bytes_needed = osb->max_slots * sizeof(__le16); } |
1c8d9a6a3 ocfs2: slot_map I... |
226 227 228 229 230 231 232 233 234 235 236 |
if (bytes_needed > i_size_read(inode)) { mlog(ML_ERROR, "Slot map file is too small! (size %llu, needed %llu) ", i_size_read(inode), bytes_needed); return -ENOSPC; } *bytes = bytes_needed; return 0; } |
fc881fa0d ocfs2: De-magic t... |
237 238 239 240 |
/* try to find global node in the slot info. Returns -ENOENT * if nothing is found. */ static int __ocfs2_node_num_to_slot(struct ocfs2_slot_info *si, unsigned int node_num) |
ccd979bdb [PATCH] OCFS2: Th... |
241 |
{ |
fc881fa0d ocfs2: De-magic t... |
242 |
int i, ret = -ENOENT; |
ccd979bdb [PATCH] OCFS2: Th... |
243 244 |
for(i = 0; i < si->si_num_slots; i++) { |
fc881fa0d ocfs2: De-magic t... |
245 246 247 |
if (si->si_slots[i].sl_valid && (node_num == si->si_slots[i].sl_node_num)) { ret = i; |
ccd979bdb [PATCH] OCFS2: Th... |
248 249 250 |
break; } } |
fc881fa0d ocfs2: De-magic t... |
251 |
|
ccd979bdb [PATCH] OCFS2: Th... |
252 253 |
return ret; } |
fc881fa0d ocfs2: De-magic t... |
254 255 |
static int __ocfs2_find_empty_slot(struct ocfs2_slot_info *si, int preferred) |
ccd979bdb [PATCH] OCFS2: Th... |
256 |
{ |
fc881fa0d ocfs2: De-magic t... |
257 |
int i, ret = -ENOSPC; |
ccd979bdb [PATCH] OCFS2: Th... |
258 |
|
fc881fa0d ocfs2: De-magic t... |
259 260 |
if ((preferred >= 0) && (preferred < si->si_num_slots)) { if (!si->si_slots[preferred].sl_valid) { |
baf4661a8 ocfs2: Add "prefe... |
261 262 263 264 |
ret = preferred; goto out; } } |
ccd979bdb [PATCH] OCFS2: Th... |
265 |
for(i = 0; i < si->si_num_slots; i++) { |
fc881fa0d ocfs2: De-magic t... |
266 267 |
if (!si->si_slots[i].sl_valid) { ret = i; |
ccd979bdb [PATCH] OCFS2: Th... |
268 269 270 |
break; } } |
baf4661a8 ocfs2: Add "prefe... |
271 |
out: |
ccd979bdb [PATCH] OCFS2: Th... |
272 273 |
return ret; } |
d85b20e4b ocfs2: Make ocfs2... |
274 |
int ocfs2_node_num_to_slot(struct ocfs2_super *osb, unsigned int node_num) |
ccd979bdb [PATCH] OCFS2: Th... |
275 |
{ |
fc881fa0d ocfs2: De-magic t... |
276 |
int slot; |
d85b20e4b ocfs2: Make ocfs2... |
277 |
struct ocfs2_slot_info *si = osb->slot_info; |
ccd979bdb [PATCH] OCFS2: Th... |
278 |
|
d85b20e4b ocfs2: Make ocfs2... |
279 280 281 |
spin_lock(&osb->osb_lock); slot = __ocfs2_node_num_to_slot(si, node_num); spin_unlock(&osb->osb_lock); |
d85b20e4b ocfs2: Make ocfs2... |
282 283 284 285 286 287 288 289 290 291 292 293 |
return slot; } int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num, unsigned int *node_num) { struct ocfs2_slot_info *si = osb->slot_info; assert_spin_locked(&osb->osb_lock); BUG_ON(slot_num < 0); BUG_ON(slot_num > osb->max_slots); |
fc881fa0d ocfs2: De-magic t... |
294 |
if (!si->si_slots[slot_num].sl_valid) |
d85b20e4b ocfs2: Make ocfs2... |
295 |
return -ENOENT; |
fc881fa0d ocfs2: De-magic t... |
296 |
*node_num = si->si_slots[slot_num].sl_node_num; |
d85b20e4b ocfs2: Make ocfs2... |
297 |
return 0; |
ccd979bdb [PATCH] OCFS2: Th... |
298 |
} |
8e8a4603b ocfs2: Move slot ... |
299 300 |
static void __ocfs2_free_slot_info(struct ocfs2_slot_info *si) { |
1c8d9a6a3 ocfs2: slot_map I... |
301 |
unsigned int i; |
8e8a4603b ocfs2: Move slot ... |
302 303 304 305 306 |
if (si == NULL) return; if (si->si_inode) iput(si->si_inode); |
1c8d9a6a3 ocfs2: slot_map I... |
307 308 309 310 311 312 313 314 315 |
if (si->si_bh) { for (i = 0; i < si->si_blocks; i++) { if (si->si_bh[i]) { brelse(si->si_bh[i]); si->si_bh[i] = NULL; } } kfree(si->si_bh); } |
8e8a4603b ocfs2: Move slot ... |
316 317 318 |
kfree(si); } |
fc881fa0d ocfs2: De-magic t... |
319 |
int ocfs2_clear_slot(struct ocfs2_super *osb, int slot_num) |
ccd979bdb [PATCH] OCFS2: Th... |
320 |
{ |
8e8a4603b ocfs2: Move slot ... |
321 322 323 324 |
struct ocfs2_slot_info *si = osb->slot_info; if (si == NULL) return 0; |
d85b20e4b ocfs2: Make ocfs2... |
325 |
spin_lock(&osb->osb_lock); |
fc881fa0d ocfs2: De-magic t... |
326 |
ocfs2_invalidate_slot(si, slot_num); |
d85b20e4b ocfs2: Make ocfs2... |
327 |
spin_unlock(&osb->osb_lock); |
8e8a4603b ocfs2: Move slot ... |
328 |
|
386a2ef85 ocfs2: New slot m... |
329 |
return ocfs2_update_disk_slot(osb, osb->slot_info, slot_num); |
ccd979bdb [PATCH] OCFS2: Th... |
330 |
} |
1c8d9a6a3 ocfs2: slot_map I... |
331 332 333 334 335 |
static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, struct ocfs2_slot_info *si) { int status = 0; u64 blkno; |
f30d44f3e When I tried to c... |
336 |
unsigned long long blocks, bytes = 0; |
1c8d9a6a3 ocfs2: slot_map I... |
337 338 339 340 341 342 343 344 345 346 347 348 |
unsigned int i; struct buffer_head *bh; status = ocfs2_slot_map_physical_size(osb, si->si_inode, &bytes); if (status) goto bail; blocks = ocfs2_blocks_for_bytes(si->si_inode->i_sb, bytes); BUG_ON(blocks > UINT_MAX); si->si_blocks = blocks; if (!si->si_blocks) goto bail; |
386a2ef85 ocfs2: New slot m... |
349 350 351 352 353 354 355 356 357 |
if (si->si_extended) si->si_slots_per_block = (osb->sb->s_blocksize / sizeof(struct ocfs2_extended_slot)); else si->si_slots_per_block = osb->sb->s_blocksize / sizeof(__le16); /* The size checks above should ensure this */ BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); |
a8731086e ocfs2: Remove mlo... |
358 |
trace_ocfs2_map_slot_buffers(bytes, si->si_blocks); |
1c8d9a6a3 ocfs2: slot_map I... |
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
si->si_bh = kzalloc(sizeof(struct buffer_head *) * si->si_blocks, GFP_KERNEL); if (!si->si_bh) { status = -ENOMEM; mlog_errno(status); goto bail; } for (i = 0; i < si->si_blocks; i++) { status = ocfs2_extent_map_get_blocks(si->si_inode, i, &blkno, NULL, NULL); if (status < 0) { mlog_errno(status); goto bail; } |
a8731086e ocfs2: Remove mlo... |
375 |
trace_ocfs2_map_slot_buffers_block((unsigned long long)blkno, i); |
1c8d9a6a3 ocfs2: slot_map I... |
376 377 |
bh = NULL; /* Acquire a fresh bh */ |
8cb471e8f ocfs2: Take the i... |
378 379 |
status = ocfs2_read_blocks(INODE_CACHE(si->si_inode), blkno, 1, &bh, OCFS2_BH_IGNORE_CACHE, NULL); |
1c8d9a6a3 ocfs2: slot_map I... |
380 381 382 383 384 385 386 387 388 389 390 |
if (status < 0) { mlog_errno(status); goto bail; } si->si_bh[i] = bh; } bail: return status; } |
ccd979bdb [PATCH] OCFS2: Th... |
391 392 |
int ocfs2_init_slot_info(struct ocfs2_super *osb) { |
fc881fa0d ocfs2: De-magic t... |
393 |
int status; |
ccd979bdb [PATCH] OCFS2: Th... |
394 |
struct inode *inode = NULL; |
ccd979bdb [PATCH] OCFS2: Th... |
395 |
struct ocfs2_slot_info *si; |
fc881fa0d ocfs2: De-magic t... |
396 397 398 |
si = kzalloc(sizeof(struct ocfs2_slot_info) + (sizeof(struct ocfs2_slot) * osb->max_slots), GFP_KERNEL); |
ccd979bdb [PATCH] OCFS2: Th... |
399 400 401 402 403 |
if (!si) { status = -ENOMEM; mlog_errno(status); goto bail; } |
386a2ef85 ocfs2: New slot m... |
404 |
si->si_extended = ocfs2_uses_extended_slot_map(osb); |
ccd979bdb [PATCH] OCFS2: Th... |
405 |
si->si_num_slots = osb->max_slots; |
fc881fa0d ocfs2: De-magic t... |
406 407 |
si->si_slots = (struct ocfs2_slot *)((char *)si + sizeof(struct ocfs2_slot_info)); |
ccd979bdb [PATCH] OCFS2: Th... |
408 409 410 411 412 413 414 415 |
inode = ocfs2_get_system_file_inode(osb, SLOT_MAP_SYSTEM_INODE, OCFS2_INVALID_SLOT); if (!inode) { status = -EINVAL; mlog_errno(status); goto bail; } |
1c8d9a6a3 ocfs2: slot_map I... |
416 417 |
si->si_inode = inode; status = ocfs2_map_slot_buffers(osb, si); |
ccd979bdb [PATCH] OCFS2: Th... |
418 419 420 421 |
if (status < 0) { mlog_errno(status); goto bail; } |
d85b20e4b ocfs2: Make ocfs2... |
422 |
osb->slot_info = (struct ocfs2_slot_info *)si; |
ccd979bdb [PATCH] OCFS2: Th... |
423 424 |
bail: if (status < 0 && si) |
8e8a4603b ocfs2: Move slot ... |
425 |
__ocfs2_free_slot_info(si); |
ccd979bdb [PATCH] OCFS2: Th... |
426 427 428 |
return status; } |
8e8a4603b ocfs2: Move slot ... |
429 |
void ocfs2_free_slot_info(struct ocfs2_super *osb) |
ccd979bdb [PATCH] OCFS2: Th... |
430 |
{ |
8e8a4603b ocfs2: Move slot ... |
431 432 433 434 |
struct ocfs2_slot_info *si = osb->slot_info; osb->slot_info = NULL; __ocfs2_free_slot_info(si); |
ccd979bdb [PATCH] OCFS2: Th... |
435 436 437 438 439 |
} int ocfs2_find_slot(struct ocfs2_super *osb) { int status; |
fc881fa0d ocfs2: De-magic t... |
440 |
int slot; |
ccd979bdb [PATCH] OCFS2: Th... |
441 |
struct ocfs2_slot_info *si; |
ccd979bdb [PATCH] OCFS2: Th... |
442 |
si = osb->slot_info; |
d85b20e4b ocfs2: Make ocfs2... |
443 |
spin_lock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
444 |
ocfs2_update_slot_info(si); |
ccd979bdb [PATCH] OCFS2: Th... |
445 446 447 448 449 |
/* search for ourselves first and take the slot if it already * exists. Perhaps we need to mark this in a variable for our * own journal recovery? Possibly not, though we certainly * need to warn to the user */ slot = __ocfs2_node_num_to_slot(si, osb->node_num); |
fc881fa0d ocfs2: De-magic t... |
450 |
if (slot < 0) { |
ccd979bdb [PATCH] OCFS2: Th... |
451 452 |
/* if no slot yet, then just take 1st available * one. */ |
baf4661a8 ocfs2: Add "prefe... |
453 |
slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); |
fc881fa0d ocfs2: De-magic t... |
454 |
if (slot < 0) { |
d85b20e4b ocfs2: Make ocfs2... |
455 |
spin_unlock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
456 457 458 459 460 461 |
mlog(ML_ERROR, "no free slots available! "); status = -EINVAL; goto bail; } } else |
619c200de ocfs2: Clean up m... |
462 463 464 |
printk(KERN_INFO "ocfs2: Slot %d on device (%s) was already " "allocated to this node! ", slot, osb->dev_str); |
ccd979bdb [PATCH] OCFS2: Th... |
465 |
|
fc881fa0d ocfs2: De-magic t... |
466 |
ocfs2_set_slot(si, slot, osb->node_num); |
ccd979bdb [PATCH] OCFS2: Th... |
467 |
osb->slot_num = slot; |
d85b20e4b ocfs2: Make ocfs2... |
468 |
spin_unlock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
469 |
|
a8731086e ocfs2: Remove mlo... |
470 |
trace_ocfs2_find_slot(osb->slot_num); |
ccd979bdb [PATCH] OCFS2: Th... |
471 |
|
386a2ef85 ocfs2: New slot m... |
472 |
status = ocfs2_update_disk_slot(osb, si, osb->slot_num); |
ccd979bdb [PATCH] OCFS2: Th... |
473 474 475 476 |
if (status < 0) mlog_errno(status); bail: |
ccd979bdb [PATCH] OCFS2: Th... |
477 478 479 480 481 |
return status; } void ocfs2_put_slot(struct ocfs2_super *osb) { |
386a2ef85 ocfs2: New slot m... |
482 |
int status, slot_num; |
ccd979bdb [PATCH] OCFS2: Th... |
483 484 485 486 |
struct ocfs2_slot_info *si = osb->slot_info; if (!si) return; |
d85b20e4b ocfs2: Make ocfs2... |
487 |
spin_lock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
488 |
ocfs2_update_slot_info(si); |
386a2ef85 ocfs2: New slot m... |
489 |
slot_num = osb->slot_num; |
fc881fa0d ocfs2: De-magic t... |
490 |
ocfs2_invalidate_slot(si, osb->slot_num); |
ccd979bdb [PATCH] OCFS2: Th... |
491 |
osb->slot_num = OCFS2_INVALID_SLOT; |
d85b20e4b ocfs2: Make ocfs2... |
492 |
spin_unlock(&osb->osb_lock); |
ccd979bdb [PATCH] OCFS2: Th... |
493 |
|
386a2ef85 ocfs2: New slot m... |
494 |
status = ocfs2_update_disk_slot(osb, si, slot_num); |
ccd979bdb [PATCH] OCFS2: Th... |
495 496 497 498 499 500 |
if (status < 0) { mlog_errno(status); goto bail; } bail: |
8e8a4603b ocfs2: Move slot ... |
501 |
ocfs2_free_slot_info(osb); |
ccd979bdb [PATCH] OCFS2: Th... |
502 |
} |