* [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate()
@ 2014-09-09 17:38 Chrysostomos Nanakos
2014-09-09 17:38 ` [Qemu-devel] [PATCH v1 2/2] qemu-iotests: Run 025 for Archipelago block driver Chrysostomos Nanakos
2014-09-10 8:20 ` [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Kevin Wolf
0 siblings, 2 replies; 5+ messages in thread
From: Chrysostomos Nanakos @ 2014-09-09 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Chrysostomos Nanakos, stefanha
Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
---
block/archipelago.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/block/archipelago.c b/block/archipelago.c
index 22a7daa..40e5f76 100644
--- a/block/archipelago.c
+++ b/block/archipelago.c
@@ -63,8 +63,6 @@
#include <xseg/xseg.h>
#include <xseg/protocol.h>
-#define ARCHIP_FD_READ 0
-#define ARCHIP_FD_WRITE 1
#define MAX_REQUEST_SIZE 524288
#define ARCHIPELAGO_OPT_VOLUME "volume"
@@ -84,6 +82,7 @@ typedef enum {
ARCHIP_OP_WRITE,
ARCHIP_OP_FLUSH,
ARCHIP_OP_VOLINFO,
+ ARCHIP_OP_TRUNCATE,
} ARCHIPCmd;
typedef struct ArchipelagoAIOCB {
@@ -248,6 +247,7 @@ static void xseg_request_handler(void *state)
}
break;
case ARCHIP_OP_VOLINFO:
+ case ARCHIP_OP_TRUNCATE:
s->is_signaled = true;
qemu_cond_signal(&s->archip_cond);
break;
@@ -995,6 +995,64 @@ static int64_t qemu_archipelago_getlength(BlockDriverState *bs)
return ret;
}
+static int qemu_archipelago_truncate(BlockDriverState *bs, int64_t offset)
+{
+ int ret, targetlen;
+ struct xseg_request *req;
+ BDRVArchipelagoState *s = bs->opaque;
+ AIORequestData *reqdata = g_new(AIORequestData, 1);
+
+ const char *volname = s->volname;
+ targetlen = strlen(volname);
+ req = xseg_get_request(s->xseg, s->srcport, s->mportno, X_ALLOC);
+ if (!req) {
+ archipelagolog("Cannot get XSEG request\n");
+ return err_exit2;
+ }
+
+ ret = xseg_prep_request(s->xseg, req, targetlen, 0);
+ if (ret < 0) {
+ archipelagolog("Cannot prepare XSEG request\n");
+ goto err_exit;
+ }
+ char *target = xseg_get_target(s->xseg, req);
+ if (!target) {
+ archipelagolog("Cannot get XSEG target\n");
+ goto err_exit;
+ }
+ memcpy(target, volname, targetlen);
+ req->offset = offset;
+ req->op = X_TRUNCATE;
+
+ reqdata->op = ARCHIP_OP_TRUNCATE;
+ reqdata->volname = volname;
+
+ xseg_set_req_data(s->xseg, req, reqdata);
+
+ xport p = xseg_submit(s->xseg, req, s->srcport, X_ALLOC);
+ if (p == NoPort) {
+ archipelagolog("Cannot submit XSEG request\n");
+ goto err_exit;
+ }
+
+ xseg_signal(s->xseg, p);
+ qemu_mutex_lock(&s->archip_mutex);
+ while (!s->is_signaled) {
+ qemu_cond_wait(&s->archip_cond, &s->archip_mutex);
+ }
+ s->is_signaled = false;
+ qemu_mutex_unlock(&s->archip_mutex);
+ xseg_put_request(s->xseg, req, s->srcport);
+ g_free(reqdata);
+ return 0;
+
+err_exit:
+ xseg_put_request(s->xseg, req, s->srcport);
+err_exit2:
+ g_free(reqdata);
+ return -EIO;
+}
+
static QemuOptsList qemu_archipelago_create_opts = {
.name = "archipelago-create-opts",
.head = QTAILQ_HEAD_INITIALIZER(qemu_archipelago_create_opts.head),
@@ -1024,6 +1082,7 @@ static BlockDriver bdrv_archipelago = {
.bdrv_close = qemu_archipelago_close,
.bdrv_create = qemu_archipelago_create,
.bdrv_getlength = qemu_archipelago_getlength,
+ .bdrv_truncate = qemu_archipelago_truncate,
.bdrv_aio_readv = qemu_archipelago_aio_readv,
.bdrv_aio_writev = qemu_archipelago_aio_writev,
.bdrv_aio_flush = qemu_archipelago_aio_flush,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v1 2/2] qemu-iotests: Run 025 for Archipelago block driver
2014-09-09 17:38 [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Chrysostomos Nanakos
@ 2014-09-09 17:38 ` Chrysostomos Nanakos
2014-09-10 8:20 ` [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Kevin Wolf
1 sibling, 0 replies; 5+ messages in thread
From: Chrysostomos Nanakos @ 2014-09-09 17:38 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Chrysostomos Nanakos, stefanha
Run resize grow test to ensure that existing data
is not lost during grow and new space is zeroed.
Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
---
tests/qemu-iotests/025 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025
index a5f45b4..467a4b7 100755
--- a/tests/qemu-iotests/025
+++ b/tests/qemu-iotests/025
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.pattern
_supported_fmt raw qcow2 qed
-_supported_proto file sheepdog rbd nfs
+_supported_proto file sheepdog rbd nfs archipelago
_supported_os Linux
echo "=== Creating image"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate()
2014-09-09 17:38 [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Chrysostomos Nanakos
2014-09-09 17:38 ` [Qemu-devel] [PATCH v1 2/2] qemu-iotests: Run 025 for Archipelago block driver Chrysostomos Nanakos
@ 2014-09-10 8:20 ` Kevin Wolf
2014-09-10 8:25 ` Chrysostomos Nanakos
1 sibling, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2014-09-10 8:20 UTC (permalink / raw)
To: Chrysostomos Nanakos; +Cc: qemu-devel, stefanha
Am 09.09.2014 um 19:38 hat Chrysostomos Nanakos geschrieben:
> Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
> ---
> block/archipelago.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 61 insertions(+), 2 deletions(-)
Thanks, applied all to the block branch.
Can you please add a cover letter (the [PATCH 0/n] mail as produced by
the --cover-letter option in git format-patch) for your next series?
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate()
2014-09-10 8:20 ` [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Kevin Wolf
@ 2014-09-10 8:25 ` Chrysostomos Nanakos
2014-09-10 8:32 ` Kevin Wolf
0 siblings, 1 reply; 5+ messages in thread
From: Chrysostomos Nanakos @ 2014-09-10 8:25 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, stefanha
On 09/10/2014 11:20 AM, Kevin Wolf wrote:
> Am 09.09.2014 um 19:38 hat Chrysostomos Nanakos geschrieben:
>> Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
>> ---
>> block/archipelago.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 61 insertions(+), 2 deletions(-)
> Thanks, applied all to the block branch.
>
> Can you please add a cover letter (the [PATCH 0/n] mail as produced by
> the --cover-letter option in git format-patch) for your next series?
>
> Kevin
Yes of course, removed it in the last minute thinking that it was only
two commits and there was no need for a cover letter.
Thanks.
Regards,
Chrysostomos.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate()
2014-09-10 8:25 ` Chrysostomos Nanakos
@ 2014-09-10 8:32 ` Kevin Wolf
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2014-09-10 8:32 UTC (permalink / raw)
To: Chrysostomos Nanakos; +Cc: qemu-devel, stefanha
Am 10.09.2014 um 10:25 hat Chrysostomos Nanakos geschrieben:
> On 09/10/2014 11:20 AM, Kevin Wolf wrote:
> >Am 09.09.2014 um 19:38 hat Chrysostomos Nanakos geschrieben:
> >>Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
> >>---
> >> block/archipelago.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++--
> >> 1 file changed, 61 insertions(+), 2 deletions(-)
> >Thanks, applied all to the block branch.
> >
> >Can you please add a cover letter (the [PATCH 0/n] mail as produced by
> >the --cover-letter option in git format-patch) for your next series?
> >
> >Kevin
> Yes of course, removed it in the last minute thinking that it was
> only two commits and there was no need for a cover letter.
No big deal, but besides having combined diffstats, it also allows
distinguishing between comments on the first patch and comments on the
whole series, so I prefer to have it when it's more than one patch.
Of course, you don't have to actually write a description for the cover
letter for such a small series, the automatically generated stuff is
good enough.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-10 8:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 17:38 [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Chrysostomos Nanakos
2014-09-09 17:38 ` [Qemu-devel] [PATCH v1 2/2] qemu-iotests: Run 025 for Archipelago block driver Chrysostomos Nanakos
2014-09-10 8:20 ` [Qemu-devel] [PATCH v1 1/2] block/archipelago: Implement bdrv_truncate() Kevin Wolf
2014-09-10 8:25 ` Chrysostomos Nanakos
2014-09-10 8:32 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.