]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: break I_NODELAY into NODELAY and FLUSH
authorSage Weil <sage@newdream.net>
Fri, 17 Apr 2009 19:26:44 +0000 (12:26 -0700)
committerSage Weil <sage@newdream.net>
Fri, 17 Apr 2009 19:26:44 +0000 (12:26 -0700)
FLUSH indicates the inode should be flushed asap.  That is, we
should send a cap message with the dirty metadata.  It's set
by write_inode.

NODELAY means we shouldn't delay our cap/wanted release when we
do send a message.  It's set for unlinked files.

src/kernel/caps.c
src/kernel/super.h
src/messages/MClientRequest.h

index 39406b4c84edcf41ee6ae5f90d68e71b78c9a4b8..412c025509415502e27c2ab48351d34ade88e46b 100644 (file)
@@ -334,18 +334,13 @@ static void __insert_cap_node(struct ceph_inode_info *ci,
 }
 
 /*
- * Set cap hold timeouts, unless already I_NODELAY.
+ * (re)set cap hold timeouts.
  */
 static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
                               struct ceph_inode_info *ci)
 {
        struct ceph_mount_args *ma = &mdsc->client->mount_args;
 
-       if (ci->i_ceph_flags & CEPH_I_NODELAY) {
-               dout(10, "__cap_set_timeouts %p I_NODELAY\n", &ci->vfs_inode);
-               return;
-       }
-
        ci->i_hold_caps_min = round_jiffies(jiffies +
                                            ma->caps_wanted_delay_min * HZ);
        ci->i_hold_caps_max = round_jiffies(jiffies +
@@ -358,6 +353,8 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
  * an inode was queued but with i_hold_caps_max=0, meaning it was
  * queued for immediate flush, don't reset the timeouts.
  *
+ * If I_FLUSH is set, leave the inode at the front of the list.
+ *
  * Caller holds i_lock
  *    -> we take mdsc->cap_delay_lock
  */
@@ -369,7 +366,7 @@ static void __cap_delay_requeue(struct ceph_mds_client *mdsc,
        if (!mdsc->stopping) {
                spin_lock(&mdsc->cap_delay_lock);
                if (!list_empty(&ci->i_cap_delay_list)) {
-                       if (ci->i_ceph_flags & CEPH_I_NODELAY)
+                       if (ci->i_ceph_flags & CEPH_I_FLUSH)
                                goto no_change;
                        list_del_init(&ci->i_cap_delay_list);
                }
@@ -380,14 +377,16 @@ static void __cap_delay_requeue(struct ceph_mds_client *mdsc,
 }
 
 /*
- * Queue an inode for immediate writeback.
+ * Queue an inode for immediate writeback.  Mark inode with I_FLUSH,
+ * indicating we should send a cap message to flush dirty metadata
+ * asap.
  */
 static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc,
                                      struct ceph_inode_info *ci)
 {
        dout(10, "__cap_delay_requeue_front %p\n", &ci->vfs_inode);
        spin_lock(&mdsc->cap_delay_lock);
-       ci->i_ceph_flags |= CEPH_I_NODELAY;
+       ci->i_ceph_flags |= CEPH_I_FLUSH;
        if (!list_empty(&ci->i_cap_delay_list))
                list_del_init(&ci->i_cap_delay_list);
        list_add(&ci->i_cap_delay_list, &mdsc->cap_delay_list);
@@ -875,7 +874,7 @@ static void __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
                want |= cap->mds_wanted;
                retain |= cap->issued;
        }
-       ci->i_ceph_flags &= ~CEPH_I_NODELAY;
+       ci->i_ceph_flags &= ~(CEPH_I_NODELAY | CEPH_I_FLUSH);
 
        cap->issued &= retain;  /* drop bits we don't want */
        if (cap->implemented & ~cap->issued) {
@@ -2229,7 +2228,7 @@ void ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
                ci = list_first_entry(&mdsc->cap_delay_list,
                                      struct ceph_inode_info,
                                      i_cap_delay_list);
-               if ((ci->i_ceph_flags & CEPH_I_NODELAY) == 0 &&
+               if ((ci->i_ceph_flags & CEPH_I_FLUSH) == 0 &&
                    time_before(jiffies, ci->i_hold_caps_max))
                        break;
                list_del_init(&ci->i_cap_delay_list);
index 61d0da954ea215ead46f3db9c847613c84a29f26..c827764dd1e329d6cd6103e87f11bec8519034e2 100644 (file)
@@ -274,7 +274,8 @@ struct ceph_inode_xattrs_info {
  */
 #define CEPH_I_COMPLETE  1  /* we have complete directory cached */
 #define CEPH_I_READDIR   2  /* no dentries trimmed since readdir start */
-#define CEPH_I_NODELAY   4  /* do not delay flush caps */
+#define CEPH_I_NODELAY   4  /* do not delay cap release */
+#define CEPH_I_FLUSH     8  /* do not delay cap send */
 
 struct ceph_inode_info {
        struct ceph_vino i_vino;   /* ceph ino + snap */
index 02020e2c0362962d736d2cb83113d6f51192847e..ba825a8a2ce1368e8a315ac83837af8c78353313 100644 (file)
@@ -170,6 +170,14 @@ public:
     out << "client_request(" << get_orig_source() 
        << ":" << get_tid() 
        << " " << ceph_mds_op_name(get_op());
+    if (head.op == CEPH_MDS_OP_SETATTR) {
+      if (head.args.setattr.mask & CEPH_SETATTR_MODE) out << " mode";
+      if (head.args.setattr.mask & CEPH_SETATTR_UID) out << " uid";
+      if (head.args.setattr.mask & CEPH_SETATTR_GID) out << " gid";
+      if (head.args.setattr.mask & CEPH_SETATTR_SIZE) out << " size";
+      if (head.args.setattr.mask & CEPH_SETATTR_MTIME) out << " mtime";
+      if (head.args.setattr.mask & CEPH_SETATTR_ATIME) out << " atime";
+    }
     //if (!get_filepath().empty()) 
     out << " " << get_filepath();
     if (!get_filepath2().empty())