diff options
| -rw-r--r-- | fs/befs/datastream.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index 5ce85cfd8ae1..b4c7ba013c0d 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
| @@ -22,17 +22,17 @@ const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; | |||
| 22 | 22 | ||
| 23 | static int befs_find_brun_direct(struct super_block *sb, | 23 | static int befs_find_brun_direct(struct super_block *sb, |
| 24 | const befs_data_stream *data, | 24 | const befs_data_stream *data, |
| 25 | befs_blocknr_t blockno, befs_block_run * run); | 25 | befs_blocknr_t blockno, befs_block_run *run); |
| 26 | 26 | ||
| 27 | static int befs_find_brun_indirect(struct super_block *sb, | 27 | static int befs_find_brun_indirect(struct super_block *sb, |
| 28 | const befs_data_stream *data, | 28 | const befs_data_stream *data, |
| 29 | befs_blocknr_t blockno, | 29 | befs_blocknr_t blockno, |
| 30 | befs_block_run * run); | 30 | befs_block_run *run); |
| 31 | 31 | ||
| 32 | static int befs_find_brun_dblindirect(struct super_block *sb, | 32 | static int befs_find_brun_dblindirect(struct super_block *sb, |
| 33 | const befs_data_stream *data, | 33 | const befs_data_stream *data, |
| 34 | befs_blocknr_t blockno, | 34 | befs_blocknr_t blockno, |
| 35 | befs_block_run * run); | 35 | befs_block_run *run); |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * befs_read_datastream - get buffer_head containing data, starting from pos. | 38 | * befs_read_datastream - get buffer_head containing data, starting from pos. |
| @@ -46,7 +46,7 @@ static int befs_find_brun_dblindirect(struct super_block *sb, | |||
| 46 | */ | 46 | */ |
| 47 | struct buffer_head * | 47 | struct buffer_head * |
| 48 | befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, | 48 | befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, |
| 49 | befs_off_t pos, uint * off) | 49 | befs_off_t pos, uint *off) |
| 50 | { | 50 | { |
| 51 | struct buffer_head *bh; | 51 | struct buffer_head *bh; |
| 52 | befs_block_run run; | 52 | befs_block_run run; |
| @@ -94,7 +94,7 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, | |||
| 94 | */ | 94 | */ |
| 95 | int | 95 | int |
| 96 | befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, | 96 | befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, |
| 97 | befs_blocknr_t fblock, befs_block_run * run) | 97 | befs_blocknr_t fblock, befs_block_run *run) |
| 98 | { | 98 | { |
| 99 | int err; | 99 | int err; |
| 100 | befs_off_t pos = fblock << BEFS_SB(sb)->block_shift; | 100 | befs_off_t pos = fblock << BEFS_SB(sb)->block_shift; |
| @@ -134,6 +134,7 @@ befs_read_lsymlink(struct super_block *sb, const befs_data_stream *ds, | |||
| 134 | befs_off_t bytes_read = 0; /* bytes readed */ | 134 | befs_off_t bytes_read = 0; /* bytes readed */ |
| 135 | u16 plen; | 135 | u16 plen; |
| 136 | struct buffer_head *bh; | 136 | struct buffer_head *bh; |
| 137 | |||
| 137 | befs_debug(sb, "---> %s length: %llu", __func__, len); | 138 | befs_debug(sb, "---> %s length: %llu", __func__, len); |
| 138 | 139 | ||
| 139 | while (bytes_read < len) { | 140 | while (bytes_read < len) { |
| @@ -189,13 +190,13 @@ befs_count_blocks(struct super_block *sb, const befs_data_stream *ds) | |||
| 189 | metablocks += ds->indirect.len; | 190 | metablocks += ds->indirect.len; |
| 190 | 191 | ||
| 191 | /* | 192 | /* |
| 192 | Double indir block, plus all the indirect blocks it maps. | 193 | * Double indir block, plus all the indirect blocks it maps. |
| 193 | In the double-indirect range, all block runs of data are | 194 | * In the double-indirect range, all block runs of data are |
| 194 | BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know | 195 | * BEFS_DBLINDIR_BRUN_LEN blocks long. Therefore, we know |
| 195 | how many data block runs are in the double-indirect region, | 196 | * how many data block runs are in the double-indirect region, |
| 196 | and from that we know how many indirect blocks it takes to | 197 | * and from that we know how many indirect blocks it takes to |
| 197 | map them. We assume that the indirect blocks are also | 198 | * map them. We assume that the indirect blocks are also |
| 198 | BEFS_DBLINDIR_BRUN_LEN blocks long. | 199 | * BEFS_DBLINDIR_BRUN_LEN blocks long. |
| 199 | */ | 200 | */ |
| 200 | if (ds->size > ds->max_indirect_range && ds->max_indirect_range != 0) { | 201 | if (ds->size > ds->max_indirect_range && ds->max_indirect_range != 0) { |
| 201 | uint dbl_bytes; | 202 | uint dbl_bytes; |
| @@ -249,7 +250,7 @@ befs_count_blocks(struct super_block *sb, const befs_data_stream *ds) | |||
| 249 | */ | 250 | */ |
| 250 | static int | 251 | static int |
| 251 | befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, | 252 | befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, |
| 252 | befs_blocknr_t blockno, befs_block_run * run) | 253 | befs_blocknr_t blockno, befs_block_run *run) |
| 253 | { | 254 | { |
| 254 | int i; | 255 | int i; |
| 255 | const befs_block_run *array = data->direct; | 256 | const befs_block_run *array = data->direct; |
| @@ -261,6 +262,7 @@ befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, | |||
| 261 | sum += array[i].len, i++) { | 262 | sum += array[i].len, i++) { |
| 262 | if (blockno >= sum && blockno < sum + (array[i].len)) { | 263 | if (blockno >= sum && blockno < sum + (array[i].len)) { |
| 263 | int offset = blockno - sum; | 264 | int offset = blockno - sum; |
| 265 | |||
| 264 | run->allocation_group = array[i].allocation_group; | 266 | run->allocation_group = array[i].allocation_group; |
| 265 | run->start = array[i].start + offset; | 267 | run->start = array[i].start + offset; |
| 266 | run->len = array[i].len - offset; | 268 | run->len = array[i].len - offset; |
| @@ -304,7 +306,7 @@ static int | |||
| 304 | befs_find_brun_indirect(struct super_block *sb, | 306 | befs_find_brun_indirect(struct super_block *sb, |
| 305 | const befs_data_stream *data, | 307 | const befs_data_stream *data, |
| 306 | befs_blocknr_t blockno, | 308 | befs_blocknr_t blockno, |
| 307 | befs_block_run * run) | 309 | befs_block_run *run) |
| 308 | { | 310 | { |
| 309 | int i, j; | 311 | int i, j; |
| 310 | befs_blocknr_t sum = 0; | 312 | befs_blocknr_t sum = 0; |
| @@ -413,7 +415,7 @@ static int | |||
| 413 | befs_find_brun_dblindirect(struct super_block *sb, | 415 | befs_find_brun_dblindirect(struct super_block *sb, |
| 414 | const befs_data_stream *data, | 416 | const befs_data_stream *data, |
| 415 | befs_blocknr_t blockno, | 417 | befs_blocknr_t blockno, |
| 416 | befs_block_run * run) | 418 | befs_block_run *run) |
| 417 | { | 419 | { |
| 418 | int dblindir_indx; | 420 | int dblindir_indx; |
| 419 | int indir_indx; | 421 | int indir_indx; |
