Whamcloud - gitweb
LU-12043 llite: switch to use ll_fsname directly 02/34602/11
authorWang Shilong <wshilong@ddn.com>
Fri, 5 Apr 2019 01:43:29 +0000 (09:43 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Apr 2019 03:36:55 +0000 (03:36 +0000)
There are many places which try to access filesystem
fsname, instead of parsing it everytime, just store
it into @sbi, we could use @ll_fsname directly whenever we need.

Change-Id: I25b8505b9aac5d4f6e97fe3691321be2b800f35d
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/34602
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
12 files changed:
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/lcommon_cl.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_nfs.c
lustre/llite/lproc_llite.c
lustre/llite/statahead.c
lustre/llite/symlink.c
lustre/llite/vvp_io.c
lustre/llite/xattr.c
lustre/llite/xattr26.c

index e282205..d04196e 100644 (file)
@@ -646,8 +646,8 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,
 
                buf = param;
                /* Get fsname and assume devname to be -MDT0000. */
-               ll_get_fsname(inode->i_sb, buf, MTI_NAME_MAXLEN);
-               strcat(buf, "-MDT0000.lov");
+               snprintf(buf, MGS_PARAM_MAXLEN, "%s-MDT0000.lov",
+                        sbi->ll_fsname);
                buf += strlen(buf);
 
                /* Set root stripesize */
@@ -1325,8 +1325,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                rc = ll_get_fid_by_name(inode, filename, namelen, NULL, NULL);
                if (rc < 0) {
                        CERROR("%s: lookup %.*s failed: rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0), namelen,
-                              filename, rc);
+                              sbi->ll_fsname, namelen, filename, rc);
                        GOTO(out_free, rc);
                }
 out_free:
index 33da782..4e063f5 100644 (file)
@@ -139,8 +139,7 @@ static int ll_close_inode_openhandle(struct inode *inode,
 
        if (class_exp2obd(md_exp) == NULL) {
                CERROR("%s: invalid MDC connection handle closing "DFID"\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
-                      PFID(&lli->lli_fid));
+                      ll_i2sbi(inode)->ll_fsname, PFID(&lli->lli_fid));
                GOTO(out, rc = 0);
        }
 
@@ -456,7 +455,7 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
         */
        if (rnb->rnb_offset + rnb->rnb_len < i_size_read(inode)) {
                CERROR("%s: server returns off/len %llu/%u < i_size %llu\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0), rnb->rnb_offset,
+                      ll_i2sbi(inode)->ll_fsname, rnb->rnb_offset,
                       rnb->rnb_len, i_size_read(inode));
                RETURN_EXIT;
        }
@@ -482,8 +481,8 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
                if (IS_ERR(vmpage)) {
                        CWARN("%s: cannot fill page %lu for "DFID
                              " with data: rc = %li\n",
-                             ll_get_fsname(inode->i_sb, NULL, 0),
-                             index + start, PFID(lu_object_fid(&obj->co_lu)),
+                             ll_i2sbi(inode)->ll_fsname, index + start,
+                             PFID(lu_object_fid(&obj->co_lu)),
                              PTR_ERR(vmpage));
                        break;
                }
@@ -1052,8 +1051,7 @@ out_close:
        rc2 = ll_close_inode_openhandle(inode, och, 0, NULL);
        if (rc2 < 0)
                CERROR("%s: error closing file "DFID": %d\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
-                      PFID(&ll_i2info(inode)->lli_fid), rc2);
+                      sbi->ll_fsname, PFID(&ll_i2info(inode)->lli_fid), rc2);
        och = NULL; /* och has been freed in ll_close_inode_openhandle() */
 out_release_it:
        ll_intent_release(&it);
@@ -1097,7 +1095,7 @@ static int ll_swap_layouts_close(struct obd_client_handle *och,
        ENTRY;
 
        CDEBUG(D_INODE, "%s: biased close of file "DFID"\n",
-              ll_get_fsname(inode->i_sb, NULL, 0), PFID(fid1));
+              ll_i2sbi(inode)->ll_fsname, PFID(fid1));
 
        rc = ll_check_swap_layouts_validity(inode, inode2);
        if (rc < 0)
