Skip to content
Snippets Groups Projects
Commit 9b808186 authored by Bobi Jam's avatar Bobi Jam
Browse files

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.
parent 124abb51
No related branches found
No related tags found
No related merge requests found
......@@ -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. <info@clusterfs.com>
......
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment