Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 650590 Details for
Bug 835622
RFE: virt-sparsify should be able to sparsify onto a thin-provisioned LV
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
add block device discard support to qemu (WIP)
835622-qemu-block-discard.patch (text/plain), 2.01 KB, created by
Dominic Cleal
on 2012-11-23 17:50:32 UTC
(
hide
)
Description:
add block device discard support to qemu (WIP)
Filename:
MIME Type:
Creator:
Dominic Cleal
Created:
2012-11-23 17:50:32 UTC
Size:
2.01 KB
patch
obsolete
>commit 0f63b071eb1b366f2a7364aa735e66e27e578cda >Author: Dominic Cleal <dcleal@redhat.com> >Date: Mon Oct 29 09:34:57 2012 +0000 > > Block device discard support > > * add discard capability to raw POSIX block devices > * discard the entire device on block device creation > >diff --git a/block/raw-posix.c b/block/raw-posix.c >index 28d439f..6b34420 100644 >--- a/block/raw-posix.c >+++ b/block/raw-posix.c >@@ -108,6 +108,10 @@ > #define O_DIRECT O_DSYNC > #endif > >+#ifndef BLKDISCARD >+#define BLKDISCARD _IO(0x12, 119) >+#endif >+ > #define FTYPE_FILE 0 > #define FTYPE_CD 1 > #define FTYPE_FD 2 >@@ -1087,6 +1091,7 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options) > int ret = 0; > struct stat stat_buf; > int64_t total_size = 0; >+ uint64_t range[2]; > > /* Read out options */ > while (options && options->name) { >@@ -1107,13 +1112,36 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options) > else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE) > ret = -ENOSPC; > >+#ifdef __linux__ >+ /* Zero the device first if possible */ >+ range[0] = 0; >+ range[1] = total_size * BDRV_SECTOR_SIZE; >+ if (ioctl(fd, BLKDISCARD, &range)) >+ return -errno; >+#endif >+ > qemu_close(fd); > return ret; > } > > static int hdev_has_zero_init(BlockDriverState *bs) > { >+#ifdef __linux__ >+ return 1; >+#else > return 0; >+#endif >+} >+ >+static BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, >+ int64_t sector_num, int nb_sectors, >+ BlockDriverCompletionFunc *cb, void *opaque) >+{ >+ uint64_t range[2]; >+ range[0] = sector_num << BDRV_SECTOR_BITS; >+ range[1] = nb_sectors << BDRV_SECTOR_BITS; >+ >+ return hdev_aio_ioctl(bs, BLKDISCARD, &range, cb, opaque); > } > > static BlockDriver bdrv_host_device = { >@@ -1140,6 +1168,7 @@ static BlockDriver bdrv_host_device = { > #ifdef __linux__ > .bdrv_ioctl = hdev_ioctl, > .bdrv_aio_ioctl = hdev_aio_ioctl, >+ .bdrv_aio_discard = hdev_aio_discard, > #endif > }; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 835622
: 650590