Whamcloud - gitweb
LU-2100 ofd: small batched precreation on a small system
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Mon, 15 Oct 2012 09:53:29 +0000 (13:53 +0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 17 Dec 2012 18:17:26 +0000 (13:17 -0500)
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 <alexey.zhuravlev@intel.com>
Change-Id: Id9b9c4b6abd76df69787777cc52380d71fdf5a86
Reviewed-on: http://review.whamcloud.com/4274
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_fs.c
lustre/ofd/ofd_internal.h

index 2ae11c3..f4b0bec 100644 (file)
@@ -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,
index 0d881dc..ea2fd06 100644 (file)
@@ -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)) {
index 7b37b0d..e2eb812 100644 (file)
 #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)