Whamcloud - gitweb
LU-5814 llite: remove lli_has_smd 90/13690/9
authorJinshan Xiong <jinshan.xiong@intel.com>
Fri, 27 Mar 2015 03:07:12 +0000 (20:07 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 10 Apr 2015 18:52:27 +0000 (18:52 +0000)
Remove the lli_has_smd flag from struct ll_inode_info. The empty
layout case will be handled by the LOV layer. Remove the unused
function cl_local_size().

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I50b73482fdc4c415f8d800e9a848099117be8f74
Reviewed-on: http://review.whamcloud.com/13690
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c
lustre/llite/glimpse.c
lustre/llite/lcommon_cl.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/rw26.c
lustre/lov/lov_io.c

index b7d5689..6653783 100644 (file)
@@ -653,12 +653,6 @@ restart:
 
         ll_capa_open(inode);
 
-       if (!lli->lli_has_smd &&
-           (cl_is_lov_delay_create(file->f_flags) ||
-            (file->f_mode & FMODE_WRITE) == 0)) {
-               CDEBUG(D_INODE, "object creation was delayed\n");
-               GOTO(out_och_free, rc);
-       }
        cl_lov_delay_create_clear(&file->f_flags);
        GOTO(out_och_free, rc);
 
@@ -3589,7 +3583,6 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf)
                       PFID(&lli->lli_fid), ll_layout_version_get(lli),
                       cl.cl_layout_gen);
                ll_layout_version_set(lli, cl.cl_layout_gen);
-               lli->lli_has_smd = lsm_has_objects(conf->u.coc_md->lsm);
        }
 
 out:
index e0c1b71..d374c81 100644 (file)
@@ -85,68 +85,62 @@ blkcnt_t dirty_cnt(struct inode *inode)
 int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
                    struct inode *inode, struct cl_object *clob, int agl)
 {
-       struct ll_inode_info *lli   = ll_i2info(inode);
-        const struct lu_fid  *fid   = lu_object_fid(&clob->co_lu);
-        int result;
+       const struct lu_fid *fid = lu_object_fid(&clob->co_lu);
+       struct cl_lock *lock = vvp_env_lock(env);
+       struct cl_lock_descr *descr = &lock->cll_descr;
+       int result;
 
-        ENTRY;
-        result = 0;
+       ENTRY;
+       result = 0;
 
        CDEBUG(D_DLMTRACE, "Glimpsing inode "DFID"\n", PFID(fid));
-       if (lli->lli_has_smd) {
-               struct cl_lock *lock = vvp_env_lock(env);
-               struct cl_lock_descr *descr = &lock->cll_descr;
-
-               /* NOTE: this looks like DLM lock request, but it may
-                *       not be one. Due to CEF_ASYNC flag (translated
-                *       to LDLM_FL_HAS_INTENT by osc), this is
-                *       glimpse request, that won't revoke any
-                *       conflicting DLM locks held. Instead,
-                *       ll_glimpse_callback() will be called on each
-                *       client holding a DLM lock against this file,
-                *       and resulting size will be returned for each
-                *       stripe. DLM lock on [0, EOF] is acquired only
-                *       if there were no conflicting locks. If there
-                *       were conflicting locks, enqueuing or waiting
-                *       fails with -ENAVAIL, but valid inode
-                *       attributes are returned anyway. */
-               *descr = whole_file;
-               descr->cld_obj = clob;
-               descr->cld_mode = CLM_READ;
-               descr->cld_enq_flags = CEF_ASYNC | CEF_MUST;
-               if (agl)
-                       descr->cld_enq_flags |= CEF_AGL;
-               /*
-                * CEF_ASYNC is used because glimpse sub-locks cannot
-                * deadlock (because they never conflict with other
-                * locks) and, hence, can be enqueued out-of-order.
-                *
-                * CEF_MUST protects glimpse lock from conversion into
-                * a lockless mode.
-                */
-               result = cl_lock_request(env, io, lock);
-               if (result < 0)
-                       RETURN(result);
 
-               if (!agl) {
-                       ll_merge_attr(env, inode);
-                       if (i_size_read(inode) > 0 && inode->i_blocks == 0) {
-                               /*
-                                * LU-417: Add dirty pages block count
-                                * lest i_blocks reports 0, some "cp" or
-                                * "tar" may think it's a completely
-                                * sparse file and skip it.
-                                */
-                               inode->i_blocks = dirty_cnt(inode);
-                       }
-               }
-
-               cl_lock_release(env, lock);
-       } else {
-               CDEBUG(D_DLMTRACE, "No objects for inode\n");
+       /* NOTE: this looks like DLM lock request, but it may
+        *       not be one. Due to CEF_ASYNC flag (translated
+        *       to LDLM_FL_HAS_INTENT by osc), this is
+        *       glimpse request, that won't revoke any
+        *       conflicting DLM locks held. Instead,
+        *       ll_glimpse_callback() will be called on each
+        *       client holding a DLM lock against this file,
+        *       and resulting size will be returned for each
+        *       stripe. DLM lock on [0, EOF] is acquired only
+        *       if there were no conflicting locks. If there
+        *       were conflicting locks, enqueuing or waiting
+        *       fails with -ENAVAIL, but valid inode
+        *       attributes are returned anyway. */
+       *descr = whole_file;
+       descr->cld_obj = clob;
+       descr->cld_mode = CLM_READ;
+       descr->cld_enq_flags = CEF_ASYNC | CEF_MUST;
+       if (agl)
+               descr->cld_enq_flags |= CEF_AGL;
+       /*
+        * CEF_ASYNC is used because glimpse sub-locks cannot
+        * deadlock (because they never conflict with other
+        * locks) and, hence, can be enqueued out-of-order.
+        *
+        * CEF_MUST protects glimpse lock from conversion into
+        * a lockless mode.
+        */
+       result = cl_lock_request(env, io, lock);
+       if (result < 0)
+               RETURN(result);
+
+       if (!agl) {
                ll_merge_attr(env, inode);
+               if (i_size_read(inode) > 0 && inode->i_blocks == 0) {
+                       /*
+                        * LU-417: Add dirty pages block count
+                        * lest i_blocks reports 0, some "cp" or
+                        * "tar" may think it's a completely
+                        * sparse file and skip it.
+                        */
+                       inode->i_blocks = dirty_cnt(inode);
+               }
        }
 
+       cl_lock_release(env, lock);
+
        RETURN(result);
 }
 
@@ -216,42 +210,3 @@ int cl_glimpse_size0(struct inode *inode, int agl)
        }
        RETURN(result);
 }
