From 12a880bfdec9259ccade5095351e80b0784956a3 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 26 Feb 2016 01:50:11 -0500 Subject: [PATCH] staging/lustre: Rework MAX_DIO_SIZE macro KMALLOC_MAX_SIZE is always defined in the kernel, so no point in checking for it, just use t directly. Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/rw26.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index b9d8e73d33a2..7a5db67bc680 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -350,20 +350,14 @@ static ssize_t ll_direct_IO_26_seg(const struct lu_env *env, struct cl_io *io, return ll_direct_rw_pages(env, io, rw, inode, &pvec); } -#ifdef KMALLOC_MAX_SIZE -#define MAX_MALLOC KMALLOC_MAX_SIZE -#else -#define MAX_MALLOC (128 * 1024) -#endif - /* This is the maximum size of a single O_DIRECT request, based on the * kmalloc limit. We need to fit all of the brw_page structs, each one * representing PAGE_SIZE worth of user data, into a single buffer, and * then truncate this to be a full-sized RPC. For 4kB PAGE_SIZE this is * up to 22MB for 128kB kmalloc and up to 682MB for 4MB kmalloc. */ -#define MAX_DIO_SIZE ((MAX_MALLOC / sizeof(struct brw_page) * PAGE_CACHE_SIZE) & \ - ~(DT_MAX_BRW_SIZE - 1)) +#define MAX_DIO_SIZE ((KMALLOC_MAX_SIZE / sizeof(struct brw_page) * \ + PAGE_CACHE_SIZE) & ~(DT_MAX_BRW_SIZE - 1)) static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter, loff_t file_offset) { -- 2.45.2