Whamcloud - gitweb
req-layout: separate req_capsule_has_field() and req_capsule_field_present()
authornikita <nikita>
Wed, 31 May 2006 11:08:51 +0000 (11:08 +0000)
committernikita <nikita>
Wed, 31 May 2006 11:08:51 +0000 (11:08 +0000)
lustre/include/lustre_req_layout.h
lustre/mdt/mdt_handler.c
lustre/ptlrpc/layout.c

index 9772e24..c256955 100644 (file)
@@ -73,6 +73,8 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt);
 
 int req_capsule_has_field(const struct req_capsule *pill,
                           const struct req_msg_field *field);
+int req_capsule_field_present(const struct req_capsule *pill,
+                              const struct req_msg_field *field);
 
 int  req_layout_init(void);
 void req_layout_fini(void);
index b899e65..7ba9fbb 100644 (file)
@@ -683,10 +683,8 @@ static int mdt_body_unpack(struct mdt_thread_info *info, __u32 flags)
                         CERROR("Invalid fid: "DFID3"\n", PFID3(&body->fid1));
                         result = -EINVAL;
                 }
-        } else {
-                CERROR("Can't unpack body\n");
+        } else
                 result = -EFAULT;
-        }
         return result;
 }
 
index 4163e62..330e47f 100644 (file)
@@ -632,20 +632,20 @@ EXPORT_SYMBOL(req_capsule_extend);
 int req_capsule_has_field(const struct req_capsule *pill,
                           const struct req_msg_field *field)
 {
-        int result;
+        return field->rmf_offset[pill->rc_fmt->rf_idx][pill->rc_loc ^ 1];
+}
+EXPORT_SYMBOL(req_capsule_has_field);
+
+int req_capsule_field_present(const struct req_capsule *pill,
+                              const struct req_msg_field *field)
+{
         int loc;
+        int offset;
 
-        loc = pill->rc_loc ^ 1;
-        if (field->rmf_offset[pill->rc_fmt->rf_idx][loc]) {
-                int offset;
+        LASSERT(req_capsule_has_field(pill, field));
 
-                offset = __req_capsule_offset(pill, field, loc);
-                result = __req_msg(pill, loc)->bufcount > offset;
-        } else
-                /*
-                 * Field doesn't exist in this format.
-                 */
-                result = 0;
-        return result;
+        loc = pill->rc_loc ^ 1;
+        offset = __req_capsule_offset(pill, field, loc);
+        return __req_msg(pill, loc)->bufcount > offset;
 }
-EXPORT_SYMBOL(req_capsule_has_field);
+EXPORT_SYMBOL(req_capsule_field_present);