@@ -2445,7 +2443,7 @@ int ll_hsm_release(struct inode *inode)
        ENTRY;
 
        CDEBUG(D_INODE, "%s: Releasing file "DFID".\n",
-              ll_get_fsname(inode->i_sb, NULL, 0),
+              ll_i2sbi(inode)->ll_fsname,
               PFID(&ll_i2info(inode)->lli_fid));
 
        och = ll_lease_open(inode, NULL, FMODE_WRITE, MDS_OPEN_RELEASE);
@@ -2853,6 +2851,7 @@ static const char *const ladvise_names[] = LU_LADVISE_NAMES;
 static int ll_ladvise_sanity(struct inode *inode,
                             struct llapi_lu_ladvise *ladvise)
 {
+       struct ll_sb_info *sbi = ll_i2sbi(inode);
        enum lu_ladvise_type advice = ladvise->lla_advice;
        /* Note the peradvice flags is a 32 bit field, so per advice flags must
         * be in the first 32 bits of enum ladvise_flags */
@@ -2864,7 +2863,7 @@ static int ll_ladvise_sanity(struct inode *inode,
                rc = -EINVAL;
                CDEBUG(D_VFSTRACE, "%s: advice with value '%d' not recognized,"
                       "last supported advice is %s (value '%d'): rc = %d\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0), advice,
+                      sbi->ll_fsname, advice,
                       ladvise_names[LU_LADVISE_MAX-1], LU_LADVISE_MAX-1, rc);
                GOTO(out, rc);
        }
@@ -2875,8 +2874,7 @@ static int ll_ladvise_sanity(struct inode *inode,
                if (flags & ~LF_LOCKNOEXPAND_MASK) {
                        rc = -EINVAL;
                        CDEBUG(D_VFSTRACE, "%s: Invalid flags (%x) for %s: "
-                              "rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0), flags,
+                              "rc = %d\n", sbi->ll_fsname, flags,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
                }
@@ -2887,8 +2885,7 @@ static int ll_ladvise_sanity(struct inode *inode,
                    ladvise->lla_lockahead_mode == 0) {
                        rc = -EINVAL;
                        CDEBUG(D_VFSTRACE, "%s: Invalid mode (%d) for %s: "
-                              "rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0),
+                              "rc = %d\n", sbi->ll_fsname,
                               ladvise->lla_lockahead_mode,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
@@ -2901,16 +2898,14 @@ static int ll_ladvise_sanity(struct inode *inode,
                if (flags & ~LF_DEFAULT_MASK) {
                        rc = -EINVAL;
                        CDEBUG(D_VFSTRACE, "%s: Invalid flags (%x) for %s: "
-                              "rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0), flags,
+                              "rc = %d\n", sbi->ll_fsname, flags,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
                }
                if (ladvise->lla_start >= ladvise->lla_end) {
                        rc = -EINVAL;
                        CDEBUG(D_VFSTRACE, "%s: Invalid range (%llu to %llu) "
-                              "for %s: rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0),
+                              "for %s: rc = %d\n", sbi->ll_fsname,
                               ladvise->lla_start, ladvise->lla_end,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
@@ -4201,8 +4196,7 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum,
                if (le32_to_cpu(lum->lum_stripe_count) > 1 ||
                    ll_i2info(child_inode)->lli_lsm_md) {
                        CERROR("%s: MDT doesn't support stripe directory "
-                              "migration!\n",
-                              ll_get_fsname(parent->i_sb, NULL, 0));
+                              "migration!\n", ll_i2sbi(parent)->ll_fsname);
                        GOTO(out_iput, rc = -EOPNOTSUPP);
                }
        }
@@ -4224,7 +4218,7 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum,
        op_data->op_fid3 = *ll_inode2fid(child_inode);
        if (!fid_is_sane(&op_data->op_fid3)) {
                CERROR("%s: migrate %s, but FID "DFID" is insane\n",
-                      ll_get_fsname(parent->i_sb, NULL, 0), name,
+                      ll_i2sbi(parent)->ll_fsname, name,
                       PFID(&op_data->op_fid3));
                GOTO(out_unlock, rc = -EINVAL);
        }
@@ -4399,7 +4393,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc)
        } else if (rc != 0) {
                CDEBUG_LIMIT((rc == -EACCES || rc == -EIDRM) ? D_INFO : D_ERROR,
                             "%s: revalidate FID "DFID" error: rc = %d\n",
-                            ll_get_fsname(inode->i_sb, NULL, 0),
+                            ll_i2sbi(inode)->ll_fsname,
                             PFID(ll_inode2fid(inode)), rc);
        }
 
@@ -5074,8 +5068,7 @@ out:
        /* wait for IO to complete if it's still being used. */
        if (wait_layout) {
                CDEBUG(D_INODE, "%s: "DFID"(%p) wait for layout reconf\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
-                      PFID(&lli->lli_fid), inode);
+                      sbi->ll_fsname, PFID(&lli->lli_fid), inode);
 
                memset(&conf, 0, sizeof conf);
                conf.coc_opc = OBJECT_CONF_WAIT;
@@ -5085,8 +5078,7 @@ out:
                        rc = -EAGAIN;
 
                CDEBUG(D_INODE, "%s file="DFID" waiting layout return: %d\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
-                      PFID(&lli->lli_fid), rc);
+                      sbi->ll_fsname, PFID(&lli->lli_fid), rc);
        }
        RETURN(rc);
 }
@@ -5124,8 +5116,7 @@ static int ll_layout_intent(struct inode *inode, struct layout_intent *intent)
                it.it_flags = FMODE_WRITE;
 
        LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file "DFID"(%p)",
-                         ll_get_fsname(inode->i_sb, NULL, 0),
-                         PFID(&lli->lli_fid), inode);
+                         sbi->ll_fsname, PFID(&lli->lli_fid), inode);
 
        rc = md_intent_lock(sbi->ll_md_exp, op_data, &it, &req,
                            &ll_md_blocking_ast, 0);
