Whamcloud - gitweb
LU-9176 osd-zfs: improve statfs estimate for ZFS 43/25743/3
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 3 Mar 2017 09:40:46 +0000 (02:40 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 16 Mar 2017 21:38:36 +0000 (21:38 +0000)
When a ZFS filesystem is newly formatted, there are 128 OI ZAPs and
96 object directories, but only a handful of regular files.  This
skews the average MDT file size to be much larger than regular files,
which in turn makes the estimated total number of files on the MDT
much too small.

Improve the inode size estimate when the filesystem has few files to
be closer to the expected long term average so that the reported total
inode count is reasonable for a new or otherwise empty filesystem.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ic40af2057d8b21e0ee4d9bb3b13b7f6786d0d406
Reviewed-on: https://review.whamcloud.com/25743
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-zfs/osd_handler.c
lustre/osd-zfs/osd_internal.h

index 5233718..5307f92 100644 (file)
@@ -394,9 +394,9 @@ uint64_t osd_objs_count_estimate(uint64_t usedbytes, uint64_t usedobjs,
        CLASSERT(OSD_DNODE_MIN_BLKSHIFT > 0);
        CLASSERT(OSD_DNODE_EST_BLKSHIFT > 0);
 
-       est_usedblocks = (usedbytes >> est_maxblockshift) +
-                        (OSD_DNODE_EST_COUNT >> OSD_DNODE_EST_BLKSHIFT);
-       est_usedobjs   = usedobjs + OSD_DNODE_EST_COUNT;
+       est_usedblocks = ((OSD_DNODE_EST_COUNT << OSD_DNODE_EST_BLKSHIFT) +
+                         usedbytes) >> est_maxblockshift;
+       est_usedobjs   = OSD_DNODE_EST_COUNT + usedobjs;
 
        if (est_usedobjs <= est_usedblocks) {
                /*
index b3b9ea4..54c9a6b 100644 (file)
@@ -85,8 +85,8 @@
 
 /* Statfs {minimum, safe estimate, and maximum} dnodes per block */
 #define OSD_DNODE_MIN_BLKSHIFT (DNODES_PER_BLOCK_SHIFT)
-#define OSD_DNODE_EST_BLKSHIFT (DNODE_BLOCK_SHIFT - 12)     /* est 4KB/dnode */
-#define OSD_DNODE_EST_COUNT    1024
+#define OSD_DNODE_EST_BLKSHIFT (12)     /* est 4KB/dnode */
+#define OSD_DNODE_EST_COUNT    4096
 
 #define OSD_GRANT_FOR_LOCAL_OIDS (2ULL << 20) /* 2MB for last_rcvd, ... */