Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127894
b: refs/heads/master
c: 8f78fc5
h: refs/heads/master
v: v3
  • Loading branch information
Kai Makisara authored and James Bottomley committed Jan 2, 2009
1 parent 950c80a commit 86f4ac3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 02ae2c0e844e2864a877d1da8a92fe5e63778a18
refs/heads/master: 8f78fc5eb798426891f99390a61f752aaef9fc39
11 changes: 10 additions & 1 deletion trunk/drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -3695,6 +3695,8 @@ static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)


/* Try to allocate enough space in the tape buffer */
#define ST_MAX_ORDER 6

static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma)
{
int segs, nbr, max_segs, b_size, order, got;
Expand Down Expand Up @@ -3723,9 +3725,16 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
b_size = PAGE_SIZE << order;
} else {
for (b_size = PAGE_SIZE, order = 0;
order <= 6 && b_size < new_size; order++, b_size *= 2)
order < ST_MAX_ORDER && b_size < new_size;
order++, b_size *= 2)
; /* empty */
}
if (max_segs * (PAGE_SIZE << order) < new_size) {
if (order == ST_MAX_ORDER)
return 0;
normalize_buffer(STbuffer);
return enlarge_buffer(STbuffer, new_size, need_dma);
}

for (segs = STbuffer->frp_segs, got = STbuffer->buffer_size;
segs < max_segs && got < new_size;) {
Expand Down

0 comments on commit 86f4ac3

Please sign in to comment.