Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2338553
)
b=20065 Add 1S statfs caching and cleanup CFS_HZ usage.
author
yangsheng
<Sheng.Yang@sun.com>
Fri, 2 Jul 2010 11:30:37 +0000
(19:30 +0800)
committer
Robert Read
<robert.read@oracle.com>
Fri, 2 Jul 2010 20:44:12 +0000
(13:44 -0700)
i=adilger
i=bobijam
lustre/include/obd.h
patch
|
blob
|
history
lustre/liblustre/super.c
patch
|
blob
|
history
lustre/llite/llite_lib.c
patch
|
blob
|
history
lustre/llite/lproc_llite.c
patch
|
blob
|
history
lustre/lmv/lmv_obd.c
patch
|
blob
|
history
lustre/lov/lov_obd.c
patch
|
blob
|
history
lustre/mdc/mdc_request.c
patch
|
blob
|
history
lustre/obdclass/lprocfs_status.c
patch
|
blob
|
history
lustre/obdfilter/filter.c
patch
|
blob
|
history
lustre/obdfilter/filter_io.c
patch
|
blob
|
history
lustre/ost/ost_handler.c
patch
|
blob
|
history
diff --git
a/lustre/include/obd.h
b/lustre/include/obd.h
index
e8d6553
..
1938cb1
100644
(file)
--- a/
lustre/include/obd.h
+++ b/
lustre/include/obd.h
@@
-627,6
+627,9
@@
struct lov_qos_rr {
unsigned long lqr_dirty:1; /* recalc round-robin list */
};
unsigned long lqr_dirty:1; /* recalc round-robin list */
};
+/* allow statfs data caching for 1 second */
+#define OBD_STATFS_CACHE_SECONDS 1
+
struct lov_statfs_data {
struct obd_info lsd_oi;
struct obd_statfs lsd_statfs;
struct lov_statfs_data {
struct obd_info lsd_oi;
struct obd_statfs lsd_statfs;
diff --git
a/lustre/liblustre/super.c
b/lustre/liblustre/super.c
index
4279fec
..
31987ac
100644
(file)
--- a/
lustre/liblustre/super.c
+++ b/
lustre/liblustre/super.c
@@
-1140,7
+1140,8
@@
static int llu_statfs(struct llu_sb_info *sbi, struct statfs *sfs)
/* For now we will always get up-to-date statfs values, but in the
* future we may allow some amount of caching on the client (e.g.
* from QOS or lprocfs updates). */
/* For now we will always get up-to-date statfs values, but in the
* future we may allow some amount of caching on the client (e.g.
* from QOS or lprocfs updates). */
- rc = llu_statfs_internal(sbi, &osfs, cfs_time_current_64() - CFS_HZ);
+ rc = llu_statfs_internal(sbi, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS));
if (rc)
return rc;
if (rc)
return rc;
diff --git
a/lustre/llite/llite_lib.c
b/lustre/llite/llite_lib.c
index
6da620f
..
4a9bc4b
100644
(file)
--- a/
lustre/llite/llite_lib.c
+++ b/
lustre/llite/llite_lib.c
@@
-254,7
+254,8
@@
static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
GOTO(out_md, err);
}
GOTO(out_md, err);
}
- err = obd_statfs(obd, &osfs, cfs_time_current_64() - CFS_HZ, 0);
+ err = obd_statfs(obd, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0);
if (err)
GOTO(out_md_fid, err);
if (err)
GOTO(out_md_fid, err);
@@
-1372,10
+1373,10
@@
int ll_statfs(struct dentry *de, struct kstatfs *sfs)
CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_STAFS, 1);
- /*
For now we will always get up-to-date statfs values, but in the
- * future we may allow some amount of caching on the client (e.g.
- * from QOS or lprocfs updates). */
-
rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1,
0);
+ /*
Some amount of caching on the client is allowed */
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+
0);
if (rc)
return rc;
if (rc)
return rc;
diff --git
a/lustre/llite/lproc_llite.c
b/lustre/llite/lproc_llite.c
index
a9623a0
..
73e60d8
100644
(file)
--- a/
lustre/llite/lproc_llite.c
+++ b/
lustre/llite/lproc_llite.c
@@
-60,7
+60,8
@@
static int ll_rd_blksize(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
@@
-78,7
+79,8
@@
static int ll_rd_kbytestotal(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-102,7
+104,8
@@
static int ll_rd_kbytesfree(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-125,7
+128,8
@@
static int ll_rd_kbytesavail(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-148,7
+152,8
@@
static int ll_rd_filestotal(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
@@
-165,7
+170,8
@@
static int ll_rd_filesfree(char *page, char **start, off_t off, int count,
int rc;
LASSERT(sb != NULL);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - CFS_HZ,
+ rc = ll_statfs_internal(sb, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
diff --git
a/lustre/lmv/lmv_obd.c
b/lustre/lmv/lmv_obd.c
index
031458b
..
e0aa6a8
100644
(file)
--- a/
lustre/lmv/lmv_obd.c
+++ b/
lustre/lmv/lmv_obd.c
@@
-754,7
+754,8
@@
static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
RETURN(-EFAULT);
rc = obd_statfs(mdc_obd, &stat_buf,
RETURN(-EFAULT);
rc = obd_statfs(mdc_obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
diff --git
a/lustre/lov/lov_obd.c
b/lustre/lov/lov_obd.c
index
8ecfd4d
..
919e698
100644
(file)
--- a/
lustre/lov/lov_obd.c
+++ b/
lustre/lov/lov_obd.c
@@
-1129,7
+1129,8
@@
static int lov_create(struct obd_export *exp, struct obdo *src_oa,
* later in alloc_qos(), we will wait for those rpcs to complete if
* the osfs age is older than 2 * qos_maxage */
qos_statfs_update(exp->exp_obd,
* later in alloc_qos(), we will wait for those rpcs to complete if
* the osfs age is older than 2 * qos_maxage */
qos_statfs_update(exp->exp_obd,
- cfs_time_shift_64(-lov->desc.ld_qos_maxage) + CFS_HZ,
+ cfs_time_shift_64(-lov->desc.ld_qos_maxage +
+ OBD_STATFS_CACHE_SECONDS),
0);
rc = lov_prep_create_set(exp, &oinfo, ea, src_oa, oti, &set);
0);
rc = lov_prep_create_set(exp, &oinfo, ea, src_oa, oti, &set);
@@
-2007,7
+2008,8
@@
static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
/* got statfs data */
rc = obd_statfs(osc_obd, &stat_buf,
/* got statfs data */
rc = obd_statfs(osc_obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
diff --git
a/lustre/mdc/mdc_request.c
b/lustre/mdc/mdc_request.c
index
20e61cc
..
6e688fd
100644
(file)
--- a/
lustre/mdc/mdc_request.c
+++ b/
lustre/mdc/mdc_request.c
@@
-1402,7
+1402,8
@@
static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
GOTO(out, rc = -EFAULT);
rc = mdc_statfs(obd, &stat_buf,
GOTO(out, rc = -EFAULT);
rc = mdc_statfs(obd, &stat_buf,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (rc != 0)
GOTO(out, rc);
if (rc != 0)
GOTO(out, rc);
diff --git
a/lustre/obdclass/lprocfs_status.c
b/lustre/obdclass/lprocfs_status.c
index
da3410f
..
e134215
100644
(file)
--- a/
lustre/obdclass/lprocfs_status.c
+++ b/
lustre/obdclass/lprocfs_status.c
@@
-521,7
+521,8
@@
int lprocfs_rd_blksize(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
@@
-534,7
+535,8
@@
int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-553,7
+555,8
@@
int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-572,7
+575,8
@@
int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
@@
-591,7
+595,8
@@
int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
@@
-605,7
+610,8
@@
int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_statfs osfs;
int *eof, void *data)
{
struct obd_statfs osfs;
- int rc = obd_statfs(data, &osfs, cfs_time_current_64() - CFS_HZ,
+ int rc = obd_statfs(data, &osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
diff --git
a/lustre/obdfilter/filter.c
b/lustre/obdfilter/filter.c
index
5ce5a27
..
56d7b83
100644
(file)
--- a/
lustre/obdfilter/filter.c
+++ b/
lustre/obdfilter/filter.c
@@
-3758,7
+3758,8
@@
static int filter_precreate(struct obd_device *obd, struct obdo *oa,
OBD_ALLOC(osfs, sizeof(*osfs));
if (osfs == NULL)
RETURN(-ENOMEM);
OBD_ALLOC(osfs, sizeof(*osfs));
if (osfs == NULL)
RETURN(-ENOMEM);
- rc = filter_statfs(obd, osfs, cfs_time_current_64() - CFS_HZ,
+ rc = filter_statfs(obd, osfs,
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
0);
if (rc == 0 && osfs->os_bavail < (osfs->os_blocks >> 10)) {
CDEBUG(D_RPCTRACE,"%s: not enough space for create "
0);
if (rc == 0 && osfs->os_bavail < (osfs->os_blocks >> 10)) {
CDEBUG(D_RPCTRACE,"%s: not enough space for create "
diff --git
a/lustre/obdfilter/filter_io.c
b/lustre/obdfilter/filter_io.c
index
71d7e28
..
979e403
100644
(file)
--- a/
lustre/obdfilter/filter_io.c
+++ b/
lustre/obdfilter/filter_io.c
@@
-153,10
+153,10
@@
obd_size filter_grant_space_left(struct obd_export *exp)
LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
if (cfs_time_before_64(obd->obd_osfs_age,
LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
if (cfs_time_before_64(obd->obd_osfs_age,
- cfs_time_
current_64() - CFS_HZ
)) {
+ cfs_time_
shift_64(-OBD_STATFS_CACHE_SECONDS)
)) {
restat:
rc = fsfilt_statfs(obd, obd->u.obt.obt_sb,
restat:
rc = fsfilt_statfs(obd, obd->u.obt.obt_sb,
- cfs_time_
current_64() + CFS_HZ
);
+ cfs_time_
shift_64(OBD_STATFS_CACHE_SECONDS)
);
if (rc) /* N.B. statfs can't really fail */
RETURN(0);
statfs_done = 1;
if (rc) /* N.B. statfs can't really fail */
RETURN(0);
statfs_done = 1;
diff --git
a/lustre/ost/ost_handler.c
b/lustre/ost/ost_handler.c
index
4bbf6c5
..
47254d3
100644
(file)
--- a/
lustre/ost/ost_handler.c
+++ b/
lustre/ost/ost_handler.c
@@
-303,7
+303,8
@@
static int ost_statfs(struct ptlrpc_request *req)
osfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
osfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
- cfs_time_current_64() - CFS_HZ, 0);
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ 0);
if (req->rq_status != 0)
CERROR("ost: statfs failed: rc %d\n", req->rq_status);
if (req->rq_status != 0)
CERROR("ost: statfs failed: rc %d\n", req->rq_status);