From: bobijam Date: Thu, 16 Aug 2007 14:26:32 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: v1_8_0_110~1325 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9b8081865eca96e6561e2cec21bc3476bc537c3c;p=fs%2Flustre-release.git Branch b1_6 b=12743 i=adilger, shadow Description: df doesn't work properly if diskfs blocksize != 4K Details : Choose biggest blocksize of OST's as the LOV's blocksize. --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index f3bc113..5f18835 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -31,6 +31,11 @@ Description: llapi_file_create() does not allow some changes Details : add llapi_file_open() that allows specifying the mode and open flags, and also returns an open file handle. +Severity : normal +Bugzilla : 12743 +Description: df doesn't work properly if diskfs blocksize != 4K +Details : Choose biggest blocksize of OST's as the LOV's blocksize. + -------------------------------------------------------------------------------- 2007-08-27 Cluster File Systems, Inc. diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 47f4cdf..39990cd 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1418,6 +1418,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs, obd_osfs.os_bavail, obd_osfs.os_blocks, obd_osfs.os_ffree, obd_osfs.os_files); + osfs->os_bsize = obd_osfs.os_bsize; osfs->os_blocks = obd_osfs.os_blocks; osfs->os_bfree = obd_osfs.os_bfree; osfs->os_bavail = obd_osfs.os_bavail; diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 439d34b..a8e43dc 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -1485,6 +1485,8 @@ int lov_fini_statfs_set(struct lov_request_set *set) void lov_update_statfs(struct obd_device *obd, struct obd_statfs *osfs, struct obd_statfs *lov_sfs, int success) { + int shift = 0, quit = 0; + __u64 tmp; spin_lock(&obd->obd_osfs_lock); memcpy(&obd->obd_osfs, lov_sfs, sizeof(*lov_sfs)); obd->obd_osfs_age = get_jiffies_64(); @@ -1493,6 +1495,33 @@ void lov_update_statfs(struct obd_device *obd, struct obd_statfs *osfs, if (success == 0) { memcpy(osfs, lov_sfs, sizeof(*lov_sfs)); } else { + if (osfs->os_bsize != lov_sfs->os_bsize) { + /* assume all block sizes are always powers of 2 */ + /* get the bits difference */ + tmp = osfs->os_bsize | lov_sfs->os_bsize; + for (shift = 0; shift <= 64; ++shift) { + if (tmp & 1) { + if (quit) + break; + else + quit = 1; + shift = 0; + } + tmp >>= 1; + } + } + + if (osfs->os_bsize < lov_sfs->os_bsize) { + osfs->os_bsize = lov_sfs->os_bsize; + + osfs->os_bfree >>= shift; + osfs->os_bavail >>= shift; + osfs->os_blocks >>= shift; + } else if (shift != 0) { + lov_sfs->os_bfree >>= shift; + lov_sfs->os_bavail >>= shift; + lov_sfs->os_blocks >>= shift; + } #ifdef MIN_DF /* Sandia requested that df (and so, statfs) only returned minimal available space on