From: Luis Henriques <lhenriques@suse.com>
To: Jeff Layton <jlayton@kernel.org>, Sage Weil <sage@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>, "Yan, Zheng" <zyan@redhat.com>,
Gregory Farnum <gfarnum@redhat.com>
Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
Luis Henriques <lhenriques@suse.com>
Subject: [RFC PATCH 3/3] ceph: add module param to throttle 'copy-from2' operations
Date: Mon, 27 Jan 2020 16:43:21 +0000 [thread overview]
Message-ID: <20200127164321.17468-4-lhenriques@suse.com> (raw)
In-Reply-To: <20200127164321.17468-1-lhenriques@suse.com>
This patch adds a ceph kernel module parameter that allows to throttle the
amount of parallel requests that can be sent to the OSDs before waiting
for the completion. This allows to prevent DoS'ing the ODSs with too many
requests at once when copying a big file.
Signed-off-by: Luis Henriques <lhenriques@suse.com>
---
fs/ceph/file.c | 10 ++++++++++
fs/ceph/super.c | 4 ++++
fs/ceph/super.h | 2 ++
3 files changed, 16 insertions(+)
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 5d8f0ba11719..bf18712f3bd3 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1973,6 +1973,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
int src_got = 0, dst_got = 0, err, dirty;
bool do_final_copy = false;
LIST_HEAD(osd_reqs);
+ unsigned int ncopies = cfr_throttle;
if (src_inode->i_sb != dst_inode->i_sb) {
struct ceph_fs_client *dst_fsc = ceph_inode_to_client(dst_inode);
@@ -2151,6 +2152,15 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
src_off += object_size;
dst_off += object_size;
ret += object_size;
+ if (cfr_throttle && (--ncopies == 0)) {
+ err = wait_copy_from_reqs(&osd_reqs);
+ if (err) {
+ if (!ret)
+ ret = err;
+ goto out_caps;
+ }
+ ncopies = cfr_throttle;
+ }
}
err = wait_copy_from_reqs(&osd_reqs);
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index b62c487a53af..02e8b6f93d50 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1238,6 +1238,10 @@ static void __exit exit_ceph(void)
destroy_caches();
}
+unsigned int cfr_throttle = 0;
+module_param(cfr_throttle, uint, 0644);
+MODULE_PARM_DESC(cfr_throttle, "copy_file_range throttle value.");
+
module_init(init_ceph);
module_exit(exit_ceph);
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index b2f86bed5c2c..fb98b4b1ec72 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -72,6 +72,8 @@
#define CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT 5 /* cap release delay */
#define CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT 60 /* cap release delay */
+extern unsigned int cfr_throttle;
+
struct ceph_mount_options {
unsigned int flags;
next prev parent reply other threads:[~2020-01-27 16:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-27 16:43 [RFC PATCH 0/3] parallel 'copy-from' Ops in copy_file_range Luis Henriques
2020-01-27 16:43 ` [RFC PATCH 1/3] libceph: add non-blocking version of ceph_osdc_copy_from() Luis Henriques
2020-01-27 17:47 ` Ilya Dryomov
2020-01-27 18:39 ` Luis Henriques
2020-01-27 16:43 ` [RFC PATCH 2/3] ceph: parallelize all copy-from requests in copy_file_range Luis Henriques
2020-01-27 17:58 ` Ilya Dryomov
2020-01-27 18:44 ` Luis Henriques
2020-01-28 8:39 ` Ilya Dryomov
2020-01-27 16:43 ` Luis Henriques [this message]
2020-01-27 18:16 ` [RFC PATCH 0/3] parallel 'copy-from' Ops " Ilya Dryomov
2020-01-27 18:52 ` Luis Henriques
2020-01-28 17:15 ` Gregory Farnum
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=20200127164321.17468-4-lhenriques@suse.com \
--to=lhenriques@suse.com \
--cc=ceph-devel@vger.kernel.org \
--cc=gfarnum@redhat.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sage@redhat.com \
--cc=zyan@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®