Skip to content

Commit

Permalink
ceph: set io_pages bdi hint
Browse files Browse the repository at this point in the history
This patch sets the io_pages bdi hint based on the rsize mount option.
Without this patch large buffered reads (request size > max readahead)
are processed sequentially in chunks of the readahead size (i.e. read
requests are sent out up to the readahead size, then the
do_generic_file_read() function waits until the first page is received).

With this patch read requests are sent out at once up to the size
specified in the rsize mount option (default: 64 MB).

Signed-off-by: Andreas Gerstmayr <andreas.gerstmayr@catalysts.cc>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
  • Loading branch information
Andreas Gerstmayr authored and Ilya Dryomov committed Feb 20, 2017
1 parent 0fbc536 commit 7c94ba2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Documentation/filesystems/ceph.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ Mount Options
size.

rsize=X
Specify the maximum read size in bytes. By default there is no
maximum.
Specify the maximum read size in bytes. Default: 64 MB.

rasize=X
Specify the maximum readahead.
Specify the maximum readahead. Default: 8 MB.

mount_timeout=X
Specify the timeout value for mount (in seconds), in the case
Expand Down
8 changes: 8 additions & 0 deletions fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,14 @@ static int ceph_register_bdi(struct super_block *sb,
fsc->backing_dev_info.ra_pages =
VM_MAX_READAHEAD * 1024 / PAGE_SIZE;

if (fsc->mount_options->rsize > fsc->mount_options->rasize &&
fsc->mount_options->rsize >= PAGE_SIZE)
fsc->backing_dev_info.io_pages =
(fsc->mount_options->rsize + PAGE_SIZE - 1)
>> PAGE_SHIFT;
else if (fsc->mount_options->rsize == 0)
fsc->backing_dev_info.io_pages = ULONG_MAX;

err = bdi_register(&fsc->backing_dev_info, NULL, "ceph-%ld",
atomic_long_inc_return(&bdi_seq));
if (!err)
Expand Down
4 changes: 2 additions & 2 deletions fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#define ceph_test_mount_opt(fsc, opt) \
(!!((fsc)->mount_options->flags & CEPH_MOUNT_OPT_##opt))

#define CEPH_RSIZE_DEFAULT 0 /* max read size */
#define CEPH_RASIZE_DEFAULT (8192*1024) /* readahead */
#define CEPH_RSIZE_DEFAULT (64*1024*1024) /* max read size */
#define CEPH_RASIZE_DEFAULT (8192*1024) /* max readahead */
#define CEPH_MAX_READDIR_DEFAULT 1024
#define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024)
#define CEPH_SNAPDIRNAME_DEFAULT ".snap"
Expand Down

0 comments on commit 7c94ba2

Please sign in to comment.