Changeset 147c9f6 in mainline
- Timestamp:
- 2011-03-31T17:10:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bd64680
- Parents:
- b438804
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs_balloc.c
rb438804 r147c9f6 6 6 7 7 static int 8 find_free_bit_and_set(bitchunk_t *b, const int bsize, const bool native); 8 find_free_bit_and_set(bitchunk_t *b, const int bsize, 9 const bool native, unsigned start_bit); 9 10 10 11 int … … 67 68 unsigned long nblocks; 68 69 unsigned *search, i, start_block; 70 unsigned bits_per_block; 69 71 int r, freebit; 70 72 … … 85 87 limit = sbi->ninodes; 86 88 } 89 bits_per_block = sbi->block_size * 8; 87 90 88 91 block_t *b; … … 90 93 retry: 91 94 92 for (i = *search ; i < nblocks; ++i) {95 for (i = *search / bits_per_block; i < nblocks; ++i) { 93 96 r = block_get(&b, inst->handle, i, BLOCK_FLAGS_NONE); 94 97 … … 97 100 98 101 freebit = find_free_bit_and_set(b->data, sbi->block_size, 99 sbi->native );102 sbi->native, *search); 100 103 if (freebit == -1) { 101 104 /*No free bit in this block*/ … … 112 115 } 113 116 114 *search = i ;117 *search = i * bits_per_block + *idx; 115 118 b->dirty = true; 116 119 block_put(b); … … 135 138 136 139 static int 137 find_free_bit_and_set(bitchunk_t *b, const int bsize, const bool native) 140 find_free_bit_and_set(bitchunk_t *b, const int bsize, 141 const bool native, unsigned start_bit) 138 142 { 139 143 int r = -1; … … 141 145 bitchunk_t chunk; 142 146 143 for (i = 0; i < bsize / sizeof(uint32_t); ++i, ++b) {144 if (~ *b) {147 for (i = start_bit; i < bsize / sizeof(uint32_t); ++i) { 148 if (~b[i]) { 145 149 /*No free bit in this chunk*/ 146 150 continue; 147 151 } 148 152 149 chunk = conv32(native, *b);153 chunk = conv32(native, b[i]); 150 154 151 155 for (j = 0; j < 32; ++j) { … … 153 157 r = i * 32 + j; 154 158 chunk |= 1 << j; 155 *b= conv32(native, chunk);159 b[i] = conv32(native, chunk); 156 160 goto found; 157 161 }
Note:
See TracChangeset
for help on using the changeset viewer.