If the ldiskfs group descriptor is marked as LDISKFS_BG_INODE_UNINIT,
then means that the inodes in such group have never been initialized,
so the otable based iterator can skip this group directly to speed up
the scanning.
If the iteration position reaches the unused inodes area in the
group descriptor (indicated by bg_itable_unused), then skip the
rest inodes in this group to reduce the scanning time.
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ie8a2eb1269d288865ce51d40e211e3db54d062af
Reviewed-on: http://review.whamcloud.com/12737
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
while (*pos <= limit && *count < max) {
struct osd_idmap_cache *oic = NULL;
while (*pos <= limit && *count < max) {
struct osd_idmap_cache *oic = NULL;
+ struct ldiskfs_group_desc *desc;
param.bg = (*pos - 1) / LDISKFS_INODES_PER_GROUP(param.sb);
param.bg = (*pos - 1) / LDISKFS_INODES_PER_GROUP(param.sb);
+ desc = ldiskfs_get_group_desc(param.sb, param.bg, NULL);
+ if (desc == NULL)
+ RETURN(-EIO);
+
+ ldiskfs_lock_group(param.sb, param.bg);
+ if (desc->bg_flags & cpu_to_le16(LDISKFS_BG_INODE_UNINIT)) {
+ ldiskfs_unlock_group(param.sb, param.bg);
+ *pos = 1 + (param.bg + 1) *
+ LDISKFS_INODES_PER_GROUP(param.sb);
+ continue;
+ }
+ ldiskfs_unlock_group(param.sb, param.bg);
+
param.offset = (*pos - 1) % LDISKFS_INODES_PER_GROUP(param.sb);
param.gbase = 1 + param.bg * LDISKFS_INODES_PER_GROUP(param.sb);
param.bitmap = ldiskfs_read_inode_bitmap(param.sb, param.bg);
param.offset = (*pos - 1) % LDISKFS_INODES_PER_GROUP(param.sb);
param.gbase = 1 + param.bg * LDISKFS_INODES_PER_GROUP(param.sb);
param.bitmap = ldiskfs_read_inode_bitmap(param.sb, param.bg);
while (param.offset < LDISKFS_INODES_PER_GROUP(param.sb) &&
*count < max) {
while (param.offset < LDISKFS_INODES_PER_GROUP(param.sb) &&
*count < max) {
+ if (param.offset +
+ ldiskfs_itable_unused_count(param.sb, desc) >
+ LDISKFS_INODES_PER_GROUP(param.sb))
+ goto next_group;
+
rc = next(info, dev, ¶m, &oic, noslot);
switch (rc) {
case SCRUB_NEXT_BREAK:
rc = next(info, dev, ¶m, &oic, noslot);
switch (rc) {
case SCRUB_NEXT_BREAK:
SAVED_OSTCOUNT=${OSTCOUNT}
# use small MDS + OST size to speed formatting time
# do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
SAVED_OSTCOUNT=${OSTCOUNT}
# use small MDS + OST size to speed formatting time
# do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
+# 200M MDT device can guarantee uninitialized groups during the OI scrub
+MDSSIZE=200000
OSTSIZE=100000
# no need too much OSTs, to reduce the format/start/stop overhead
[ $OSTCOUNT -gt 4 ] && OSTCOUNT=4
OSTSIZE=100000
# no need too much OSTs, to reduce the format/start/stop overhead
[ $OSTCOUNT -gt 4 ] && OSTCOUNT=4