Whamcloud - gitweb
LU-5587 lustre: require HAVE_SERVER_SUPPORT in md_object.h
[fs/lustre-release.git] / lustre / osc / osc_io.c
index 0070308..61bc1a1 100644 (file)
@@ -321,8 +321,8 @@ static int osc_io_rw_iter_init(const struct lu_env *env,
        struct osc_object *osc = cl2osc(ios->cis_obj);
        struct client_obd *cli = osc_cli(osc);
        unsigned long c;
-       unsigned int npages;
-       unsigned int max_pages;
+       unsigned long npages;
+       unsigned long max_pages;
        ENTRY;
 
        if (cl_io_is_append(io))
@@ -336,15 +336,15 @@ static int osc_io_rw_iter_init(const struct lu_env *env,
        if (npages > max_pages)
                npages = max_pages;
 
-       c = atomic_read(cli->cl_lru_left);
+       c = atomic_long_read(cli->cl_lru_left);
        if (c < npages && osc_lru_reclaim(cli) > 0)
-               c = atomic_read(cli->cl_lru_left);
+               c = atomic_long_read(cli->cl_lru_left);
        while (c >= npages) {
-               if (c == atomic_cmpxchg(cli->cl_lru_left, c, c - npages)) {
+               if (c == atomic_long_cmpxchg(cli->cl_lru_left, c, c - npages)) {
                        oio->oi_lru_reserved = npages;
                        break;
                }
-               c = atomic_read(cli->cl_lru_left);
+               c = atomic_long_read(cli->cl_lru_left);
        }
 
        RETURN(0);
@@ -358,7 +358,7 @@ static void osc_io_rw_iter_fini(const struct lu_env *env,
        struct client_obd *cli = osc_cli(osc);
 
        if (oio->oi_lru_reserved > 0) {
-               atomic_add(oio->oi_lru_reserved, cli->cl_lru_left);
+               atomic_long_add(oio->oi_lru_reserved, cli->cl_lru_left);
                oio->oi_lru_reserved = 0;
        }
 }
@@ -395,7 +395,6 @@ static int osc_async_upcall(void *a, int rc)
         return 0;
 }
 
-#if defined(__KERNEL__)
 /**
  * Checks that there are no pages being written in the extent being truncated.
  */
@@ -412,11 +411,9 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io,
                CL_PAGE_DEBUG(D_ERROR, env, page, "exists " LPU64 "/%s.\n",
                                start, current->comm);
 
-#ifdef __linux__
        if (PageLocked(page->cp_vmpage))
                CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n",
                       ops, osc_index(ops), oap->oap_cmd & OBD_BRW_RWMASK);
-#endif
 
        return CLP_GANG_OKAY;
 }
@@ -439,13 +436,6 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
                                start + partial, CL_PAGE_EOF,
                                trunc_check_cb, (void *)&size);
 }
-#else /* __KERNEL__ */
-static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
-                           struct osc_io *oio, __u64 size)
-{
-       return;
-}
-#endif
 
 static int osc_io_setattr_start(const struct lu_env *env,
                                 const struct cl_io_slice *slice)
@@ -542,10 +532,8 @@ static void osc_io_setattr_end(const struct lu_env *env,
         int result = 0;
 
        if (cbargs->opc_rpc_sent) {
-               result = wait_for_completion_killable(&cbargs->opc_sync);
-               if (result == 0)
-                       result = cbargs->opc_rc;
-               io->ci_result = result;
+               wait_for_completion(&cbargs->opc_sync);
+               result = io->ci_result = cbargs->opc_rc;
        }
         if (result == 0) {
                 if (oio->oi_lockless) {
@@ -690,7 +678,7 @@ static void osc_io_fsync_end(const struct lu_env *env,
                struct osc_io           *oio    = cl2osc_io(env, slice);
                struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
 
-               result = wait_for_completion_killable(&cbargs->opc_sync);
+               wait_for_completion(&cbargs->opc_sync);
                if (result == 0)
                        result = cbargs->opc_rc;
        }