diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/osc')
-rw-r--r-- | drivers/staging/lustre/lustre/osc/Makefile | 3 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/lproc_osc.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_cache.c | 31 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 6 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_dev.c | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_internal.h | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_io.c | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_lock.c | 4 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_object.c | 9 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_quota.c | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/osc/osc_request.c | 32 |
11 files changed, 65 insertions, 36 deletions
diff --git a/drivers/staging/lustre/lustre/osc/Makefile b/drivers/staging/lustre/lustre/osc/Makefile index 37cdeea9ac49..30dec90e64e8 100644 --- a/drivers/staging/lustre/lustre/osc/Makefile +++ b/drivers/staging/lustre/lustre/osc/Makefile @@ -1,3 +1,6 @@ +subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/include +subdir-ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include + obj-$(CONFIG_LUSTRE_FS) += osc.o osc-y := osc_request.o osc_dev.o osc_object.o \ osc_page.o osc_lock.o osc_io.o osc_quota.o osc_cache.o lproc_osc.o diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 86f252d6adbd..ae13eb055229 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -32,9 +32,9 @@ #define DEBUG_SUBSYSTEM S_CLASS #include <linux/statfs.h> -#include "../include/obd_cksum.h" -#include "../include/obd_class.h" -#include "../include/lprocfs_status.h" +#include <obd_cksum.h> +#include <obd_class.h> +#include <lprocfs_status.h> #include <linux/seq_file.h> #include "osc_internal.h" @@ -831,7 +831,7 @@ static struct attribute *osc_attrs[] = { NULL, }; -static struct attribute_group osc_attr_group = { +static const struct attribute_group osc_attr_group = { .attrs = osc_attrs, }; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d8a95f8fe1ff..e1207c227b79 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -783,6 +783,7 @@ restart: /* pull ext's start back to cover cur */ ext->oe_start = cur->oe_start; ext->oe_grants += chunksize; + LASSERT(*grants >= chunksize); *grants -= chunksize; found = osc_extent_hold(ext); @@ -790,6 +791,7 @@ restart: /* rear merge */ ext->oe_end = cur->oe_end; ext->oe_grants += chunksize; + LASSERT(*grants >= chunksize); *grants -= chunksize; /* try to merge with the next one because we just fill @@ -819,8 +821,8 @@ restart: /* create a new extent */ EASSERT(osc_extent_is_overlapped(obj, cur) == 0, cur); cur->oe_grants = chunksize + cli->cl_extent_tax; + LASSERT(*grants >= cur->oe_grants); *grants -= cur->oe_grants; - LASSERT(*grants >= 0); cur->oe_state = OES_CACHE; found = osc_extent_hold(cur); @@ -849,7 +851,6 @@ restart: out: osc_extent_put(env, cur); - LASSERT(*grants >= 0); return found; } @@ -1219,8 +1220,8 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, ext->oe_end = end_index; ext->oe_grants += chunksize; + LASSERT(*grants >= chunksize); *grants -= chunksize; - LASSERT(*grants >= 0); EASSERTF(osc_extent_is_overlapped(obj, ext) == 0, ext, "overlapped after expanding for %lu.\n", index); @@ -1887,6 +1888,7 @@ struct extent_rpc_data { unsigned int erd_page_count; unsigned int erd_max_pages; unsigned int erd_max_chunks; + unsigned int erd_max_extents; }; static inline unsigned int osc_extent_chunks(const struct osc_extent *ext) @@ -1915,11 +1917,23 @@ static int try_to_add_extent_for_io(struct client_obd *cli, EASSERT((ext->oe_state == OES_CACHE || ext->oe_state == OES_LOCK_DONE), ext); + if (!data->erd_max_extents) + return 0; + chunk_count = osc_extent_chunks(ext); + EASSERTF(data->erd_page_count != 0 || + chunk_count <= data->erd_max_chunks, ext, + "The first extent to be fit in a RPC contains %u chunks, which is over the limit %u.\n", + chunk_count, data->erd_max_chunks); + if (chunk_count > data->erd_max_chunks) return 0; data->erd_max_pages = max(ext->oe_mppr, data->erd_max_pages); + EASSERTF(data->erd_page_count != 0 || + ext->oe_nr_pages <= data->erd_max_pages, ext, + "The first extent to be fit in a RPC contains %u pages, which is over the limit %u.\n", + ext->oe_nr_pages, data->erd_max_pages); if (data->erd_page_count + ext->oe_nr_pages > data->erd_max_pages) return 0; @@ -1943,6 +1957,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, break; } + data->erd_max_extents--; data->erd_max_chunks -= chunk_count; data->erd_page_count += ext->oe_nr_pages; list_move_tail(&ext->oe_link, data->erd_rpc_list); @@ -1972,10 +1987,12 @@ static inline unsigned int osc_max_write_chunks(const struct client_obd *cli) * * This limitation doesn't apply to ldiskfs, which allows as many * chunks in one RPC as we want. However, it won't have any benefits - * to have too many discontiguous pages in one RPC. Therefore, it - * can only have 256 chunks at most in one RPC. + * to have too many discontiguous pages in one RPC. + * + * An osc_extent won't cover over a RPC size, so the chunks in an + * osc_extent won't bigger than PTLRPC_MAX_BRW_SIZE >> chunkbits. */ - return min(PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits, 256); + return PTLRPC_MAX_BRW_SIZE >> cli->cl_chunkbits; } /** @@ -2002,6 +2019,7 @@ static unsigned int get_write_extents(struct osc_object *obj, .erd_page_count = 0, .erd_max_pages = cli->cl_max_pages_per_rpc, .erd_max_chunks = osc_max_write_chunks(cli), + .erd_max_extents = 256, }; LASSERT(osc_object_is_locked(obj)); @@ -2140,6 +2158,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, .erd_page_count = 0, .erd_max_pages = cli->cl_max_pages_per_rpc, .erd_max_chunks = UINT_MAX, + .erd_max_extents = UINT_MAX, }; int rc = 0; diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index 270212f4e5cf..35bdbfb8660d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -42,11 +42,11 @@ #ifndef OSC_CL_INTERNAL_H #define OSC_CL_INTERNAL_H -#include "../../include/linux/libcfs/libcfs.h" +#include <linux/libcfs/libcfs.h> -#include "../include/obd.h" +#include <obd.h> /* osc_build_res_name() */ -#include "../include/cl_object.h" +#include <cl_object.h> #include "osc_internal.h" /** \defgroup osc osc diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index c5d62aeaeab5..cf7b8879d7f0 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -37,7 +37,7 @@ #define DEBUG_SUBSYSTEM S_OSC /* class_name2obd() */ -#include "../include/obd_class.h" +#include <obd_class.h> #include "osc_cl_internal.h" diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 13a40f6423ff..a536908fb26a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -99,7 +99,7 @@ void osc_update_next_shrink(struct client_obd *cli); /* * cl integration. */ -#include "../include/cl_object.h" +#include <cl_object.h> extern struct ptlrpc_request_set *PTLRPCD_SET; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index cbab80092442..f7969e33f28a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -37,7 +37,7 @@ #define DEBUG_SUBSYSTEM S_OSC -#include "../include/lustre_obdo.h" +#include <lustre_obdo.h> #include "osc_cl_internal.h" diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 940c10c1d7a1..b4f1f74dead8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -37,9 +37,9 @@ #define DEBUG_SUBSYSTEM S_OSC -#include "../../include/linux/libcfs/libcfs.h" +#include <linux/libcfs/libcfs.h> /* fid_build_reg_res_name() */ -#include "../include/lustre_fid.h" +#include <lustre_fid.h> #include "osc_cl_internal.h" diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index fa621bda1ffe..945ae6e5a8b1 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -369,7 +369,14 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, oa->o_valid |= OBD_MD_FLGROUP; } if (flags & OBD_MD_FLID) { - ostid_set_id(&oa->o_oi, ostid_id(&oinfo->loi_oi)); + int rc; + + rc = ostid_set_id(&oa->o_oi, ostid_id(&oinfo->loi_oi)); + if (rc) { + CERROR("Bad %llu to set " DOSTID " : rc %d\n", + (unsigned long long)ostid_id(&oinfo->loi_oi), + POSTID(&oa->o_oi), rc); + } oa->o_valid |= OBD_MD_FLID; } if (flags & OBD_MD_FLHANDLE) { diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index fed4da63ee45..a6118f8ba446 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -23,7 +23,7 @@ * Code originally extracted from quota directory */ -#include "../include/obd_class.h" +#include <obd_class.h> #include "osc_internal.h" static inline struct osc_quota_info *osc_oqi_alloc(u32 id) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 922d0cbe83dc..4c68c42b2281 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -32,22 +32,22 @@ #define DEBUG_SUBSYSTEM S_OSC -#include "../../include/linux/libcfs/libcfs.h" - -#include "../include/lustre_dlm.h" -#include "../include/lustre_net.h" -#include "../include/lustre/lustre_user.h" -#include "../include/obd_cksum.h" - -#include "../include/lustre_ha.h" -#include "../include/lprocfs_status.h" -#include "../include/lustre/lustre_ioctl.h" -#include "../include/lustre_debug.h" -#include "../include/lustre_obdo.h" -#include "../include/lustre_param.h" -#include "../include/lustre_fid.h" -#include "../include/obd_class.h" -#include "../include/obd.h" +#include <linux/libcfs/libcfs.h> + +#include <lustre_dlm.h> +#include <lustre_net.h> +#include <uapi/linux/lustre/lustre_idl.h> +#include <obd_cksum.h> + +#include <lustre_ha.h> +#include <lprocfs_status.h> +#include <uapi/linux/lustre/lustre_ioctl.h> +#include <lustre_debug.h> +#include <lustre_obdo.h> +#include <uapi/linux/lustre/lustre_param.h> +#include <lustre_fid.h> +#include <obd_class.h> +#include <obd.h> #include "osc_internal.h" #include "osc_cl_internal.h" |