All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] SCSI tape: Store page order before driver buffer allocation
@ 2010-12-20 16:43 Kai Makisara
  2010-12-20 16:44 ` [PATCH 2/2] SCSI tape: Increase success probability in " Kai Makisara
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Makisara @ 2010-12-20 16:43 UTC (permalink / raw)
  To: linux-scsi

The order of the pages allocated for the driver buffer must be stored before
allocation because it is used in freeing already allocated pages if 
allocation fails.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Reported-by: Lukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
---
 linux-2.6.37-rc6-git4-1/drivers/scsi/st.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.37-rc6-git4/drivers/scsi/st.c	2010-12-16 03:24:48.000000000 +0200
+++ linux-2.6.37-rc6-git4-1/drivers/scsi/st.c	2010-12-19 09:42:08.255998445 +0200
@@ -17,7 +17,7 @@
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
  */
 
-static const char *verstr = "20100829";
+static const char *verstr = "20101219";
 
 #include <linux/module.h>
 
@@ -3732,6 +3732,7 @@ static int enlarge_buffer(struct st_buff
 		     order < ST_MAX_ORDER && b_size < new_size;
 		     order++, b_size *= 2)
 			;  /* empty */
+		STbuffer->reserved_page_order = order;
 	}
 	if (max_segs * (PAGE_SIZE << order) < new_size) {
 		if (order == ST_MAX_ORDER)
@@ -3758,7 +3759,6 @@ static int enlarge_buffer(struct st_buff
 		segs++;
 	}
 	STbuffer->b_data = page_address(STbuffer->reserved_pages[0]);
-	STbuffer->reserved_page_order = order;
 
 	return 1;
 }

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

* [PATCH 2/2] SCSI tape: Increase success probability in driver buffer allocation
  2010-12-20 16:43 [PATCH 1/2] SCSI tape: Store page order before driver buffer allocation Kai Makisara
@ 2010-12-20 16:44 ` Kai Makisara
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Makisara @ 2010-12-20 16:44 UTC (permalink / raw)
  To: linux-scsi

From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

Modify allocation to try the minimum possible page order allowed by the HBA
scatter/gather segment limit in allocation of the driver's internal
buffer. This increases the probability of successful allocation. The
allocation may still fail if this minimum order is > 0.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Reported-by: Lukas Kolbe <lkolbe@techfak.uni-bielefeld.de>
---
 linux-2.6.37-rc6-git4-2/drivers/scsi/st.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.37-rc6-git4-1/drivers/scsi/st.c	2010-12-19 09:42:08.255998445 +0200
+++ linux-2.6.37-rc6-git4-2/drivers/scsi/st.c	2010-12-19 09:44:36.483997640 +0200
@@ -3729,7 +3729,8 @@ static int enlarge_buffer(struct st_buff
 		b_size = PAGE_SIZE << order;
 	} else {
 		for (b_size = PAGE_SIZE, order = 0;
-		     order < ST_MAX_ORDER && b_size < new_size;
+		     order < ST_MAX_ORDER &&
+			     max_segs * (PAGE_SIZE << order) < new_size;
 		     order++, b_size *= 2)
 			;  /* empty */
 		STbuffer->reserved_page_order = order;

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

end of thread, other threads:[~2010-12-20 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20 16:43 [PATCH 1/2] SCSI tape: Store page order before driver buffer allocation Kai Makisara
2010-12-20 16:44 ` [PATCH 2/2] SCSI tape: Increase success probability in " Kai Makisara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.