From: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/6] hw/9pfs: Add directory reclaim support
Date: Thu, 09 Jun 2011 18:36:16 -0700 [thread overview]
Message-ID: <4DF17510.6050901@linux.vnet.ibm.com> (raw)
In-Reply-To: <1307380618-1963-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
On 06/06/2011 10:16 AM, Aneesh Kumar K.V wrote:
> Signed-off-by: Aneesh Kumar K.V<aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
> ---
> hw/9pfs/codir.c | 9 +++++++++
> hw/9pfs/virtio-9p.c | 26 ++++++++++++++++++++++++--
> 2 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c
> index 3347038..2c26f72 100644
> --- a/hw/9pfs/codir.c
> +++ b/hw/9pfs/codir.c
> @@ -98,6 +98,12 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
> err = 0;
> }
> });
> + if (!err) {
> + total_open_fd++;
> + if (total_open_fd> open_fd_hw) {
> + v9fs_reclaim_fd(s);
> + }
> + }
> return err;
> }
>
> @@ -112,5 +118,8 @@ int v9fs_co_closedir(V9fsState *s, DIR *dir)
> err = -errno;
> }
> });
> + if (!err) {
> + total_open_fd--;
> + }
> return err;
> }
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index d322814..55aca93 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -265,7 +265,17 @@ static V9fsFidState *get_fid(V9fsState *s, int32_t fid)
> return NULL;
> }
> }
> - }
> + } else if (f->fid_type == P9_FID_DIR) {
> + if (f->fs.dir == NULL) {
> + do {
> + err = v9fs_co_opendir(s, f);
> + } while (err == -EINTR);
> + if (err< 0) {
> + f->ref--;
> + return NULL;
> + }
> + }
> + }
> /*
> * Mark the fid as referenced so that the LRU
> * reclaim won't close the file descriptor
> @@ -346,7 +356,9 @@ static int release_fid(V9fsState *s, V9fsFidState *fidp)
> retval = v9fs_co_close(s, fidp->fs.fd);
> }
> } else if (fidp->fid_type == P9_FID_DIR) {
> - retval = v9fs_co_closedir(s, fidp->fs.dir);
> + if (fidp->fs.dir != NULL) {
> + retval = v9fs_co_closedir(s, fidp->fs.dir);
> + }
> } else if (fidp->fid_type == P9_FID_XATTR) {
> retval = v9fs_xattr_fid_clunk(s, fidp);
> }
> @@ -431,6 +443,14 @@ void v9fs_reclaim_fd(V9fsState *s)
> f->fs.fd = -1;
> reclaim_count++;
> }
> + } else if (f->fid_type == P9_FID_DIR) {
> + if (f->fs.dir != NULL) {
> + f->rclm_lst = reclaim_list;
> + reclaim_list = f;
> + f->fs_reclaim.dir = f->fs.dir;
> + f->fs.dir = NULL;
> + reclaim_count++;
> + }
> }
> if (reclaim_count>= open_fd_rc) {
> break;
> @@ -448,6 +468,8 @@ void v9fs_reclaim_fd(V9fsState *s)
> } else {
> if (f->fid_type == P9_FID_FILE) {
> v9fs_co_close(s, f->fs_reclaim.fd);
> + } else if (f->fid_type == P9_FID_DIR) {
> + v9fs_co_closedir(s, f->fs_reclaim.dir);
> }
> f->rclm_lst = NULL;
> }
next prev parent reply other threads:[~2011-06-10 1:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 17:16 [Qemu-devel] [PATCH 1/6] hw/9pfs: Add reference counting for fid Aneesh Kumar K.V
2011-06-06 17:16 ` [Qemu-devel] [PATCH 2/6] hw/9pfs: Don't free fid in clunk Aneesh Kumar K.V
2011-06-10 0:27 ` Venkateswararao Jujjuri
2011-06-10 6:19 ` Aneesh Kumar K.V
2011-06-06 17:16 ` [Qemu-devel] [PATCH 3/6] hw/9pfs: Add file descriptor reclaim support Aneesh Kumar K.V
2011-06-10 1:27 ` Venkateswararao Jujjuri
2011-06-06 17:16 ` [Qemu-devel] [PATCH 4/6] hw/9pfs: init fid list properly Aneesh Kumar K.V
2011-06-06 17:16 ` [Qemu-devel] [PATCH 5/6] hw/9pfs: Use v9fs_do_close instead of close Aneesh Kumar K.V
2011-06-10 1:32 ` Venkateswararao Jujjuri
2011-06-06 17:16 ` [Qemu-devel] [PATCH 6/6] hw/9pfs: Add directory reclaim support Aneesh Kumar K.V
2011-06-10 1:36 ` Venkateswararao Jujjuri [this message]
2011-06-09 23:10 ` [Qemu-devel] [PATCH 1/6] hw/9pfs: Add reference counting for fid Venkateswararao Jujjuri
2011-06-10 6:27 ` Aneesh Kumar K.V
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=4DF17510.6050901@linux.vnet.ibm.com \
--to=jvrao@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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.