.. | .. |
---|
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, |
---|