lightnvm: make address conversions depend on generic device
On address conversions, use the generic device, instead of the target device. This allows to use conversions outside of the target's realm. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
6947151374
commit
7100d50a7e
|
@ -581,7 +581,7 @@ static void nvm_ppa_tgt_to_dev(struct nvm_tgt_dev *tgt_dev,
|
||||||
|
|
||||||
for (i = 0; i < nr_ppas; i++) {
|
for (i = 0; i < nr_ppas; i++) {
|
||||||
nvm_map_to_dev(tgt_dev, &ppa_list[i]);
|
nvm_map_to_dev(tgt_dev, &ppa_list[i]);
|
||||||
ppa_list[i] = generic_to_dev_addr(tgt_dev, ppa_list[i]);
|
ppa_list[i] = generic_to_dev_addr(tgt_dev->parent, ppa_list[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ static void nvm_ppa_dev_to_tgt(struct nvm_tgt_dev *tgt_dev,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < nr_ppas; i++) {
|
for (i = 0; i < nr_ppas; i++) {
|
||||||
ppa_list[i] = dev_to_generic_addr(tgt_dev, ppa_list[i]);
|
ppa_list[i] = dev_to_generic_addr(tgt_dev->parent, ppa_list[i]);
|
||||||
nvm_map_to_tgt(tgt_dev, &ppa_list[i]);
|
nvm_map_to_tgt(tgt_dev, &ppa_list[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,10 +397,10 @@ struct nvm_dev {
|
||||||
struct list_head targets;
|
struct list_head targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct ppa_addr generic_to_dev_addr(struct nvm_tgt_dev *tgt_dev,
|
static inline struct ppa_addr generic_to_dev_addr(struct nvm_dev *dev,
|
||||||
struct ppa_addr r)
|
struct ppa_addr r)
|
||||||
{
|
{
|
||||||
struct nvm_geo *geo = &tgt_dev->geo;
|
struct nvm_geo *geo = &dev->geo;
|
||||||
struct ppa_addr l;
|
struct ppa_addr l;
|
||||||
|
|
||||||
if (geo->version == NVM_OCSSD_SPEC_12) {
|
if (geo->version == NVM_OCSSD_SPEC_12) {
|
||||||
|
@ -424,10 +424,10 @@ static inline struct ppa_addr generic_to_dev_addr(struct nvm_tgt_dev *tgt_dev,
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct ppa_addr dev_to_generic_addr(struct nvm_tgt_dev *tgt_dev,
|
static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev,
|
||||||
struct ppa_addr r)
|
struct ppa_addr r)
|
||||||
{
|
{
|
||||||
struct nvm_geo *geo = &tgt_dev->geo;
|
struct nvm_geo *geo = &dev->geo;
|
||||||
struct ppa_addr l;
|
struct ppa_addr l;
|
||||||
|
|
||||||
l.ppa = 0;
|
l.ppa = 0;
|
||||||
|
|
Loading…
Reference in New Issue