aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis de Bethencourt <luisbg@osg.samsung.com>2016-08-13 13:11:20 -0400
committerLuis de Bethencourt <luisbg@osg.samsung.com>2016-10-08 05:01:36 -0400
commita20af5f9eaac083e2865e94f37e47af74d70f187 (patch)
tree13484afbbc5a70c82d13b1c7eff673a59d24c1af
parentd327e612bd1f854f08bc4c419122a41440455cbe (diff)
befs: improve documentation in datastream.c
Convert function descriptions to kernel-doc style. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Salah Triki <salah.triki@gmail.com>
-rw-r--r--fs/befs/datastream.c193
1 files changed, 98 insertions, 95 deletions
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
index b2eb5b5cdff2..5ce85cfd8ae1 100644
--- a/fs/befs/datastream.c
+++ b/fs/befs/datastream.c
@@ -75,7 +75,13 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
75 return bh; 75 return bh;
76} 76}
77 77
78/* 78/**
79 * befs_fblock2brun - give back block run for fblock
80 * @sb: the superblock
81 * @data: datastream to read from
82 * @fblock: the blocknumber with the file position to find
83 * @run: The found run is passed back through this pointer
84 *
79 * Takes a file position and gives back a brun who's starting block 85 * Takes a file position and gives back a brun who's starting block
80 * is block number fblock of the file. 86 * is block number fblock of the file.
81 * 87 *
@@ -212,36 +218,35 @@ befs_count_blocks(struct super_block *sb, const befs_data_stream *ds)
212 return blocks; 218 return blocks;
213} 219}
214 220
215/* 221/**
216 Finds the block run that starts at file block number blockno 222 * befs_find_brun_direct - find a direct block run in the datastream
217 in the file represented by the datastream data, if that 223 * @sb: the superblock
218 blockno is in the direct region of the datastream. 224 * @data: the datastream
219 225 * @blockno: the blocknumber to find
220 sb: the superblock 226 * @run: The found run is passed back through this pointer
221 data: the datastream 227 *
222 blockno: the blocknumber to find 228 * Finds the block run that starts at file block number blockno
223 run: The found run is passed back through this pointer 229 * in the file represented by the datastream data, if that
224 230 * blockno is in the direct region of the datastream.
225 Return value is BEFS_OK if the blockrun is found, BEFS_ERR 231 *
226 otherwise. 232 * Return value is BEFS_OK if the blockrun is found, BEFS_ERR
227 233 * otherwise.
228 Algorithm: 234 *
229 Linear search. Checks each element of array[] to see if it 235 * Algorithm:
230 contains the blockno-th filesystem block. This is necessary 236 * Linear search. Checks each element of array[] to see if it
231 because the block runs map variable amounts of data. Simply 237 * contains the blockno-th filesystem block. This is necessary
232 keeps a count of the number of blocks searched so far (sum), 238 * because the block runs map variable amounts of data. Simply
233 incrementing this by the length of each block run as we come 239 * keeps a count of the number of blocks searched so far (sum),
234 across it. Adds sum to *count before returning (this is so 240 * incrementing this by the length of each block run as we come
235 you can search multiple arrays that are logicaly one array, 241 * across it. Adds sum to *count before returning (this is so
236 as in the indirect region code). 242 * you can search multiple arrays that are logicaly one array,
237 243 * as in the indirect region code).
238 When/if blockno is found, if blockno is inside of a block 244 *
239 run as stored on disk, we offset the start and length members 245 * When/if blockno is found, if blockno is inside of a block
240 of the block run, so that blockno is the start and len is 246 * run as stored on disk, we offset the start and length members
241 still valid (the run ends in the same place). 247 * of the block run, so that blockno is the start and len is
242 248 * still valid (the run ends in the same place).
243 2001-11-15 Will Dyson 249 */
244*/
245static int 250static int
246befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, 251befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
247 befs_blocknr_t blockno, befs_block_run * run) 252 befs_blocknr_t blockno, befs_block_run * run)
@@ -273,29 +278,28 @@ befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
273 return BEFS_ERR; 278 return BEFS_ERR;
274} 279}
275 280
276/* 281/**
277 Finds the block run that starts at file block number blockno 282 * befs_find_brun_indirect - find a block run in the datastream
278 in the file represented by the datastream data, if that 283 * @sb: the superblock
279 blockno is in the indirect region of the datastream. 284 * @data: the datastream
280 285 * @blockno: the blocknumber to find
281 sb: the superblock 286 * @run: The found run is passed back through this pointer
282 data: the datastream 287 *
283 blockno: the blocknumber to find 288 * Finds the block run that starts at file block number blockno
284 run: The found run is passed back through this pointer 289 * in the file represented by the datastream data, if that
285 290 * blockno is in the indirect region of the datastream.
286 Return value is BEFS_OK if the blockrun is found, BEFS_ERR 291 *
287 otherwise. 292 * Return value is BEFS_OK if the blockrun is found, BEFS_ERR
288 293 * otherwise.
289 Algorithm: 294 *
290 For each block in the indirect run of the datastream, read 295 * Algorithm:
291 it in and search through it for search_blk. 296 * For each block in the indirect run of the datastream, read
292 297 * it in and search through it for search_blk.
293 XXX: 298 *
294 Really should check to make sure blockno is inside indirect 299 * XXX:
295 region. 300 * Really should check to make sure blockno is inside indirect
296 301 * region.
297 2001-11-15 Will Dyson 302 */
298*/
299static int 303static int
300befs_find_brun_indirect(struct super_block *sb, 304befs_find_brun_indirect(struct super_block *sb,
301 const befs_data_stream *data, 305 const befs_data_stream *data,
@@ -365,47 +369,46 @@ befs_find_brun_indirect(struct super_block *sb,
365 return BEFS_ERR; 369 return BEFS_ERR;
366} 370}
367 371
368/* 372/**
369 Finds the block run that starts at file block number blockno 373 * befs_find_brun_dblindirect - find a block run in the datastream
370 in the file represented by the datastream data, if that 374 * @sb: the superblock
371 blockno is in the double-indirect region of the datastream. 375 * @data: the datastream
372 376 * @blockno: the blocknumber to find
373 sb: the superblock 377 * @run: The found run is passed back through this pointer
374 data: the datastream 378 *
375 blockno: the blocknumber to find 379 * Finds the block run that starts at file block number blockno
376 run: The found run is passed back through this pointer 380 * in the file represented by the datastream data, if that
377 381 * blockno is in the double-indirect region of the datastream.
378 Return value is BEFS_OK if the blockrun is found, BEFS_ERR 382 *
379 otherwise. 383 * Return value is BEFS_OK if the blockrun is found, BEFS_ERR
380 384 * otherwise.
381 Algorithm: 385 *
382 The block runs in the double-indirect region are different. 386 * Algorithm:
383 They are always allocated 4 fs blocks at a time, so each 387 * The block runs in the double-indirect region are different.
384 block run maps a constant amount of file data. This means 388 * They are always allocated 4 fs blocks at a time, so each
385 that we can directly calculate how many block runs into the 389 * block run maps a constant amount of file data. This means
386 double-indirect region we need to go to get to the one that 390 * that we can directly calculate how many block runs into the
387 maps a particular filesystem block. 391 * double-indirect region we need to go to get to the one that
388 392 * maps a particular filesystem block.
389 We do this in two stages. First we calculate which of the 393 *
390 inode addresses in the double-indirect block will point us 394 * We do this in two stages. First we calculate which of the
391 to the indirect block that contains the mapping for the data, 395 * inode addresses in the double-indirect block will point us
392 then we calculate which of the inode addresses in that 396 * to the indirect block that contains the mapping for the data,
393 indirect block maps the data block we are after. 397 * then we calculate which of the inode addresses in that
394 398 * indirect block maps the data block we are after.
395 Oh, and once we've done that, we actually read in the blocks 399 *
396 that contain the inode addresses we calculated above. Even 400 * Oh, and once we've done that, we actually read in the blocks
397 though the double-indirect run may be several blocks long, 401 * that contain the inode addresses we calculated above. Even
398 we can calculate which of those blocks will contain the index 402 * though the double-indirect run may be several blocks long,
399 we are after and only read that one. We then follow it to 403 * we can calculate which of those blocks will contain the index
400 the indirect block and perform a similar process to find 404 * we are after and only read that one. We then follow it to
401 the actual block run that maps the data block we are interested 405 * the indirect block and perform a similar process to find
402 in. 406 * the actual block run that maps the data block we are interested
403 407 * in.
404 Then we offset the run as in befs_find_brun_array() and we are 408 *
405 done. 409 * Then we offset the run as in befs_find_brun_array() and we are
406 410 * done.
407 2001-11-15 Will Dyson 411 */
408*/
409static int 412static int
410befs_find_brun_dblindirect(struct super_block *sb, 413befs_find_brun_dblindirect(struct super_block *sb,
411 const befs_data_stream *data, 414 const befs_data_stream *data,