Skip to content

Commit

Permalink
scst_vdisk: Add zero-copy file I/O readsupport
Browse files Browse the repository at this point in the history
Speeds up reading from a RAM disk via ib_srpt by about 30%.
Tested with iSCSI-SCST, ib_srpt and scst_local.

Signed-off-by: Bart Van Assche <[email protected]>

In it:

- Fixed NULLIO, which the original patch breaks

- Changed on all fast paths sBUG_ON() on EXTRACHECKS_BUG_ON()

- Fixed errors path in non_fileio_exec() and fileio_alloc_data_buf().

- Renamed zero_copy_read to just zero_copy.

- Docs and change log updated

- Some cleanups
  • Loading branch information
vlnb committed Apr 18, 2012
1 parent fa50293 commit 101a4e6
Show file tree
Hide file tree
Showing 13 changed files with 713 additions and 472 deletions.
2 changes: 1 addition & 1 deletion iscsi-scst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary of changes between versions 2.1.0 and 3.0
-------------------------------------------------

- Update to kernels up to 3.1
- Update to kernels up to 3.3

- Bug fixes and other improvements

Expand Down
2 changes: 1 addition & 1 deletion qla2x00t/qla2x00-target/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary of changes between versions 2.1.0 and 3.0
-------------------------------------------------

- Update to kernels up to 3.1
- Update to kernels up to 3.3

- Bug fixes and other improvements

Expand Down
4 changes: 3 additions & 1 deletion scst/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Summary of changes between versions 2.1.0 and 3.0
-------------------------------------------------

- Update to kernels up to 3.1
- Update to kernels up to 3.3

- Zero copy read side FILEIO implemented

- New initialization scripts implemented

Expand Down
3 changes: 3 additions & 0 deletions scst/README
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,9 @@ cache. The following parameters possible for vdisk_fileio:
- rotational - if set, this device reported as rotational. Otherwise,
it is reported as non-rotational (SSD, etc.)

- zero_copy - if set, then this device uses zero copy access to the
page cache. At the moment, only read side zero copy is implemented.

Handler vdisk_blockio provides BLOCKIO mode to create virtual devices.
This mode performs direct block I/O with a block device, bypassing the
page cache for all operations. This mode works ideally with high-end
Expand Down
3 changes: 3 additions & 0 deletions scst/README_in-tree
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ cache. The following parameters possible for vdisk_fileio:
- rotational - if set, this device reported as rotational. Otherwise,
it is reported as non-rotational (SSD, etc.)

- zero_copy - if set, then this device uses zero copy access to the
page cache. At the moment, only read side zero copy is implemented.

Handler vdisk_blockio provides BLOCKIO mode to create virtual devices.
This mode performs direct block I/O with a block device, bypassing the
page cache for all operations. This mode works ideally with high-end
Expand Down
47 changes: 2 additions & 45 deletions scst/include/scst.h
Original file line number Diff line number Diff line change
Expand Up @@ -2420,18 +2420,6 @@ struct scst_device {
#endif
};

/*
* Used to store threads local tgt_dev specific data
*/
struct scst_thr_data_hdr {
/* List entry in tgt_dev->thr_data_list */
struct list_head thr_data_list_entry;
struct task_struct *owner_thr; /* the owner thread */
atomic_t ref;
/* Function that will be called on the tgt_dev destruction */
void (*free_fn) (struct scst_thr_data_hdr *data);
};

/*
* Used to clearly dispose async io_context
*/
Expand Down Expand Up @@ -2473,10 +2461,6 @@ struct scst_tgt_dev {
struct scst_order_data *curr_order_data;
struct scst_order_data tgt_dev_order_data;

/* List of scst_thr_data_hdr and lock */
spinlock_t thr_data_lock;
struct list_head thr_data_list;

/* Pointer to lists of commands with the lock */
struct scst_cmd_threads *active_cmd_threads;

Expand Down Expand Up @@ -3974,7 +3958,8 @@ static inline int scst_check_local_events(struct scst_cmd *cmd)
return __scst_check_local_events(cmd, true);
}

int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd);
int scst_get_cmd_abnormal_done_state(const struct scst_cmd *cmd);
void scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd);

struct scst_trace_log {
unsigned int val;
Expand Down Expand Up @@ -4129,34 +4114,6 @@ void scst_cmd_put(struct scst_cmd *cmd);
struct scatterlist *scst_alloc(int size, gfp_t gfp_mask, int *count);
void scst_free(struct scatterlist *sg, int count);

void scst_add_thr_data(struct scst_tgt_dev *tgt_dev,
struct scst_thr_data_hdr *data,
void (*free_fn) (struct scst_thr_data_hdr *data));
void scst_del_all_thr_data(struct scst_tgt_dev *tgt_dev);
void scst_dev_del_all_thr_data(struct scst_device *dev);
struct scst_thr_data_hdr *__scst_find_thr_data(struct scst_tgt_dev *tgt_dev,
struct task_struct *tsk);

/* Finds local to the current thread data. Returns NULL, if they not found. */
static inline struct scst_thr_data_hdr *scst_find_thr_data(
struct scst_tgt_dev *tgt_dev)
{
return __scst_find_thr_data(tgt_dev, current);
}

/* Increase ref counter for the thread data */
static inline void scst_thr_data_get(struct scst_thr_data_hdr *data)
{
atomic_inc(&data->ref);
}

/* Decrease ref counter for the thread data */
static inline void scst_thr_data_put(struct scst_thr_data_hdr *data)
{
if (atomic_dec_and_test(&data->ref))
data->free_fn(data);
}

int scst_calc_block_shift(int sector_size);
int scst_sbc_generic_parse(struct scst_cmd *cmd,
int (*get_block_shift)(struct scst_cmd *cmd));
Expand Down
4 changes: 2 additions & 2 deletions scst/src/dev_handlers/scst_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ static int dev_user_alloc_space(struct scst_user_cmd *ucmd)
goto out;
else if (rc < 0) {
scst_set_busy(cmd);
res = scst_set_cmd_abnormal_done_state(cmd);
res = scst_get_cmd_abnormal_done_state(cmd);
goto out;
}

Expand Down Expand Up @@ -860,7 +860,7 @@ static int dev_user_parse(struct scst_cmd *cmd)
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_invalid_opcode));

out_error:
res = scst_set_cmd_abnormal_done_state(cmd);
res = scst_get_cmd_abnormal_done_state(cmd);
goto out;
}

Expand Down
Loading

0 comments on commit 101a4e6

Please sign in to comment.