On Saturday 29 March 2008, Borislav Petkov wrote: > Instead of freeing pages one by one, free them 2^order-wise. Also, mv > __idetape_kfree_stage() to ide_tape_kfree_buffer(). > > Signed-off-by: Borislav Petkov <petkovbb@xxxxxxxxx> > --- > drivers/ide/ide-tape.c | 37 +++++++++++++++++++------------------ > 1 files changed, 19 insertions(+), 18 deletions(-) > > diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c > index cf4351c..dcaefef 100644 > --- a/drivers/ide/ide-tape.c > +++ b/drivers/ide/ide-tape.c > @@ -583,20 +583,21 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) > } > } > > -/* Free a stage along with its related buffers completely. */ > -static void __idetape_kfree_stage(idetape_stage_t *stage) > +/* Free data buffers completely. */ > +static void ide_tape_kfree_buffer(idetape_stage_t *stage) > { > struct idetape_bh *prev_bh, *bh = stage->bh; > - int size; > - > - while (bh != NULL) { > - if (bh->b_data != NULL) { > - size = (int) bh->b_size; > - while (size > 0) { > - free_page((unsigned long) bh->b_data); > - size -= PAGE_SIZE; > - bh->b_data += PAGE_SIZE; > - } > + > + while (bh) { > + u32 size = bh->b_size; > + > + while (size) { > + unsigned int order = fls(size >> PAGE_SHIFT)-1; > + > + if (bh->b_data) > + free_pages((unsigned long)bh->b_data, order); > + > + size &= (order-1); > } Hmmm, don't we also need to update bh->b_data? [ I added the change below to the merged patch version for now: ] @@ -598,6 +598,7 @@ free_pages((unsigned long)bh->b_data, order); size &= (order-1); + bh->b_data += (1 << order) * PAGE_SIZE; } prev_bh = bh; bh = bh->b_reqnext; -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html