In the OSD debug message, we originally used the code similar as
"LDISKFS_SB(osd_sb(osd))>s_es>s_volume_name" to get the ldiskfs
backend name information. That is inefficient, it can be replaced
by the "osd_sb(osd)->s_id" or "inode->i_sb->s_id".
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I077452796065cc924e9ca3b9cfaec4b1a2a4bebe
Reviewed-on: https://review.whamcloud.com/27177
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre_loa_swab(loa, true);
/* Check LMA compatibility */
if (lma->lma_incompat & ~LMA_INCOMPAT_SUPP) {
lustre_loa_swab(loa, true);
/* Check LMA compatibility */
if (lma->lma_incompat & ~LMA_INCOMPAT_SUPP) {
- CWARN("%.16s: unsupported incompat LMA feature(s) %#x "
+ CWARN("%s: unsupported incompat LMA feature(s) %#x "
"for fid = "DFID", ino = %lu\n",
"for fid = "DFID", ino = %lu\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name,
lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
PFID(&lma->lma_self_fid), inode->i_ino);
rc = -EOPNOTSUPP;
lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
PFID(&lma->lma_self_fid), inode->i_ino);
rc = -EOPNOTSUPP;
iput(inode);
inode = ERR_PTR(-ESTALE);
} else if (is_bad_inode(inode)) {
iput(inode);
inode = ERR_PTR(-ESTALE);
} else if (is_bad_inode(inode)) {
- CWARN("%.16s: bad inode: ino = %u\n",
- LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name, id->oii_ino);
+ CWARN("%s: bad inode: ino = %u\n",
+ osd_dev2name(dev), id->oii_ino);
iput(inode);
inode = ERR_PTR(-ENOENT);
} else if ((rc = osd_attach_jinode(inode))) {
iput(inode);
inode = ERR_PTR(-ENOENT);
} else if ((rc = osd_attach_jinode(inode))) {
- CDEBUG(D_LFSCK, "%.16s: fail to check LMV EA, inode = %lu/%u,"
- DFID": rc = %d\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name,
+ CDEBUG(D_LFSCK, "%s: fail to check LMV EA, inode = %lu/%u,"
+ DFID": rc = %d\n", osd_ino2name(inode),
inode->i_ino, inode->i_generation,
PFID(&oic->oic_fid), rc);
else
inode->i_ino, inode->i_generation,
PFID(&oic->oic_fid), rc);
else
join:
rc1 = osd_scrub_start(dev, flags);
join:
rc1 = osd_scrub_start(dev, flags);
- LCONSOLE_WARN("%.16s: trigger OI scrub by RPC "
+ LCONSOLE_WARN("%s: trigger OI scrub by RPC "
"for the "DFID" with flags 0x%x,"
" rc = %d\n", osd_name(dev),
PFID(fid), flags, rc1);
"for the "DFID" with flags 0x%x,"
" rc = %d\n", osd_name(dev),
PFID(fid), flags, rc1);
rc = osd_scrub_start(dev, SS_AUTO_PARTIAL | SS_CLEAR_DRYRUN |
SS_CLEAR_FAILOUT);
CDEBUG(D_LFSCK | D_CONSOLE | D_WARNING,
rc = osd_scrub_start(dev, SS_AUTO_PARTIAL | SS_CLEAR_DRYRUN |
SS_CLEAR_FAILOUT);
CDEBUG(D_LFSCK | D_CONSOLE | D_WARNING,
- "%.16s: trigger partial OI scrub for RPC inconsistency "
+ "%s: trigger partial OI scrub for RPC inconsistency "
"checking FID "DFID": rc = %d\n",
"checking FID "DFID": rc = %d\n",
- LDISKFS_SB(osd_sb(dev))->s_es->s_volume_name,
- PFID(fid), rc);
+ osd_dev2name(dev), PFID(fid), rc);
if (rc == 0 || rc == -EALREADY)
goto again;
}
if (rc == 0 || rc == -EALREADY)
goto again;
}
/* It is too bad, we cannot reinsert the name entry back.
* That means we lose it! */
if (rc != 0)
/* It is too bad, we cannot reinsert the name entry back.
* That means we lose it! */
if (rc != 0)
- CDEBUG(D_LFSCK, "%.16s: fail to reinsert the dirent, "
+ CDEBUG(D_LFSCK, "%s: fail to reinsert the dirent, "
"dir = %lu/%u, name = %.*s, "DFID": rc = %d\n",
"dir = %lu/%u, name = %.*s, "DFID": rc = %d\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name,
dir->i_ino, dir->i_generation, namelen,
dentry->d_name.name, PFID(fid), rc);
dir->i_ino, dir->i_generation, namelen,
dentry->d_name.name, PFID(fid), rc);
bh = __ldiskfs_bread(NULL, inode, blk, 0);
if (IS_ERR_OR_NULL(bh)) {
bh = __ldiskfs_bread(NULL, inode, blk, 0);
if (IS_ERR_OR_NULL(bh)) {
- CERROR("%.16s: cannot load idle blocks, blk = %u, err = %ld\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name, blk,
- bh ? PTR_ERR(bh) : -EIO);
+ CERROR("%s: cannot load idle blocks, blk = %u, err = %ld\n",
+ osd_ino2name(inode), blk, bh ? PTR_ERR(bh) : -EIO);
c->ic_idle_failed = 1;
if (bh == NULL)
bh = ERR_PTR(-EIO);
c->ic_idle_failed = 1;
if (bh == NULL)
bh = ERR_PTR(-EIO);
head = (struct iam_idle_head *)(bh->b_data);
if (le16_to_cpu(head->iih_magic) != IAM_IDLE_HEADER_MAGIC) {
head = (struct iam_idle_head *)(bh->b_data);
if (le16_to_cpu(head->iih_magic) != IAM_IDLE_HEADER_MAGIC) {
- CERROR("%.16s: invalid idle block head, blk = %u, magic = %d\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name, blk,
- le16_to_cpu(head->iih_magic));
+ CERROR("%s: invalid idle block head, blk = %u, magic = %d\n",
+ osd_ino2name(inode), blk, le16_to_cpu(head->iih_magic));
brelse(bh);
c->ic_idle_failed = 1;
return ERR_PTR(-EBADF);
brelse(bh);
c->ic_idle_failed = 1;
return ERR_PTR(-EBADF);
lh = iam_lock_htree(c, frame->curidx, DLT_WRITE);
if (lh == NULL) {
lh = iam_lock_htree(c, frame->curidx, DLT_WRITE);
if (lh == NULL) {
- CWARN("%.16s: No memory to recycle idle blocks\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name);
+ CWARN("%s: No memory to recycle idle blocks\n",
+ osd_ino2name(inode));
unlock:
mutex_unlock(&c->ic_idle_mutex);
if (rc != 0)
unlock:
mutex_unlock(&c->ic_idle_mutex);
if (rc != 0)
- CWARN("%.16s: idle blocks failed, will lose the blk %u\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name, blk);
+ CWARN("%s: idle blocks failed, will lose the blk %u\n",
+ osd_ino2name(inode), blk);
return dev->od_mnt->mnt_sb;
}
return dev->od_mnt->mnt_sb;
}
+static inline const char *osd_dev2name(const struct osd_device *dev)
+{
+ return osd_sb(dev)->s_id;
+}
+
+static inline const char *osd_ino2name(const struct inode *inode)
+{
+ return inode->i_sb->s_id;
+}
+
/**
* Put the osd object once done with it.
*
/**
* Put the osd object once done with it.
*
csize = min(blocksize - boffs, size);
bh = __ldiskfs_bread(NULL, inode, block, 0);
if (IS_ERR(bh)) {
csize = min(blocksize - boffs, size);
bh = __ldiskfs_bread(NULL, inode, block, 0);
if (IS_ERR(bh)) {
- CERROR("%s: can't read %u@%llu on ino %lu: rc = %ld\n",
- LDISKFS_SB(inode->i_sb)->s_es->s_volume_name,
+ CERROR("%s: can't read %u@%llu on ino %lu: "
+ "rc = %ld\n", osd_ino2name(inode),
csize, *offs, inode->i_ino,
PTR_ERR(bh));
return PTR_ERR(bh);
csize, *offs, inode->i_ino,
PTR_ERR(bh));
return PTR_ERR(bh);
- CERROR("%.16s: can't open %s: rc = %d\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name, name, rc);
+ CERROR("%s: can't open %s: rc = %d\n",
+ osd_dev2name(osd), name, rc);
- CERROR("%.16s: expect to open total %d OI files.\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name,
- oi_count);
+ CERROR("%s: expect to open total %d OI files.\n",
+ osd_dev2name(osd), oi_count);
OSD_OI_NAME_BASE, i);
rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
if (rc != 0) {
OSD_OI_NAME_BASE, i);
rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
if (rc != 0) {
- CERROR("%.16s: fail to remove the stale OI file %s: "
- "rc = %d\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name,
- name, rc);
+ CERROR("%s: fail to remove the stale OI file %s: "
+ "rc = %d\n", osd_dev2name(osd), name, rc);
namelen = snprintf(name, sizeof(name), "%s", OSD_OI_NAME_BASE);
rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
if (rc != 0)
namelen = snprintf(name, sizeof(name), "%s", OSD_OI_NAME_BASE);
rc = osd_remove_oi_one(osd_sb(osd)->s_root, name, namelen);
if (rc != 0)
- CERROR("%.16s: fail to remove the stale OI file %s: rc = %d\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name, name, rc);
+ CERROR("%s: fail to remove the stale OI file %s: rc = %d\n",
+ osd_dev2name(osd), name, rc);
SF_UPGRADE);
GOTO(out, rc = 1);
} else if (rc != -ENOENT) {
SF_UPGRADE);
GOTO(out, rc = 1);
} else if (rc != -ENOENT) {
- CERROR("%.16s: can't open %s: rc = %d\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name,
- OSD_OI_NAME_BASE, rc);
+ CERROR("%s: can't open %s: rc = %d\n",
+ osd_dev2name(osd), OSD_OI_NAME_BASE, rc);
if (!(lma->lma_compat & LMAC_NOT_IN_OI) &&
lu_fid_eq(fid, &lma->lma_self_fid)) {
if (!(lma->lma_compat & LMAC_NOT_IN_OI) &&
lu_fid_eq(fid, &lma->lma_self_fid)) {
- CERROR("%.16s: the FID "DFID" is used by two objects: "
- "%u/%u %u/%u\n",
- LDISKFS_SB(osd_sb(osd))->s_es->s_volume_name,
+ CERROR("%s: the FID "DFID" is used by two objects: "
+ "%u/%u %u/%u\n", osd_dev2name(osd),
PFID(fid), oi_id->oii_ino, oi_id->oii_gen,
id->oii_ino, id->oii_gen);
return -EEXIST;
PFID(fid), oi_id->oii_ino, oi_id->oii_gen,
id->oii_ino, id->oii_gen);
return -EEXIST;
static inline const char *osd_scrub2name(struct osd_scrub *scrub)
{
static inline const char *osd_scrub2name(struct osd_scrub *scrub)
{
- return LDISKFS_SB(osd_scrub2sb(scrub))->s_es->s_volume_name;
+ return osd_dev2name(osd_scrub2dev(scrub));
{
struct scrub_file *sf = &scrub->os_file;
{
struct scrub_file *sf = &scrub->os_file;
- CDEBUG(D_LFSCK, "%.16s: reset OI scrub file, old flags = "
+ CDEBUG(D_LFSCK, "%s: reset OI scrub file, old flags = "
"%#llx, add flags = %#llx\n",
osd_scrub2name(scrub), sf->sf_flags, flags);
"%#llx, add flags = %#llx\n",
osd_scrub2name(scrub), sf->sf_flags, flags);
osd_scrub_file_to_cpu(sf, &scrub->os_file_disk);
if (sf->sf_magic != SCRUB_MAGIC_V1) {
osd_scrub_file_to_cpu(sf, &scrub->os_file_disk);
if (sf->sf_magic != SCRUB_MAGIC_V1) {
- CDEBUG(D_LFSCK, "%.16s: invalid scrub magic "
+ CDEBUG(D_LFSCK, "%s: invalid scrub magic "
"0x%x != 0x%x\n", osd_scrub2name(scrub),
sf->sf_magic, SCRUB_MAGIC_V1);
/* Process it as new scrub file. */
"0x%x != 0x%x\n", osd_scrub2name(scrub),
sf->sf_magic, SCRUB_MAGIC_V1);
/* Process it as new scrub file. */
rc = 0;
}
} else if (rc != 0) {
rc = 0;
}
} else if (rc != 0) {
- CDEBUG(D_LFSCK, "%.16s: fail to load scrub file, "
+ CDEBUG(D_LFSCK, "%s: fail to load scrub file, "
"expected = %d: rc = %d\n",
osd_scrub2name(scrub), len, rc);
if (rc > 0)
"expected = %d: rc = %d\n",
osd_scrub2name(scrub), len, rc);
if (rc > 0)
jh = osd_journal_start_sb(osd_sb(dev), LDISKFS_HT_MISC, credits);
if (IS_ERR(jh)) {
rc = PTR_ERR(jh);
jh = osd_journal_start_sb(osd_sb(dev), LDISKFS_HT_MISC, credits);
if (IS_ERR(jh)) {
rc = PTR_ERR(jh);
- CDEBUG(D_LFSCK, "%.16s: fail to start trans for scrub store: "
+ CDEBUG(D_LFSCK, "%s: fail to start trans for scrub store: "
"rc = %d\n", osd_scrub2name(scrub), rc);
return rc;
}
"rc = %d\n", osd_scrub2name(scrub), rc);
return rc;
}
len, 0, &pos, jh);
ldiskfs_journal_stop(jh);
if (rc != 0)
len, 0, &pos, jh);
ldiskfs_journal_stop(jh);
if (rc != 0)
- CDEBUG(D_LFSCK, "%.16s: fail to store scrub file, "
+ CDEBUG(D_LFSCK, "%s: fail to store scrub file, "
"expected = %d: rc = %d\n",
osd_scrub2name(scrub), len, rc);
"expected = %d: rc = %d\n",
osd_scrub2name(scrub), len, rc);
bool drop_dryrun = false;
ENTRY;
bool drop_dryrun = false;
ENTRY;
- CDEBUG(D_LFSCK, "%.16s: OI scrub prep, flags = 0x%x\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub prep, flags = 0x%x\n",
osd_scrub2name(scrub), flags);
down_write(&scrub->os_rwsem);
osd_scrub2name(scrub), flags);
down_write(&scrub->os_rwsem);
- CDEBUG(D_LFSCK, "%.16s: OI scrub post, result = %d\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub post, result = %d\n",
osd_scrub2name(scrub), result);
down_write(&scrub->os_rwsem);
osd_scrub2name(scrub), result);
down_write(&scrub->os_rwsem);
if (rc == -ENOENT || rc == -ESTALE)
RETURN(SCRUB_NEXT_CONTINUE);
if (rc == -ENOENT || rc == -ESTALE)
RETURN(SCRUB_NEXT_CONTINUE);
- CDEBUG(D_LFSCK, "%.16s: fail to read inode, ino# = %u: "
- "rc = %d\n", LDISKFS_SB(sb)->s_es->s_volume_name,
- pos, rc);
+ CDEBUG(D_LFSCK, "%s: fail to read inode, ino# = %u: "
+ "rc = %d\n", osd_dev2name(dev), pos, rc);
rc = osd_scrub_checkpoint(scrub);
if (rc != 0) {
rc = osd_scrub_checkpoint(scrub);
if (rc != 0) {
- CDEBUG(D_LFSCK, "%.16s: fail to checkpoint, pos = %u: "
+ CDEBUG(D_LFSCK, "%s: fail to checkpoint, pos = %u: "
"rc = %d\n", osd_scrub2name(scrub),
scrub->os_pos_current, rc);
/* Continue, as long as the scrub itself can go ahead. */
"rc = %d\n", osd_scrub2name(scrub),
scrub->os_pos_current, rc);
/* Continue, as long as the scrub itself can go ahead. */
sf->sf_pos_last_checkpoint = sf->sf_pos_latest_start - 1;
rc = osd_scrub_file_store(scrub);
if (rc != 0)
sf->sf_pos_last_checkpoint = sf->sf_pos_latest_start - 1;
rc = osd_scrub_file_store(scrub);
if (rc != 0)
- CDEBUG(D_LFSCK, "%.16s: fail to store scrub file when join "
+ CDEBUG(D_LFSCK, "%s: fail to store scrub file when join "
"the OI scrub: rc = %d\n", osd_scrub2name(scrub), rc);
spin_lock(&scrub->os_lock);
"the OI scrub: rc = %d\n", osd_scrub2name(scrub), rc);
spin_lock(&scrub->os_lock);
param.bitmap = ldiskfs_read_inode_bitmap(param.sb, param.bg);
if (!param.bitmap) {
param.bitmap = ldiskfs_read_inode_bitmap(param.sb, param.bg);
if (!param.bitmap) {
- CERROR("%.16s: fail to read bitmap for %u, "
+ CERROR("%s: fail to read bitmap for %u, "
"scrub will stop, urgent mode\n",
osd_scrub2name(scrub), (__u32)param.bg);
RETURN(-EIO);
"scrub will stop, urgent mode\n",
osd_scrub2name(scrub), (__u32)param.bg);
RETURN(-EIO);
rc = lu_env_init(&env, LCT_LOCAL);
if (rc != 0) {
rc = lu_env_init(&env, LCT_LOCAL);
if (rc != 0) {
- CDEBUG(D_LFSCK, "%.16s: OI scrub fail to init env: rc = %d\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub fail to init env: rc = %d\n",
osd_scrub2name(scrub), rc);
GOTO(noenv, rc);
}
rc = osd_scrub_prep(dev);
if (rc != 0) {
osd_scrub2name(scrub), rc);
GOTO(noenv, rc);
}
rc = osd_scrub_prep(dev);
if (rc != 0) {
- CDEBUG(D_LFSCK, "%.16s: OI scrub fail to scrub prep: rc = %d\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub fail to scrub prep: rc = %d\n",
osd_scrub2name(scrub), rc);
GOTO(out, rc);
}
osd_scrub2name(scrub), rc);
GOTO(out, rc);
}
scrub->os_pos_current = ooc->ooc_pos_preload;
}
scrub->os_pos_current = ooc->ooc_pos_preload;
}
- CDEBUG(D_LFSCK, "%.16s: OI scrub start, flags = 0x%x, pos = %u\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub start, flags = 0x%x, pos = %u\n",
osd_scrub2name(scrub), scrub->os_start_flags,
scrub->os_pos_current);
osd_scrub2name(scrub), scrub->os_start_flags,
scrub->os_pos_current);
post:
rc = osd_scrub_post(scrub, rc);
post:
rc = osd_scrub_post(scrub, rc);
- CDEBUG(D_LFSCK, "%.16s: OI scrub: stop, pos = %u: rc = %d\n",
+ CDEBUG(D_LFSCK, "%s: OI scrub: stop, pos = %u: rc = %d\n",
osd_scrub2name(scrub), scrub->os_pos_current, rc);
out:
osd_scrub2name(scrub), scrub->os_pos_current, rc);
out:
task = kthread_run(osd_scrub_main, dev, "OI_scrub");
if (IS_ERR(task)) {
rc = PTR_ERR(task);
task = kthread_run(osd_scrub_main, dev, "OI_scrub");
if (IS_ERR(task)) {
rc = PTR_ERR(task);
- CERROR("%.16s: cannot start iteration thread: rc = %d\n",
+ CERROR("%s: cannot start iteration thread: rc = %d\n",
osd_scrub2name(scrub), rc);
RETURN(rc);
}
osd_scrub2name(scrub), rc);
RETURN(rc);
}
OBD_ALLOC_PTR(old_uuid);
OBD_ALLOC_PTR(new_uuid);
if (old_uuid == NULL || new_uuid == NULL) {
OBD_ALLOC_PTR(old_uuid);
OBD_ALLOC_PTR(new_uuid);
if (old_uuid == NULL || new_uuid == NULL) {
- CERROR("%.16s: UUID has been changed, but"
+ CERROR("%s: UUID has been changed, but"
"failed to allocate RAM for report\n",
"failed to allocate RAM for report\n",
- LDISKFS_SB(sb)->s_es->s_volume_name);
} else {
class_uuid_unparse(sf->sf_uuid, old_uuid);
class_uuid_unparse(es->s_uuid, new_uuid);
} else {
class_uuid_unparse(sf->sf_uuid, old_uuid);
class_uuid_unparse(es->s_uuid, new_uuid);
- CERROR("%.16s: UUID has been changed from "
- "%s to %s\n",
- LDISKFS_SB(sb)->s_es->s_volume_name,
+ CERROR("%s: UUID has been changed from "
+ "%s to %s\n", osd_dev2name(dev),
old_uuid->uuid, new_uuid->uuid);
}
osd_scrub_file_reset(scrub, es->s_uuid,SF_INCONSISTENT);
old_uuid->uuid, new_uuid->uuid);
}
osd_scrub_file_reset(scrub, es->s_uuid,SF_INCONSISTENT);