index 21a10ec..bc4c30a 100644 (file)
@@ -164,8 +164,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
                if (!(inode->i_state & I_NEW)) {
                        result = -EIO;
                        CERROR("%s: unexpected not-NEW inode "DFID": rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0), PFID(fid),
-                              result);
+                              ll_i2sbi(inode)->ll_fsname, PFID(fid), result);
                        goto out;
                }
 
@@ -192,7 +191,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
 
        if (result != 0)
                CERROR("%s: failed to initialize cl_object "DFID": rc = %d\n",
-                       ll_get_fsname(inode->i_sb, NULL, 0), PFID(fid), result);
+                      ll_i2sbi(inode)->ll_fsname, PFID(fid), result);
 
 out:
        cl_env_put(env, &refcheck);
index 168f16e..99c8ab3 100644 (file)
@@ -582,6 +582,9 @@ struct ll_sb_info {
        /* File heat */
        unsigned int              ll_heat_decay_weight;
        unsigned int              ll_heat_period_second;
+
+       /* filesystem fsname */
+       char                      ll_fsname[LUSTRE_MAXFSNAME + 1];
 };
 
 #define SBI_DEFAULT_HEAT_DECAY_WEIGHT  ((80 * 256 + 50) / 100)
@@ -998,7 +1001,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
                                      __u32 mode, __u32 opc, void *data);
 void ll_finish_md_op_data(struct md_op_data *op_data);
 int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg);
-char *ll_get_fsname(struct super_block *sb, char *buf, int buflen);
 void ll_compute_rootsquash_state(struct ll_sb_info *sbi);
 ssize_t ll_copy_user_md(const struct lov_user_md __user *md,
                        struct lov_user_md **kbuf);
index 456cb84..b3b35eb 100644 (file)
@@ -594,9 +594,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
        sb->s_root = d_make_root(root);
        if (sb->s_root == NULL) {
-               CERROR("%s: can't make root dentry\n",
-                       ll_get_fsname(sb, NULL, 0));
-               GOTO(out_root, err = -ENOMEM);
+               err = -ENOMEM;
+               CERROR("%s: can't make root dentry: rc = %d\n",
+                      sbi->ll_fsname, err);
+               GOTO(out_root, err);
        }
 #ifdef HAVE_DCACHE_LOCK
        sb->s_root->d_op = &ll_d_ops;
@@ -624,7 +625,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                        sbi->ll_dt_obd->obd_type->typ_name);
                if (err < 0) {
                        CERROR("%s: could not register %s in llite: rc = %d\n",
-                              dt, ll_get_fsname(sb, NULL, 0), err);
+                              dt, sbi->ll_fsname, err);
                        err = 0;
                }
        }
@@ -635,7 +636,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                        sbi->ll_md_obd->obd_type->typ_name);
                if (err < 0) {
                        CERROR("%s: could not register %s in llite: rc = %d\n",
-                              md, ll_get_fsname(sb, NULL, 0), err);
+                              md, sbi->ll_fsname, err);
                        err = 0;
                }
        }
