diff options
-rw-r--r-- | drivers/target/target_core_device.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e2be1f510da8..9b8639425472 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -954,8 +954,12 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag) | |||
954 | return -EINVAL; | 954 | return -EINVAL; |
955 | } | 955 | } |
956 | 956 | ||
957 | pr_err("dpo_emulated not supported\n"); | 957 | if (flag) { |
958 | return -EINVAL; | 958 | pr_err("dpo_emulated not supported\n"); |
959 | return -EINVAL; | ||
960 | } | ||
961 | |||
962 | return 0; | ||
959 | } | 963 | } |
960 | 964 | ||
961 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | 965 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) |
@@ -965,7 +969,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
965 | return -EINVAL; | 969 | return -EINVAL; |
966 | } | 970 | } |
967 | 971 | ||
968 | if (dev->transport->fua_write_emulated == 0) { | 972 | if (flag && dev->transport->fua_write_emulated == 0) { |
969 | pr_err("fua_write_emulated not supported\n"); | 973 | pr_err("fua_write_emulated not supported\n"); |
970 | return -EINVAL; | 974 | return -EINVAL; |
971 | } | 975 | } |
@@ -982,8 +986,12 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) | |||
982 | return -EINVAL; | 986 | return -EINVAL; |
983 | } | 987 | } |
984 | 988 | ||
985 | pr_err("ua read emulated not supported\n"); | 989 | if (flag) { |
986 | return -EINVAL; | 990 | pr_err("ua read emulated not supported\n"); |
991 | return -EINVAL; | ||
992 | } | ||
993 | |||
994 | return 0; | ||
987 | } | 995 | } |
988 | 996 | ||
989 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | 997 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) |
@@ -992,7 +1000,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
992 | pr_err("Illegal value %d\n", flag); | 1000 | pr_err("Illegal value %d\n", flag); |
993 | return -EINVAL; | 1001 | return -EINVAL; |
994 | } | 1002 | } |
995 | if (dev->transport->write_cache_emulated == 0) { | 1003 | if (flag && dev->transport->write_cache_emulated == 0) { |
996 | pr_err("write_cache_emulated not supported\n"); | 1004 | pr_err("write_cache_emulated not supported\n"); |
997 | return -EINVAL; | 1005 | return -EINVAL; |
998 | } | 1006 | } |
@@ -1053,7 +1061,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag) | |||
1053 | * We expect this value to be non-zero when generic Block Layer | 1061 | * We expect this value to be non-zero when generic Block Layer |
1054 | * Discard supported is detected iblock_create_virtdevice(). | 1062 | * Discard supported is detected iblock_create_virtdevice(). |
1055 | */ | 1063 | */ |
1056 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1064 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
1057 | pr_err("Generic Block Discard not supported\n"); | 1065 | pr_err("Generic Block Discard not supported\n"); |
1058 | return -ENOSYS; | 1066 | return -ENOSYS; |
1059 | } | 1067 | } |
@@ -1074,7 +1082,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag) | |||
1074 | * We expect this value to be non-zero when generic Block Layer | 1082 | * We expect this value to be non-zero when generic Block Layer |
1075 | * Discard supported is detected iblock_create_virtdevice(). | 1083 | * Discard supported is detected iblock_create_virtdevice(). |
1076 | */ | 1084 | */ |
1077 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1085 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
1078 | pr_err("Generic Block Discard not supported\n"); | 1086 | pr_err("Generic Block Discard not supported\n"); |
1079 | return -ENOSYS; | 1087 | return -ENOSYS; |
1080 | } | 1088 | } |