Re: [[PATCH v1] 11/37] [CIFS] SMBD: Post a receive request

From: Christoph Hellwig
Date: Sun Aug 13 2017 - 06:18:38 EST


> + switch(response->type) {
> + case SMBD_TRANSFER_DATA:
> + data_transfer = (struct smbd_data_transfer *) response->packet;

Maybe add a little helper for the packet data to hide these cast, e.g.

static inline void *smbd_payload(struct cifs_rdma_response *resp)
{
return (void *)response->packet;
}


> + atomic_dec(&info->receive_credits);
> + atomic_set(&info->receive_credit_target,
> + le16_to_cpu(data_transfer->credits_requested));
> + atomic_add(le16_to_cpu(data_transfer->credits_granted),
> + &info->send_credits);

That's a lot of atomic ops in the fast path handler. Also remember
that atomic_set isn't really atomic vs other callers.