Skip to content

Commit

Permalink
libceph: just have osd_req_op_init() return a pointer
Browse files Browse the repository at this point in the history
The caller can just ignore the return. No need for this wrapper that
just casts the other function to void.

[ idryomov: argument alignment ]

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Jeff Layton authored and Ilya Dryomov committed Aug 3, 2020
1 parent d1d9655 commit 042f649
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/linux/ceph/osd_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ void ceph_osdc_clear_abort_err(struct ceph_osd_client *osdc);
&__oreq->r_ops[__whch].typ.fld; \
})

extern void osd_req_op_init(struct ceph_osd_request *osd_req,
struct ceph_osd_req_op *osd_req_op_init(struct ceph_osd_request *osd_req,
unsigned int which, u16 opcode, u32 flags);

extern void osd_req_op_raw_data_in_pages(struct ceph_osd_request *,
Expand Down
39 changes: 16 additions & 23 deletions net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ EXPORT_SYMBOL(ceph_osdc_put_request);

static void request_init(struct ceph_osd_request *req)
{
/* req only, each op is zeroed in _osd_req_op_init() */
/* req only, each op is zeroed in osd_req_op_init() */
memset(req, 0, sizeof(*req));

kref_init(&req->r_kref);
Expand Down Expand Up @@ -746,8 +746,8 @@ EXPORT_SYMBOL(ceph_osdc_alloc_messages);
* other information associated with them. It also serves as a
* common init routine for all the other init functions, below.
*/
static struct ceph_osd_req_op *
_osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which,
struct ceph_osd_req_op *
osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which,
u16 opcode, u32 flags)
{
struct ceph_osd_req_op *op;
Expand All @@ -762,21 +762,15 @@ _osd_req_op_init(struct ceph_osd_request *osd_req, unsigned int which,

return op;
}

void osd_req_op_init(struct ceph_osd_request *osd_req,
unsigned int which, u16 opcode, u32 flags)
{
(void)_osd_req_op_init(osd_req, which, opcode, flags);
}
EXPORT_SYMBOL(osd_req_op_init);

void osd_req_op_extent_init(struct ceph_osd_request *osd_req,
unsigned int which, u16 opcode,
u64 offset, u64 length,
u64 truncate_size, u32 truncate_seq)
{
struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which,
opcode, 0);
struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which,
opcode, 0);
size_t payload_len = 0;

BUG_ON(opcode != CEPH_OSD_OP_READ && opcode != CEPH_OSD_OP_WRITE &&
Expand Down Expand Up @@ -822,7 +816,7 @@ void osd_req_op_extent_dup_last(struct ceph_osd_request *osd_req,
BUG_ON(which + 1 >= osd_req->r_num_ops);

prev_op = &osd_req->r_ops[which];
op = _osd_req_op_init(osd_req, which + 1, prev_op->op, prev_op->flags);
op = osd_req_op_init(osd_req, which + 1, prev_op->op, prev_op->flags);
/* dup previous one */
op->indata_len = prev_op->indata_len;
op->outdata_len = prev_op->outdata_len;
Expand All @@ -845,7 +839,7 @@ int osd_req_op_cls_init(struct ceph_osd_request *osd_req, unsigned int which,
size_t size;
int ret;

op = _osd_req_op_init(osd_req, which, CEPH_OSD_OP_CALL, 0);
op = osd_req_op_init(osd_req, which, CEPH_OSD_OP_CALL, 0);

pagelist = ceph_pagelist_alloc(GFP_NOFS);
if (!pagelist)
Expand Down Expand Up @@ -883,8 +877,8 @@ int 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, 0);
struct ceph_osd_req_op *op = osd_req_op_init(osd_req, which,
opcode, 0);
struct ceph_pagelist *pagelist;
size_t payload_len;
int ret;
Expand Down Expand Up @@ -928,7 +922,7 @@ static void osd_req_op_watch_init(struct ceph_osd_request *req, int which,
{
struct ceph_osd_req_op *op;

op = _osd_req_op_init(req, which, CEPH_OSD_OP_WATCH, 0);
op = osd_req_op_init(req, which, CEPH_OSD_OP_WATCH, 0);
op->watch.cookie = cookie;
op->watch.op = watch_opcode;
op->watch.gen = 0;
Expand All @@ -943,10 +937,9 @@ void osd_req_op_alloc_hint_init(struct ceph_osd_request *osd_req,
u64 expected_write_size,
u32 flags)
{
struct ceph_osd_req_op *op = _osd_req_op_init(osd_req, which,
CEPH_OSD_OP_SETALLOCHINT,
0);
struct ceph_osd_req_op *op;

op = osd_req_op_init(osd_req, which, CEPH_OSD_OP_SETALLOCHINT, 0);
op->alloc_hint.expected_object_size = expected_object_size;
op->alloc_hint.expected_write_size = expected_write_size;
op->alloc_hint.flags = flags;
Expand Down Expand Up @@ -4799,7 +4792,7 @@ static int osd_req_op_notify_ack_init(struct ceph_osd_request *req, int which,
struct ceph_pagelist *pl;
int ret;

op = _osd_req_op_init(req, which, CEPH_OSD_OP_NOTIFY_ACK, 0);
op = osd_req_op_init(req, which, CEPH_OSD_OP_NOTIFY_ACK, 0);

pl = ceph_pagelist_alloc(GFP_NOIO);
if (!pl)
Expand Down Expand Up @@ -4868,7 +4861,7 @@ static int osd_req_op_notify_init(struct ceph_osd_request *req, int which,
struct ceph_pagelist *pl;
int ret;

op = _osd_req_op_init(req, which, CEPH_OSD_OP_NOTIFY, 0);
op = osd_req_op_init(req, which, CEPH_OSD_OP_NOTIFY, 0);
op->notify.cookie = cookie;

pl = ceph_pagelist_alloc(GFP_NOIO);
Expand Down Expand Up @@ -5332,8 +5325,8 @@ static int osd_req_op_copy_from_init(struct ceph_osd_request *req,
if (IS_ERR(pages))
return PTR_ERR(pages);

op = _osd_req_op_init(req, 0, CEPH_OSD_OP_COPY_FROM2,
dst_fadvise_flags);
op = osd_req_op_init(req, 0, CEPH_OSD_OP_COPY_FROM2,
dst_fadvise_flags);
op->copy_from.snapid = src_snapid;
op->copy_from.src_version = src_version;
op->copy_from.flags = copy_from_flags;
Expand Down

0 comments on commit 042f649

Please sign in to comment.