From: Alex Zhuravlev Date: Mon, 15 Oct 2012 09:53:29 +0000 (+0400) Subject: LU-2100 ofd: small batched precreation on a small system X-Git-Tag: 2.3.58~23 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=71eb67f041732093696781cc3ddddb7d9aac66a6;p=fs%2Flustre-release.git LU-2100 ofd: small batched precreation on a small system on a small system (like NAME=local configuration) ldiskfs transactions can not accept many changes. with batched precreation in OFD, the default value of 128 objects may lead to warnings and transaction overflow. to prevent this OFD checks fs and if it's small (OFD_PRECREATE_SMALL_FS = 1GB), then initial number of objects to precreate in a single transaction is set to OFD_PRECREATE_BATCH_SMALL=8. Signed-off-by: Alex Zhuravlev Change-Id: Id9b9c4b6abd76df69787777cc52380d71fdf5a86 Reviewed-on: http://review.whamcloud.com/4274 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Mike Pershin --- diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 2ae11c3..f4b0bec 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -577,6 +577,10 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m, } m->ofd_blockbits = fls(osfs->os_bsize) - 1; + m->ofd_precreate_batch = OFD_PRECREATE_BATCH_DEFAULT; + if (osfs->os_bsize * osfs->os_blocks < OFD_PRECREATE_SMALL_FS) + m->ofd_precreate_batch = OFD_PRECREATE_BATCH_SMALL; + snprintf(info->fti_u.name, sizeof(info->fti_u.name), "filter-%p", m); m->ofd_namespace = ldlm_namespace_new(obd, info->fti_u.name, LDLM_NAMESPACE_SERVER, diff --git a/lustre/ofd/ofd_fs.c b/lustre/ofd/ofd_fs.c index 0d881dc..ea2fd06 100644 --- a/lustre/ofd/ofd_fs.c +++ b/lustre/ofd/ofd_fs.c @@ -232,7 +232,6 @@ int ofd_groups_init(const struct lu_env *env, struct ofd_device *ofd) if (rc) GOTO(cleanup, rc); - ofd->ofd_precreate_batch = OFD_PRECREATE_BATCH_DEFAULT; groups_size = (unsigned long)info->fti_attr.la_size; if (groups_size == sizeof(last_group)) { diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index 7b37b0d..e2eb812 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -51,6 +51,11 @@ #define OFD_MAX_GROUPS 256 #define OFD_PRECREATE_BATCH_DEFAULT (FILTER_SUBDIR_COUNT * 4) +/* on small filesystems we should not precreate too many objects in + * a single transaction, otherwise we can overflow transactions */ +#define OFD_PRECREATE_SMALL_FS (1024ULL * 1024 * 1024) +#define OFD_PRECREATE_BATCH_SMALL 8 + /* Limit the returned fields marked valid to those that we actually might set */ #define OFD_VALID_FLAGS (LA_TYPE | LA_MODE | LA_SIZE | LA_BLOCKS | \ LA_BLKSIZE | LA_ATIME | LA_MTIME | LA_CTIME)