Thread (80 messages) 80 messages, 6 authors, 2017-01-31

Re: [PATCH 15/18] scsi: allocate scsi_cmnd structures as part of struct request

From: Bart Van Assche <hidden>
Date: 2017-01-27 18:39:46
Also in: dm-devel, linux-block, linux-scsi

On Wed, 2017-01-25 at 18:25 +0100, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
-unsigned char *scsi_alloc_sense_buffer(struct Scsi_Host *shost, gfp_t gfp_mask,
-               int numa_node)
+static unsigned char *scsi_alloc_sense_buffer(struct Scsi_Host *shost,
+       gfp_t gfp_mask, int numa_node)
 {
        return kmem_cache_alloc_node(scsi_select_sense_cache(shost), gfp_mask,
                        numa_node);
@@ -697,14 +696,13 @@ static bool scsi_end_request(struct request *req, int error,
 
                if (bidi_bytes)
                        scsi_release_bidi_buffers(cmd);
+               scsi_release_buffers(cmd);
+               scsi_put_command(cmd);
 
                spin_lock_irqsave(q->queue_lock, flags);
                blk_finish_request(req, error);
                spin_unlock_irqrestore(q->queue_lock, flags);
 
-               scsi_release_buffers(cmd);
-
-               scsi_put_command(cmd);
                scsi_run_queue(q);
        }
Hello Christoph,

Why have the scsi_release_buffers() and scsi_put_command(cmd) calls been
moved up? I haven't found an explanation for this change in the patch
description.

Please also consider to remove the cmd->request->special = NULL assignments
via this patch. Since this patch makes the lifetime of struct scsi_cmnd and
struct request identical these assignments are no longer needed.

This patch introduces the function scsi_exit_rq(). Having two functions
for the single-queue path that release resources (scsi_release_buffers()
and scsi_exit_rq()) is confusing. Since every scsi_release_buffers() call
is followed by a blk_unprep_request() call, have you considered to move
the scsi_release_buffers() call into scsi_unprep_fn() via an additional
patch?

Thanks,

Bart.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help