All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: allow STAT osd operations
@ 2013-02-08 16:20 Alex Elder
  2013-02-19 19:16 ` Josh Durgin
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2013-02-08 16:20 UTC (permalink / raw)
  To: ceph-devel

Add support for CEPH_OSD_OP_STAT operations in the osd client
and in rbd.

This operation sends no data to the osd; everything required is
encoded in identity of the target object.

The result will be ENOENT if the object doesn't exist.  If it does
exist and no other error occurs the server returns the size and last
modification time of the target object as output data (in little
endian format).  The size is a 64 bit unsigned and the time is
ceph_timespec structure (two unsigned 32-bit integers, representing
a seconds and nanoseconds value).

This resolves:
    http://tracker.ceph.com/issues/4007

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c   |   15 +++++++++++++++
 net/ceph/osd_client.c |    3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6e9e2c2..37361bd 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1148,6 +1148,8 @@ struct ceph_osd_req_op *rbd_osd_req_op_create(u16
opcode, ...)
 		if (opcode == CEPH_OSD_OP_WRITE)
 			op->payload_len = op->extent.length;
 		break;
+	case CEPH_OSD_OP_STAT:
+		break;
 	case CEPH_OSD_OP_CALL:
 		/* rbd_osd_req_op_create(CALL, class, method, data, datalen) */
 		op->cls.class_name = va_arg(args, char *);
@@ -1277,6 +1279,16 @@ static void rbd_osd_write_callback(struct
rbd_obj_request *obj_request,
 	obj_request_done_set(obj_request);
 }

+/*
+ * For a simple stat call there's nothing to do.  We'll do more if
+ * this is part of a write sequence for a layered image.
+ */
+static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request,
+				struct ceph_osd_op *op)
+{
+	obj_request_done_set(obj_request);
+}
+
 static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
 				struct ceph_msg *msg)
 {
@@ -1307,6 +1319,9 @@ static void rbd_osd_req_callback(struct
ceph_osd_request *osd_req,
 	case CEPH_OSD_OP_WRITE:
 		rbd_osd_write_callback(obj_request, op);
 		break;
+	case CEPH_OSD_OP_STAT:
+		rbd_osd_stat_callback(obj_request, op);
+		break;
 	case CEPH_OSD_OP_CALL:
 	case CEPH_OSD_OP_NOTIFY_ACK:
 	case CEPH_OSD_OP_WATCH:
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index d9d58bb..3e4d8c4 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -244,7 +244,8 @@ static void osd_req_encode_op(struct
ceph_osd_request *req,
 		dst->extent.truncate_seq =
 			cpu_to_le32(src->extent.truncate_seq);
 		break;
-
+	case CEPH_OSD_OP_STAT:
+		break;
 	case CEPH_OSD_OP_GETXATTR:
 	case CEPH_OSD_OP_SETXATTR:
 	case CEPH_OSD_OP_CMPXATTR:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libceph: allow STAT osd operations
  2013-02-08 16:20 [PATCH] libceph: allow STAT osd operations Alex Elder
@ 2013-02-19 19:16 ` Josh Durgin
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Durgin @ 2013-02-19 19:16 UTC (permalink / raw)
  To: Alex Elder; +Cc: ceph-devel

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 02/08/2013 08:20 AM, Alex Elder wrote:
> Add support for CEPH_OSD_OP_STAT operations in the osd client
> and in rbd.
>
> This operation sends no data to the osd; everything required is
> encoded in identity of the target object.
>
> The result will be ENOENT if the object doesn't exist.  If it does
> exist and no other error occurs the server returns the size and last
> modification time of the target object as output data (in little
> endian format).  The size is a 64 bit unsigned and the time is
> ceph_timespec structure (two unsigned 32-bit integers, representing
> a seconds and nanoseconds value).
>
> This resolves:
>      http://tracker.ceph.com/issues/4007
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c   |   15 +++++++++++++++
>   net/ceph/osd_client.c |    3 ++-
>   2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 6e9e2c2..37361bd 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1148,6 +1148,8 @@ struct ceph_osd_req_op *rbd_osd_req_op_create(u16
> opcode, ...)
>   		if (opcode == CEPH_OSD_OP_WRITE)
>   			op->payload_len = op->extent.length;
>   		break;
> +	case CEPH_OSD_OP_STAT:
> +		break;
>   	case CEPH_OSD_OP_CALL:
>   		/* rbd_osd_req_op_create(CALL, class, method, data, datalen) */
>   		op->cls.class_name = va_arg(args, char *);
> @@ -1277,6 +1279,16 @@ static void rbd_osd_write_callback(struct
> rbd_obj_request *obj_request,
>   	obj_request_done_set(obj_request);
>   }
>
> +/*
> + * For a simple stat call there's nothing to do.  We'll do more if
> + * this is part of a write sequence for a layered image.
> + */
> +static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request,
> +				struct ceph_osd_op *op)
> +{
> +	obj_request_done_set(obj_request);
> +}
> +
>   static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
>   				struct ceph_msg *msg)
>   {
> @@ -1307,6 +1319,9 @@ static void rbd_osd_req_callback(struct
> ceph_osd_request *osd_req,
>   	case CEPH_OSD_OP_WRITE:
>   		rbd_osd_write_callback(obj_request, op);
>   		break;
> +	case CEPH_OSD_OP_STAT:
> +		rbd_osd_stat_callback(obj_request, op);
> +		break;
>   	case CEPH_OSD_OP_CALL:
>   	case CEPH_OSD_OP_NOTIFY_ACK:
>   	case CEPH_OSD_OP_WATCH:
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index d9d58bb..3e4d8c4 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -244,7 +244,8 @@ static void osd_req_encode_op(struct
> ceph_osd_request *req,
>   		dst->extent.truncate_seq =
>   			cpu_to_le32(src->extent.truncate_seq);
>   		break;
> -
> +	case CEPH_OSD_OP_STAT:
> +		break;
>   	case CEPH_OSD_OP_GETXATTR:
>   	case CEPH_OSD_OP_SETXATTR:
>   	case CEPH_OSD_OP_CMPXATTR:
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-19 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 16:20 [PATCH] libceph: allow STAT osd operations Alex Elder
2013-02-19 19:16 ` Josh Durgin

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.