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 */
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:
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);
}
*/
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;
}
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;
}
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);
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)
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);
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 */
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);
}
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);
}
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);
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);
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);
}
}
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);
}
} 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);
}
/* 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;
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);
}
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);
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;
}
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);
/* 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)
__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);
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;
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;
}
}
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;
}
}
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);
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;
}
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));
}
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
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);
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);
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
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;
}
*/
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);
}
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;
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);
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) {
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)
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);
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;
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;
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;
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);
}
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;
}
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);
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;
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;
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;
"%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)),
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);
}
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);
}
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);
}
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));
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;
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:
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: