# This patch eliminates the atomic count associated with a bitmap_io # struct. The original thinking was that there would be a number of # aio structures associated with the bitmap_io, since different chunks # of the sg element could go to different layers. The count was # needed to know when the full sg segment reached disk and it was safe # to write the bitmap. # However, the flaw in that thinking is that a bitmap_io struct is # only needed for writes, and writes always go to the COW layer. # Hence, there will only be one bitmap_io per aio, and the counting is # unnecessary. # This patch makes it possible to merge the aio and bitmap_io structs, # which would be a good cleanup. Index: linux-2.6.17/arch/um/drivers/ubd_kern.c =================================================================== --- linux-2.6.17.orig/arch/um/drivers/ubd_kern.c 2007-11-19 11:24:43.000000000 -0500 +++ linux-2.6.17/arch/um/drivers/ubd_kern.c 2007-11-19 11:25:40.000000000 -0500 @@ -506,7 +506,6 @@ struct bitmap_io { unsigned long long start; unsigned long long end; struct ubd_aio *aio_ptr; - atomic_t count; struct aio_context aio; }; @@ -738,8 +737,7 @@ static void ubd_intr(struct aio_context if(n == 0){ req->nr_sectors -= aio->len >> 9; - if((aio->bitmap != NULL) && - (atomic_dec_and_test(&aio->bitmap->count))){ + if(aio->bitmap != NULL){ spin_lock_irqsave(&bitmaps_lock, flags); bitmap_start(aio); spin_unlock_irqrestore(&bitmaps_lock, flags); @@ -1596,7 +1594,6 @@ static int do_io(struct io_thread_req *r .aio_ptr = NULL, .start = off, .end = off + len, - .count = ATOMIC_INIT(0), .aio = INIT_AIO(AIO_WRITE, req->fds[1], bits, len, req->bitmap_offset + off, @@ -1644,10 +1641,8 @@ static int do_io(struct io_thread_req *r .bitmap_start = sector + start, .bitmap_end = sector + end }); - if(aio->bitmap != NULL){ - atomic_inc(&aio->bitmap->count); + if(aio->bitmap != NULL) aio->bitmap->aio_ptr = aio; - } err = submit_aio(&aio->aio); if(err){