Projects
Eulaceura:Mainline:GA
qemu
_service:obs_scm:Revert-file-posix-Remove-unuse...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:Revert-file-posix-Remove-unused-s-discard_zeroes.patch of Package qemu
From db37bc0d85e141a666dd287cdc562a47f29b4343 Mon Sep 17 00:00:00 2001 From: Jinhua Cao <caojinhua1@huawei.com> Date: Mon, 18 Mar 2024 10:01:28 +0800 Subject: [PATCH] Revert "file-posix: Remove unused s->discard_zeroes" This reverts commit a7ca2eb488ff149c898f43abe103f8bd8e3ca3c4. --- block/file-posix.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index b862406c71..01ae5fd88c 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -158,6 +158,7 @@ typedef struct BDRVRawState { bool has_discard:1; bool has_write_zeroes:1; + bool discard_zeroes:1; bool use_linux_aio:1; bool use_linux_io_uring:1; int page_cache_inconsistent; /* errno from fdatasync failure */ @@ -765,6 +766,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, ret = -EINVAL; goto fail; } else { + s->discard_zeroes = true; s->has_fallocate = true; } } else { @@ -790,12 +792,19 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, #endif if (S_ISBLK(st.st_mode)) { +#ifdef BLKDISCARDZEROES + unsigned int arg; + if (ioctl(s->fd, BLKDISCARDZEROES, &arg) == 0 && arg) { + s->discard_zeroes = true; + } +#endif #ifdef __linux__ /* On Linux 3.10, BLKDISCARD leaves stale data in the page cache. Do * not rely on the contents of discarded blocks unless using O_DIRECT. * Same for BLKZEROOUT. */ if (!(bs->open_flags & BDRV_O_NOCACHE)) { + s->discard_zeroes = false; s->has_write_zeroes = false; } #endif -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2