Whamcloud - gitweb
minor fix:
authorlsy <lsy>
Mon, 29 Aug 2005 10:33:29 +0000 (10:33 +0000)
committerlsy <lsy>
Mon, 29 Aug 2005 10:33:29 +0000 (10:33 +0000)
* for partial write only search capability once.

lustre/obdclass/capa.c
lustre/osc/osc_request.c

index b832580..24d34ec 100644 (file)
@@ -96,7 +96,7 @@ find_capa(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid,
                         continue;
                 if (ocapa->c_capa.lc_mdsid != mdsid)
                         continue;
-                if (ocapa->c_capa.lc_op != capa_op)
+                if ((ocapa->c_capa.lc_op & capa_op) != ocapa->c_capa.lc_op)
                         continue;
                 if (ocapa->c_type != type)
                         continue;
index 8a49e36..70ce8a4 100644 (file)
@@ -810,18 +810,11 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa,
 
         /* TODO: this could be optimized: thie capability can be
          * found from ll_inode_info->lli_capas. */
-        capa_op = (opc == OST_WRITE) ? CAPA_WRITE : CAPA_READ;
-get_capa:
+        /* partial write might cause read, both CAPA_READ and CAPA_WRITE
+         * capability could be used here */
+        capa_op = (opc == OST_WRITE) ? CAPA_WRITE : CAPA_READ | CAPA_WRITE;
         ocapa = capa_get(oa->o_fsuid, capa_op, raw_id->li_fid.lf_group,
                          raw_id->li_stc.u.e3s.l3s_ino, CLIENT_CAPA);
-        if (!ocapa) {
-                if (opc == OST_READ && capa_op == MAY_READ) {
-                        /* partial write might cause read, MAY_WRITE capability
-                         * should be used here */
-                        capa_op = MAY_WRITE;
-                        goto get_capa;
-                }
-        }
 
         size[bufcnt++] = sizeof(*body);
         size[bufcnt++] = sizeof(*ioobj);