Libiscsi: Introducing new functions for zero-copy read operations
iscsi-command: Adding new functions for all write operations (READ6,
READ10, READ12, READ16, etc') for cases where the
user wants to pass his own io vectors (prevent memcpy).
new functions are called iscsi_read*_iov_task and looks
very similar to the iscsi_read*_task, only they get
scsi_iovec pointer and number of scsi_iovec as
parameters.
Change-Id: Ice6bdb9227d72b20f495927f17d6757c124e4c84
Signed-off-by: Roy Shterman <roysh@mellanox.com>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
6c1bdb4808
commit
e00e47d28d
89
lib/sync.c
89
lib/sync.c
@@ -420,6 +420,26 @@ iscsi_read6_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read6_iov_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize, struct scsi_iovec *iov, int niov)
|
||||
{
|
||||
struct iscsi_sync_state state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (iscsi_read6_iov_task(iscsi, lun, lba, datalen, blocksize,
|
||||
scsi_sync_cb, &state, iov, niov) == NULL) {
|
||||
iscsi_set_error(iscsi,
|
||||
"Failed to send Read6 command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
event_loop(iscsi, &state);
|
||||
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read10_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
@@ -442,6 +462,29 @@ iscsi_read10_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read10_iov_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
int rdprotect, int dpo, int fua, int fua_nv, int group_number,
|
||||
struct scsi_iovec *iov, int niov)
|
||||
{
|
||||
struct iscsi_sync_state state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (iscsi_read10_iov_task(iscsi, lun, lba, datalen, blocksize, rdprotect,
|
||||
dpo, fua, fua_nv, group_number,
|
||||
scsi_sync_cb, &state, iov, niov) == NULL) {
|
||||
iscsi_set_error(iscsi,
|
||||
"Failed to send Read10 command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
event_loop(iscsi, &state);
|
||||
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read12_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
@@ -464,6 +507,29 @@ iscsi_read12_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read12_iov_sync(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
int rdprotect, int dpo, int fua, int fua_nv, int group_number,
|
||||
struct scsi_iovec *iov, int niov)
|
||||
{
|
||||
struct iscsi_sync_state state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (iscsi_read12_iov_task(iscsi, lun, lba, datalen, blocksize, rdprotect,
|
||||
dpo, fua, fua_nv, group_number,
|
||||
scsi_sync_cb, &state, iov, niov) == NULL) {
|
||||
iscsi_set_error(iscsi,
|
||||
"Failed to send Read12 command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
event_loop(iscsi, &state);
|
||||
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read16_sync(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
@@ -486,6 +552,29 @@ iscsi_read16_sync(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_read16_iov_sync(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
||||
uint32_t datalen, int blocksize,
|
||||
int rdprotect, int dpo, int fua, int fua_nv, int group_number,
|
||||
struct scsi_iovec *iov, int niov)
|
||||
{
|
||||
struct iscsi_sync_state state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (iscsi_read16_iov_task(iscsi, lun, lba, datalen, blocksize, rdprotect,
|
||||
dpo, fua, fua_nv, group_number,
|
||||
scsi_sync_cb, &state, iov, niov) == NULL) {
|
||||
iscsi_set_error(iscsi,
|
||||
"Failed to send Read16 command");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
event_loop(iscsi, &state);
|
||||
|
||||
return state.task;
|
||||
}
|
||||
|
||||
struct scsi_task *
|
||||
iscsi_readcapacity10_sync(struct iscsi_context *iscsi, int lun, int lba,
|
||||
int pmi)
|
||||
|
||||
Reference in New Issue
Block a user