Whamcloud - gitweb
LU-4604 lfsck: LFSCK async updates RPC flow control
[fs/lustre-release.git] / lustre / liblustre / llite_cl.c
index f906613..0d857fa 100644 (file)
@@ -17,7 +17,7 @@
  *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- *   Copyright (c) 2011, 2012, Intel Corporation.
+ *   Copyright (c) 2011, 2013, Intel Corporation.
  */
 
 #define DEBUG_SUBSYSTEM S_LLITE
@@ -57,9 +57,8 @@
 static int   slp_type_init     (struct lu_device_type *t);
 static void  slp_type_fini     (struct lu_device_type *t);
 
-static struct cl_page * slp_page_init(const struct lu_env *env,
-                                     struct cl_object *obj,
-                                     struct cl_page *page, cfs_page_t *vmpage);
+static int slp_page_init(const struct lu_env *env, struct cl_object *obj,
+                        struct cl_page *page, pgoff_t index);
 static int   slp_attr_get     (const struct lu_env *env, struct cl_object *obj,
                                struct cl_attr *attr);
 
@@ -224,32 +223,26 @@ void slp_global_fini(void)
  *
  */
 
-static struct cl_page *slp_page_init(const struct lu_env *env,
-                                     struct cl_object *obj,
-                                     struct cl_page *page, cfs_page_t *vmpage)
+static int slp_page_init(const struct lu_env *env, struct cl_object *obj,
+                       struct cl_page *page, pgoff_t index)
 {
-        struct ccc_page *cpg;
-        int result;
+       struct ccc_page *cpg = cl_object_page_slice(obj, page);
 
-        CLOBINVRNT(env, obj, ccc_object_invariant(obj));
+       CLOBINVRNT(env, obj, ccc_object_invariant(obj));
 
-        OBD_ALLOC_PTR(cpg);
-        if (cpg != NULL) {
-                cpg->cpg_page = vmpage;
+       cpg->cpg_page = page->cp_vmpage;
 
-                if (page->cp_type == CPT_CACHEABLE) {
-                        LBUG();
-                } else {
-                        struct ccc_object *clobj = cl2ccc(obj);
+       if (page->cp_type == CPT_CACHEABLE) {
+               LBUG();
+       } else {
+               struct ccc_object *clobj = cl2ccc(obj);
 
-                        cl_page_slice_add(page, &cpg->cpg_cl, obj,
-                                          &slp_transient_page_ops);
-                        clobj->cob_transient_pages++;
-                }
-                result = 0;
-        } else
-                result = -ENOMEM;
-        return ERR_PTR(result);
+               cl_page_slice_add(page, &cpg->cpg_cl, obj, index,
+                                 &slp_transient_page_ops);
+               clobj->cob_transient_pages++;
+       }
+
+       return 0;
 }
 
 static int slp_io_init(const struct lu_env *env, struct cl_object *obj,
@@ -301,7 +294,7 @@ static int slp_attr_get(const struct lu_env *env, struct cl_object *obj,
 
 static void slp_page_fini_common(struct ccc_page *cp)
 {
-        cfs_page_t *vmpage = cp->cpg_page;
+       struct page *vmpage = cp->cpg_page;
 
         LASSERT(vmpage != NULL);
         llu_free_user_page(vmpage);
@@ -366,10 +359,8 @@ static const struct cl_page_operations slp_transient_page_ops = {
         .cpo_unassume      = ccc_transient_page_unassume,
         .cpo_disown        = ccc_transient_page_disown,
         .cpo_discard       = ccc_transient_page_discard,
-        .cpo_vmpage        = ccc_page_vmpage,
         .cpo_is_vmlocked   = slp_page_is_vmlocked,
         .cpo_fini          = slp_transient_page_fini,
-        .cpo_is_under_lock = ccc_page_is_under_lock,
         .io = {
                 [CRT_READ] = {
                         .cpo_completion  = slp_page_completion_read,
@@ -504,8 +495,8 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io,
                 unsigned long index, offset, bytes;
 
                 offset = (pos & ~CFS_PAGE_MASK);
-                index = pos >> CFS_PAGE_SHIFT;
-                bytes = CFS_PAGE_SIZE - offset;
+               index = pos >> PAGE_CACHE_SHIFT;
+               bytes = PAGE_CACHE_SIZE - offset;
                 if (bytes > count)
                         bytes = count;
 
@@ -589,7 +580,8 @@ struct llu_io_group * get_io_group(struct inode *inode, int maxpages,
 
 static int max_io_pages(ssize_t len, int iovlen)
 {
-        return (((len + CFS_PAGE_SIZE -1) / CFS_PAGE_SIZE) + 2 + iovlen - 1);
+       return ((len + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE) +
+               2 + iovlen - 1;
 }
 
 void put_io_group(struct llu_io_group *group)
@@ -792,12 +784,7 @@ int cl_sb_fini(struct llu_sb_info *sbi)
                 sbi->ll_site = NULL;
         }
         cl_env_put(env, &refcheck);
-        /*
-         * If mount failed (sbi->ll_cl == NULL), and this there are no other
-         * mounts, stop device types manually (this usually happens
-         * automatically when last device is destroyed).
-         */
-        lu_types_stop();
-        cl_env_cache_purge(~0);
-        RETURN(0);
+       cl_env_cache_purge(~0);
+
+       RETURN(0);
 }