@@ -1068,6 +1069,19 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
        if (ptr && (strcmp(ptr, "-client") == 0))
                len -= 7;
 
+       if (len > LUSTRE_MAXFSNAME) {
+               if (unlikely(len >= MAX_STRING_SIZE))
+                       len = MAX_STRING_SIZE - 1;
+               strncpy(name, profilenm, len);
+               name[len] = '\0';
+               err = -ENAMETOOLONG;
+               CERROR("%s: fsname longer than %u characters: rc = %d\n",
+                      name, LUSTRE_MAXFSNAME, err);
+               GOTO(out_free_cfg, err);
+       }
+       strncpy(sbi->ll_fsname, profilenm, len);
+       sbi->ll_fsname[len] = '\0';
+
        /* Mount info */
        snprintf(name, MAX_STRING_SIZE, "%.*s-%016lx", len,
                 profilenm, cfg_instance);
@@ -1078,7 +1092,7 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
        err = ll_debugfs_register_super(sb, name);
        if (err < 0) {
                CERROR("%s: could not register mountpoint in llite: rc = %d\n",
-                      ll_get_fsname(sb, NULL, 0), err);
+                      sbi->ll_fsname, err);
                err = 0;
        }
 
@@ -1286,7 +1300,7 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb,
        inode = iget_locked(sb, ino);
        if (inode == NULL) {
                CERROR("%s: failed get simple inode "DFID": rc = -ENOENT\n",
-                      ll_get_fsname(sb, NULL, 0), PFID(fid));
+                      sbi->ll_fsname, PFID(fid));
                RETURN(ERR_PTR(-ENOENT));
        }
 
@@ -1335,8 +1349,7 @@ static int ll_init_lsm_md(struct inode *inode, struct lustre_md *md)
        LASSERT(lsm != NULL);
 
        CDEBUG(D_INODE, "%s: "DFID" set dir layout:\n",
-               ll_get_fsname(inode->i_sb, NULL, 0),
-               PFID(&lli->lli_fid));
+              ll_i2sbi(inode)->ll_fsname, PFID(&lli->lli_fid));
        lsm_md_dump(D_INODE, lsm);
 
        /* XXX sigh, this lsm_root initialization should be in
@@ -1404,8 +1417,8 @@ static int ll_update_lsm_md(struct inode *inode, struct lustre_md *md)
                if (lsm->lsm_md_layout_version <=
                    lli->lli_lsm_md->lsm_md_layout_version) {
                        CERROR("%s: "DFID" dir layout mismatch:\n",
-                               ll_get_fsname(inode->i_sb, NULL, 0),
-                               PFID(&lli->lli_fid));
+                              ll_i2sbi(inode)->ll_fsname,
+                              PFID(&lli->lli_fid));
                        lsm_md_dump(D_ERROR, lli->lli_lsm_md);
                        lsm_md_dump(D_ERROR, lsm);
                        GOTO(unlock, rc = -EINVAL);
@@ -1611,7 +1624,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
 
        CDEBUG(D_VFSTRACE, "%s: setattr inode "DFID"(%p) from %llu to %llu, "
               "valid %x, hsm_import %d\n",
-              ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid),
+              ll_i2sbi(inode)->ll_fsname, PFID(&lli->lli_fid),
               inode, i_size_read(inode), attr->ia_size, attr->ia_valid,
               hsm_import);
 
@@ -2126,7 +2139,7 @@ void ll_delete_inode(struct inode *inode)
 
        LASSERTF(nrpages == 0, "%s: inode="DFID"(%p) nrpages=%lu, "
                 "see https://jira.whamcloud.com/browse/LU-118\n",
-                ll_get_fsname(inode->i_sb, NULL, 0),
+                ll_i2sbi(inode)->ll_fsname,
                 PFID(ll_inode2fid(inode)), inode, nrpages);
 
 #ifdef HAVE_SBOPS_EVICT_INODE
@@ -2355,8 +2368,7 @@ void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req)
        OBD_ALLOC_PTR(op_data);
        if (op_data == NULL) {
                CWARN("%s: cannot allocate op_data to release open handle for "
-                     DFID"\n",
-                     ll_get_fsname(sb, NULL, 0), PFID(&body->mbo_fid1));
+                     DFID"\n", ll_s2sbi(sb)->ll_fsname, PFID(&body->mbo_fid1));
 
                RETURN_EXIT;
        }
@@ -2399,7 +2411,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
                 */
                if (!fid_is_sane(&md.body->mbo_fid1)) {
                        CERROR("%s: Fid is insane "DFID"\n",
-                               ll_get_fsname(sb, NULL, 0),
+                               sbi->ll_fsname,
                                PFID(&md.body->mbo_fid1));
                        GOTO(out, rc = -EINVAL);
                }
