qed.c (776efef32439a31cb13a6acfe8aab833687745ad) qed.c (c41a73ffaf40aadc2c1e038ae4d12b62cd578e7f)
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

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

138 void *opaque)
139{
140 /* We must write full sectors for O_DIRECT but cannot necessarily generate
141 * the data following the header if an unrecognized compat feature is
142 * active. Therefore, first read the sectors containing the header, update
143 * them, and write back.
144 */
145
1/*
2 * QEMU Enhanced Disk Format
3 *
4 * Copyright IBM, Corp. 2010
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
8 * Anthony Liguori <aliguori@us.ibm.com>

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

138 void *opaque)
139{
140 /* We must write full sectors for O_DIRECT but cannot necessarily generate
141 * the data following the header if an unrecognized compat feature is
142 * active. Therefore, first read the sectors containing the header, update
143 * them, and write back.
144 */
145
146 int nsectors = (sizeof(QEDHeader) + BDRV_SECTOR_SIZE - 1) /
147 BDRV_SECTOR_SIZE;
146 int nsectors = DIV_ROUND_UP(sizeof(QEDHeader), BDRV_SECTOR_SIZE);
148 size_t len = nsectors * BDRV_SECTOR_SIZE;
149 QEDWriteHeaderCB *write_header_cb = gencb_alloc(sizeof(*write_header_cb),
150 cb, opaque);
151
152 write_header_cb->s = s;
153 write_header_cb->nsectors = nsectors;
154 write_header_cb->buf = qemu_blockalign(s->bs, len);
155 write_header_cb->iov.iov_base = write_header_cb->buf;

--- 1529 unchanged lines hidden ---
147 size_t len = nsectors * BDRV_SECTOR_SIZE;
148 QEDWriteHeaderCB *write_header_cb = gencb_alloc(sizeof(*write_header_cb),
149 cb, opaque);
150
151 write_header_cb->s = s;
152 write_header_cb->nsectors = nsectors;
153 write_header_cb->buf = qemu_blockalign(s->bs, len);
154 write_header_cb->iov.iov_base = write_header_cb->buf;

--- 1529 unchanged lines hidden ---