Browse Source

ceph: fix frag offset for non-leftmost frags

We start at offset 2 for the leftmost frag, and 0 for subsequent frags.
When we reach the end (rightmost), we go back to 2.  This fixes readdir on
fragmented (large) directories.

Signed-off-by: Sage Weil <sage@newdream.net>
Sage Weil 14 years ago
parent
commit
7b88dadc13
1 changed files with 4 additions and 1 deletions
  1. 4 1
      fs/ceph/dir.c

+ 4 - 1
fs/ceph/dir.c

@@ -336,7 +336,10 @@ more:
 		if (req->r_reply_info.dir_end) {
 		if (req->r_reply_info.dir_end) {
 			kfree(fi->last_name);
 			kfree(fi->last_name);
 			fi->last_name = NULL;
 			fi->last_name = NULL;
-			fi->next_offset = 2;
+			if (ceph_frag_is_rightmost(frag))
+				fi->next_offset = 2;
+			else
+				fi->next_offset = 0;
 		} else {
 		} else {
 			rinfo = &req->r_reply_info;
 			rinfo = &req->r_reply_info;
 			err = note_last_dentry(fi,
 			err = note_last_dentry(fi,