Mike Christie
2022-May-15 20:29 UTC
[PATCH V2 4/8] vhost_test: remove vhost_test_flush_vq()
From: Andrey Ryabinin <arbn at yandex-team.com> vhost_test_flush_vq() just a simple wrapper around vhost_work_dev_flush() which seems have no value. It's just easier to call vhost_work_dev_flush() directly. Besides there is no point in obtaining vhost_dev pointer via 'n->vqs[index].poll.dev' while we can just use &n->dev. It's the same pointers, see vhost_test_open()/vhost_dev_init(). Signed-off-by: Andrey Ryabinin <arbn at yandex-team.com> Signed-off-by: Mike Christie <michael.christie at oracle.com> --- drivers/vhost/test.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index f0ac9e35f5d6..837148d0a6a8 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -144,14 +144,9 @@ static void vhost_test_stop(struct vhost_test *n, void **privatep) *privatep = vhost_test_stop_vq(n, n->vqs + VHOST_TEST_VQ); } -static void vhost_test_flush_vq(struct vhost_test *n, int index) -{ - vhost_work_dev_flush(n->vqs[index].poll.dev); -} - static void vhost_test_flush(struct vhost_test *n) { - vhost_test_flush_vq(n, VHOST_TEST_VQ); + vhost_work_dev_flush(&n->dev); } static int vhost_test_release(struct inode *inode, struct file *f) @@ -210,7 +205,7 @@ static long vhost_test_run(struct vhost_test *n, int test) goto err; if (oldpriv) { - vhost_test_flush_vq(n, index); + vhost_test_flush(n, index); } } @@ -303,7 +298,7 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd) mutex_unlock(&vq->mutex); if (enable) { - vhost_test_flush_vq(n, index); + vhost_test_flush(n); } mutex_unlock(&n->dev.mutex); -- 2.25.1
? 2022/5/16 04:29, Mike Christie ??:> From: Andrey Ryabinin <arbn at yandex-team.com> > > vhost_test_flush_vq() just a simple wrapper around vhost_work_dev_flush() > which seems have no value. It's just easier to call vhost_work_dev_flush() > directly. Besides there is no point in obtaining vhost_dev pointer > via 'n->vqs[index].poll.dev' while we can just use &n->dev. > It's the same pointers, see vhost_test_open()/vhost_dev_init(). > > Signed-off-by: Andrey Ryabinin <arbn at yandex-team.com> > Signed-off-by: Mike Christie <michael.christie at oracle.com>Acked-by: Jason Wang <jasowang at redhat.com>> --- > drivers/vhost/test.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c > index f0ac9e35f5d6..837148d0a6a8 100644 > --- a/drivers/vhost/test.c > +++ b/drivers/vhost/test.c > @@ -144,14 +144,9 @@ static void vhost_test_stop(struct vhost_test *n, void **privatep) > *privatep = vhost_test_stop_vq(n, n->vqs + VHOST_TEST_VQ); > } > > -static void vhost_test_flush_vq(struct vhost_test *n, int index) > -{ > - vhost_work_dev_flush(n->vqs[index].poll.dev); > -} > - > static void vhost_test_flush(struct vhost_test *n) > { > - vhost_test_flush_vq(n, VHOST_TEST_VQ); > + vhost_work_dev_flush(&n->dev); > } > > static int vhost_test_release(struct inode *inode, struct file *f) > @@ -210,7 +205,7 @@ static long vhost_test_run(struct vhost_test *n, int test) > goto err; > > if (oldpriv) { > - vhost_test_flush_vq(n, index); > + vhost_test_flush(n, index); > } > } > > @@ -303,7 +298,7 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd) > mutex_unlock(&vq->mutex); > > if (enable) { > - vhost_test_flush_vq(n, index); > + vhost_test_flush(n); > } > > mutex_unlock(&n->dev.mutex);
Stefano Garzarella
2022-May-17 14:11 UTC
[PATCH V2 4/8] vhost_test: remove vhost_test_flush_vq()
On Sun, May 15, 2022 at 03:29:18PM -0500, Mike Christie wrote:>From: Andrey Ryabinin <arbn at yandex-team.com> > >vhost_test_flush_vq() just a simple wrapper around vhost_work_dev_flush() >which seems have no value. It's just easier to call vhost_work_dev_flush() >directly. Besides there is no point in obtaining vhost_dev pointer >via 'n->vqs[index].poll.dev' while we can just use &n->dev. >It's the same pointers, see vhost_test_open()/vhost_dev_init(). > >Signed-off-by: Andrey Ryabinin <arbn at yandex-team.com> >Signed-off-by: Mike Christie <michael.christie at oracle.com> >--- > drivers/vhost/test.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > >diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c >index f0ac9e35f5d6..837148d0a6a8 100644 >--- a/drivers/vhost/test.c >+++ b/drivers/vhost/test.c >@@ -144,14 +144,9 @@ static void vhost_test_stop(struct vhost_test *n, void **privatep) > *privatep = vhost_test_stop_vq(n, n->vqs + VHOST_TEST_VQ); > } > >-static void vhost_test_flush_vq(struct vhost_test *n, int index) >-{ >- vhost_work_dev_flush(n->vqs[index].poll.dev); >-} >- > static void vhost_test_flush(struct vhost_test *n) > { >- vhost_test_flush_vq(n, VHOST_TEST_VQ); >+ vhost_work_dev_flush(&n->dev); > } > > static int vhost_test_release(struct inode *inode, struct file *f) >@@ -210,7 +205,7 @@ static long vhost_test_run(struct vhost_test *n, int test) > goto err; > > if (oldpriv) { >- vhost_test_flush_vq(n, index); >+ vhost_test_flush(n, index);^ Should we remove the `index` parameter?> } > } > >@@ -303,7 +298,7 @@ static long vhost_test_set_backend(struct vhost_test *n, unsigned index, int fd) > mutex_unlock(&vq->mutex); > > if (enable) { >- vhost_test_flush_vq(n, index); >+ vhost_test_flush(n); > } > > mutex_unlock(&n->dev.mutex); >-- >2.25.1 >