Re: [PATCH 01/12] libceph: add SETXATTR/CMPXATTR osd operations support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 17, 2014 at 10:56 AM, Yan, Zheng <zyan@xxxxxxxxxx> wrote:
> Signed-off-by: Yan, Zheng <zyan@xxxxxxxxxx>
> ---
>  include/linux/ceph/osd_client.h | 10 ++++++++++
>  net/ceph/osd_client.c           | 38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 48 insertions(+)
>
> diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
> index 03aeb27..1ad217b 100644
> --- a/include/linux/ceph/osd_client.h
> +++ b/include/linux/ceph/osd_client.h
> @@ -87,6 +87,13 @@ struct ceph_osd_req_op {
>                         struct ceph_osd_data osd_data;
>                 } extent;
>                 struct {
> +                       __le32 name_len;
> +                       __le32 value_len;
> +                       __u8 cmp_op;       /* CEPH_OSD_CMPXATTR_OP_* */
> +                       __u8 cmp_mode;     /* CEPH_OSD_CMPXATTR_MODE_* */
> +                       struct ceph_osd_data osd_data;
> +               } xattr;
> +               struct {
>                         const char *class_name;
>                         const char *method_name;
>                         struct ceph_osd_data request_info;
> @@ -295,6 +302,9 @@ extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
>  extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
>                                         unsigned int which, u16 opcode,
>                                         const char *class, const char *method);
> +extern void osd_req_op_xattr_init(struct ceph_osd_request *osd_req, unsigned int which,
> +                                 u16 opcode, const char *name, const void *value,
> +                                 size_t size, u8 cmp_op, u8 cmp_mode);
>  extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
>                                         unsigned int which, u16 opcode,
>                                         u64 cookie, u64 version, int flag);
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 1f6c405..f8fb376 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -545,6 +545,34 @@ void osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which,
>  }
>  EXPORT_SYMBOL(osd_req_op_cls_init);
>
> +void osd_req_op_xattr_init(struct ceph_osd_request *osd_req, unsigned int which,
> +                         u16 opcode, const char *name, const void *value,
> +                         size_t size, u8 cmp_op, u8 cmp_mode)
> +{
> +       struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which, opcode);
> +       struct ceph_pagelist *pagelist;
> +       size_t payload_len;

Add

BUG_ON(opcode != CEPH_OSD_OP_SETXATTR && opcode != CEPH_OSD_OP_CMPXATTR);

These asserts in osd_req_op_*_init() proved to be useful and some day
we will change from BUG_ONs to something nicer throughout.

> +
> +       pagelist = kmalloc(sizeof (*pagelist), GFP_NOFS);
> +       BUG_ON(!pagelist);

This BUG_ON OTOH is not useful ;)  Can you make osd_req_op_xattr_init()
return an error and get rid of it?  I know you just pasted this from
osd_req_op_cls_init(), but ceph_uninline_data() is perfectly capable of
handling -ENOMEM so no reason to spread this any further.

Also drop the space after sizeof.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux