| .. | .. |
|---|
| 67 | 67 | |
|---|
| 68 | 68 | down_read(&bmap->b_sem); |
|---|
| 69 | 69 | ret = bmap->b_ops->bop_lookup(bmap, key, level, ptrp); |
|---|
| 70 | | - if (ret < 0) { |
|---|
| 71 | | - ret = nilfs_bmap_convert_error(bmap, __func__, ret); |
|---|
| 70 | + if (ret < 0) |
|---|
| 72 | 71 | goto out; |
|---|
| 73 | | - } |
|---|
| 72 | + |
|---|
| 74 | 73 | if (NILFS_BMAP_USE_VBN(bmap)) { |
|---|
| 75 | 74 | ret = nilfs_dat_translate(nilfs_bmap_get_dat(bmap), *ptrp, |
|---|
| 76 | 75 | &blocknr); |
|---|
| 77 | 76 | if (!ret) |
|---|
| 78 | 77 | *ptrp = blocknr; |
|---|
| 78 | + else if (ret == -ENOENT) { |
|---|
| 79 | + /* |
|---|
| 80 | + * If there was no valid entry in DAT for the block |
|---|
| 81 | + * address obtained by b_ops->bop_lookup, then pass |
|---|
| 82 | + * internal code -EINVAL to nilfs_bmap_convert_error |
|---|
| 83 | + * to treat it as metadata corruption. |
|---|
| 84 | + */ |
|---|
| 85 | + ret = -EINVAL; |
|---|
| 86 | + } |
|---|
| 79 | 87 | } |
|---|
| 80 | 88 | |
|---|
| 81 | 89 | out: |
|---|
| 82 | 90 | up_read(&bmap->b_sem); |
|---|
| 83 | | - return ret; |
|---|
| 91 | + return nilfs_bmap_convert_error(bmap, __func__, ret); |
|---|
| 84 | 92 | } |
|---|
| 85 | 93 | |
|---|
| 86 | 94 | int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp, |
|---|
| .. | .. |
|---|
| 355 | 363 | /** |
|---|
| 356 | 364 | * nilfs_bmap_assign - assign a new block number to a block |
|---|
| 357 | 365 | * @bmap: bmap |
|---|
| 358 | | - * @bhp: pointer to buffer head |
|---|
| 366 | + * @bh: pointer to buffer head |
|---|
| 359 | 367 | * @blocknr: block number |
|---|
| 360 | 368 | * @binfo: block information |
|---|
| 361 | 369 | * |
|---|
| .. | .. |
|---|
| 519 | 527 | break; |
|---|
| 520 | 528 | case NILFS_IFILE_INO: |
|---|
| 521 | 529 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key); |
|---|
| 522 | | - /* Fall through */ |
|---|
| 530 | + fallthrough; |
|---|
| 523 | 531 | default: |
|---|
| 524 | 532 | bmap->b_ptr_type = NILFS_BMAP_PTR_VM; |
|---|
| 525 | 533 | bmap->b_last_allocated_key = 0; |
|---|