Whamcloud - gitweb
r=adilger
[fs/lustre-release.git] / lustre / obdfilter / filter_io.c
index 3d505ec..41659a4 100644 (file)
@@ -637,8 +637,14 @@ cleanup:
 int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
                   int objcount, struct obd_ioobj *obj, int niocount,
                   struct niobuf_remote *nb, struct niobuf_local *res,
-                  struct obd_trans_info *oti)
+                  struct obd_trans_info *oti, struct lustre_capa *capa)
 {
+        int rc;
+
+        rc = filter_verify_capa(cmd, exp, capa);
+        if (rc)
+                return rc;
+
         if (cmd == OBD_BRW_WRITE)
                 return filter_preprw_write(cmd, exp, oa, objcount, obj,
                                            niocount, nb, res, oti);
@@ -883,16 +889,29 @@ cleanup:
 
 int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
                     int objcount, struct obd_ioobj *obj, int niocount,
-                    struct niobuf_local *res, struct obd_trans_info *oti,int rc)
+                    struct niobuf_local *res, struct obd_trans_info *oti,int ret)
 {
-        if (cmd == OBD_BRW_WRITE)
-                return filter_commitrw_write(exp, oa, objcount, obj, niocount,
-                                             res, oti, rc);
-        if (cmd == OBD_BRW_READ)
-                return filter_commitrw_read(exp, oa, objcount, obj, niocount,
-                                            res, oti, rc);
-        LBUG();
-        return -EPROTO;
+        int rc = -EPROTO;
+        struct lustre_id *id = obdo_id(oa);
+        __u32 len = sizeof(*id);
+        struct inode * inode = res->dentry->d_inode;
+        struct super_block * sb = res->dentry->d_sb;
+        struct obd_device *obd = class_exp2obd(exp);
+        
+        if (cmd == OBD_BRW_WRITE) {
+                rc = filter_commitrw_write(exp, oa, objcount, obj, niocount,
+                                           res, oti, ret);
+                fsfilt_set_info(obd, sb, inode, 10, "file_write", len, (void*)id);
+        }
+        else if (cmd == OBD_BRW_READ) {
+                rc = filter_commitrw_read(exp, oa, objcount, obj, niocount,
+                                          res, oti, ret);
+                fsfilt_set_info(obd, sb, inode, 9, "file_read", len, (void*)id);
+        }
+        else
+                LBUG();
+
+        return rc;
 }
 
 int filter_brw(int cmd, struct obd_export *exp, struct obdo *oa,
@@ -920,7 +939,7 @@ int filter_brw(int cmd, struct obd_export *exp, struct obdo *oa,
         obdo_to_ioobj(oa, &ioo);
         ioo.ioo_bufcnt = oa_bufs;
 
-        ret = filter_preprw(cmd, exp, oa, 1, &ioo, oa_bufs, rnb, lnb, oti);
+        ret = filter_preprw(cmd, exp, oa, 1, &ioo, oa_bufs, rnb, lnb, oti,NULL);
         if (ret != 0)
                 GOTO(out, ret);