req->error = update_bitmap(req); 
*bitmap_io = ((struct bitmap_io) { .count	= ATOMIC_INIT(0), .aio		= INIT_AIO(AIO_WRITE, req->fds[1], bitmap_buf, len, req->bitmap_offset + off, ubd_reply_fd) } ); }  nsectors = req->length / req->sectorsize; start = 0; end = nsectors; bit = 0; do { if(bitmap != NULL){ sector = req->offset / req->sectorsize; bit = ubd_test_bit(sector + start, bitmap); end = start; while((end < nsectors) && (ubd_test_bit(sector + end, bitmap) == bit)) end++; }  off = req->offsets[bit] + req->offset + start * req->sectorsize; len = (end - start) * req->sectorsize; buf = &req->buffer[start * req->sectorsize];  aio = kmalloc(sizeof(*aio), GFP_KERNEL); if(aio == NULL){ req->error = 1; return; }  *aio = ((struct ubd_aio) { .aio		= INIT_AIO(req->op, req->fds[bit], buf, len, off, ubd_reply_fd), .len		= len, .req		= r, .bitmap	= bitmap_io, .bitmap_buf 	= bitmap_buf });  if(aio->bitmap != NULL) atomic_inc(&aio->bitmap->count);  err = submit_aio(&aio->aio); if(err){ printk("do_io - submit_aio failed, " "err = %d\n", err); req->error = 1; return; }  start = end; } while(start < nsectors); 
void do_io(struct io_thread_req *req){	char *buf;	unsigned long len;	int n, nsectors, start, end, bit;	int err;	__u64 off;	nsectors = req->length / req->sectorsize;	start = 0;	do {		bit = ubd_test_bit(start, (unsigned char *) &req->sector_mask);		end = start;		while((end < nsectors) &&		      (ubd_test_bit(end, (unsigned char *)				    &req->sector_mask) == bit))			end++;		off = req->offset + req->offsets[bit] +			start * req->sectorsize;		len = (end - start) * req->sectorsize;		buf = &req->buffer[start * req->sectorsize];		err = os_seek_file(req->fds[bit], off);		if(err < 0){			printk("do_io - lseek failed : err = %d\n", -err);			req->error = 1;			return;		}		if(req->op == UBD_READ){			n = 0;			do {				buf = &buf[n];				len -= n;				n = os_read_file(req->fds[bit], buf, len);				if (n < 0) {					printk("do_io - read failed, err = %d "					       "fd = %d\n", -n, req->fds[bit]);					req->error = 1;					return;				}			} while((n < len) && (n != 0));			if (n < len) memset(&buf[n], 0, len - n);		} else {			n = os_write_file(req->fds[bit], buf, len);			if(n != len){				printk("do_io - write failed err = %d "				       "fd = %d\n", -n, req->fds[bit]);				req->error = 1;				return;			}		}		start = end;	} while(start < nsectors);	req->error = update_bitmap(req);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/09ace81c1d737bcbb2423db235ac980cac4d5de9/ubd_kern.c/buggy/arch/um/drivers/ubd_kern.c