@@ -2671,39 +2683,6 @@ int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg)
        RETURN(0);
 }
 
-/**
- * Get lustre file system name by \a sbi. If \a buf is provided(non-NULL), the
- * fsname will be returned in this buffer; otherwise, a static buffer will be
- * used to store the fsname and returned to caller.
- */
-char *ll_get_fsname(struct super_block *sb, char *buf, int buflen)
-{
-       static char fsname_static[MTI_NAME_MAXLEN];
-       struct lustre_sb_info *lsi = s2lsi(sb);
-       char *ptr;
-       int len;
-
-       if (buf == NULL) {
-               /* this means the caller wants to use static buffer
-                * and it doesn't care about race. Usually this is
-                * in error reporting path */
-               buf = fsname_static;
-               buflen = sizeof(fsname_static);
-       }
-
-       len = strlen(lsi->lsi_lmd->lmd_profile);
-       ptr = strrchr(lsi->lsi_lmd->lmd_profile, '-');
-       if (ptr && (strcmp(ptr, "-client") == 0))
-               len -= 7;
-
-       if (unlikely(len >= buflen))
-               len = buflen - 1;
-       strncpy(buf, lsi->lsi_lmd->lmd_profile, len);
-       buf[len] = '\0';
-
-       return buf;
-}
-
 static char* ll_d_path(struct dentry *dentry, char *buf, int bufsize)
 {
        char *path = NULL;
@@ -2734,7 +2713,7 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret)
 
        CDEBUG(D_WARNING,
               "%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted "
-              "(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0),
+              "(rc %d)\n", ll_i2sbi(inode)->ll_fsname,
               s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev,
               PFID(ll_inode2fid(inode)),
               (path && !IS_ERR(path)) ? path : "", ioret);
index cf24560..d291cfa 100644 (file)
@@ -199,7 +199,7 @@ static int ll_encode_fh(struct inode *inode, u32 *fh, int *plen,
        ENTRY;
 
        CDEBUG(D_INFO, "%s: encoding for ("DFID") maxlen=%d minlen=%d\n",
-              ll_get_fsname(inode->i_sb, NULL, 0),
+              ll_i2sbi(inode)->ll_fsname,
               PFID(ll_inode2fid(inode)), *plen, fileid_len);
 
        if (*plen < fileid_len) {
@@ -329,8 +329,7 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid)
        sbi = ll_s2sbi(dir->i_sb);
 
        CDEBUG(D_INFO, "%s: getting parent for ("DFID")\n",
-              ll_get_fsname(dir->i_sb, NULL, 0),
-              PFID(ll_inode2fid(dir)));
+              sbi->ll_fsname, PFID(ll_inode2fid(dir)));
 
        rc = ll_get_default_mdsize(sbi, &lmmsize);
        if (rc != 0)
@@ -346,8 +345,7 @@ int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid)
        ll_finish_md_op_data(op_data);
        if (rc != 0) {
                CERROR("%s: failure inode "DFID" get parent: rc = %d\n",
-                      ll_get_fsname(dir->i_sb, NULL, 0),
-                      PFID(ll_inode2fid(dir)), rc);
+                      sbi->ll_fsname, PFID(ll_inode2fid(dir)), rc);
                RETURN(rc);
        }
        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
