On Tue, Feb 07, 2017 at 02:52:38PM +0100, Laszlo Ersek wrote: > On 02/07/17 14:27, Fam Zheng wrote: > > These are used in each request handling, inline them. > > > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- > > hw/block/virtio-blk.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > > index 2858c31..1da9570 100644 > > --- a/hw/block/virtio-blk.c > > +++ b/hw/block/virtio-blk.c > > @@ -29,8 +29,8 @@ > > #include "hw/virtio/virtio-bus.h" > > #include "hw/virtio/virtio-access.h" > > > > -static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq, > > - VirtIOBlockReq *req) > > +static inline void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq, > > + VirtIOBlockReq *req) > > { > > req->dev = s; > > req->vq = vq; > > @@ -40,12 +40,13 @@ static void virtio_blk_init_request(VirtIOBlock *s, > > VirtQueue *vq, > > req->mr_next = NULL; > > } > > > > -static void virtio_blk_free_request(VirtIOBlockReq *req) > > +static inline void virtio_blk_free_request(VirtIOBlockReq *req) > > { > > g_free(req); > > } > > > > -static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char > > status) > > +static inline void virtio_blk_req_complete(VirtIOBlockReq *req, > > + unsigned char status) > > { > > VirtIOBlock *s = req->dev; > > VirtIODevice *vdev = VIRTIO_DEVICE(s); > > > > Hm, virtio_blk_req_complete() looks a bit too "meaty" and seems to be > called from a little too many places for me to feel convenient about > inlining it. I guess I'd leave it to the compiler to optimize the > function call. Does the explicit hint offer a noticeable perf improvement? > > Inlining virtio_blk_free_request() looks reasonable. > > virtio_blk_init_request() looks okay too. > > Other reviewers should feel free to override my concerns :) My view on > this is distant.
I'm not a big fan of manually inlining functions. Let the compiler decide whether these static functions should be inlined. Stefan
signature.asc
Description: PGP signature