-
-int cl_local_size(struct inode *inode)
-{
-        struct lu_env           *env = NULL;
-        struct cl_io            *io  = NULL;
-        struct cl_object        *clob;
-        int                      result;
-        int                      refcheck;
-
-        ENTRY;
-
-       if (!ll_i2info(inode)->lli_has_smd)
-                RETURN(0);
-
-        result = cl_io_get(inode, &env, &io, &refcheck);
-        if (result <= 0)
-                RETURN(result);
-
-        clob = io->ci_obj;
-        result = cl_io_init(env, io, CIT_MISC, clob);
-        if (result > 0)
-                result = io->ci_result;
-       else if (result == 0) {
-               struct cl_lock *lock = vvp_env_lock(env);
-
-               lock->cll_descr = whole_file;
-               lock->cll_descr.cld_enq_flags = CEF_PEEK;
-               lock->cll_descr.cld_obj = clob;
-               result = cl_lock_request(env, io, lock);
-               if (result == 0) {
-                       ll_merge_attr(env, inode);
-                       cl_lock_release(env, lock);
-               }
-       }
-       cl_io_fini(env, io);
-       cl_env_put(env, &refcheck);
-       RETURN(result);
-}
-
index 53b5d4e..32a51ea 100644 (file)
@@ -176,7 +176,6 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
                          * locked by I_NEW bit.
                          */
                         lli->lli_clob = clob;
-                       lli->lli_has_smd = lsm_has_objects(md->lsm);
                         lu_object_ref_add(&clob->co_lu, "inode", inode);
                 } else
                         result = PTR_ERR(clob);
