All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v8 2/7] 9pfs: make v9fs_readdir_response_size() public
Date: Wed, 29 Jul 2020 17:44:27 +0200	[thread overview]
Message-ID: <20200729174427.4f4d2e35@bahia.lan> (raw)
In-Reply-To: <3668ebc7d5b929a0e4f1357457060d96f50f76f4.1596012787.git.qemu_oss@crudebyte.com>

On Wed, 29 Jul 2020 10:11:15 +0200
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:

> Rename function v9fs_readdir_data_size() -> v9fs_readdir_response_size()
> and make it callable from other units. So far this function is only
> used by 9p.c, however subsequent patches require the function to be
> callable from another 9pfs unit. And as we're at it; also make it clear
> for what this function is used for.
> 
> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/9pfs/9p.c | 10 ++++++++--
>  hw/9pfs/9p.h |  1 +
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 2ffd96ade9..7a228c4828 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -2313,7 +2313,13 @@ out_nofid:
>      pdu_complete(pdu, err);
>  }
>  
> -static size_t v9fs_readdir_data_size(V9fsString *name)
> +/**
> + * Returns size required in Rreaddir response for the passed dirent @p name.
> + *
> + * @param name - directory entry's name (i.e. file name, directory name)
> + * @returns required size in bytes
> + */
> +size_t v9fs_readdir_response_size(V9fsString *name)
>  {
>      /*
>       * Size of each dirent on the wire: size of qid (13) + size of offset (8)
> @@ -2348,7 +2354,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp,
>          }
>          v9fs_string_init(&name);
>          v9fs_string_sprintf(&name, "%s", dent->d_name);
> -        if ((count + v9fs_readdir_data_size(&name)) > max_count) {
> +        if ((count + v9fs_readdir_response_size(&name)) > max_count) {
>              v9fs_readdir_unlock(&fidp->fs.dir);
>  
>              /* Ran out of buffer. Set dir back to old position and return */
> diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
> index ee2271663c..561774e843 100644
> --- a/hw/9pfs/9p.h
> +++ b/hw/9pfs/9p.h
> @@ -419,6 +419,7 @@ void v9fs_path_init(V9fsPath *path);
>  void v9fs_path_free(V9fsPath *path);
>  void v9fs_path_sprintf(V9fsPath *path, const char *fmt, ...);
>  void v9fs_path_copy(V9fsPath *dst, const V9fsPath *src);
> +size_t v9fs_readdir_response_size(V9fsString *name);
>  int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
>                        const char *name, V9fsPath *path);
>  int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t,



  reply	other threads:[~2020-07-29 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29  8:53 [PATCH v8 0/7] 9pfs: readdir optimization Christian Schoenebeck
2020-07-29  8:10 ` [PATCH v8 1/7] tests/virtio-9p: added split readdir tests Christian Schoenebeck
2020-07-29 15:42   ` Greg Kurz
2020-07-29 17:24     ` Christian Schoenebeck
2020-07-29  8:11 ` [PATCH v8 2/7] 9pfs: make v9fs_readdir_response_size() public Christian Schoenebeck
2020-07-29 15:44   ` Greg Kurz [this message]
2020-07-29  8:11 ` [PATCH v8 3/7] 9pfs: split out fs driver core of v9fs_co_readdir() Christian Schoenebeck
2020-07-29 16:02   ` Greg Kurz
2020-07-29 17:38     ` Christian Schoenebeck
2020-07-29  8:12 ` [PATCH v8 4/7] 9pfs: add new function v9fs_co_readdir_many() Christian Schoenebeck
2020-07-30 10:08   ` Christian Schoenebeck
2020-08-06  9:38     ` Christian Schoenebeck
2020-07-29  8:13 ` [PATCH v8 5/7] 9pfs: T_readdir latency optimization Christian Schoenebeck
2020-07-29  8:39 ` [PATCH v8 6/7] 9pfs: differentiate readdir lock between 9P2000.u vs. 9P2000.L Christian Schoenebeck
2020-07-29  8:42 ` [PATCH v8 7/7] 9pfs: clarify latency of v9fs_co_run_in_worker() Christian Schoenebeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200729174427.4f4d2e35@bahia.lan \
    --to=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.