Re: review of ocfs2

From: Pekka Enberg
Date: Mon May 30 2005 - 06:47:21 EST


Hi,

On 5/30/05, Andi Kleen <ak@xxxxxxx> wrote:
> +static int ocfs2_do_request_vote(ocfs_super *osb,
> + u64 blkno,
> + unsigned int generation,
> + enum ocfs2_vote_request type,
> + int orphaned_slot,
> + struct ocfs2_net_response_cb *callback)
> ...
> + request = kmalloc(sizeof(*request), GFP_KERNEL);
> + if (!request) {
> + status = -ENOMEM;
> + mlog_errno(status);
> + goto bail;
> + }
> + memset(request, 0, sizeof(*request));
>
> kcalloc

Actually, the latest preferred form for

kcalloc(1, sizeof(*p), GFP_KERNEL)

is the following (as suggested by Al Viro):

request = kmalloc(sizeof(*request), GFP_KERNEL);
if (!request) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
*request = (ocfs2_vote_msg) { .md1.v_generic1 = htonl(priv) };
hdr = &request->v_hdr;

response_id = ocfs2_new_response_id(osb);

*hdr = (ocfs2_msg_hdr) {
.h_response_id = htonl(response_id);
.h_request = htonl(type);
.h_blkno = cpu_to_be64(blkno);
.h_generation = htonl(generation);
.h_node_num = htonl((unsigned int) osb->node_num)
};

Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/