]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: fix MClientRequest::is_write(), rename to may_write().
authorGreg Farnum <gregf@hq.newdream.net>
Fri, 16 Jul 2010 16:56:40 +0000 (09:56 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 16 Jul 2010 16:56:40 +0000 (09:56 -0700)
Also remove unused can_forward(), auth_is_best().

src/mds/Server.cc
src/messages/MClientRequest.h

index a4e5e3e3e0ef477346d345fc38e83e000af7f4e1..1069ad8b05a8aded6813afd4267b8f1fb7b15c85 100644 (file)
@@ -819,7 +819,7 @@ void Server::reply_request(MDRequest *mdr, MClientReply *reply, CInode *tracei,
           << ") " << *req << dendl;
 
   // note successful request in session map?
-  if (req->is_write() && mdr->session && reply->get_result() == 0)
+  if (req->may_write() && mdr->session && reply->get_result() == 0)
     mdr->session->add_completed_request(mdr->reqid.tid);
 
   // give any preallocated inos to the session
@@ -2038,7 +2038,7 @@ void Server::handle_client_open(MDRequest *mdr)
   if (!cur)
     return;
 
-  if (mdr->snapid != CEPH_NOSNAP && mdr->client_request->is_write()) {
+  if (mdr->snapid != CEPH_NOSNAP && mdr->client_request->may_write()) {
     reply_request(mdr, -EROFS);
     return;
   }
index eeb69f0dfd25a29d455927394ec1f0e0bf3bcd87..1a82d00fcd4ea3faddedf491c34564d710a172e0 100644 (file)
@@ -97,27 +97,11 @@ public:
   /*bool open_file_mode_is_readonly() {
     return file_mode_is_readonly(ceph_flags_to_mode(head.args.open.flags));
     }*/
-  bool is_write() {
+  bool may_write() {
     return
       (head.op & CEPH_MDS_OP_WRITE) || 
-      (head.op == CEPH_MDS_OP_OPEN && !(head.args.open.flags & (O_CREAT|O_TRUNC))) ||
-      (head.op == CEPH_MDS_OP_CREATE && !(head.args.open.flags & (O_CREAT|O_TRUNC)));
-  }
-  bool can_forward() {
-    if (is_write() ||
-       head.op == CEPH_MDS_OP_OPEN ||   // do not forward _any_ open request.
-       head.op == CEPH_MDS_OP_CREATE)   // do not forward _any_ open request.
-      return false;
-    return true;
-  }
-  bool auth_is_best() {
-    if (is_write()) 
-      return true;
-    if (head.op == CEPH_MDS_OP_OPEN ||
-       head.op == CEPH_MDS_OP_CREATE ||
-       head.op == CEPH_MDS_OP_READDIR) 
-      return true;
-    return false;    
+      (head.op == CEPH_MDS_OP_OPEN && (head.args.open.flags & (O_CREAT|O_TRUNC))) ||
+      (head.op == CEPH_MDS_OP_CREATE);
   }
 
   int get_flags() {