index 36be655..2048730 100644 (file)
@@ -253,7 +253,6 @@ struct ll_inode_info {
          *      In the future, if more members are added only for directory,
          *      some of the following members can be moved into u.f.
          */
-       bool                            lli_has_smd;
        struct cl_object                *lli_clob;
 
        /* mutex to request for layout lock exclusively. */
@@ -1516,7 +1515,6 @@ extern int cl_inode_fini_refcheck;
 
 int cl_file_inode_init(struct inode *inode, struct lustre_md *md);
 void cl_inode_fini(struct inode *inode);
-int cl_local_size(struct inode *inode);
 
 u64 cl_fid_build_ino(const struct lu_fid *fid, int api32);
 u32 cl_fid_build_gen(const struct lu_fid *fid);
index 4e7cf0c..1497b3a 100644 (file)
@@ -964,7 +964,6 @@ void ll_lli_init(struct ll_inode_info *lli)
         lli->lli_open_fd_exec_count = 0;
        mutex_init(&lli->lli_och_mutex);
        spin_lock_init(&lli->lli_agl_lock);
-       lli->lli_has_smd = false;
        spin_lock_init(&lli->lli_layout_lock);
        ll_layout_version_set(lli, CL_LAYOUT_GEN_NONE);
        lli->lli_clob = NULL;
@@ -1477,7 +1476,6 @@ void ll_clear_inode(struct inode *inode)
         * cl_object still uses inode lsm.
         */
        cl_inode_fini(inode);
-       lli->lli_has_smd = false;
 
        EXIT;
 }
@@ -1890,9 +1888,7 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)
 
        LASSERT((lsm != NULL) == ((body->mbo_valid & OBD_MD_FLEASIZE) != 0));
        if (lsm != NULL) {
-               if (!lli->lli_has_smd &&
-                   !(sbi->ll_flags & LL_SBI_LAYOUT_LOCK))
-                       cl_file_inode_init(inode, md);
+               cl_file_inode_init(inode, md);
 
                lli->lli_maxbytes = lsm->lsm_maxbytes;
                if (lli->lli_maxbytes > MAX_LFS_FILESIZE)
@@ -2026,8 +2022,6 @@ int ll_read_inode2(struct inode *inode, void *opaque)
         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
                PFID(&lli->lli_fid), inode);
 
-       LASSERT(!lli->lli_has_smd);
-
         /* Core attributes from the MDS first.  This is a new inode, and
          * the VFS doesn't zero times in the core inode so we have to do
          * it ourselves.  They will be overwritten by either MDS or OST
index 7ae14df..6bfb256 100644 (file)
@@ -378,15 +378,11 @@ static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb,
         struct inode *inode = file->f_mapping->host;
         long count = iov_length(iov, nr_segs);
         long tot_bytes = 0, result = 0;
-        struct ll_inode_info *lli = ll_i2info(inode);
         unsigned long seg = 0;
         long size = MAX_DIO_SIZE;
         int refcheck;
         ENTRY;
 
-       if (!lli->lli_has_smd)
-                RETURN(-EBADF);
-
         /* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */
         if ((file_offset & ~CFS_PAGE_MASK) || (count & ~CFS_PAGE_MASK))
                 RETURN(-EINVAL);
index b8edb13..4582529 100644 (file)
@@ -909,6 +909,13 @@ static void lov_empty_io_fini(const struct lu_env *env,
        EXIT;
 }
 
+static int lov_empty_io_submit(const struct lu_env *env,
+                              const struct cl_io_slice *ios,
+                              enum cl_req_type crt, struct cl_2queue *queue)
+{
+       return -EBADF;
+}
+
 static void lov_empty_impossible(const struct lu_env *env,
                                  struct cl_io_slice *ios)
 {
@@ -959,7 +966,7 @@ static const struct cl_io_operations lov_empty_io_ops = {
                        .cio_fini      = lov_empty_io_fini
                }
        },
-       .cio_submit                    = LOV_EMPTY_IMPOSSIBLE,
+       .cio_submit                    = lov_empty_io_submit,
        .cio_commit_async              = LOV_EMPTY_IMPOSSIBLE
 };