io.c (09e0c771e47e02278c264bafff6bfc0771732d72) io.c (04c01a5c8f006b6e45fa5be8ea857efe7d9c41f9)
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

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

1296 int ret;
1297
1298 if (!bs->drv) {
1299 return -ENOMEDIUM;
1300 }
1301 if (bs->read_only) {
1302 return -EPERM;
1303 }
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

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

1296 int ret;
1297
1298 if (!bs->drv) {
1299 return -ENOMEDIUM;
1300 }
1301 if (bs->read_only) {
1302 return -EPERM;
1303 }
1304 assert(!(bs->open_flags & BDRV_O_INCOMING));
1304 assert(!(bs->open_flags & BDRV_O_INACTIVE));
1305
1306 ret = bdrv_check_byte_request(bs, offset, bytes);
1307 if (ret < 0) {
1308 return ret;
1309 }
1310
1311 /* throttling disk I/O */
1312 if (bs->io_limits_enabled) {

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

2458 }
2459
2460 ret = bdrv_check_request(bs, sector_num, nb_sectors);
2461 if (ret < 0) {
2462 return ret;
2463 } else if (bs->read_only) {
2464 return -EPERM;
2465 }
1305
1306 ret = bdrv_check_byte_request(bs, offset, bytes);
1307 if (ret < 0) {
1308 return ret;
1309 }
1310
1311 /* throttling disk I/O */
1312 if (bs->io_limits_enabled) {

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

2458 }
2459
2460 ret = bdrv_check_request(bs, sector_num, nb_sectors);
2461 if (ret < 0) {
2462 return ret;
2463 } else if (bs->read_only) {
2464 return -EPERM;
2465 }
2466 assert(!(bs->open_flags & BDRV_O_INCOMING));
2466 assert(!(bs->open_flags & BDRV_O_INACTIVE));
2467
2468 /* Do nothing if disabled. */
2469 if (!(bs->open_flags & BDRV_O_UNMAP)) {
2470 return 0;
2471 }
2472
2473 if (!bs->drv->bdrv_co_discard && !bs->drv->bdrv_aio_discard) {
2474 return 0;

--- 296 unchanged lines hidden ---
2467
2468 /* Do nothing if disabled. */
2469 if (!(bs->open_flags & BDRV_O_UNMAP)) {
2470 return 0;
2471 }
2472
2473 if (!bs->drv->bdrv_co_discard && !bs->drv->bdrv_aio_discard) {
2474 return 0;

--- 296 unchanged lines hidden ---