index 631b43e..c177569 100644 (file)
@@ -356,7 +356,7 @@ ll_max_readahead_mb_seq_write(struct file *file, const char __user *buffer,
        if (pages_number < 0 || pages_number > totalram_pages / 2) {
                /* 1/2 of RAM */
                CERROR("%s: can't set max_readahead_mb=%lu > %luMB\n",
-                      ll_get_fsname(sb, NULL, 0),
+                      sbi->ll_fsname,
                       (unsigned long)pages_number >> (20 - PAGE_SHIFT),
                       totalram_pages >> (20 - PAGE_SHIFT + 1));
                return -ERANGE;
@@ -405,7 +405,7 @@ ll_max_readahead_per_file_mb_seq_write(struct file *file,
 
        if (pages_number < 0 || pages_number > sbi->ll_ra_info.ra_max_pages) {
                CERROR("%s: can't set max_readahead_per_file_mb=%lu > "
-                      "max_read_ahead_mb=%lu\n", ll_get_fsname(sb, NULL, 0),
+                      "max_read_ahead_mb=%lu\n", sbi->ll_fsname,
                       (unsigned long)pages_number >> (20 - PAGE_SHIFT),
                       sbi->ll_ra_info.ra_max_pages >> (20 - PAGE_SHIFT));
                return -ERANGE;
@@ -459,7 +459,7 @@ ll_max_read_ahead_whole_mb_seq_write(struct file *file,
                int pages_shift = 20 - PAGE_SHIFT;
                CERROR("%s: can't set max_read_ahead_whole_mb=%lu > "
                       "max_read_ahead_per_file_mb=%lu\n",
-                      ll_get_fsname(sb, NULL, 0),
+                      sbi->ll_fsname,
                       (unsigned long)pages_number >> pages_shift,
                       sbi->ll_ra_info.ra_max_pages_per_file >> pages_shift);
                return -ERANGE;
@@ -532,7 +532,7 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,
 
        if (pages_number < 0 || pages_number > totalram_pages) {
                CERROR("%s: can't set max cache more than %lu MB\n",
-                      ll_get_fsname(sb, NULL, 0),
+                      sbi->ll_fsname,
                       totalram_pages >> (20 - PAGE_SHIFT));
                RETURN(-ERANGE);
        }
@@ -979,7 +979,7 @@ static int ll_sbi_flags_seq_show(struct seq_file *m, void *v)
        while (flags != 0) {
                if (ARRAY_SIZE(str) <= i) {
                        CERROR("%s: Revise array LL_SBI_FLAGS to match sbi "
-                               "flags please.\n", ll_get_fsname(sb, NULL, 0));
+                               "flags please.\n", ll_s2sbi(sb)->ll_fsname);
                        return -EINVAL;
                }
 
@@ -1273,8 +1273,7 @@ static ssize_t ll_root_squash_seq_write(struct file *file,
        struct ll_sb_info *sbi = ll_s2sbi(sb);
        struct root_squash_info *squash = &sbi->ll_squash;
 
-       return lprocfs_wr_root_squash(buffer, count, squash,
-                                     ll_get_fsname(sb, NULL, 0));
+       return lprocfs_wr_root_squash(buffer, count, squash, sbi->ll_fsname);
 }
 
 LDEBUGFS_SEQ_FOPS(ll_root_squash);
@@ -1310,8 +1309,7 @@ static ssize_t ll_nosquash_nids_seq_write(struct file *file,
        struct root_squash_info *squash = &sbi->ll_squash;
        int rc;
 
-       rc = lprocfs_wr_nosquash_nids(buffer, count, squash,
-                                     ll_get_fsname(sb, NULL, 0));
+       rc = lprocfs_wr_nosquash_nids(buffer, count, squash, sbi->ll_fsname);
        if (rc < 0)
                return rc;
 
index 5c7dbb5..5379440 100644 (file)
@@ -667,9 +667,8 @@ static void sa_instantiate(struct ll_statahead_info *sai,
                GOTO(out, rc);
 
        CDEBUG(D_READA, "%s: setting %.*s"DFID" l_data to inode %p\n",
-              ll_get_fsname(child->i_sb, NULL, 0),
-              entry->se_qstr.len, entry->se_qstr.name,
-              PFID(ll_inode2fid(child)), child);
+              ll_i2sbi(dir)->ll_fsname, entry->se_qstr.len,
+              entry->se_qstr.name, PFID(ll_inode2fid(child)), child);
        ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, child, it, NULL);
 
        entry->se_inode = child;
@@ -1319,7 +1318,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry)
                        rc = PTR_ERR(page);
                        CERROR("%s: reading dir "DFID" at %llu"
                               "opendir_pid = %u : rc = %d\n",
-                              ll_get_fsname(dir->i_sb, NULL, 0),
+                              ll_i2sbi(dir)->ll_fsname,
                               PFID(ll_inode2fid(dir)), pos,
                               lli->lli_opendir_pid, rc);
                        break;
@@ -1517,8 +1516,7 @@ static int revalidate_statahead_dentry(struct inode *dir,
                                        "%s: stale dentry %.*s inode "
                                        DFID", statahead inode "DFID
                                        "\n",
-                                       ll_get_fsname((*dentryp)->d_inode->i_sb,
-                                                     NULL, 0),
+                                       ll_i2sbi(inode)->ll_fsname,
                                        (*dentryp)->d_name.len,
                                        (*dentryp)->d_name.name,
                                        PFID(ll_inode2fid((*dentryp)->d_inode)),
index 5216c9b..5d660b1 100644 (file)
@@ -77,7 +77,7 @@ static int ll_readlink_internal(struct inode *inode,
        if (rc) {
                if (rc != -ENOENT)
                        CERROR("%s: inode "DFID": rc = %d\n",
-                              ll_get_fsname(inode->i_sb, NULL, 0),
+                              ll_i2sbi(inode)->ll_fsname,
                               PFID(ll_inode2fid(inode)), rc);
                GOTO(failed, rc);
        }
@@ -92,9 +92,8 @@ static int ll_readlink_internal(struct inode *inode,
        LASSERT(symlen != 0);
        if (body->mbo_eadatasize != symlen) {
                CERROR("%s: inode "DFID": symlink length %d not expected %d\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
-                      PFID(ll_inode2fid(inode)), body->mbo_eadatasize - 1,
-                      symlen - 1);
+                      sbi->ll_fsname, PFID(ll_inode2fid(inode)),
+                      body->mbo_eadatasize - 1, symlen - 1);
                 GOTO(failed, rc = -EPROTO);
        }
 
@@ -102,7 +101,7 @@ static int ll_readlink_internal(struct inode *inode,
        if (!*symname || strnlen(*symname, symlen) != symlen - 1) {
                /* not full/NULL terminated */
                CERROR("%s: inode "DFID": symlink not NULL terminated string"
-                      "of length %d\n", ll_get_fsname(inode->i_sb, NULL, 0),
+                      "of length %d\n", sbi->ll_fsname,
                       PFID(ll_inode2fid(inode)), symlen - 1);
                GOTO(failed, rc = -EPROTO);
        }
index 212ac9d..39b308e 100644 (file)
@@ -1066,7 +1066,7 @@ static int vvp_io_write_start(const struct lu_env *env,
        if (pos + cnt > ll_file_maxbytes(inode)) {
                CDEBUG(D_INODE,
                       "%s: file %s ("DFID") offset %llu > maxbytes %llu\n",
-                      ll_get_fsname(inode->i_sb, NULL, 0),
+                      ll_i2sbi(inode)->ll_fsname,
                       file_dentry(file)->d_name.name,
                       PFID(ll_inode2fid(inode)), pos + cnt,
                       ll_file_maxbytes(inode));
@@ -1500,8 +1500,8 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
                        result = 0;
                if (result < 0)
                        CERROR("%s: refresh file layout " DFID " error %d.\n",
-                               ll_get_fsname(inode->i_sb, NULL, 0),
-                               PFID(lu_object_fid(&obj->co_lu)), result);
+                              ll_i2sbi(inode)->ll_fsname,
+                              PFID(lu_object_fid(&obj->co_lu)), result);
        }
 
        io->ci_result = result < 0 ? result : 0;
index 97f9725..3958dd6 100644 (file)
@@ -395,8 +395,8 @@ getxattr_nocache:
 out_xattr:
        if (rc == -EOPNOTSUPP && type == XATTR_USER_T) {
                LCONSOLE_INFO("%s: disabling user_xattr feature because "
-                               "it is not supported on the server: rc = %d\n",
-                               ll_get_fsname(inode->i_sb, NULL, 0), rc);
+                             "it is not supported on the server: rc = %d\n",
+                             sbi->ll_fsname, rc);
                sbi->ll_flags &= ~LL_SBI_USER_XATTR;
        }
 out:
index 28772dd..917ea3f 100644 (file)
@@ -430,8 +430,8 @@ getxattr_nocache:
 out_xattr:
        if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) {
                LCONSOLE_INFO("%s: disabling user_xattr feature because "
-                               "it is not supported on the server: rc = %d\n",
-                               ll_get_fsname(inode->i_sb, NULL, 0), rc);
+                             "it is not supported on the server: rc = %d\n",
+                             ll_i2sbi(inode)->ll_fsname, rc);
                sbi->ll_flags &= ~LL_SBI_USER_XATTR;
        }
 out: