file-posix.c (6d43eaa39647507563017590b090b2e2b10aed2d) file-posix.c (774c726ceb2a3aa039dc20f0b51c9d36a2c6760d)
1/*
2 * Block driver for RAW files (posix)
3 *
4 * Copyright (c) 2006 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

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

771 if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
772 error_setg(errp, "'%s' driver requires '%s' to be either "
773 "a character or block device",
774 bs->drv->format_name, bs->filename);
775 ret = -EINVAL;
776 goto fail;
777 }
778 }
1/*
2 * Block driver for RAW files (posix)
3 *
4 * Copyright (c) 2006 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

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

771 if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
772 error_setg(errp, "'%s' driver requires '%s' to be either "
773 "a character or block device",
774 bs->drv->format_name, bs->filename);
775 ret = -EINVAL;
776 goto fail;
777 }
778 }
779#ifdef CONFIG_BLKZONED
780 /*
781 * The kernel page cache does not reliably work for writes to SWR zones
782 * of zoned block device because it can not guarantee the order of writes.
783 */
784 if ((bs->bl.zoned != BLK_Z_NONE) &&
785 (!(s->open_flags & O_DIRECT))) {
786 error_setg(errp, "The driver supports zoned devices, and it requires "
787 "cache.direct=on, which was not specified.");
788 return -EINVAL; /* No host kernel page cache */
789 }
790#endif
779
780 if (S_ISBLK(st.st_mode)) {
781#ifdef __linux__
782 /* On Linux 3.10, BLKDISCARD leaves stale data in the page cache. Do
783 * not rely on the contents of discarded blocks unless using O_DIRECT.
784 * Same for BLKZEROOUT.
785 */
786 if (!(bs->open_flags & BDRV_O_NOCACHE)) {

--- 3582 unchanged lines hidden ---
791
792 if (S_ISBLK(st.st_mode)) {
793#ifdef __linux__
794 /* On Linux 3.10, BLKDISCARD leaves stale data in the page cache. Do
795 * not rely on the contents of discarded blocks unless using O_DIRECT.
796 * Same for BLKZEROOUT.
797 */
798 if (!(bs->open_flags & BDRV_O_NOCACHE)) {

--- 3582 unchanged lines hidden ---