[PATCH] loop 8/9 copy_bio use highmem

From: Hugh Dickins (hugh@veritas.com)
Date: Tue Jun 10 2003 - 10:37:01 EST


loop_copy_bio uses one gfp_mask for bio_alloc and alloc_page calls.
The bio_alloc obviously can't use highmem, but the alloc_page can.
Yes, the underlying device might be unable to use highmem, and have
to use one of its bounce buffers, with an extra copy: so be it.

(Originally I did propagate the underlying device's bounce needs down to
the loop device, to avoid that possible extra copy; but let's keep this
simple, the low end doesn't have highmem and the high end can I/O it.)

--- loop7/drivers/block/loop.c Tue Jun 10 11:40:23 2003
+++ loop8/drivers/block/loop.c Tue Jun 10 11:55:11 2003
@@ -432,13 +432,13 @@
         return 0;
 }
 
-static struct bio *loop_copy_bio(struct bio *rbh, int gfp_mask)
+static struct bio *loop_copy_bio(struct bio *rbh)
 {
         struct bio *bio;
         struct bio_vec *bv;
         int i;
 
- bio = bio_alloc(gfp_mask, rbh->bi_vcnt);
+ bio = bio_alloc(__GFP_NOWARN, rbh->bi_vcnt);
         if (!bio)
                 return NULL;
 
@@ -448,7 +448,7 @@
         __bio_for_each_segment(bv, rbh, i, 0) {
                 struct bio_vec *bbv = &bio->bi_io_vec[i];
 
- bbv->bv_page = alloc_page(gfp_mask);
+ bbv->bv_page = alloc_page(__GFP_NOWARN|__GFP_HIGHMEM);
                 if (bbv->bv_page == NULL)
                         goto oom;
 
@@ -483,8 +483,7 @@
                 int flags = current->flags;
 
                 current->flags &= ~PF_MEMALLOC;
- bio = loop_copy_bio(rbh,
- (GFP_ATOMIC & ~__GFP_HIGH) | __GFP_NOWARN);
+ bio = loop_copy_bio(rbh);
                 current->flags = flags;
                 if (bio == NULL)
                         blk_congestion_wait(WRITE, HZ/10);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:24 EST