aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-07-26 14:26:18 -0400
committerSage Weil <sage@newdream.net>2011-07-26 14:26:18 -0400
commit9cfa1098dcfb34f71c5f3b7bcdbbb435a0cecab2 (patch)
treececff467984dd0d5e8fef2014e296b682c7a0267 /fs/ceph
parent4918b6d140c4822201ebbe2f070875332aff337b (diff)
ceph: use flag bit for at_end readdir flag
This saves us a word of memory per file. Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/dir.c10
-rw-r--r--fs/ceph/super.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index ef8f08c343e8..53b441fe78f1 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -133,7 +133,7 @@ more:
133 d_unhashed(dentry) ? "!hashed" : "hashed", 133 d_unhashed(dentry) ? "!hashed" : "hashed",
134 parent->d_subdirs.prev, parent->d_subdirs.next); 134 parent->d_subdirs.prev, parent->d_subdirs.next);
135 if (p == &parent->d_subdirs) { 135 if (p == &parent->d_subdirs) {
136 fi->at_end = 1; 136 fi->flags |= CEPH_F_ATEND;
137 goto out_unlock; 137 goto out_unlock;
138 } 138 }
139 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 139 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
@@ -234,7 +234,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
234 const int max_bytes = fsc->mount_options->max_readdir_bytes; 234 const int max_bytes = fsc->mount_options->max_readdir_bytes;
235 235
236 dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off); 236 dout("readdir %p filp %p frag %u off %u\n", inode, filp, frag, off);
237 if (fi->at_end) 237 if (fi->flags & CEPH_F_ATEND)
238 return 0; 238 return 0;
239 239
240 /* always start with . and .. */ 240 /* always start with . and .. */
@@ -403,7 +403,7 @@ more:
403 dout("readdir next frag is %x\n", frag); 403 dout("readdir next frag is %x\n", frag);
404 goto more; 404 goto more;
405 } 405 }
406 fi->at_end = 1; 406 fi->flags |= CEPH_F_ATEND;
407 407
408 /* 408 /*
409 * if dir_release_count still matches the dir, no dentries 409 * if dir_release_count still matches the dir, no dentries
@@ -435,7 +435,7 @@ static void reset_readdir(struct ceph_file_info *fi)
435 dput(fi->dentry); 435 dput(fi->dentry);
436 fi->dentry = NULL; 436 fi->dentry = NULL;
437 } 437 }
438 fi->at_end = 0; 438 fi->flags &= ~CEPH_F_ATEND;
439} 439}
440 440
441static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin) 441static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
@@ -458,7 +458,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin)
458 if (offset != file->f_pos) { 458 if (offset != file->f_pos) {
459 file->f_pos = offset; 459 file->f_pos = offset;
460 file->f_version = 0; 460 file->f_version = 0;
461 fi->at_end = 0; 461 fi->flags &= ~CEPH_F_ATEND;
462 } 462 }
463 retval = offset; 463 retval = offset;
464 464
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index cdb17d36755c..a8a273320241 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -544,6 +544,7 @@ extern void ceph_reservation_status(struct ceph_fs_client *client,
544 * we keep buffered readdir results attached to file->private_data 544 * we keep buffered readdir results attached to file->private_data
545 */ 545 */
546#define CEPH_F_SYNC 1 546#define CEPH_F_SYNC 1
547#define CEPH_F_ATEND 2
547 548
548struct ceph_file_info { 549struct ceph_file_info {
549 short fmode; /* initialized on open */ 550 short fmode; /* initialized on open */
@@ -552,7 +553,6 @@ struct ceph_file_info {
552 /* readdir: position within the dir */ 553 /* readdir: position within the dir */
553 u32 frag; 554 u32 frag;
554 struct ceph_mds_request *last_readdir; 555 struct ceph_mds_request *last_readdir;
555 int at_end;
556 556
557 /* readdir: position within a frag */ 557 /* readdir: position within a frag */
558 unsigned offset; /* offset of last chunk, adjusted for . and .. */ 558 unsigned offset; /* offset of last chunk, adjusted for . and .. */