io.c (f7946da274cf451d66e5207f21286fea14c4795d) io.c (47fec59941a7182380bc8dde3faf17cfb05b770f)
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1388 unchanged lines hidden (view full) ---

1397 if (ret < 0) {
1398 break;
1399 }
1400 bytes_remaining -= num;
1401 }
1402 }
1403 bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
1404
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1388 unchanged lines hidden (view full) ---

1397 if (ret < 0) {
1398 break;
1399 }
1400 bytes_remaining -= num;
1401 }
1402 }
1403 bdrv_debug_event(bs, BLKDBG_PWRITEV_DONE);
1404
1405 ++bs->write_gen;
1405 atomic_inc(&bs->write_gen);
1406 bdrv_set_dirty(bs, start_sector, end_sector - start_sector);
1407
1408 stat64_max(&bs->wr_highest_offset, offset + bytes);
1409
1410 if (ret >= 0) {
1411 bs->total_sectors = MAX(bs->total_sectors, end_sector);
1412 ret = 0;
1413 }

--- 872 unchanged lines hidden (view full) ---

2286
2287 bdrv_inc_in_flight(bs);
2288
2289 if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
2290 bdrv_is_sg(bs)) {
2291 goto early_exit;
2292 }
2293
1406 bdrv_set_dirty(bs, start_sector, end_sector - start_sector);
1407
1408 stat64_max(&bs->wr_highest_offset, offset + bytes);
1409
1410 if (ret >= 0) {
1411 bs->total_sectors = MAX(bs->total_sectors, end_sector);
1412 ret = 0;
1413 }

--- 872 unchanged lines hidden (view full) ---

2286
2287 bdrv_inc_in_flight(bs);
2288
2289 if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs) ||
2290 bdrv_is_sg(bs)) {
2291 goto early_exit;
2292 }
2293
2294 current_gen = bs->write_gen;
2294 current_gen = atomic_read(&bs->write_gen);
2295
2296 /* Wait until any previous flushes are completed */
2297 while (bs->active_flush_req) {
2298 qemu_co_queue_wait(&bs->flush_queue, NULL);
2299 }
2300
2301 bs->active_flush_req = true;
2302

--- 208 unchanged lines hidden (view full) ---

2511 goto out;
2512 }
2513
2514 offset += num;
2515 count -= num;
2516 }
2517 ret = 0;
2518out:
2295
2296 /* Wait until any previous flushes are completed */
2297 while (bs->active_flush_req) {
2298 qemu_co_queue_wait(&bs->flush_queue, NULL);
2299 }
2300
2301 bs->active_flush_req = true;
2302

--- 208 unchanged lines hidden (view full) ---

2511 goto out;
2512 }
2513
2514 offset += num;
2515 count -= num;
2516 }
2517 ret = 0;
2518out:
2519 ++bs->write_gen;
2519 atomic_inc(&bs->write_gen);
2520 bdrv_set_dirty(bs, req.offset >> BDRV_SECTOR_BITS,
2521 req.bytes >> BDRV_SECTOR_BITS);
2522 tracked_request_end(&req);
2523 bdrv_dec_in_flight(bs);
2524 return ret;
2525}
2526
2527int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count)

--- 142 unchanged lines hidden ---
2520 bdrv_set_dirty(bs, req.offset >> BDRV_SECTOR_BITS,
2521 req.bytes >> BDRV_SECTOR_BITS);
2522 tracked_request_end(&req);
2523 bdrv_dec_in_flight(bs);
2524 return ret;
2525}
2526
2527int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count)

--- 142 unchanged lines hidden ---