Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-6050 target: control OST-index in IDIF via ROCOMPAT flag
[fs/lustre-release.git]
/
lustre
/
osd-ldiskfs
/
osd_scrub.c
diff --git
a/lustre/osd-ldiskfs/osd_scrub.c
b/lustre/osd-ldiskfs/osd_scrub.c
index
c95046d
..
a92db02
100644
(file)
--- a/
lustre/osd-ldiskfs/osd_scrub.c
+++ b/
lustre/osd-ldiskfs/osd_scrub.c
@@
-370,6
+370,7
@@
osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
{
struct filter_fid_old *ff = &info->oti_ff;
struct dentry *dentry = &info->oti_obj_dentry;
+ struct lu_fid *tfid = &info->oti_fid;
handle_t *jh;
int size = 0;
int rc;
@@
-380,6
+381,15
@@
osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
if (dev->od_scrub.os_file.sf_param & SP_DRYRUN)
RETURN(0);
+ if (fid_is_idif(fid) && dev->od_index_in_idif == 0) {
+ struct ost_id *oi = &info->oti_ostid;
+
+ fid_to_ostid(fid, oi);
+ ostid_to_fid(tfid, oi, 0);
+ } else {
+ *tfid = *fid;
+ }
+
/* We want the LMA to fit into the 256-byte OST inode, so operate
* as following:
* 1) read old XATTR_NAME_FID and save the parent FID;
@@
-395,7
+405,7
@@
osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
if (IS_ERR(jh)) {
rc = PTR_ERR(jh);
CDEBUG(D_LFSCK, "%s: fail to start trans for convert ff "
- DFID": rc = %d\n", osd_name(dev), PFID(fid), rc);
+ DFID": rc = %d\n", osd_name(dev), PFID(
t
fid), rc);
RETURN(rc);
}
@@
-416,7
+426,7
@@
osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
}
/* 3) make new LMA and add it */
- rc = osd_ea_fid_set(info, inode, fid, LMAC_FID_ON_OST, 0);
+ rc = osd_ea_fid_set(info, inode,
t
fid, LMAC_FID_ON_OST, 0);
if (rc == 0 && reset)
size = sizeof(struct filter_fid);
else if (rc != 0 && removed)
@@
-439,7
+449,7
@@
stop:
ldiskfs_journal_stop(jh);
if (rc < 0)
CDEBUG(D_LFSCK, "%s: fail to convert ff "DFID": rc = %d\n",
- osd_name(dev), PFID(fid), rc);
+ osd_name(dev), PFID(
t
fid), rc);
return rc;
}
@@
-582,9
+592,6
@@
iget:
sf->sf_items_updated_prior++;
else
sf->sf_items_updated++;
-
- /* The target has been changed, need to be re-loaded. */
- lu_object_purge(info->oti_env, osd2lu_dev(dev), fid);
}
GOTO(out, rc);
@@
-975,10
+982,11
@@
static int osd_scrub_next(struct osd_thread_info *info, struct osd_device *dev,
struct l_wait_info lwi;
lwi = LWI_TIMEOUT(cfs_time_seconds(cfs_fail_val), NULL, NULL);
- l_wait_event(thread->t_ctl_waitq,
- !list_empty(&scrub->os_inconsistent_items) ||
- !thread_is_running(thread),
- &lwi);
+ if (likely(lwi.lwi_timeout > 0))
+ l_wait_event(thread->t_ctl_waitq,
+ !list_empty(&scrub->os_inconsistent_items) ||
+ !thread_is_running(thread),
+ &lwi);
}
if (OBD_FAIL_CHECK(OBD_FAIL_OSD_SCRUB_CRASH)) {
@@
-1536,6
+1544,7
@@
struct osd_lf_map {
char *olm_name;
struct lu_fid olm_fid;
__u16 olm_flags;
+ __u16 olm_namelen;
scandir_t olm_scandir;
filldir_t olm_filldir;
};
@@
-1544,107
+1553,125
@@
struct osd_lf_map {
static const struct osd_lf_map osd_lf_maps[] = {
/* CATALOGS */
{ CATLIST, { FID_SEQ_LOCAL_FILE, LLOG_CATALOGS_OID, 0 }, OLF_SHOW_NAME,
- NULL, NULL },
+
sizeof(CATLIST) - 1,
NULL, NULL },
/* CONFIGS */
{ MOUNT_CONFIGS_DIR, { FID_SEQ_LOCAL_FILE, MGS_CONFIGS_OID, 0 },
- OLF_SCAN_SUBITEMS,
osd_ios_general_scan
,
- osd_ios_varfid_fill },
+ OLF_SCAN_SUBITEMS,
sizeof(MOUNT_CONFIGS_DIR) - 1
,
+ osd_ios_
general_scan, osd_ios_
varfid_fill },
/* NIDTBL_VERSIONS */
{ MGS_NIDTBL_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
- osd_ios_general_scan, osd_ios_varfid_fill },
+ sizeof(MGS_NIDTBL_DIR) - 1, osd_ios_general_scan,
+ osd_ios_varfid_fill },
/* PENDING */
- { "PENDING", { 0, 0, 0 }, 0, NULL, NULL },
+ { "PENDING", { 0, 0, 0 }, 0,
sizeof("PENDING") - 1,
NULL, NULL },
/* ROOT */
- { "ROOT", { FID_SEQ_ROOT, 1, 0 },
- OLF_SCAN_SUBITEMS | OLF_HIDE_FID, osd_ios_ROOT_scan, NULL },
+ { "ROOT", { FID_SEQ_ROOT, FID_OID_ROOT, 0 },
+ OLF_SCAN_SUBITEMS | OLF_HIDE_FID, sizeof("ROOT") - 1,
+ osd_ios_ROOT_scan, NULL },
/* changelog_catalog */
- { CHANGELOG_CATALOG, { 0, 0, 0 }, 0, NULL, NULL },
+ { CHANGELOG_CATALOG, { 0, 0, 0 }, 0, sizeof(CHANGELOG_CATALOG) - 1,
+ NULL, NULL },
/* changelog_users */
- { CHANGELOG_USERS, { 0, 0, 0 }, 0, NULL, NULL },
+ { CHANGELOG_USERS, { 0, 0, 0 }, 0, sizeof(CHANGELOG_USERS) - 1,
+ NULL, NULL },
/* fld */
{ "fld", { FID_SEQ_LOCAL_FILE, FLD_INDEX_OID, 0 }, OLF_SHOW_NAME,
- NULL, NULL },
+
sizeof("fld") - 1,
NULL, NULL },
/* last_rcvd */
{ LAST_RCVD, { FID_SEQ_LOCAL_FILE, LAST_RECV_OID, 0 }, OLF_SHOW_NAME,
- NULL, NULL },
-
- /* lfsck_bookmark */
- { "lfsck_bookmark", { 0, 0, 0 }, 0, NULL, NULL },
+ sizeof(LAST_RCVD) - 1, NULL, NULL },
/* lov_objid */
{ LOV_OBJID, { FID_SEQ_LOCAL_FILE, MDD_LOV_OBJ_OID, 0 }, OLF_SHOW_NAME,
- NULL, NULL },
+
sizeof(LOV_OBJID) - 1,
NULL, NULL },
/* lov_objseq */
{ LOV_OBJSEQ, { FID_SEQ_LOCAL_FILE, MDD_LOV_OBJ_OSEQ, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME,
sizeof(LOV_OBJSEQ) - 1,
NULL, NULL },
/* quota_master */
- { QMT_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
+ { QMT_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
sizeof(QMT_DIR) - 1,
osd_ios_general_scan, osd_ios_varfid_fill },
/* quota_slave */
- { QSD_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
+ { QSD_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
sizeof(QSD_DIR) - 1,
osd_ios_general_scan, osd_ios_varfid_fill },
/* seq_ctl */
{ "seq_ctl", { FID_SEQ_LOCAL_FILE, FID_SEQ_CTL_OID, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME,
sizeof("seq_ctl") - 1,
NULL, NULL },
/* seq_srv */
{ "seq_srv", { FID_SEQ_LOCAL_FILE, FID_SEQ_SRV_OID, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME,
sizeof("seq_srv") - 1,
NULL, NULL },
/* health_check */
{ HEALTH_CHECK, { FID_SEQ_LOCAL_FILE, OFD_HEALTH_CHECK_OID, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME, sizeof(HEALTH_CHECK) - 1, NULL, NULL },
+
+ /* LFSCK */
+ { LFSCK_DIR, { 0, 0, 0 }, 0, sizeof(LFSCK_DIR) - 1,
+ osd_ios_general_scan, osd_ios_varfid_fill },
+
+ /* lfsck_bookmark */
+ { LFSCK_BOOKMARK, { 0, 0, 0 }, 0, sizeof(LFSCK_BOOKMARK) - 1,
+ NULL, NULL },
+
+ /* lfsck_layout */
+ { LFSCK_LAYOUT, { 0, 0, 0 }, 0, sizeof(LFSCK_LAYOUT) - 1,
+ NULL, NULL },
/* lfsck_namespace */
- { "lfsck_namespace", { 0, 0, 0 }, 0, NULL, NULL },
+ { LFSCK_NAMESPACE, { 0, 0, 0 }, 0, sizeof(LFSCK_NAMESPACE) - 1,
+ NULL, NULL },
/* OBJECTS, upgrade from old device */
- { OBJECTS, { 0, 0, 0 }, OLF_SCAN_SUBITEMS, osd_ios_OBJECTS_scan, NULL },
+ { OBJECTS, { 0, 0, 0 }, OLF_SCAN_SUBITEMS, sizeof(OBJECTS) - 1,
+ osd_ios_OBJECTS_scan, NULL },
/* lquota_v2.user, upgrade from old device */
- { "lquota_v2.user", { 0, 0, 0 }, 0, NULL, NULL },
+ { "lquota_v2.user", { 0, 0, 0 }, 0, sizeof("lquota_v2.user") - 1,
+ NULL, NULL },
/* lquota_v2.group, upgrade from old device */
- { "lquota_v2.group", { 0, 0, 0 }, 0, NULL, NULL },
+ { "lquota_v2.group", { 0, 0, 0 }, 0, sizeof("lquota_v2.group") - 1,
+ NULL, NULL },
/* LAST_GROUP, upgrade from old device */
{ "LAST_GROUP", { FID_SEQ_LOCAL_FILE, OFD_LAST_GROUP_OID, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME,
sizeof("LAST_GROUP") - 1,
NULL, NULL },
/* SLAVE_LOG, llog for destroy slave stripes of striped dir */
{ "SLAVE_LOG", { FID_SEQ_LOCAL_FILE, SLAVE_LLOG_CATALOGS_OID, 0 },
- OLF_SHOW_NAME, NULL, NULL },
+ OLF_SHOW_NAME,
sizeof("SLAVE_LOG") - 1,
NULL, NULL },
/* lost+found */
{ "lost+found", { FID_SEQ_LOCAL_FILE, OSD_LPF_OID, 0 },
- OLF_SCAN_SUBITEMS, osd_ios_general_scan, osd_ios_lf_fill },
+ OLF_SCAN_SUBITEMS, sizeof("lost+found") - 1,
+ osd_ios_general_scan, osd_ios_lf_fill },
- { NULL, { 0, 0, 0 }, 0, NULL, NULL }
+ { NULL, { 0, 0, 0 }, 0,
0,
NULL, NULL }
};
/* Add the new introduced files under .lustre/ in the list in the future. */
static const struct osd_lf_map osd_dl_maps[] = {
/* .lustre/fid */
{ "fid", { FID_SEQ_DOT_LUSTRE, FID_OID_DOT_LUSTRE_OBF, 0 }, 0,
- NULL, NULL },
+
sizeof("fid") - 1,
NULL, NULL },
/* .lustre/lost+found */
{ "lost+found", { FID_SEQ_DOT_LUSTRE, FID_OID_DOT_LUSTRE_LPF, 0 }, 0,
- NULL, NULL },
+
sizeof("lost+found") - 1,
NULL, NULL },
- { NULL, { 0, 0, 0 }, 0, NULL, NULL }
+ { NULL, { 0, 0, 0 }, 0,
0,
NULL, NULL }
};
struct osd_ios_item {
@@
-1893,7
+1920,7
@@
static int osd_ios_dl_fill(void *buf, const char *name, int namelen,
RETURN(0);
for (map = osd_dl_maps; map->olm_name != NULL; map++) {
- if (
strlen(map->olm_name)
!= namelen)
+ if (
map->olm_namelen
!= namelen)
continue;
if (strncmp(map->olm_name, name, namelen) == 0)
@@
-1929,7
+1956,7
@@
static int osd_ios_root_fill(void *buf, const char *name, int namelen,
RETURN(0);
for (map = osd_lf_maps; map->olm_name != NULL; map++) {
- if (
strlen(map->olm_name)
!= namelen)
+ if (
map->olm_namelen
!= namelen)
continue;
if (strncmp(map->olm_name, name, namelen) == 0)
@@
-1965,7
+1992,7
@@
osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev,
.oifb_info = info,
.oifb_dev = dev,
.oifb_dentry = dentry };
- struct file *filp = &info->oti_
it_ea.oie_
file;
+ struct file *filp = &info->oti_file;
struct inode *inode = dentry->d_inode;
const struct file_operations *fops = inode->i_fop;
int rc;
@@
-2171,7
+2198,7
@@
static int osd_initial_OI_scrub(struct osd_thread_info *info,
child = osd_ios_lookup_one_len(map->olm_name,
osd_sb(dev)->s_root,
-
strlen(map->olm_name)
);
+
map->olm_namelen
);
if (!IS_ERR(child))
dput(child);
else if (PTR_ERR(child) == -ENOENT)
@@
-2220,7
+2247,8
@@
static int do_osd_scrub_start(struct osd_device *dev, __u32 flags)
again:
if (thread_is_running(thread)) {
spin_unlock(&scrub->os_lock);
- if (!scrub->os_partial_scan || flags & SS_AUTO_PARTIAL)
+ if (!(scrub->os_file.sf_flags & SF_AUTO) ||
+ (flags & (SS_AUTO_FULL | SS_AUTO_PARTIAL)))
RETURN(-EALREADY);
osd_scrub_join(dev, flags, false);
@@
-2772,7
+2800,8
@@
int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
}
scrub->os_bad_oimap_time = now;
- if (++scrub->os_bad_oimap_count > dev->od_full_scrub_speed)
+ if (++scrub->os_bad_oimap_count >
+ dev->od_full_scrub_threshold_rate)
scrub->os_full_scrub = 1;
}