block.c (4993f7ea7e63f18f18880289d6be8a9ab1591409) block.c (465bee1da82e43f18d10c43cc7566d0284ad13a9)
1/*
2 * QEMU System Emulator block driver
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

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

3284
3285 waited = wait_serialising_requests(req);
3286 assert(!waited || !req->serialising);
3287 assert(req->overlap_offset <= offset);
3288 assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
3289
3290 ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
3291
1/*
2 * QEMU System Emulator block driver
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

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

3284
3285 waited = wait_serialising_requests(req);
3286 assert(!waited || !req->serialising);
3287 assert(req->overlap_offset <= offset);
3288 assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
3289
3290 ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
3291
3292 if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF &&
3293 !(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_write_zeroes &&
3294 qemu_iovec_is_zero(qiov)) {
3295 flags |= BDRV_REQ_ZERO_WRITE;
3296 if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
3297 flags |= BDRV_REQ_MAY_UNMAP;
3298 }
3299 }
3300
3292 if (ret < 0) {
3293 /* Do nothing, write notifier decided to fail this request */
3294 } else if (flags & BDRV_REQ_ZERO_WRITE) {
3295 BLKDBG_EVENT(bs, BLKDBG_PWRITEV_ZERO);
3296 ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);
3297 } else {
3298 BLKDBG_EVENT(bs, BLKDBG_PWRITEV);
3299 ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);

--- 2314 unchanged lines hidden ---
3301 if (ret < 0) {
3302 /* Do nothing, write notifier decided to fail this request */
3303 } else if (flags & BDRV_REQ_ZERO_WRITE) {
3304 BLKDBG_EVENT(bs, BLKDBG_PWRITEV_ZERO);
3305 ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors, flags);
3306 } else {
3307 BLKDBG_EVENT(bs, BLKDBG_PWRITEV);
3308 ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);

--- 2314 unchanged lines hidden ---