All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 18/30] lustre: llite: llite.stat_blocksize param for fixed st_blksize
Date: Mon, 17 Sep 2018 13:30:28 -0400	[thread overview]
Message-ID: <1537205440-6656-19-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1537205440-6656-1-git-send-email-jsimmons@infradead.org>

From: Andrew Perepechko <c17827@cray.com>

llite.stat_blocksize is added to allow configurable st_blksize
for stat(2). The latter is treated incorrectly by some
applications. For example, glibc pre-2.25 uses this value for
stdio buffering which completely ruins performance with random
reads.

The patch changes the behaviour of getattr rather than inode
initialization so that change of the setting causes immediate
effect without the need of reclaiming existing inodes.

The patch is similar to the patch from bz # 12739 by Aurelien
Degremont.

Signed-off-by: Andrew Perepechko <c17827@cray.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-9413
Reviewed-on: https://review.whamcloud.com/26869
Reviewed-by: Alexander Zarochentsev <c17826@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/file.c         |  2 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  6 +++-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 33 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index b90c59c..94760eb 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3267,7 +3267,7 @@ int ll_getattr(const struct path *path, struct kstat *stat,
 	stat->atime = inode->i_atime;
 	stat->mtime = inode->i_mtime;
 	stat->ctime = inode->i_ctime;
-	stat->blksize = 1 << inode->i_blkbits;
+	stat->blksize = sbi->ll_stat_blksize ?: BIT(inode->i_blkbits);
 
 	stat->nlink = inode->i_nlink;
 	stat->size = i_size_read(inode);
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 9d9f623..dcb2fed 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -523,7 +523,11 @@ struct ll_sb_info {
 	struct root_squash_info	  ll_squash;
 	struct path		 ll_mnt;
 
-	__kernel_fsid_t		  ll_fsid;
+	/* st_blksize returned by stat(2), when non-zero */
+	unsigned int		 ll_stat_blksize;
+
+	__kernel_fsid_t		 ll_fsid;
+
 	struct kset		ll_kset;	/* sysfs object */
 	struct completion	 ll_kobj_unregister;
 };
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index f775b4f..d8ef090 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -128,6 +128,38 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RO_ATTR(blocksize);
 
+static ssize_t stat_blocksize_show(struct kobject *kobj, struct attribute *attr,
+				   char *buf)
+{
+	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+					      ll_kset.kobj);
+
+	return sprintf(buf, "%u\n", sbi->ll_stat_blksize);
+}
+
+static ssize_t stat_blocksize_store(struct kobject *kobj,
+				    struct attribute *attr,
+				    const char *buffer,
+				    size_t count)
+{
+	struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+					      ll_kset.kobj);
+	unsigned int val;
+	int rc;
+
+	rc = kstrtouint(buffer, 10, &val);
+	if (rc)
+		return rc;
+
+	if (val != 0 && (val < PAGE_SIZE || (val & (val - 1))) != 0)
+		return -ERANGE;
+
+	sbi->ll_stat_blksize = val;
+
+	return count;
+}
+LUSTRE_RW_ATTR(stat_blocksize);
+
 static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
 				char *buf)
 {
@@ -1123,6 +1155,7 @@ static ssize_t ll_nosquash_nids_seq_write(struct file *file,
 
 static struct attribute *llite_attrs[] = {
 	&lustre_attr_blocksize.attr,
+	&lustre_attr_stat_blocksize.attr,
 	&lustre_attr_kbytestotal.attr,
 	&lustre_attr_kbytesfree.attr,
 	&lustre_attr_kbytesavail.attr,
-- 
1.8.3.1

  parent reply	other threads:[~2018-09-17 17:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 17:30 [lustre-devel] [PATCH 00/30] lustre: first batch of fixes from lustre 2.10 James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 01/30] lustre: lnd: resolve IP query code in LND drivers James Simmons
2018-09-24  3:20   ` NeilBrown
2018-09-17 17:30 ` [lustre-devel] [PATCH 02/30] lustre: uapi: add documentation about FIDs James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 03/30] lustre: osc: fix for cl_env_get in low memory James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 04/30] lustre: ptlrpc: fix wrong error handlers James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 05/30] lustre: osc: GPF while doing ELC with no_wait_policy James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 06/30] lustre: ptlrpc: Prevent possible dereference of NULL pointers James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 07/30] lustre: llog: update llog print format to use FIDs James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 08/30] lustre: mgc: Remove unnecessary checks for config_log_put() James Simmons
2018-09-24  3:35   ` NeilBrown
2018-09-29 21:18     ` James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 09/30] lustre: obd: remove obsolete OBD_FL_LOCAL_MASK James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 10/30] lustre: ptlrpc: set rq_sent when send fails due to -ENOMEM James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 11/30] lustre: mdc: allow setting readdir RPC size parameter James Simmons
2018-09-18 13:14   ` NeilBrown
2018-09-20  5:42     ` Andreas Dilger
2018-09-24  3:50       ` NeilBrown
2018-09-29 21:11       ` James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 12/30] lustre: kuc: initialize kkuc_groups at module init time James Simmons
2018-09-24  3:58   ` NeilBrown
2018-09-17 17:30 ` [lustre-devel] [PATCH 13/30] lustre: ldlm: GPF in _ldlm_lock_debug() James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 14/30] lustre: ldlm: cond_resched in ldlm_bl_thread_main James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 15/30] lustre: ptlrpc: drain "ptlrpc_request_buffer_desc" objects James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 16/30] lustre: lnet: Change sock_create() to sock_create_kern() James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 17/30] lustre: llite: protect ll_dentry_data modification James Simmons
2018-09-24  4:09   ` NeilBrown
2018-09-29 21:30     ` James Simmons
2018-09-17 17:30 ` James Simmons [this message]
2018-09-24  4:11   ` [lustre-devel] [PATCH 18/30] lustre: llite: llite.stat_blocksize param for fixed st_blksize NeilBrown
2018-09-17 17:30 ` [lustre-devel] [PATCH 19/30] lustre: llite: set sec ctx on client's inode at create time James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 20/30] lustre: osc: osc page lru list race James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 21/30] lustre: ldlm: use static initializer macros where possible James Simmons
2018-09-24  4:17   ` NeilBrown
2018-09-17 17:30 ` [lustre-devel] [PATCH 22/30] lustre: osc: update timestamps on write only James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 23/30] lustre: osc: adds radix_tree_preload James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 24/30] lustre: llite: rcu-walk check should not depend on statahead James Simmons
2018-09-24  4:22   ` NeilBrown
2018-09-29 21:33     ` James Simmons
2018-10-02  4:35       ` NeilBrown
2018-09-17 17:30 ` [lustre-devel] [PATCH 25/30] lustre: llite: check the return value of cl_file_inode_init() James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 26/30] lustre: ptlrpc: add replay request into unreplied list James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 27/30] lustre: ptlrpc: increase sleep time in ptlrpc_request_bufs_pack() James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 28/30] lustre: ptlrpc: free reply buffer earlier for open RPC James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 29/30] lustre: libcfs: use save_stack_trace for stack dump James Simmons
2018-09-17 17:30 ` [lustre-devel] [PATCH 30/30] lustre: clio: fix spare bit handling James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537205440-6656-19-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.