target: clean up the backend interface to caching parameters
Remove the dpo_emulated, fua_write_emulated, fua_read_emulated and write_cache_emulated methods, and replace them with a simple bitfields in se_subsystem_api in those cases where they ever returned one. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
parent
df5fa691ce
commit
f55918fa32
|
@ -972,36 +972,24 @@ int se_dev_set_unmap_granularity_alignment(
|
|||
|
||||
int se_dev_set_emulate_dpo(struct se_device *dev, int flag)
|
||||
{
|
||||
if ((flag != 0) && (flag != 1)) {
|
||||
if (flag != 0 && flag != 1) {
|
||||
pr_err("Illegal value %d\n", flag);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->dpo_emulated == NULL) {
|
||||
pr_err("dev->transport->dpo_emulated is NULL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->dpo_emulated(dev) == 0) {
|
||||
pr_err("dev->transport->dpo_emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->se_sub_dev->se_dev_attrib.emulate_dpo = flag;
|
||||
pr_debug("dev[%p]: SE Device Page Out (DPO) Emulation"
|
||||
" bit: %d\n", dev, dev->se_sub_dev->se_dev_attrib.emulate_dpo);
|
||||
return 0;
|
||||
|
||||
pr_err("dpo_emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
|
||||
{
|
||||
if ((flag != 0) && (flag != 1)) {
|
||||
if (flag != 0 && flag != 1) {
|
||||
pr_err("Illegal value %d\n", flag);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->fua_write_emulated == NULL) {
|
||||
pr_err("dev->transport->fua_write_emulated is NULL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->fua_write_emulated(dev) == 0) {
|
||||
pr_err("dev->transport->fua_write_emulated not supported\n");
|
||||
|
||||
if (dev->transport->fua_write_emulated == 0) {
|
||||
pr_err("fua_write_emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->se_sub_dev->se_dev_attrib.emulate_fua_write = flag;
|
||||
|
@ -1012,36 +1000,23 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
|
|||
|
||||
int se_dev_set_emulate_fua_read(struct se_device *dev, int flag)
|
||||
{
|
||||
if ((flag != 0) && (flag != 1)) {
|
||||
if (flag != 0 && flag != 1) {
|
||||
pr_err("Illegal value %d\n", flag);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->fua_read_emulated == NULL) {
|
||||
pr_err("dev->transport->fua_read_emulated is NULL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->fua_read_emulated(dev) == 0) {
|
||||
pr_err("dev->transport->fua_read_emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->se_sub_dev->se_dev_attrib.emulate_fua_read = flag;
|
||||
pr_debug("dev[%p]: SE Device Forced Unit Access READs: %d\n",
|
||||
dev, dev->se_sub_dev->se_dev_attrib.emulate_fua_read);
|
||||
return 0;
|
||||
|
||||
pr_err("ua read emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
|
||||
{
|
||||
if ((flag != 0) && (flag != 1)) {
|
||||
if (flag != 0 && flag != 1) {
|
||||
pr_err("Illegal value %d\n", flag);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->write_cache_emulated == NULL) {
|
||||
pr_err("dev->transport->write_cache_emulated is NULL\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (dev->transport->write_cache_emulated(dev) == 0) {
|
||||
pr_err("dev->transport->write_cache_emulated not supported\n");
|
||||
if (dev->transport->write_cache_emulated == 0) {
|
||||
pr_err("write_cache_emulated not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
dev->se_sub_dev->se_dev_attrib.emulate_write_cache = flag;
|
||||
|
|
|
@ -399,33 +399,6 @@ static void fd_emulate_sync_cache(struct se_task *task)
|
|||
transport_complete_sync_cache(cmd, ret == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell TCM Core that we are capable of WriteCache emulation for
|
||||
* an underlying struct se_device.
|
||||
*/
|
||||
static int fd_emulated_write_cache(struct se_device *dev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fd_emulated_dpo(struct se_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Tell TCM Core that we will be emulating Forced Unit Access (FUA) for WRITEs
|
||||
* for TYPE_DISK.
|
||||
*/
|
||||
static int fd_emulated_fua_write(struct se_device *dev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fd_emulated_fua_read(struct se_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* WRITE Force Unit Access (FUA) emulation on a per struct se_task
|
||||
* LBA range basis..
|
||||
|
@ -640,15 +613,13 @@ static struct se_subsystem_api fileio_template = {
|
|||
.name = "fileio",
|
||||
.owner = THIS_MODULE,
|
||||
.transport_type = TRANSPORT_PLUGIN_VHBA_PDEV,
|
||||
.write_cache_emulated = 1,
|
||||
.fua_write_emulated = 1,
|
||||
.attach_hba = fd_attach_hba,
|
||||
.detach_hba = fd_detach_hba,
|
||||
.allocate_virtdevice = fd_allocate_virtdevice,
|
||||
.create_virtdevice = fd_create_virtdevice,
|
||||
.free_device = fd_free_device,
|
||||
.dpo_emulated = fd_emulated_dpo,
|
||||
.fua_write_emulated = fd_emulated_fua_write,
|
||||
.fua_read_emulated = fd_emulated_fua_read,
|
||||
.write_cache_emulated = fd_emulated_write_cache,
|
||||
.alloc_task = fd_alloc_task,
|
||||
.do_task = fd_do_task,
|
||||
.do_sync_cache = fd_emulate_sync_cache,
|
||||
|
|
|
@ -351,34 +351,6 @@ static void iblock_emulate_sync_cache(struct se_task *task)
|
|||
submit_bio(WRITE_FLUSH, bio);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell TCM Core that we are capable of WriteCache emulation for
|
||||
* an underlying struct se_device.
|
||||
*/
|
||||
static int iblock_emulated_write_cache(struct se_device *dev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int iblock_emulated_dpo(struct se_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tell TCM Core that we will be emulating Forced Unit Access (FUA) for WRITEs
|
||||
* for TYPE_DISK.
|
||||
*/
|
||||
static int iblock_emulated_fua_write(struct se_device *dev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int iblock_emulated_fua_read(struct se_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int iblock_do_discard(struct se_device *dev, sector_t lba, u32 range)
|
||||
{
|
||||
struct iblock_dev *ibd = dev->dev_ptr;
|
||||
|
@ -679,15 +651,13 @@ static struct se_subsystem_api iblock_template = {
|
|||
.name = "iblock",
|
||||
.owner = THIS_MODULE,
|
||||
.transport_type = TRANSPORT_PLUGIN_VHBA_PDEV,
|
||||
.write_cache_emulated = 1,
|
||||
.fua_write_emulated = 1,
|
||||
.attach_hba = iblock_attach_hba,
|
||||
.detach_hba = iblock_detach_hba,
|
||||
.allocate_virtdevice = iblock_allocate_virtdevice,
|
||||
.create_virtdevice = iblock_create_virtdevice,
|
||||
.free_device = iblock_free_device,
|
||||
.dpo_emulated = iblock_emulated_dpo,
|
||||
.fua_write_emulated = iblock_emulated_fua_write,
|
||||
.fua_read_emulated = iblock_emulated_fua_read,
|
||||
.write_cache_emulated = iblock_emulated_write_cache,
|
||||
.alloc_task = iblock_alloc_task,
|
||||
.do_task = iblock_do_task,
|
||||
.do_discard = iblock_do_discard,
|
||||
|
|
|
@ -218,6 +218,10 @@ struct se_subsystem_api {
|
|||
* Transport Type.
|
||||
*/
|
||||
u8 transport_type;
|
||||
|
||||
unsigned int fua_write_emulated : 1;
|
||||
unsigned int write_cache_emulated : 1;
|
||||
|
||||
/*
|
||||
* struct module for struct se_hba references
|
||||
*/
|
||||
|
@ -253,22 +257,6 @@ struct se_subsystem_api {
|
|||
*/
|
||||
void (*free_device)(void *);
|
||||
|
||||
/*
|
||||
* dpo_emulated():
|
||||
*/
|
||||
int (*dpo_emulated)(struct se_device *);
|
||||
/*
|
||||
* fua_write_emulated():
|
||||
*/
|
||||
int (*fua_write_emulated)(struct se_device *);
|
||||
/*
|
||||
* fua_read_emulated():
|
||||
*/
|
||||
int (*fua_read_emulated)(struct se_device *);
|
||||
/*
|
||||
* write_cache_emulated():
|
||||
*/
|
||||
int (*write_cache_emulated)(struct se_device *);
|
||||
/*
|
||||
* transport_complete():
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue