Changes in uspace/srv/fs/mfs/mfs_balloc.c [40a2af3:6d4d883] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_balloc.c
r40a2af3 r6d4d883 36 36 static int 37 37 find_free_bit_and_set(bitchunk_t *b, const int bsize, 38 38 const bool native, unsigned start_bit); 39 39 40 40 static int … … 129 129 if (idx > sbi->nzones) { 130 130 printf(NAME ": Error! Trying to free beyond the" \ 131 131 "bitmap max size\n"); 132 132 return -1; 133 133 } 134 134 } else { 135 /* bid == BMAP_INODE*/135 /* bid == BMAP_INODE */ 136 136 search = &sbi->isearch; 137 137 start_block = 2; 138 138 if (idx > sbi->ninodes) { 139 139 printf(NAME ": Error! Trying to free beyond the" \ 140 140 "bitmap max size\n"); 141 141 return -1; 142 142 } 143 143 } 144 144 145 /* Compute the bitmap block*/145 /* Compute the bitmap block */ 146 146 uint32_t block = idx / (sbi->block_size * 8) + start_block; 147 147 … … 150 150 goto out_err; 151 151 152 /* Compute the bit index in the block*/152 /* Compute the bit index in the block */ 153 153 idx %= (sbi->block_size * 8); 154 154 bitchunk_t *ptr = b->data; … … 220 220 221 221 freebit = find_free_bit_and_set(b->data, sbi->block_size, 222 222 sbi->native, tmp); 223 223 if (freebit == -1) { 224 /* No free bit in this block*/224 /* No free bit in this block */ 225 225 r = block_put(b); 226 226 if (r != EOK) … … 229 229 } 230 230 231 /* Free bit found in this block, compute the real index*/231 /* Free bit found in this block, compute the real index */ 232 232 *idx = freebit + bits_per_block * i; 233 233 if (*idx > limit) { 234 /* Index is beyond the limit, it is invalid*/234 /* Index is beyond the limit, it is invalid */ 235 235 r = block_put(b); 236 236 if (r != EOK) … … 246 246 247 247 if (*search > 0) { 248 /* Repeat the search from the first bitmap block*/248 /* Repeat the search from the first bitmap block */ 249 249 *search = 0; 250 250 goto retry; 251 251 } 252 252 253 /* Free bit not found, return error*/253 /* Free bit not found, return error */ 254 254 return ENOSPC; 255 255 … … 260 260 static int 261 261 find_free_bit_and_set(bitchunk_t *b, const int bsize, 262 262 const bool native, unsigned start_bit) 263 263 { 264 264 int r = -1; … … 268 268 269 269 for (i = start_bit / chunk_bits; 270 i < bsize / sizeof(bitchunk_t); ++i) { 270 i < bsize / sizeof(bitchunk_t); ++i) { 271 271 272 if (!(~b[i])) { 272 /* No free bit in this chunk*/273 /* No free bit in this chunk */ 273 274 continue; 274 275 }
Note:
See TracChangeset
for help on using the changeset viewer.