From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUqe4-0005h9-Ek for qemu-devel@nongnu.org; Thu, 09 Jun 2011 21:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUqe2-0002IB-V9 for qemu-devel@nongnu.org; Thu, 09 Jun 2011 21:36:20 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:36721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUqe2-0002I5-Ii for qemu-devel@nongnu.org; Thu, 09 Jun 2011 21:36:18 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p5A1M7oS024984 for ; Thu, 9 Jun 2011 19:22:07 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id p5A1aHaE143548 for ; Thu, 9 Jun 2011 19:36:17 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p59JaGXH008575 for ; Thu, 9 Jun 2011 13:36:16 -0600 Received: from oc6675851006.ibm.com (sig-9-65-39-156.mts.ibm.com [9.65.39.156]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p59JaFE8008558 for ; Thu, 9 Jun 2011 13:36:16 -0600 Message-ID: <4DF17510.6050901@linux.vnet.ibm.com> Date: Thu, 09 Jun 2011 18:36:16 -0700 From: Venkateswararao Jujjuri MIME-Version: 1.0 References: <1307380618-1963-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1307380618-1963-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1307380618-1963-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 6/6] hw/9pfs: Add directory reclaim support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 06/06/2011 10:16 AM, Aneesh Kumar K.V wrote: > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Venkateswararao Jujjuri > --- > 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; > }