ceph: limit osd write size
OSD has a configurable limitation of max write size. OSD return error if write request size is larger than the limitation. For now, set max write size to CEPH_MSG_MAX_DATA_LEN. It should be small enough. Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
aa187926b7
commit
95cca2b44e
@ -779,10 +779,8 @@ static int ceph_writepages_start(struct address_space *mapping,
|
|||||||
mapping_set_error(mapping, -EIO);
|
mapping_set_error(mapping, -EIO);
|
||||||
return -EIO; /* we're in a forced umount, don't write! */
|
return -EIO; /* we're in a forced umount, don't write! */
|
||||||
}
|
}
|
||||||
if (fsc->mount_options->wsize && fsc->mount_options->wsize < wsize)
|
if (fsc->mount_options->wsize < wsize)
|
||||||
wsize = fsc->mount_options->wsize;
|
wsize = fsc->mount_options->wsize;
|
||||||
if (wsize < PAGE_SIZE)
|
|
||||||
wsize = PAGE_SIZE;
|
|
||||||
max_pages_ever = wsize >> PAGE_SHIFT;
|
max_pages_ever = wsize >> PAGE_SHIFT;
|
||||||
|
|
||||||
pagevec_init(&pvec, 0);
|
pagevec_init(&pvec, 0);
|
||||||
|
@ -887,7 +887,9 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!write)
|
if (write)
|
||||||
|
size = min_t(u64, size, fsc->mount_options->wsize);
|
||||||
|
else
|
||||||
size = min_t(u64, size, fsc->mount_options->rsize);
|
size = min_t(u64, size, fsc->mount_options->rsize);
|
||||||
|
|
||||||
len = size;
|
len = size;
|
||||||
|
@ -233,7 +233,9 @@ static int parse_fsopt_token(char *c, void *private)
|
|||||||
break;
|
break;
|
||||||
/* misc */
|
/* misc */
|
||||||
case Opt_wsize:
|
case Opt_wsize:
|
||||||
fsopt->wsize = intval;
|
if (intval < PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
|
||||||
|
return -EINVAL;
|
||||||
|
fsopt->wsize = ALIGN(intval, PAGE_SIZE);
|
||||||
break;
|
break;
|
||||||
case Opt_rsize:
|
case Opt_rsize:
|
||||||
if (intval < PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
|
if (intval < PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
|
||||||
@ -392,6 +394,7 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,
|
|||||||
fsopt->sb_flags = flags;
|
fsopt->sb_flags = flags;
|
||||||
fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
|
fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
|
||||||
|
|
||||||
|
fsopt->wsize = CEPH_MAX_WRITE_SIZE;
|
||||||
fsopt->rsize = CEPH_MAX_READ_SIZE;
|
fsopt->rsize = CEPH_MAX_READ_SIZE;
|
||||||
fsopt->rasize = CEPH_RASIZE_DEFAULT;
|
fsopt->rasize = CEPH_RASIZE_DEFAULT;
|
||||||
fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
|
fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
|
|
||||||
/* max size of osd read request, limited by libceph */
|
/* max size of osd read request, limited by libceph */
|
||||||
#define CEPH_MAX_READ_SIZE CEPH_MSG_MAX_DATA_LEN
|
#define CEPH_MAX_READ_SIZE CEPH_MSG_MAX_DATA_LEN
|
||||||
|
/* osd has a configurable limitaion of max write size.
|
||||||
|
* CEPH_MSG_MAX_DATA_LEN should be small enough. */
|
||||||
|
#define CEPH_MAX_WRITE_SIZE CEPH_MSG_MAX_DATA_LEN
|
||||||
#define CEPH_RASIZE_DEFAULT (8192*1024) /* max readahead */
|
#define CEPH_RASIZE_DEFAULT (8192*1024) /* max readahead */
|
||||||
#define CEPH_MAX_READDIR_DEFAULT 1024
|
#define CEPH_MAX_READDIR_DEFAULT 1024
|
||||||
#define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024)
|
#define CEPH_MAX_READDIR_BYTES_DEFAULT (512*1024)
|
||||||
|
Loading…
Reference in New Issue
Block a user