diff options
| author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-25 22:03:22 -0500 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-27 21:27:52 -0500 |
| commit | ce19a5d4321911f98d42e4d724630ae48f413719 (patch) | |
| tree | 4b97b609a1d544da234ac53cd369bd5b80fc60c8 | |
| parent | 64c576fe51bc6b19e99340d2d0e1bda89f66db25 (diff) | |
f2fs: clean up the start_bidx_of_node function
This patch also resolves the following warning reported by kbuild test robot.
fs/f2fs/gc.c: In function 'start_bidx_of_node':
fs/f2fs/gc.c:453:21: warning: 'bidx' may be used uninitialized in this function
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
| -rw-r--r-- | fs/f2fs/gc.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 644aa3808273..eda8230deb0c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
| @@ -430,28 +430,22 @@ next_step: | |||
| 430 | */ | 430 | */ |
| 431 | block_t start_bidx_of_node(unsigned int node_ofs) | 431 | block_t start_bidx_of_node(unsigned int node_ofs) |
| 432 | { | 432 | { |
| 433 | block_t start_bidx; | 433 | unsigned int indirect_blks = 2 * NIDS_PER_BLOCK + 4; |
| 434 | unsigned int bidx, indirect_blks; | 434 | unsigned int bidx; |
| 435 | int dec; | ||
| 436 | 435 | ||
| 437 | indirect_blks = 2 * NIDS_PER_BLOCK + 4; | 436 | if (node_ofs == 0) |
| 437 | return 0; | ||
| 438 | 438 | ||
| 439 | start_bidx = 1; | 439 | if (node_ofs <= 2) { |
| 440 | if (node_ofs == 0) { | ||
| 441 | start_bidx = 0; | ||
| 442 | } else if (node_ofs <= 2) { | ||
| 443 | bidx = node_ofs - 1; | 440 | bidx = node_ofs - 1; |
| 444 | } else if (node_ofs <= indirect_blks) { | 441 | } else if (node_ofs <= indirect_blks) { |
| 445 | dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1); | 442 | int dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1); |
| 446 | bidx = node_ofs - 2 - dec; | 443 | bidx = node_ofs - 2 - dec; |
| 447 | } else { | 444 | } else { |
| 448 | dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); | 445 | int dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); |
| 449 | bidx = node_ofs - 5 - dec; | 446 | bidx = node_ofs - 5 - dec; |
| 450 | } | 447 | } |
| 451 | 448 | return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE; | |
| 452 | if (start_bidx) | ||
| 453 | start_bidx = bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE; | ||
| 454 | return start_bidx; | ||
| 455 | } | 449 | } |
| 456 | 450 | ||
| 457 | static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, | 451 | static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, |
