]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: some dir.c cleanup
authorSage Weil <sage@newdream.net>
Tue, 21 Jul 2009 16:53:33 +0000 (09:53 -0700)
committerSage Weil <sage@newdream.net>
Tue, 21 Jul 2009 16:53:33 +0000 (09:53 -0700)
src/TODO
src/kernel/dir.c

index dc2933433dd96773d195419737bbebdca07e2c70..1ccc80dab96a496f69f90fc11ecaf73c964f28be 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -31,12 +31,20 @@ v0.10
 /- improved monitor read model
 - osd bugfixes
 
-kclient review
-- andi
-/  - server-specified max file size
-/  - pr_debug
-/  - top of file comments
-- test nfs export
+v0.11
+(andi)
+/- server-specified max file size
+/- simplified pr_debug macro
+/- more comments
+/- added a few missing '__attribute__ ((packed))'
+/- kcalloc throughout (chris wright)
+/- simplified export.c (jbfields)
+/- cleaned up mount code
+/- kmem_cache for dentry_info
+/- EBADF on bad caps
+/- fixed stray unaligned access
+/- respond to control-c on slow/hung mount
+
 
 bugs
 - premature filejournal trimming?
index e1ea029743c01329e9ee5927d0050dabfb1c726a..205f834a60981399a2d4b6c3d5d9d16322efe717 100644 (file)
@@ -6,6 +6,10 @@
 #include "ceph_debug.h"
 #include "super.h"
 
+/*
+ * Directory operations: lookup, create, link, unlink, rename, etc.
+ */
+
 /*
  * Ceph MDS operations are specified in terms of a base ino and
  * relative path.  Thus, the client can specify an operation on a
@@ -25,8 +29,8 @@ struct dentry_operations ceph_dentry_ops;
 static int ceph_dentry_revalidate(struct dentry *dentry, struct nameidata *nd);
 
 /*
- * for readdir, encoding the directory frag and offset within that frag
- * into f_pos.
+ * for readdir, we encode the directory frag and offset within that
+ * frag into f_pos.
  */
 static unsigned fpos_frag(loff_t p)
 {
@@ -38,14 +42,15 @@ static unsigned fpos_off(loff_t p)
 }
 
 /*
- * Satisfy a readdir by peeking at the dcache.  We make this work by
- * carefully ordering dentryes on d_u.d_child when we initially get
- * results back from the MDS, and falling back to a "normal" sync
- * readdir if any dentries in the dir are dropped.
+ * When possible, we try to satisfy a readdir by peeking at the
+ * dcache.  We make this work by carefully ordering dentries on
+ * d_u.d_child when we initially get results back from the MDS, and
+ * falling back to a "normal" sync readdir if any dentries in the dir
+ * are dropped.
  *
- * I_COMPLETE tells indicates we have all dirs.  It is defined IFF we
- * hold the CEPH_CAP_FILE_SHARED (which will be revoked by the MDS
- * if/when the directory is modified).
+ * I_COMPLETE tells indicates we have all dentries in the dir.  It is
+ * defined IFF we hold CEPH_CAP_FILE_SHARED (which will be revoked by
+ * the MDS if/when the directory is modified).
  */
 static int __dcache_readdir(struct file *filp,
                            void *dirent, filldir_t filldir)
@@ -59,13 +64,16 @@ static int __dcache_readdir(struct file *filp,
        struct ceph_dentry_info *di;
        int err = 0;
 
+       /* claim ref on last dentry we returned */
        last = fi->dentry;
        fi->dentry = NULL;
+
        dout("__dcache_readdir %p at %llu (last %p)\n", dir, filp->f_pos,
             last);
 
        spin_lock(&dcache_lock);
 
+       /* start at beginning? */
        if (filp->f_pos == 2 || (last &&
                                 filp->f_pos < ceph_dentry(last)->offset)) {
                if (list_empty(&parent->d_subdirs))
@@ -111,15 +119,15 @@ more:
             dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode);
        filp->f_pos = di->offset;
        err = filldir(dirent, dentry->d_name.name,
-                   dentry->d_name.len, di->offset,
-                   dentry->d_inode->i_ino,
-                   dentry->d_inode->i_mode >> 12);
+                     dentry->d_name.len, di->offset,
+                     dentry->d_inode->i_ino,
+                     dentry->d_inode->i_mode >> 12);
 
        spin_lock(&inode->i_lock);
        spin_lock(&dcache_lock);
 
        if (err < 0) {
-               fi->dentry = dentry;
+               fi->dentry = dentry;  /* remember our position */
                goto out_unlock;
        }