[PVFS2-CVS] commit by robl in pvfs2-1/src/server: get-eattr.sm set-eattr.sm

CVS commit program cvs at parl.clemson.edu
Mon Aug 1 19:49:52 EDT 2005


Update of /projects/cvsroot/pvfs2-1/src/server
In directory parlweb:/tmp/cvs-serv3456/src/server

Modified Files:
	get-eattr.sm set-eattr.sm 
Log Message:
Murali's patch to add VFS support for extended attributes.  


Index: get-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/get-eattr.sm,v
diff -u -w -p -u -r1.2 -r1.3
--- get-eattr.sm	21 Jul 2005 16:17:57 -0000	1.2
+++ get-eattr.sm	1 Aug 2005 22:49:52 -0000	1.3
@@ -192,11 +192,20 @@ static int geteattr_check_resp(PINT_serv
     gossip_debug(GOSSIP_GETEATTR_DEBUG,"geteattr returning %d values\n",
             s_op->resp.u.geteattr.nkey);
     /* put the returned read buffer size in buffer_sz */
+    gossip_debug(GOSSIP_GETEATTR_DEBUG,"status %d error_code %d nkeys %d\n",
+            s_op->resp.status, js_p->error_code, s_op->resp.u.geteattr.nkey);
     /* it is the only thing returned across the wire */
     for (k = 0; k < s_op->resp.u.geteattr.nkey; k++)
     {
+        if (js_p->error_code == 0)
+        {
         s_op->resp.u.geteattr.val[k].buffer_sz =
             s_op->resp.u.geteattr.val[k].read_sz;
+        }
+        /* in case of any errors, we initialize it to 0 */
+        else {
+            s_op->resp.u.geteattr.val[k].buffer_sz = 0;
+        }
     }
     return 1;
 }

Index: set-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/set-eattr.sm,v
diff -u -w -p -u -r1.2 -r1.3
--- set-eattr.sm	21 Jul 2005 16:17:57 -0000	1.2
+++ set-eattr.sm	1 Aug 2005 22:49:52 -0000	1.3
@@ -95,6 +95,7 @@ machine pvfs2_set_eattr_sm(
  * be we'll try to verify what we can.  We can also disallow setting
  * extended attributes on certain object types if we want.  We might
  * want to prevent access to standard metadata keys.
+ *
  */
 static int seteattr_verify_eattribs(
     PINT_server_op *s_op, job_status_s *js_p)
@@ -172,11 +173,23 @@ static int seteattr_verify_eattribs(
 /*
  * This is where the actual extended attrib gets written.
  * Not much to this, its pretty straight-forward.
+ * 
+ * NOTE: we need to check the value of s_op->req->u.seteattr.flags to determine
+ * the following:
+ *
+ * if (flags & PVFS_XATTR_CREATE)
+ *  we need to make sure that the attribute does not exist. (pure create)
+ * else if (flags & PVFS_XATTR_REPLACE)
+ *  we need to make sure that the attribute does exist. (pure replace)
+ * else it is default operation as before.
+ * We translate this to an internal trove flag 
+ *  (TROVE_NOOVERWRITE, TROVE_ONLYOVERWRITE)
  */
 static int seteattr_setobj_eattribs(
         PINT_server_op *s_op, job_status_s *js_p)
 {
     int ret = 0;
+    PVFS_ds_flags trove_flags = 0;
     job_id_t j_id;
     struct server_configuration_s *user_opts = get_server_config_struct();
 
@@ -184,19 +197,28 @@ static int seteattr_setobj_eattribs(
 
     gossip_debug(
         GOSSIP_SETEATTR_DEBUG,
-        "  writing keylist [%Lu,%d,len %d]\n",
+        "  writing keylist [%Lu,%d,len %d flags %d]\n",
         Lu(s_op->req->u.seteattr.handle),
         s_op->req->u.seteattr.fs_id,
-        s_op->req->u.seteattr.nkey);
+        s_op->req->u.seteattr.nkey, s_op->req->u.seteattr.flags);
 
+    if (s_op->req->u.seteattr.flags & PVFS_XATTR_CREATE)
+    {
+        trove_flags = TROVE_NOOVERWRITE;
+    }
+    else if (s_op->req->u.seteattr.flags & PVFS_XATTR_REPLACE)
+    {
+        trove_flags = TROVE_ONLYOVERWRITE;
+    }
+    trove_flags |= PINT_config_get_trove_sync_meta(user_opts, 
+            s_op->req->u.seteattr.fs_id);
     ret = job_trove_keyval_write_list(
         s_op->req->u.seteattr.fs_id,
         s_op->req->u.seteattr.handle,
         s_op->req->u.seteattr.key,
         s_op->req->u.seteattr.val,
         s_op->req->u.seteattr.nkey,
-        PINT_config_get_trove_sync_meta(
-            user_opts, s_op->req->u.seteattr.fs_id),
+        trove_flags,
         NULL,
         s_op,
         0,



More information about the PVFS2-CVS mailing list