On Fri, Dec 02, 2016 at 02:40:49PM -0500, James Simmons wrote: > -/* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available. > - * Otherwise, 2 are available. > - */ > -#define ldlm_request_bufsize(count, type) \ > -({ \ > - int _avail = LDLM_LOCKREQ_HANDLES; \ > - _avail -= (type == LDLM_ENQUEUE ? LDLM_ENQUEUE_CANCEL_OFF : 0); \ > - sizeof(struct ldlm_request) + \ > - (count > _avail ? count - _avail : 0) * \ > - sizeof(struct lustre_handle); \ > -}) > - > +/** > + * ldlm_request_bufsize > + * > + * @count: number of ldlm handles > + * @type: ldlm opcode > + * > + * If opcode=LDLM_ENQUEUE, 1 slot is already occupied, > + * LDLM_LOCKREQ_HANDLE -1 slots are available. > + * Otherwise, LDLM_LOCKREQ_HANDLE slots are available. > + * > + * Return: size of the request buffer > + */ > +int ldlm_request_bufsize(int count, int type) > +{ > + int avail = LDLM_LOCKREQ_HANDLES; > + > + if (type == LDLM_ENQUEUE) > + avail -= LDLM_ENQUEUE_CANCEL_OFF; > + > + if (count > avail) > + avail = (count - avail) * sizeof(struct lustre_handle); > + else > + avail = 0; > + > + return sizeof(struct ldlm_request) + avail; > +} > + This is a nice cleanup. regards, dan carpenter _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel