Whamcloud - gitweb
LU-11025 osd: osd_attr_get() returns dirent count 97/38097/8
authorLai Siyao <lai.siyao@whamcloud.com>
Fri, 20 Mar 2020 09:59:32 +0000 (17:59 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 20 May 2020 08:22:34 +0000 (08:22 +0000)
commit03a4431dac1c59fa2b98501fc7dfb8451a0a2af8
tree8f99e1a915feb53ddcda79abbc05dea174383b42
parent736d2d62ab1f00926000f0c3aa31fcb6aa53050f
LU-11025 osd: osd_attr_get() returns dirent count

For osd-ldiskfs, to get dirent count it needs to iterate directory
entries and sum it up, while for osd-zfs, zap_count() can get it
from ZAP directly.

Add a new field 'la_dirent_count' in struct lu_attr, and set it
to directory entry count in osd_attr_get() if object is directory, and
this value will be cached in osd_object for osd-ldiskfs, if directory
is newly created, it will be set to '0', and later index_insert/delete
will update its value, so the following osd_attr_get() can use the
cached value.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: If4225aecdba1c428d64d97c35b6c982c4932a265
Reviewed-on: https://review.whamcloud.com/38097
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-zfs/osd_object.c