Whamcloud - gitweb
LU-10994 clio: remove cl_page_export() and cl_page_is_vmlocked() 41/47241/5
authorJohn L. Hammond <jhammond@whamcloud.com>
Wed, 4 May 2022 21:03:34 +0000 (16:03 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 27 Jun 2022 04:49:39 +0000 (04:49 +0000)
Remove cl_page_export() and cl_page_is_vmlocked(), replacing them with
direct calls to PageSetUptodate() and PageLoecked().

Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: I883d1664f4afc7a1d4006f9f4833db8125c0e8f5
Reviewed-on: https://review.whamcloud.com/47241
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/cl_object.h
lustre/llite/file.c
lustre/llite/rw.c
lustre/llite/vvp_page.c
lustre/lov/lov_page.c
lustre/obdclass/cl_io.c
lustre/obdclass/cl_page.c
lustre/osc/osc_lock.c

index 8d89a32..37aca77 100644 (file)
@@ -871,25 +871,6 @@ struct cl_page_operations {
         void (*cpo_unassume)(const struct lu_env *env,
                              const struct cl_page_slice *slice,
                              struct cl_io *io);
-        /**
-         * Announces whether the page contains valid data or not by \a uptodate.
-         *
-         * \see cl_page_export()
-         * \see vvp_page_export()
-         */
-        void  (*cpo_export)(const struct lu_env *env,
-                            const struct cl_page_slice *slice, int uptodate);
-        /**
-         * Checks whether underlying VM page is locked (in the suitable
-         * sense). Used for assertions.
-         *
-         * \retval    -EBUSY: page is protected by a lock of a given mode;
-         * \retval  -ENODATA: page is not protected by a lock;
-         * \retval         0: this layer cannot decide. (Should never happen.)
-         */
-        int (*cpo_is_vmlocked)(const struct lu_env *env,
-                               const struct cl_page_slice *slice);
-
        /**
         * Update file attributes when all we have is this page.  Used for tiny
         * writes to update attributes when we don't have a full cl_io.
@@ -2326,12 +2307,8 @@ int  cl_page_flush      (const struct lu_env *env, struct cl_io *io,
 void    cl_page_discard(const struct lu_env *env, struct cl_io *io,
                        struct cl_page *pg);
 void    cl_page_delete(const struct lu_env *env, struct cl_page *pg);
-int     cl_page_is_vmlocked(const struct lu_env *env,
-                           const struct cl_page *pg);
 void   cl_page_touch(const struct lu_env *env, const struct cl_page *pg,
                      size_t to);
-void    cl_page_export(const struct lu_env *env,
-                      struct cl_page *pg, int uptodate);
 loff_t  cl_offset(const struct cl_object *obj, pgoff_t idx);
 pgoff_t cl_index(const struct cl_object *obj, loff_t offset);
 size_t  cl_page_size(const struct cl_object *obj);
index 783e708..bf2f49b 100644 (file)
@@ -594,7 +594,7 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req)
                        put_page(vmpage);
                        break;
                }
-               cl_page_export(env, page, 1);
+               SetPageUptodate(vmpage);
                cl_page_put(env, page);
                unlock_page(vmpage);
                put_page(vmpage);
index c195a9d..d707a93 100644 (file)
@@ -1663,7 +1663,7 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
        cl_2queue_init(queue);
        if (uptodate) {
                vpg->vpg_ra_used = 1;
-               cl_page_export(env, page, 1);
+               SetPageUptodate(page->cp_vmpage);
                cl_page_disown(env, io, page);
        } else {
                anchor = &vvp_env_info(env)->vti_anchor;
@@ -1904,7 +1904,7 @@ int ll_readpage(struct file *file, struct page *vmpage)
                /* export the page and skip io stack */
                if (result == 0) {
                        vpg->vpg_ra_used = 1;
-                       cl_page_export(env, page, 1);
+                       SetPageUptodate(vmpage);
                } else {
                        ll_ra_stats_inc_sbi(sbi, RA_STAT_FAILED_FAST_READ);
                }
index af4ff2e..f87aa0e 100644 (file)
@@ -176,26 +176,6 @@ static void vvp_page_delete(const struct lu_env *env,
         */
 }
 
-static void vvp_page_export(const struct lu_env *env,
-                           const struct cl_page_slice *slice,
-                           int uptodate)
-{
-       struct page *vmpage = cl2vm_page(slice);
-
-       LASSERT(vmpage != NULL);
-       LASSERT(PageLocked(vmpage));
-       if (uptodate)
-               SetPageUptodate(vmpage);
-       else
-               ClearPageUptodate(vmpage);
-}
-
-static int vvp_page_is_vmlocked(const struct lu_env *env,
-                               const struct cl_page_slice *slice)
-{
-       return PageLocked(cl2vm_page(slice)) ? -EBUSY : -ENODATA;
-}
-
 static int vvp_page_prep_read(const struct lu_env *env,
                              const struct cl_page_slice *slice,
                              struct cl_io *unused)
@@ -271,7 +251,7 @@ static void vvp_page_completion_read(const struct lu_env *env,
 
        if (ioret == 0)  {
                if (!vpg->vpg_defer_uptodate)
-                       cl_page_export(env, page, 1);
+                       SetPageUptodate(vmpage);
        } else if (vpg->vpg_defer_uptodate) {
                vpg->vpg_defer_uptodate = 0;
                if (ioret == -EAGAIN) {
@@ -401,8 +381,6 @@ static const struct cl_page_operations vvp_page_ops = {
        .cpo_disown        = vvp_page_disown,
        .cpo_discard       = vvp_page_discard,
        .cpo_delete        = vvp_page_delete,
-       .cpo_export        = vvp_page_export,
-       .cpo_is_vmlocked   = vvp_page_is_vmlocked,
        .cpo_fini          = vvp_page_fini,
        .cpo_print         = vvp_page_print,
        .io = {
@@ -431,15 +409,8 @@ static void vvp_transient_page_discard(const struct lu_env *env,
        cl_page_delete(env, page);
 }
 
-static int vvp_transient_page_is_vmlocked(const struct lu_env *env,
-                                         const struct cl_page_slice *slice)
-{
-       return -EBUSY;
-}
-
 static const struct cl_page_operations vvp_transient_page_ops = {
        .cpo_discard            = vvp_transient_page_discard,
-       .cpo_is_vmlocked        = vvp_transient_page_is_vmlocked,
        .cpo_print              = vvp_page_print,
 };
 
index 73d92e5..44031d2 100644 (file)
@@ -145,7 +145,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj,
        addr = kmap(page->cp_vmpage);
        memset(addr, 0, cl_page_size(obj));
        kunmap(page->cp_vmpage);
-       cl_page_export(env, page, 1);
+       SetPageUptodate(page->cp_vmpage);
        RETURN(0);
 }
 
index b7d4c1f..97dfda1 100644 (file)
@@ -875,7 +875,6 @@ void cl_page_list_del(const struct lu_env *env,
                      struct cl_page_list *plist, struct cl_page *page)
 {
        LASSERT(plist->pl_nr > 0);
-       LASSERT(cl_page_is_vmlocked(env, page));
 
        ENTRY;
        list_del_init(&page->cp_batch);
index b573e8d..7a646e0 100644 (file)
@@ -880,55 +880,6 @@ void cl_page_delete(const struct lu_env *env, struct cl_page *pg)
 }
 EXPORT_SYMBOL(cl_page_delete);
 
-/**
- * Marks page up-to-date.
- *
- * Call cl_page_operations::cpo_export() through all layers top-to-bottom. The
- * layer responsible for VM interaction has to mark/clear page as up-to-date
- * by the \a uptodate argument.
- *
- * \see cl_page_operations::cpo_export()
- */
-void cl_page_export(const struct lu_env *env, struct cl_page *cl_page,
-                   int uptodate)
-{
-       const struct cl_page_slice *slice;
-       int i;
-
-       PINVRNT(env, cl_page, cl_page_invariant(cl_page));
-
-       cl_page_slice_for_each(cl_page, slice, i) {
-               if (slice->cpl_ops->cpo_export != NULL)
-                       (*slice->cpl_ops->cpo_export)(env, slice, uptodate);
-       }
-}
-EXPORT_SYMBOL(cl_page_export);
-
-/**
- * Returns true, if \a page is VM locked in a suitable sense by the calling
- * thread.
- */
-int cl_page_is_vmlocked(const struct lu_env *env,
-                       const struct cl_page *cl_page)
-{
-        const struct cl_page_slice *slice;
-       int result;
-
-       ENTRY;
-       slice = cl_page_slice_get(cl_page, 0);
-       PASSERT(env, cl_page, slice->cpl_ops->cpo_is_vmlocked != NULL);
-        /*
-        * Call ->cpo_is_vmlocked() directly instead of going through
-         * CL_PAGE_INVOKE(), because cl_page_is_vmlocked() is used by
-         * cl_page_invariant().
-         */
-        result = slice->cpl_ops->cpo_is_vmlocked(env, slice);
-       PASSERT(env, cl_page, result == -EBUSY || result == -ENODATA);
-
-       RETURN(result == -EBUSY);
-}
-EXPORT_SYMBOL(cl_page_is_vmlocked);
-
 void cl_page_touch(const struct lu_env *env,
                   const struct cl_page *cl_page, size_t to)
 {
index dbf8cde..7230e8d 100644 (file)
@@ -645,7 +645,7 @@ static bool weigh_cb(const struct lu_env *env, struct cl_io *io,
                struct osc_page *ops = pvec[i];
                struct cl_page *page = ops->ops_cl.cpl_page;
 
-               if (cl_page_is_vmlocked(env, page) ||
+               if (PageLocked(page->cp_vmpage) ||
                    PageDirty(page->cp_vmpage) ||
                    PageWriteback(page->cp_vmpage))
                        return false;