From: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx> Signed-off-by: Kai Makisara <kai.makisara@xxxxxxxxxxx> Reported-by: Lukas Kolbe <lkolbe@xxxxxxxxxxxxxxxxxxxxxxxx> --- 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; -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html