Oleg Drokin wrote:
And what about workaround for the moment ? What is the solution at short
term ?
It's also possible to decrease st_blksize reported by lustre by patching
lustre.
Here is a small patch that add a module param that tunes the value
returned by stat/fstat/lstat syscalls (all calling ll_getattr_it())
By default, Lustre behaves like it actually does, if you change the
module param 'stat_blksize', Lustre will return this value as the
preferred I/O size.
The value could be dynamically change using /proc.
We are using it for days with success. Easy tuning could be done,
depending on your prefered behaviour.
I could add it to BugZilla if needed.
The patch is against Lustre 1.5.97.
--
Aurelien Degremont
diff -rup lustre-1.5.97.orig/lustre/include/lustre_lite.h lustre-1.5.97/lustre/include/lustre_lite.h
--- lustre-1.5.97.orig/lustre/include/lustre_lite.h 2007-03-02 13:16:55.553289000 +0100
+++ lustre-1.5.97/lustre/include/lustre_lite.h 2007-03-02 13:25:13.976765000 +0100
@@ -36,6 +36,14 @@
#define LL_MAX_BLKSIZE_BITS (22)
#define LL_MAX_BLKSIZE (1UL<<LL_MAX_BLKSIZE_BITS)
+/*
+ * Default value for the module param 'stat_blksize'.
+ * If the variable is set to LL_BLKSIZE_UNSET, then the default behaviour is
+ * used when setting i_blksize in ll_getattr_it(). If not, 'stat_blksize' is
+ * used instead.
+ */
+#define LL_BLKSIZE_UNSET 0
+
#include <lustre/lustre_user.h>
diff -rup lustre-1.5.97.orig/lustre/llite/file.c lustre-1.5.97/lustre/llite/file.c
--- lustre-1.5.97.orig/lustre/llite/file.c 2007-03-02 13:17:03.527254000 +0100
+++ lustre-1.5.97/lustre/llite/file.c 2007-03-02 13:25:43.403164000 +0100
@@ -32,6 +32,15 @@
#endif
#include "llite_internal.h"
+/*
+ * The blksize value, returned by ll_getattr_it() could be tuned with a module
+ * param.
+ */
+static int statfs_blksize = LL_BLKSIZE_UNSET;
+CFS_MODULE_PARM(stat_blksize, "i", int, 0644, \
+ "Preferred block size value returned in stat() calls.");
+
+
/* also used by llite/special.c:ll_special_open() */
struct ll_file_data *ll_file_data_get(void)
{
@@ -2375,11 +2384,16 @@ int ll_getattr_it(struct vfsmount *mnt,
stat->atime = inode->i_atime;
stat->mtime = inode->i_mtime;
stat->ctime = inode->i_ctime;
+ if (stat_blksize == LL_BLKSIZE_UNSET) {
+ /* Set the default Lustre value */
#ifdef HAVE_INODE_BLKSIZE
- stat->blksize = inode->i_blksize;
+ stat->blksize = inode->i_blksize;
#else
- stat->blksize = 1<<inode->i_blkbits;
+ stat->blksize = 1<<inode->i_blkbits;
#endif
+ } else
+ /* Else, set the value specified by the module param */
+ stat->blksize = stat_blksize;
ll_inode_size_lock(inode, 0);
stat->size = inode->i_size;
_______________________________________________
Lustre-devel mailing list
[email protected]
https://mail.clusterfs.com/mailman/listinfo/lustre-devel