Blob Blame History Raw
From c925baf1c95d876b867d9b44a4d6af908e3f7af3 Mon Sep 17 00:00:00 2001
From: Poornima G <pgurusid@redhat.com>
Date: Tue, 6 Dec 2016 16:31:51 +0530
Subject: [PATCH 355/361] readdir-ahead: Enhance EOD detection logic

Issue:
Currently end of directory is identified on obtaining a
readdirp_cbk with op_ret = 0 (i.e. 0 entries fetched in
readdirp). Thus an extra readdirp is required for every
directory just to identify EOD. Consider a case of listing
large number of small directories. The readdirp fops required
are doubled in that case.

Solution:
On reaching the EOD, posix sets the op_errno to ENOENT,
hence along with looking for 'op_ret == 0' we also
look for 'operrno == ENOENT' ehile checking for EOD condition

mainline:
> BUG: 1401812
> Reviewed-on: http://review.gluster.org/16042
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
(cherry picked from commit f60631904defdaec2f1bae84b3cfd6a3e083cf09)

BUG: 1427096
Change-Id: I7a5b52e7b98f5dc236c387635fcc651dac0171b3
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/101415
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/performance/readdir-ahead/src/readdir-ahead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
index 4b57a8b..38507a1 100644
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
@@ -322,7 +322,7 @@ rda_fill_fd_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
 	if (ctx->cur_size >= priv->rda_high_wmark)
 		ctx->state &= ~RDA_FD_PLUGGED;
 
-	if (!op_ret) {
+	if (!op_ret || op_errno == ENOENT) {
 		/* we've hit eod */
 		ctx->state &= ~RDA_FD_RUNNING;
 		ctx->state |= RDA_FD_EOD;
-- 
1.8.3.1