linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags
@ 2008-02-20 18:26 Matthew Wilcox
  2008-02-20 18:28 ` Matthew Wilcox
  2008-03-06 15:37 ` Boaz Harrosh
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Wilcox @ 2008-02-20 18:26 UTC (permalink / raw)
  To: linux-scsi


scsi_init_io() is already passed a gfp_mask, so we should use that
instead of an explicit GFP_ATOMIC

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f243fc3..b81170d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1048,8 +1048,8 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
 		goto err_exit;
 
 	if (blk_bidi_rq(cmd->request)) {
-		struct scsi_data_buffer *bidi_sdb = kmem_cache_zalloc(
-			scsi_bidi_sdb_cache, GFP_ATOMIC);
+		struct scsi_data_buffer *bidi_sdb;
+		bidi_sdb = kmem_cache_zalloc(scsi_bidi_sdb_cache, gfp_mask);
 		if (!bidi_sdb) {
 			error = BLKPREP_DEFER;
 			goto err_exit;
@@ -1057,7 +1057,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
 
 		cmd->request->next_rq->special = bidi_sdb;
 		error = scsi_init_sgtable(cmd->request->next_rq, bidi_sdb,
-								    GFP_ATOMIC);
+								    gfp_mask);
 		if (error)
 			goto err_exit;
 	}

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags
  2008-02-20 18:26 [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags Matthew Wilcox
@ 2008-02-20 18:28 ` Matthew Wilcox
  2008-03-06 15:37 ` Boaz Harrosh
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2008-02-20 18:28 UTC (permalink / raw)
  To: linux-scsi


Sorry, $SUBJECT should have read 'gfp_mask' instead of 'gfp_flags'.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags
  2008-02-20 18:26 [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags Matthew Wilcox
  2008-02-20 18:28 ` Matthew Wilcox
@ 2008-03-06 15:37 ` Boaz Harrosh
  1 sibling, 0 replies; 3+ messages in thread
From: Boaz Harrosh @ 2008-03-06 15:37 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-scsi, Jens Axboe

On Wed, Feb 20 2008 at 20:26 +0200, Matthew Wilcox <matthew@wil.cx> wrote:
> scsi_init_io() is already passed a gfp_mask, so we should use that
> instead of an explicit GFP_ATOMIC
> 
> Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index f243fc3..b81170d 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1048,8 +1048,8 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
>  		goto err_exit;
>  
>  	if (blk_bidi_rq(cmd->request)) {
> -		struct scsi_data_buffer *bidi_sdb = kmem_cache_zalloc(
> -			scsi_bidi_sdb_cache, GFP_ATOMIC);
> +		struct scsi_data_buffer *bidi_sdb;
> +		bidi_sdb = kmem_cache_zalloc(scsi_bidi_sdb_cache, gfp_mask);
>  		if (!bidi_sdb) {
>  			error = BLKPREP_DEFER;
>  			goto err_exit;
> @@ -1057,7 +1057,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
>  
>  		cmd->request->next_rq->special = bidi_sdb;
>  		error = scsi_init_sgtable(cmd->request->next_rq, bidi_sdb,
> -								    GFP_ATOMIC);
> +								    gfp_mask);
>  		if (error)
>  			goto err_exit;
>  	}
> 
Sorry for the late reply. Thanks for the patch but ...

Jens does not like a second part in a compound allocation to wait. This is
because it can cause a deadlock between contenders that both grabbed half
the resource and are waiting for the second part, if they don't wait, and
release the first part at least one can continue.

Perhaps a small change to the patch would be better. (See below)

Boaz
---
From: Matthew Wilcox <willy@linux.intel.com>
Date: Thu, 6 Mar 2008 17:21:47 +0200
Subject: [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags

scsi_init_io() is already passed a gfp_mask, so we should use that
instead of an explicit GFP_ATOMIC

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 drivers/scsi/scsi_lib.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ba21d97..4d1d886 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1047,8 +1047,9 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
 		goto err_exit;
 
 	if (blk_bidi_rq(cmd->request)) {
-		struct scsi_data_buffer *bidi_sdb = kmem_cache_zalloc(
-			scsi_bidi_sdb_cache, GFP_ATOMIC);
+		struct scsi_data_buffer *bidi_sdb;
+		bidi_sdb = kmem_cache_zalloc(scsi_bidi_sdb_cache,
+							gfp_mask & ~__GFP_WAIT);
 		if (!bidi_sdb) {
 			error = BLKPREP_DEFER;
 			goto err_exit;
@@ -1056,7 +1057,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
 
 		cmd->request->next_rq->special = bidi_sdb;
 		error = scsi_init_sgtable(cmd->request->next_rq, bidi_sdb,
-								    GFP_ATOMIC);
+							gfp_mask & ~__GFP_WAIT);
 		if (error)
 			goto err_exit;
 	}
-- 
1.5.3.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-06 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 18:26 [PATCH] scsi_lib: Convert GFP_ATOMIC to gfp_flags Matthew Wilcox
2008-02-20 18:28 ` Matthew Wilcox
2008-03-06 15:37 ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).