Whamcloud - gitweb
LU-5473 tests: print space usage in sanity test_51b
[fs/lustre-release.git] / lustre / llite / vvp_object.c
index 9ee04b7..4150f74 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-#ifndef __KERNEL__
-# error This file is kernel only.
-#endif
 
 #include <libcfs/libcfs.h>
 
 #include <obd.h>
-#include <lustre_lite.h>
-
 #include "vvp_internal.h"
 
 /*****************************************************************************
@@ -66,7 +61,8 @@ static int vvp_object_print(const struct lu_env *env, void *cookie,
 
        (*p)(env, cookie, "(%s %d %d) inode: %p ",
             list_empty(&obj->cob_pending_list) ? "-" : "+",
-            obj->cob_transient_pages, atomic_read(&obj->cob_mmap_cnt),
+            atomic_read(&obj->cob_transient_pages),
+            atomic_read(&obj->cob_mmap_cnt),
             inode);
        if (inode) {
                lli = ll_i2info(inode);
@@ -123,8 +119,8 @@ static int vvp_attr_set(const struct lu_env *env, struct cl_object *obj,
        return 0;
 }
 
-int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,
-               const struct cl_object_conf *conf)
+static int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,
+                       const struct cl_object_conf *conf)
 {
        struct ll_inode_info *lli = ll_i2info(conf->coc_inode);
 
@@ -144,26 +140,6 @@ int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,
                 * a price themselves. */
                unmap_mapping_range(conf->coc_inode->i_mapping,
                                    0, OBD_OBJECT_EOF, 0);
-
-               return 0;
-       }
-
-       if (conf->coc_opc != OBJECT_CONF_SET)
-               return 0;
-
-       if (conf->u.coc_md != NULL && conf->u.coc_md->lsm != NULL) {
-               CDEBUG(D_VFSTRACE, DFID ": layout version change: %u -> %u\n",
-                      PFID(&lli->lli_fid), lli->lli_layout_gen,
-                      conf->u.coc_md->lsm->lsm_layout_gen);
-
-               lli->lli_has_smd = lsm_has_objects(conf->u.coc_md->lsm);
-               ll_layout_version_set(lli, conf->u.coc_md->lsm->lsm_layout_gen);
-       } else {
-               CDEBUG(D_VFSTRACE, DFID ": layout nuked: %u.\n",
-                      PFID(&lli->lli_fid), lli->lli_layout_gen);
-
-               lli->lli_has_smd = false;
-               ll_layout_version_set(lli, LL_LAYOUT_GEN_EMPTY);
        }
        return 0;
 }
@@ -174,11 +150,15 @@ static int vvp_prune(const struct lu_env *env, struct cl_object *obj)
        int rc;
        ENTRY;
 
-       rc = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, CL_FSYNC_ALL, 1);
-       if (rc == 0)
-               truncate_inode_pages(inode->i_mapping, 0);
+       rc = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, CL_FSYNC_LOCAL, 1);
+       if (rc < 0) {
+               CDEBUG(D_VFSTRACE, DFID ": writeback failed: %d\n",
+                      PFID(lu_object_fid(&obj->co_lu)), rc);
+               RETURN(rc);
+       }
 
-       RETURN(rc);
+       truncate_inode_pages(inode->i_mapping, 0);
+       RETURN(0);
 }
 
 static const struct cl_object_operations vvp_ops = {