lustre - more cleanups including module reduction.
Subsystems (3)
cover lustre - more cleanups including module reduction.
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.
Which parts of lustre/lustre/* are also used by server?
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown
---
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disable KBUILD_MODNAME when building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.
lustre: use truncate_inode_page in place of truncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: remove lustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discard LTIME_S macro
lustre: discard NO_QUOTA and QUOTA_OK
lustre: discard ext2* bit operations
lustre: centralize TIMES_SET_FLAGS
lustre: remove redefinition of module_init().
lustre: remove lustre_compat.h
lustre/lnet: move tracefile locking from linux-tracefile.c to tracefile.c
lustre: open code cfs_trace_max_debug_mb() into cfs_trace_set_debug_mb()
lustre: move tcd locking across to tracefile.c
lustre: move remainder of linux-tracefile.c to tracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamed CFS_TCD_TYPE_MAX to CFS_TCD_TYPE_CNT
lustre: discard TCD_MAX_TYPES
Documentation/kbuild/makefiles.txt | 65 +++++ drivers/staging/lustre/lnet/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/debug.c | 6 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 258 -------------------- drivers/staging/lustre/lnet/libcfs/module.c | 26 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 241 +++++++++++++++++-- drivers/staging/lustre/lnet/libcfs/tracefile.h | 40 --- drivers/staging/lustre/lnet/lnet/Makefile | 11 - drivers/staging/lustre/lnet/lnet/module.c | 9 + drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 drivers/staging/lustre/lustre/include/cl_object.h | 6 .../staging/lustre/lustre/include/lustre_compat.h | 82 ------ drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 68 ----- drivers/staging/lustre/lustre/include/obd.h | 7 + .../staging/lustre/lustre/include/obd_support.h | 1 drivers/staging/lustre/lustre/ldlm/Makefile | 11 + drivers/staging/lustre/lustre/llite/dir.c | 3 drivers/staging/lustre/lustre/llite/file.c | 36 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 11 - .../staging/lustre/lustre/llite/llite_internal.h | 13 + drivers/staging/lustre/lustre/llite/llite_lib.c | 52 ++-- drivers/staging/lustre/lustre/llite/namei.c | 16 + drivers/staging/lustre/lustre/llite/vvp_io.c | 8 - drivers/staging/lustre/lustre/llite/vvp_object.c | 6 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 19 + drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 7 - .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/obdclass/obdo.c | 10 - .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 drivers/staging/lustre/lustre/osc/osc_io.c | 23 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 drivers/staging/lustre/lustre/osc/osc_request.c | 1 drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 - drivers/staging/lustre/lustre/ptlrpc/import.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 + drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 scripts/Makefile.build | 57 +++- scripts/Makefile.lib | 63 +++-- 57 files changed, 584 insertions(+), 685 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile
--
Signature
PATCH 1/24 kbuild: detect directories in components of a module.
This is a first step in a larger change and so can only be fully understood in the larger context.
This patch changes the code for extracting directories from a list of objects to extract them from real-obj-X instead of obj-X.
This should not cause any change in behaviour yet as listing directories as components of an object is not currently supported and will cause an error. A future patch will give a useful meaning to directories listed in componsite objects.
A consequence of this change is that any subsequent use of obj-y or obj-m will still have directories listed in it.
There are no subsequent uses of obj-y and only 2 of obj-m.
1/ obj-m is included as a dependency of __build. subdir-ym, which
contains all the directories mentioned in obj-m, is also a dependency, so this won't change the set of final dependencies.
2/ Any rule that builds a directory listed in obj-m will find that
quite_modtag has the value '[M]'. As quiet_modtag is not used when descending into directories, this is of no consequence.
--- scripts/Makefile.lib | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
scripts/Makefile.lib +19 -19
@@ -25,36 +25,36 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # and -m subdirs. Just put -y's first. modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object +multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) +multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) +multi-used := $(multi-used-y) $(multi-used-m) +single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) + +# Replace multi-part objects by their individual parts, +# including built-in.a from subdirectories +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) +real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) + # Handle objects in subdirs # --------------------------------------------------------------------------- -# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a +# o if we encounter foo/ in $(real-obj-y), replace it by foo/built-in.a # and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) +# o if we encounter foo/ in $(real-obj-m), remove it from $(real-obj-m) # and add the directory to the list of dirs to descend into: $(subdir-m) -__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +__subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) -__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +__subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) -obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) -obj-m := $(filter-out %/, $(obj-m)) +real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) +real-obj-m := $(filter-out %/, $(real-obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) -# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) -multi-used := $(multi-used-y) $(multi-used-m) -single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) - -# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to +# $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend -subdir-obj-y := $(filter %/built-in.a, $(obj-y)) - -# Replace multi-part objects by their individual parts, -# including built-in.a from subdirectories -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) +subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
PATCH 2/24 kbuild: treat a directory listed in a composite object as foo/mod.a
In reply to NeilBrownCurrently a directory is not permitted in a composite object.
This patch changes kbuild so that a directory it assumed to mean the file "mod.a" in that directory.
The file cannot, yet, be created, so this does not yet affect behaviour.
There are several parts to this.
1/ strip out all the directories from obj-m so that
the directories that appear in real-obj-m must be parts of composite objects
2/ translate those directories from foo/ to foo/mod.a
at the same time that obj-y directories becomes foo/built-in.a
3/ hold list of directories needed for modules in subdir-obj-m
so that we can descend into them as required.
4/ We need a little "dance" in "Rule to link composite objects"
where we strip the mod.a back off - so we can filter against the foo-{objs,y,m} macros, then add it back on for declaring dependencies.
As part of this, multi_depend gains an extra argument being the name to append to any directory.
--- scripts/Makefile.build | 15 ++++++++------- scripts/Makefile.lib | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 11 deletions(-)
scripts/Makefile.build +8 -7
@@ -412,8 +412,9 @@ endif $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) -targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) -targets += $(extra-y) $(MAKECMDGOALS) $(always) +targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) +targets += $(filter-out $(subdir-obj-m), $(real-obj-m)) +targets += $(lib-y) $(extra-y) $(MAKECMDGOALS) $(always) # Linker scripts preprocessor (.lds.S -> .lds) # ---------------------------------------------------------------------------
@@ -437,7 +438,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # --------------------------------------------------------------------------- # To build objects in subdirs, we need to descend into the directories -$(sort $(subdir-obj-y)): $(subdir-ym) ; +$(sort $(subdir-obj-y) $(subdir-obj-m)): $(subdir-ym) ; # # Rule to compile a set of .o files into one .o file
@@ -522,16 +523,16 @@ link_multi_deps = \ $(filter $(addprefix $(obj)/, \ $($(subst $(obj)/,,$(@:.o=-objs))) \ $($(subst $(obj)/,,$(@:.o=-y))) \ -$($(subst $(obj)/,,$(@:.o=-m)))), $^) +$($(subst $(obj)/,,$(@:.o=-m)))), $(patsubst %/mod.a,%/,$^)) quiet_cmd_link_multi-m = LD [M] $@ -cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) +cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(patsubst %/, --whole-archive %/mod.a --no-whole-archive ,$(link_multi_deps)) $(cmd_secanalysis) $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(link_multi_deps); \ + @{ echo $(@:.o=.ko); echo $(patsubst %/,%/mod.a,$(link_multi_deps)); \ $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) -$(call multi_depend, $(multi-used-m), .o, -objs -y -m) +$(call multi_depend, $(multi-used-m), .o, -objs -y -m,mod.a) targets += $(multi-used-m) targets := $(filter-out $(PHONY), $(targets))
scripts/Makefile.lib +15 -4
@@ -12,6 +12,13 @@ KBUILD_CFLAGS += $(subdir-ccflags-y) # Figure out what we need to build from the various variables # =========================================================================== +# Directories in obj-m only cause that directory to be descended, which +# is exactly what happens for directories in obj-y. So move all +# directories from obj-m to obj-y. Then we will know that any directory +# in real-obj-m is a component of some other object. +obj-y := $(obj-y) $(filter %/, $(obj-m)) +obj-m := $(filter-out %/, $(obj-m)) + # When an object is listed to be built compiled-in and modular, # only build the compiled-in version obj-m := $(filter-out $(obj-y),$(obj-m))
@@ -40,14 +47,14 @@ real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) # --------------------------------------------------------------------------- # o if we encounter foo/ in $(real-obj-y), replace it by foo/built-in.a # and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(real-obj-m), remove it from $(real-obj-m) +# o if we encounter foo/ in $(real-obj-m), replace it by foo/mod.a # and add the directory to the list of dirs to descend into: $(subdir-m) __subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) -real-obj-m := $(filter-out %/, $(real-obj-m)) +real-obj-m := $(patsubst %/, %/mod.a, $(real-obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m))
@@ -55,6 +62,9 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) # $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) +# $(subdir-obj-m) is the list of objects in $(real-obj-m) which uses dir/ to +# tell kbuild to descend +subdir-obj-m := $(filter %/mod.a, $(real-obj-m)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -70,6 +80,7 @@ modorder := $(addprefix $(obj)/,$(modorder)) obj-m := $(addprefix $(obj)/,$(obj-m)) lib-y := $(addprefix $(obj)/,$(lib-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) +subdir-obj-m := $(addprefix $(obj)/,$(subdir-obj-m)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m))
@@ -172,11 +183,11 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ # Useful for describing the dependency of composite objects # Usage: -# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) +# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add, object_in_directories) define multi_depend $(foreach m, $(notdir $1), \ $(eval $(obj)/$m: \ - $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) + $(addprefix $(obj)/, $(patsubst %/,%/$4,$(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))) endef # LEX
PATCH 3/24 kbuild: support building of per-directory mod.a
In reply to NeilBrownThis patch allows a "mod.a" to be built in any
directory. A previous patch allows that mod.a
to be included in any module or another mod.a.
This is achieved via a new pair of macros: modobj-y and modobj-m.
Anything in modobj-y is added to obj-y and is otherwise ignored.
Anything listed in modobj-m is built, almost as though "modobj.o" was a requested target. The objects are then combined
into mod.a.
These objects are always built with part-of-module=y.
This is sufficient to build a module from source in multiple directories. Each "other" directory lists something like
modobj-$(CONFIG_FOO) += bar.o bar.o bat.o
and the main directory lists
obj-$(CONFIG-FOO) = foo.o
foo-y = other1/ ../friend/other2/ module.o
--- scripts/Makefile.build | 44 +++++++++++++++++++++++++++++++++----------- scripts/Makefile.lib | 14 ++++++++++---- 2 files changed, 43 insertions(+), 15 deletions(-)
scripts/Makefile.build +33 -11
@@ -15,6 +15,8 @@ obj-y := obj-m := lib-y := lib-m := +modobj-y := +modobj-m := always := targets := subdir-y :=
@@ -80,12 +82,16 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) builtin-target := $(obj)/built-in.a endif +ifneq ($(strip $(modobj-m)),) +modobj-target := $(obj)/mod.a +endif + modorder-target := $(obj)/modules.order # We keep a list of all modules in $(MODVERDIR) __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target) $(modobj-target)) \ $(subdir-ym) $(always) @:
@@ -119,17 +125,19 @@ modkern_cflags = \ $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) quiet_modtag := $(empty) $(empty) -$(real-obj-m) : part-of-module := y -$(real-obj-m:.o=.i) : part-of-module := y -$(real-obj-m:.o=.s) : part-of-module := y -$(real-obj-m:.o=.lst): part-of-module := y +_mod_obj = $(real-obj-m) $(real-modobj-m) + +$(_mod_obj) : part-of-module := y +$(_mod_obj:.o=.i) : part-of-module := y +$(_mod_obj:.o=.s) : part-of-module := y +$(_mod_obj:.o=.lst): part-of-module := y -$(real-obj-m) : quiet_modtag := [M] -$(real-obj-m:.o=.i) : quiet_modtag := [M] -$(real-obj-m:.o=.s) : quiet_modtag := [M] -$(real-obj-m:.o=.lst): quiet_modtag := [M] +$(_mod_obj) : quiet_modtag := [M] +$(_mod_obj:.o=.i) : quiet_modtag := [M] +$(_mod_obj:.o=.s) : quiet_modtag := [M] +$(_mod_obj:.o=.lst): quiet_modtag := [M] -$(obj-m) : quiet_modtag := [M] +$(obj-m) : quiet_modtag := [M] quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
@@ -413,7 +421,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) -targets += $(filter-out $(subdir-obj-m), $(real-obj-m)) +targets += $(filter-out $(subdir-obj-m) $(real-modobj-m), $(real-obj-m)) targets += $(lib-y) $(extra-y) $(MAKECMDGOALS) $(always) # Linker scripts preprocessor (.lds.S -> .lds)
@@ -509,6 +517,20 @@ targets += $(obj)/lib-ksyms.o endif +ifdef modobj-target + +quiet_cmd_ar_modobj = AR $@ + cmd_ar_modobj = rm -f $@; \ + $(AR) rcTP$(KBUILD_ARFLAGS) $@ $(filter $(real-modobj-m), $^) + +$(modobj-target): $(real-modobj-m) FORCE + $(call if_changed,ar_modobj) + +targets += $(modobj-target) + +endif # modobj-target + + # # Rule to link composite objects #
scripts/Makefile.lib +10 -4
@@ -16,12 +16,13 @@ KBUILD_CFLAGS += $(subdir-ccflags-y) # is exactly what happens for directories in obj-y. So move all # directories from obj-m to obj-y. Then we will know that any directory # in real-obj-m is a component of some other object. -obj-y := $(obj-y) $(filter %/, $(obj-m)) +obj-y := $(obj-y) $(filter %/, $(obj-m)) $(filter-out $(obj-y), $(modobj-y)) obj-m := $(filter-out %/, $(obj-m)) # When an object is listed to be built compiled-in and modular, # only build the compiled-in version obj-m := $(filter-out $(obj-y),$(obj-m)) +modobj-m := $(filter-out $(obj-y), $(modobj-m)) # Libraries are always collected in one lib file. # Filter out objects already built-in
@@ -42,6 +43,7 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) # including built-in.a from subdirectories real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) +real-modobj-m := $(foreach m, $(modobj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) # Handle objects in subdirs # ---------------------------------------------------------------------------
@@ -53,8 +55,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) +__subdir-mo := $(patsubst %/,%,$(filter %/, $(real-modobj-m))) +subdir-m += $(__subdir-mo) real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) real-obj-m := $(patsubst %/, %/mod.a, $(real-obj-m)) +real-modobj-m := $(patsubst %/, %/mod.a, $(real-modobj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m))
@@ -62,9 +67,9 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) # $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) -# $(subdir-obj-m) is the list of objects in $(real-obj-m) which uses dir/ to -# tell kbuild to descend -subdir-obj-m := $(filter %/mod.a, $(real-obj-m)) +# $(subdir-obj-m) is the list of objects in $(real-obj-m) and +# $(real-modobj-m) which use dir/ to tell kbuild to descend +subdir-obj-m := $(filter %/mod.a, $(real-obj-m) $(real-modobj-m)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -83,6 +88,7 @@ subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) subdir-obj-m := $(addprefix $(obj)/,$(subdir-obj-m)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) +real-modobj-m := $(addprefix $(obj)/,$(real-modobj-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
PATCH 4/24 kbuild: disable KBUILD_MODNAME when building for mod.a
In reply to NeilBrownWhen building an object to be included in mod.a we cannot know the name of the module. So don't define KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error.
--- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.lib +2 -2
@@ -96,7 +96,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. -modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used) modobj.o,\ $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
@@ -106,7 +106,7 @@ modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) # end up in (or would, if it gets compiled in) name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) -modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) +modname_flags = $(if $(filter-out modobj,$(modname)),-DKBUILD_MODNAME=$(call name-fix,$(modname))) orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o)
PATCH 5/24 kbuild: Add documentation for modobj-m
In reply to NeilBrownAdd documentation for building modules
from multiple directories using modobj-m.
--- Documentation/kbuild/makefiles.txt | 65 ++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-)
Documentation/kbuild/makefiles.txt +61 -4
@@ -225,17 +225,74 @@ more details, with real examples. part of the composite object ext2.o if $(CONFIG_EXT2_FS_XATTR) evaluates to 'y'. + If you wish to include code in some other directory into a + module, that directory should be configured to create a + mod.a target from the relevant code, as described below. + The list of components for the module (e.g. foo-y) should + then contain the name of the directory (with trailing /). + The mod.a from that directory will be built and included + into this module. + Note: Of course, when you are building objects into the kernel, the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, kbuild will build an ext2.o file for you out of the individual parts and then link this into built-in.a, as you would expect. ---- 3.4 Objects which export symbols +--- 3.4 Loadable modules from multiple directories - modobj-m + + One way to build modules with source from multiple directories + is to list relative path names of all source files in a + single Makefile. + + Example: + btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \ + tests/extent-buffer-tests.o tests/btrfs-tests.o \ + .... + + This works, but defeats the ability to build individual + directories, or individual target files such as assembly + language targets. + + Example: + make btrfs/tests/free-space-tests.s + + A more general way is to create a mod.a file using modobj-m + + Example: + modobj-$(CONFIG_LUSTRE_FS) += fid_request.o fid_lib.o lproc_fid.o + + modobj-y is treated identically to obj-y so if CONFIG_LUSTRE_FS=y + then these objects are built in to the kernel. If + CONFIG_LUSTRE_FS=m then these objects are gathered into an archive + called mod.a. Archives from other directories can be included + by listing the directories in modobj-m, so + + Example: + modobj-$(CONFIG_LUSTRE_FS) += fid/ fld/ + + This will create a mod.a in the same directory as the + Makefile, combining the contents of mod.a from the listed + directories. The mod.a can instead be included into a module + by listing the directory with any other local object files. + + Example: + obj-$(CONFIG_LUSTRE_FS) += lustre.o + lustre-y := module.o + lustre-y += obdclass/ ldlm/ ptlrpc/ fld/ osc/ mgc/ + + When CONFIG_LUSTRE_FS=m, kbuild will build lustre.ko from module.o and + the mod.a archives created in the listed directories. + + When components of a module are built in a different directory + kbuild cannot determine the name of the module so the + KBUILD_MODNAME macro is left undefined. + +--- 3.5 Objects which export symbols No special notation is required in the makefiles for modules exporting symbols. ---- 3.5 Library file goals - lib-y +--- 3.6 Library file goals - lib-y Objects listed with obj-* are used for modules, or combined in a built-in.a for that specific directory.
@@ -263,7 +320,7 @@ more details, with real examples. Use of lib-y is normally restricted to lib/ and arch/*/lib. ---- 3.6 Descending down in directories +--- 3.7 Descending down in directories A Makefile is only responsible for building objects in its own directory. Files in subdirectories should be taken care of by
@@ -290,7 +347,7 @@ more details, with real examples. names. This allows kbuild to totally skip the directory if the corresponding CONFIG_ option is neither 'y' nor 'm'. ---- 3.7 Compilation flags +--- 3.8 Compilation flags ccflags-y, asflags-y and ldflags-y These three flags apply only to the kbuild makefile in which they
PATCH 6/24 lustre: build ldlm in the ldlm directory.
In reply to NeilBrownldlm code is currently build from the ptlrpc directory, with files listed in the Makefile of that directory. This is because both need to be in the same module. This make partial builds such as
make drivers/staging/lustre/lustre/ldlm/
ineffective.
kbuild recently gained the ability to build modules from multiple directories. Use that ability to allow ldlm code to be built in the correct directory.
Note that we need to set KBUILD_MODNAME for ldlm to build correctly.
--- drivers/staging/lustre/lustre/ldlm/Makefile | 11 +++++++++++ drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 +++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile
drivers/staging/lustre/lustre/ldlm/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +ccflags-y += -I$(srctree)/drivers/staging/lustre/include +ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include +ccflags-y += -DKBUILD_MODNAME='"ptlrpc"' + +modobj-$(CONFIG_LUSTRE_FS) += l_lock.o ldlm_lock.o +modobj-$(CONFIG_LUSTRE_FS) += ldlm_resource.o ldlm_lib.o +modobj-$(CONFIG_LUSTRE_FS) += ldlm_plain.o ldlm_extent.o +modobj-$(CONFIG_LUSTRE_FS) += ldlm_request.o ldlm_lockd.o +modobj-$(CONFIG_LUSTRE_FS) += ldlm_flock.o ldlm_inodebits.o +modobj-$(CONFIG_LUSTRE_FS) += ldlm_pool.o
drivers/staging/lustre/lustre/ptlrpc/Makefile +3 -9
@@ -3,20 +3,14 @@ ccflags-y += -I$(srctree)/drivers/staging/lustre/include ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include obj-$(CONFIG_LUSTRE_FS) += ptlrpc.o -LDLM := ../../lustre/ldlm/ -ldlm_objs := $(LDLM)l_lock.o $(LDLM)ldlm_lock.o -ldlm_objs += $(LDLM)ldlm_resource.o $(LDLM)ldlm_lib.o -ldlm_objs += $(LDLM)ldlm_plain.o $(LDLM)ldlm_extent.o -ldlm_objs += $(LDLM)ldlm_request.o $(LDLM)ldlm_lockd.o -ldlm_objs += $(LDLM)ldlm_flock.o $(LDLM)ldlm_inodebits.o -ldlm_objs += $(LDLM)ldlm_pool.o -ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o +ptlrpc_objs += ../ldlm/ +ptlrpc_objs += client.o recover.o connection.o niobuf.o pack_generic.o ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o ptlrpc_objs += llog_net.o llog_client.o import.o ptlrpcd.o ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o ptlrpc_objs += sec.o sec_bulk.o sec_gc.o sec_config.o ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o -ptlrpc-y := $(ldlm_objs) $(ptlrpc_objs) sec_lproc.o +ptlrpc-y := $(ptlrpc_objs) sec_lproc.o ptlrpc-$(CONFIG_LUSTRE_TRANSLATE_ERRNOS) += errno.o
PATCH 7/24 lustre: merge libcfs module into lnet.
In reply to NeilBrownWe want to ultimately make libcfs disappear. This step makes the module disappear - all libcfs code is now included in the lnet module.
This mean the lnet module_init function needs to call lnet_init(). Also the module parameters have changed names so we need to update the links from debugs.
--- drivers/staging/lustre/lnet/Makefile | 7 ++++++- drivers/staging/lustre/lnet/libcfs/Makefile | 5 ++--- drivers/staging/lustre/lnet/libcfs/module.c | 26 +++++++++----------------- drivers/staging/lustre/lnet/lnet/Makefile | 11 +++++------ drivers/staging/lustre/lnet/lnet/module.c | 9 +++++++++ 5 files changed, 31 insertions(+), 27 deletions(-)
drivers/staging/lustre/lnet/Makefile +6 -1
@@ -1 +1,6 @@ -obj-$(CONFIG_LNET) += libcfs/ lnet/ klnds/ selftest/ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_LNET) += klnds/ selftest/ +obj-$(CONFIG_LNET) += lnet.o + +lnet-y = libcfs/ lnet/
drivers/staging/lustre/lnet/libcfs/Makefile +2 -3
@@ -1,8 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 ccflags-y += -I$(srctree)/drivers/staging/lustre/include ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include - -obj-$(CONFIG_LNET) += libcfs.o +ccflags-y += -DKBUILD_MODNAME='"lnet"' libcfs-obj-y += linux-tracefile.o linux-debug.o libcfs-obj-y += linux-crypto.o
@@ -13,4 +12,4 @@ libcfs-obj-y += libcfs_string.o hash.o libcfs-obj-$(CONFIG_SMP) += libcfs_cpu.o libcfs-obj-y += libcfs_mem.o libcfs_lock.o -libcfs-objs := $(libcfs-obj-y) +modobj-$(CONFIG_LNET) += $(libcfs-obj-y)
drivers/staging/lustre/lnet/libcfs/module.c +9 -17
@@ -513,19 +513,19 @@ static struct ctl_table lnet_table[] = {static const struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = { {"console_ratelimit" , -"/sys/module/libcfs/parameters/libcfs_console_ratelimit" }, +"/sys/module/lnet/parameters/libcfs_console_ratelimit" }, {"debug_path" , -"/sys/module/libcfs/parameters/libcfs_debug_file_path" }, +"/sys/module/lnet/parameters/libcfs_debug_file_path" }, {"panic_on_lbug" , -"/sys/module/libcfs/parameters/libcfs_panic_on_lbug" }, +"/sys/module/lnet/parameters/libcfs_panic_on_lbug" }, {"libcfs_console_backoff" , -"/sys/module/libcfs/parameters/libcfs_console_backoff" }, +"/sys/module/lnet/parameters/libcfs_console_backoff" }, {"debug_mb" , -"/sys/module/libcfs/parameters/libcfs_debug_mb" }, +"/sys/module/lnet/parameters/libcfs_debug_mb" }, {"console_min_delay_centisecs" , -"/sys/module/libcfs/parameters/libcfs_console_min_delay" }, +"/sys/module/lnet/parameters/libcfs_console_min_delay" }, {"console_max_delay_centisecs" , -"/sys/module/libcfs/parameters/libcfs_console_max_delay" }, +"/sys/module/lnet/parameters/libcfs_console_max_delay" }, {}, };
@@ -688,7 +688,7 @@ int libcfs_setup(void) }EXPORT_SYMBOL (libcfs_setup); -static int libcfs_init (void ) +int libcfs_init (void ) {int rc;
@@ -700,7 +700,7 @@ static int libcfs_init(void)return rc; } -static void libcfs_exit (void ) +void libcfs_exit (void ) {int rc;
@@ -720,11 +720,3 @@ static void libcfs_exit(void)if (rc)pr_err ("LustreError: libcfs_debug_cleanup: %d\n" , rc); } - -MODULE_AUTHOR ("OpenSFS, Inc. <http://www.lustre.org/>" ); -MODULE_DESCRIPTION ("Lustre helper library" ); -MODULE_VERSION (LIBCFS_VERSION ); -MODULE_LICENSE ("GPL" ); - -module_init (libcfs_init); -module_exit (libcfs_exit);
drivers/staging/lustre/lnet/lnet/Makefile +5 -6
@@ -1,10 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 ccflags-y += -I$(srctree)/drivers/staging/lustre/include ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include +ccflags-y += -DKBUILD_MODNAME='"lnet"' -obj-$(CONFIG_LNET) += lnet.o - -lnet-y := api-ni.o config.o nidstrings.o net_fault.o \ - lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o \ - lib-socket.o lib-move.o module.o lo.o \ - router.o router_proc.o acceptor.o peer.o +modobj-$(CONFIG_LNET) += api-ni.o config.o nidstrings.o net_fault.o +modobj-$(CONFIG_LNET) += lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o +modobj-$(CONFIG_LNET) += lib-socket.o lib-move.o module.o lo.o +modobj-$(CONFIG_LNET) += router.o router_proc.o acceptor.o peer.o
drivers/staging/lustre/lnet/lnet/module.c +9 -0
@@ -36,6 +36,9 @@#include <linux/lnet/lib-lnet.h> #include <uapi/linux/lnet/lnet-dlc.h> +int libcfs_init (void ); +void libcfs_exit (void ); +static int config_on_load;module_param (config_on_load, int,0444 );MODULE_PARM_DESC (config_on_load,"configure network at module load" );
@@ -192,6 +195,10 @@ static int __init lnet_init(void) {int rc; + rc =libcfs_init (); +if (rc) +return rc; +mutex_init (&lnet_config_mutex); rc =libcfs_setup ();
@@ -228,12 +235,14 @@ static void __exit lnet_exit(void)LASSERT (!rc);lnet_lib_exit (); +libcfs_exit (); }MODULE_AUTHOR ("OpenSFS, Inc. <http://www.lustre.org/>" );MODULE_DESCRIPTION ("Lustre Networking layer" );MODULE_VERSION (LNET_VERSION );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("libcfs" );module_init (lnet_init);module_exit (lnet_exit);
PATCH 8/24 lustre: use truncate_inode_page in place of truncate_complete_page
In reply to NeilBrownCarrying a local truncate_complete_page() is not good for maintainability. Linux now used truncate_inode_page, so use that instead.
For correct use, we need to pass the mapping to mdc_release_page() rather than trusting page->mapping.
--- .../lustre/include/lustre_patchless_compat.h | 16 ---------------- drivers/staging/lustre/lustre/llite/dir.c | 3 +-- .../staging/lustre/lustre/llite/llite_internal.h | 4 ++-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 ++++++------ 4 files changed, 9 insertions(+), 26 deletions(-)
drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0 -16
@@ -41,22 +41,6 @@#include <linux/hash.h> #include <linux/pagemap.h> -#define ll_delete_from_page_cache (page) delete_from_page_cache(page) - -static inline void -truncate_complete_page (struct address_space *mapping,struct page *page) -{ -if (page->mapping != mapping) -return ; - -if (PagePrivate (page)) - page->mapping->a_ops->invalidatepage (page,0 ,PAGE_SIZE ); - -cancel_dirty_page (page); -ClearPageMappedToDisk (page); -ll_delete_from_page_cache (page); -} -#ifndef ATTR_CTIME_SET /* * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other
drivers/staging/lustre/lustre/llite/dir.c +1 -2
@@ -167,8 +167,7 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)if (remove) {lock_page (page); -if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +truncate_inode_page (inode->i_mapping, page);unlock_page (page); }put_page (page);
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -938,11 +938,11 @@ static inline void ll_invalidate_page(struct page *vmpage)return ;/* -* truncate_complete_page() calls +* truncate_inode_page() calls * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). */ ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); +truncate_inode_page (mapping, vmpage); }#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)
drivers/staging/lustre/lustre/mdc/mdc_request.c +6 -6
@@ -922,12 +922,12 @@ static int mdc_getpage(struct obd_export *exp, const struct lu_fid *fid,return 0 ; } -static void mdc_release_page (struct page *page,int remove) +static void mdc_release_page (struct address_space *mapping, +struct page *page,int remove) {if (remove) {lock_page (page); -if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +truncate_inode_page (mapping, page);unlock_page (page); }put_page (page);
@@ -981,7 +981,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, offset, *start, *end, *hash);if (*hash > *end) {kunmap (page); -mdc_release_page (page,0 ); +mdc_release_page (mapping, page,0 ); page =NULL ; }else if (*end != *start && *hash == *end) {/*
@@ -991,7 +991,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,* fetch the page we want. */ kunmap (page); -mdc_release_page (page, +mdc_release_page (mapping, page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); page =NULL ; }
@@ -1365,7 +1365,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data,return rc; fail:kunmap (page); -mdc_release_page (page,1 ); +mdc_release_page (mapping, page,1 ); rc = -EIO ; goto out_unlock; }
James Simmons
NAKPATCH 8/24 lustre: use truncate_inode_page in place of truncate_complete_page
Quoted 6 lines
Carrying a local
truncate_complete_page()is not good for maintainability. Linux now usedtruncate_inode_page, so use that instead.
For correct use, we need to pass the mapping tomdc_release_page()rather than trustingpage->mapping.
Nak: truncate_inode_page is not exported so it fails to build when lustre is configured as a module.
Quoted 117 lines
Signed-off-by NeilBrown <[email protected]>--- .../lustre/include/lustre_patchless_compat.h | 16 ---------------- drivers/staging/lustre/lustre/llite/dir.c | 3 +-- .../staging/lustre/lustre/llite/llite_internal.h | 4 ++-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 ++++++------ 4 files changed, 9 insertions(+), 26 deletions(-)drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0
-16@@ -41,22 +41,6 @@#include <linux/hash.h> #include <linux/pagemap.h> -#define ll_delete_from_page_cache (page) delete_from_page_cache(page) - -static inline void -truncate_complete_page (struct address_space *mapping,struct page *page) -{ -if (page->mapping != mapping) -return ; - -if (PagePrivate (page)) - page->mapping->a_ops->invalidatepage (page,0 ,PAGE_SIZE ); - -cancel_dirty_page (page); -ClearPageMappedToDisk (page); -ll_delete_from_page_cache (page); -} -#ifndef ATTR_CTIME_SET /* * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other drivers/staging/lustre/lustre/llite/dir.c +1
-2@@ -167,8 +167,7 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)if (remove) {lock_page (page); -if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +truncate_inode_page (inode->i_mapping, page);unlock_page (page); }put_page (page);drivers/staging/lustre/lustre/llite/llite_internal.h +2
-2@@ -938,11 +938,11 @@ static inline void ll_invalidate_page(struct page *vmpage)return ;/* -* truncate_complete_page() calls +* truncate_inode_page() calls * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). */ ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); +truncate_inode_page (mapping, vmpage); }#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)drivers/staging/lustre/lustre/mdc/mdc_request.c +6
-6@@ -922,12 +922,12 @@ static int mdc_getpage(struct obd_export *exp, const struct lu_fid *fid,return 0 ; } -static void mdc_release_page (struct page *page,int remove) +static void mdc_release_page (struct address_space *mapping, +struct page *page,int remove) {if (remove) {lock_page (page); -if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +truncate_inode_page (mapping, page);unlock_page (page); }put_page (page);@@ -981,7 +981,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, offset, *start, *end, *hash);if (*hash > *end) {kunmap (page); -mdc_release_page (page,0 ); +mdc_release_page (mapping, page,0 ); page =NULL ; }else if (*end != *start && *hash == *end) {/* @@ -991,7 +991,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash,* fetch the page we want. */ kunmap (page); -mdc_release_page (page, +mdc_release_page (mapping, page,le32_to_cpu (dp->ldp_flags) &LDF_COLLIDE ); page =NULL ; }@@ -1365,7 +1365,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data,return rc; fail:kunmap (page); -mdc_release_page (page,1 ); +mdc_release_page (mapping, page,1 ); rc = -EIO ; goto out_unlock; }
PATCH 8/24 lustre: use truncate_inode_page in place of truncate_complete_page
Quoted 8 lines · James Simmons
Quoted 5 lines
Carrying a local
truncate_complete_page()is not good for maintainability. Linux now usedtruncate_inode_page, so use that instead.
For correct use, we need to pass the mapping tomdc_release_page()rather than trustingpage->mapping.Nak:
truncate_inode_pageis not exported so it fails to build when lustre is configured as a module.
Bother, nor it is.
We could probably use truncate_inode_pages_range() but it isn't a perfect fit, which seems to suggest that lustre is trying to do something that no other filesystem finds the need to do. I'll dig deeper and work out what is really going on.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180616/0991e7c2/attachment.sig>
PATCH 8/24 lustre: use truncate_inode_page in place of truncate_complete_page
Quoted 11 lines · NeilBrown
Quoted 6 lines · James Simmons
Quoted 5 lines
Carrying a local
truncate_complete_page()is not good for maintainability. Linux now usedtruncate_inode_page, so use that instead.
For correct use, we need to pass the mapping tomdc_release_page()rather than trustingpage->mapping.
Quoted 8 lines
Quoted 2 lines
Nak:
truncate_inode_pageis not exported so it fails to build when lustre is configured as a module.Bother, nor it is.
We could probably usetruncate_inode_pages_range()but it isn't a perfect fit, which seems to suggest that lustre is trying to do something that no other filesystem finds the need to do. I'll dig deeper and work out what is really going on.
Lustre evicts pages from mapping when the lock that covers the pages
is canceled.
Normally this only applies to data pages, and I see this is in mdc which is for metadata.
For metadata the only pages we hold are readdir pages and the lock currently covers entire dir so lock cancelation should not need this.
So looking at the code the other two users are readdir where we failed to populate page somehow and now need to throw it out and then a collision event for hashes, it appears. Both of these should apply to other filesystems I am sure.
PATCH 8/24 lustre: use truncate_inode_page in place of truncate_complete_page
Quoted 19 lines · Oleg Drokin
Quoted 10 lines · NeilBrown
Quoted 6 lines · James Simmons
Quoted 5 lines
Carrying a local
truncate_complete_page()is not good for maintainability. Linux now usedtruncate_inode_page, so use that instead.
For correct use, we need to pass the mapping tomdc_release_page()rather than trustingpage->mapping.Quoted 8 lines
Quoted 2 lines
Nak:
truncate_inode_pageis not exported so it fails to build when lustre is configured as a module.Bother, nor it is.
We could probably usetruncate_inode_pages_range()but it isn't a perfect fit, which seems to suggest that lustre is trying to do something that no other filesystem finds the need to do. I'll dig deeper and work out what is really going on.
Quoted 3 lines
Lustre evicts pages from mapping when the lock that covers the pages
is canceled.
Normally this only applies to data pages, and I see this is in mdc which is for metadata.
The invalidation of data pages is presumably where vvp_page_discard() calls ll_invalidate_page() [which is not the same as ll_invalidatepage() :-( ]
ll_invalidate_page does almost exactly the same as truncate_inode_page(), which isn't exported. We cannot just call
truncate_inode_pages_range(page->mapping,
page->index<<PAGE_SHIFT, page->index<<PAGE_SHIFT + 1);
as that will try to lock the page, which is already locked.
We could use generic_error_remove_page() instead (that is exported). This condition isn't exactly an error, but it is a situation where memory soon will not contain correct data.
afs uses this in afs_kill_pages() though the purpose is different.
cepfs uses it in writepages_finish in a context described as:
/*
* We lost the cache cap, need to truncate the page before
* it is unlocked, otherwise we'd truncate it later in the
* page truncation thread, possibly losing some data that
* raced its way in
*/
which sounds similar to what lustre is doing.
NFS can only lose a lock (delegation) on the whole file, not for individual pages, so it just invalidates a range.
I think I'd like to change lustre to use generic_error_remove_page instead of ll_invalidate_page() - for S_ISREG mappings.
Quoted 7 lines
For metadata the only pages we hold are readdir pages and the lock currently covers entire dir so lock cancelation should not need this.
So looking at the code the other two users are readdir where we failed to populate page somehow and now need to throw it out and then a collision event for hashes, it appears. Both of these should apply to other filesystems I am sure.
In the directory case there is no invalidatepage operation, so the current truncate_complete_page() function just does:
cancel_dirty_page(page);
ClearPageMappedToDisk(page);
ll_delete_from_page_cache(page);I'd guess that lustre directory pages don't get PageMappedToDisk set, and in this situation there aren't dirty.
So this just boils down to
delete_from_page_cache(page)
Do you know if my guesses are correct? If they are, lets just use delete_from_page_cache() for unwanted directory pages.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180618/b06cae4e/attachment.sig>
PATCH 1/3 lustre: use generic_error_remove_page()
lustre's internal ll_invalidate_page() is behaviourally identical to generic_error_remove_page().
In the case of lustre it isn't a memory hardware error that requires the page being invalidated, it is the loss of a lock, which will like result in the data changing on the server.
In either case, we don't want the page to be accessed any more, so the same removal is appropriate.
---
I've replaced
[PATCH 08/24] lustre: use truncate_inode_page in place of truncate_complete_page
with 3 patches, this and the next two.
Thanks,
NeilBrown
drivers/staging/lustre/lustre/llite/llite_internal.h | 17 ----------------- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -17
@@ -928,23 +928,6 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,struct vm_area_struct *our_vma (struct mm_struct *mm,unsigned long addr,size_t count); -static inline void ll_invalidate_page (struct page *vmpage) -{ -struct address_space *mapping = vmpage->mapping; -loff_t offset = vmpage->index <<PAGE_SHIFT ; - -LASSERT (PageLocked (vmpage)); -if (!mapping) -return ; - -/* -* truncate_complete_page() calls -* a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). -*/ -ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); -} -#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)/* don't need an addref as the sb_info should be holding one */
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -1
@@ -1098,7 +1098,7 @@ static int vvp_io_fault_start(const struct lu_env *env,LASSERT (PageLocked (vmpage));if (OBD_FAIL_CHECK (OBD_FAIL_LLITE_FAULT_TRUNC_RACE )) -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); size =i_size_read (inode);/* Though we have already held a cl_lock upon this page, but
drivers/staging/lustre/lustre/llite/vvp_page.c +1 -1
@@ -147,7 +147,7 @@ static void vvp_page_discard(const struct lu_env *env,if (vpg->vpg_defer_uptodate && !vpg->vpg_ra_used)ll_ra_stats_inc (vmpage->mapping->host,RA_STAT_DISCARDED ); -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); } static void vvp_page_delete(const struct lu_env *env,
Signature · 9 lines
2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/20e31790/attachment-0001.sig>
PATCH 2/3 lustre: use delete_from_page_cache() for directory pages.
lustre sometimes uses the internal function truncate_complete_page() to remove a page of a directory.
Must of what this function does, does not apply to directory pages as there is no invalidatepage function, and at these times, the page is not dirty.
The only useful part of the function is delete_from_page_cache(), so just call that directly.
--- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/dir.c +1 -1
@@ -168,7 +168,7 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
@@ -927,7 +927,7 @@ static void mdc_release_page(struct page *page, int remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);
Signature · 9 lines
2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/9f5eb849/attachment.sig>
PATCH 3/3 lustre: discard truncate_complete_page()
This function is no longer used, so remove it.
--- .../lustre/lustre/include/lustre_patchless_compat.h | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0 -16
@@ -41,22 +41,6 @@#include <linux/hash.h> #include <linux/pagemap.h> -#define ll_delete_from_page_cache (page) delete_from_page_cache(page) - -static inline void -truncate_complete_page (struct address_space *mapping,struct page *page) -{ -if (page->mapping != mapping) -return ; - -if (PagePrivate (page)) - page->mapping->a_ops->invalidatepage (page,0 ,PAGE_SIZE ); - -cancel_dirty_page (page); -ClearPageMappedToDisk (page); -ll_delete_from_page_cache (page); -} -#ifndef ATTR_CTIME_SET /* * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other
Signature · 9 lines
2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/bb5e4e4c/attachment.sig>
PATCH 3/3 lustre: discard truncate_complete_page()
Quoted 2 lines
This function is no longer used, so remove it.
Quoted 36 lines
Signed-off-by NeilBrown <[email protected]>--- .../lustre/lustre/include/lustre_patchless_compat.h | 16 ---------------- 1 file changed, 16 deletions(-)drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0
-16@@ -41,22 +41,6 @@#include <linux/hash.h> #include <linux/pagemap.h> -#define ll_delete_from_page_cache (page) delete_from_page_cache(page) - -static inline void -truncate_complete_page (struct address_space *mapping,struct page *page) -{ -if (page->mapping != mapping) -return ; - -if (PagePrivate (page)) - page->mapping->a_ops->invalidatepage (page,0 ,PAGE_SIZE ); - -cancel_dirty_page (page); -ClearPageMappedToDisk (page); -ll_delete_from_page_cache (page); -} -#ifndef ATTR_CTIME_SET /* * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other Signature · 1 line
2.14.0.rc0.dirty
PATCH 2/3 lustre: use delete_from_page_cache() for directory pages.
In reply to NeilBrownQuoted 12 lines · NeilBrown
lustre sometimes uses the internal function
truncate_complete_page()to remove a page of a directory.
Must of what this function does, does not apply to directory pages as there is no invalidatepage function, and at these times, the page is not dirty.The only useful part of the function is
delete_from_page_cache(), so just call that directly.
I guess this is also fine since we indeed do not have dirty directory pages in Lustre
Quoted 36 lines
Signed-off-by NeilBrown <[email protected]>---
drivers/staging/lustre/lustre/llite/dir.c| 2 +-drivers/staging/lustre/lustre/mdc/mdc_request.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +1
-1@@ -168,7 +168,7 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);drivers/staging/lustre/lustre/mdc/mdc_request.c +1
-1@@ -927,7 +927,7 @@ static void mdc_release_page(struct page *page, int remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);Signature · 1 line
2.14.0.rc0.dirty
PATCH 2/3 lustre: use delete_from_page_cache() for directory pages.
In reply to NeilBrownQuoted 9 lines
lustre sometimes uses the internal function
truncate_complete_page()to remove a page of a directory.
Must of what this function does, does not apply to directory pages as there is no invalidatepage function, and at these times, the page is not dirty.
The only useful part of the function isdelete_from_page_cache(), so just call that directly.
Quoted 36 lines
Signed-off-by NeilBrown <[email protected]>--- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/staging/lustre/lustre/llite/dir.c +1
-1@@ -168,7 +168,7 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);drivers/staging/lustre/lustre/mdc/mdc_request.c +1
-1@@ -927,7 +927,7 @@ static void mdc_release_page(struct page *page, int remove)if (remove) {lock_page (page);if (likely (page->mapping)) -truncate_complete_page (page->mapping, page); +delete_from_page_cache (page);unlock_page (page); }put_page (page);Signature · 1 line
2.14.0.rc0.dirty
PATCH 1/3 lustre: use generic_error_remove_page()
In reply to NeilBrownQuoted 12 lines · NeilBrown
lustre's internal
ll_invalidate_page()is behaviourally identical togeneric_error_remove_page().
In the case of lustre it isn't a memory hardware error that requires the page being invalidated, it is the loss of a lock, which will like result in the data changing on the server.
In either case, we don't want the page to be accessed any more, so the same removal is appropriate.
Quoted 6 lines
Signed-off-by NeilBrown <[email protected]>---
I've replaced
[PATCH 08/24] lustre: usetruncate_inode_pagein place oftruncate_complete_pagewith 3 patches, this and the next two.
This looks reasonable. Are you running any tests on this?
Quoted 67 lines
Thanks,
NeilBrowndrivers/staging/lustre/lustre/llite/llite_internal.h | 17 ----------------- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/llite_internal.h +0
-17@@ -928,23 +928,6 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,struct vm_area_struct *our_vma (struct mm_struct *mm,unsigned long addr,size_t count); -static inline void ll_invalidate_page (struct page *vmpage) -{ -struct address_space *mapping = vmpage->mapping; -loff_t offset = vmpage->index <<PAGE_SHIFT ; - -LASSERT (PageLocked (vmpage)); -if (!mapping) -return ; - -/* -* truncate_complete_page() calls -* a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). -*/ -ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); -} -#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)/* don't need an addref as the sb_info should be holding one */ drivers/staging/lustre/lustre/llite/vvp_io.c +1
-1@@ -1098,7 +1098,7 @@ static int vvp_io_fault_start(const struct lu_env *env,LASSERT (PageLocked (vmpage));if (OBD_FAIL_CHECK (OBD_FAIL_LLITE_FAULT_TRUNC_RACE )) -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); size =i_size_read (inode);/* Though we have already held a cl_lock upon this page, but drivers/staging/lustre/lustre/llite/vvp_page.c +1
-1@@ -147,7 +147,7 @@ static void vvp_page_discard(const struct lu_env *env,if (vpg->vpg_defer_uptodate && !vpg->vpg_ra_used)ll_ra_stats_inc (vmpage->mapping->host,RA_STAT_DISCARDED ); -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); } static void vvp_page_delete(const struct lu_env *env,Signature · 1 line
2.14.0.rc0.dirty
PATCH 1/3 lustre: use generic_error_remove_page()
Quoted 11 lines · Oleg Drokin
Quoted 11 lines · NeilBrown
lustre's internal
ll_invalidate_page()is behaviourally identical togeneric_error_remove_page().
In the case of lustre it isn't a memory hardware error that requires the page being invalidated, it is the loss of a lock, which will like result in the data changing on the server.
In either case, we don't want the page to be accessed any more, so the same removal is appropriate.
Quoted 8 lines
Quoted 6 lines
Signed-off-by NeilBrown <[email protected]>---
I've replaced
[PATCH 08/24] lustre: usetruncate_inode_pagein place oftruncate_complete_pagewith 3 patches, this and the next two.This looks reasonable. Are you running any tests on this?
Just the sanity tests on a 4-node vcluster. They haven't caused any noticeable regressions.
Quoted 2 lines
Acked-by Oleg Drokin <[email protected]>
Thanks,
NeilBrown
Quoted 60 lines
Quoted 60 lines
Thanks,
NeilBrowndrivers/staging/lustre/lustre/llite/llite_internal.h | 17 ----------------- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/llite_internal.h +0
-17@@ -928,23 +928,6 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,struct vm_area_struct *our_vma (struct mm_struct *mm,unsigned long addr,size_t count); -static inline void ll_invalidate_page (struct page *vmpage) -{ -struct address_space *mapping = vmpage->mapping; -loff_t offset = vmpage->index <<PAGE_SHIFT ; - -LASSERT (PageLocked (vmpage)); -if (!mapping) -return ; - -/* -* truncate_complete_page() calls -* a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). -*/ -ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); -} -#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)/* don't need an addref as the sb_info should be holding one */ drivers/staging/lustre/lustre/llite/vvp_io.c +1
-1@@ -1098,7 +1098,7 @@ static int vvp_io_fault_start(const struct lu_env *env,LASSERT (PageLocked (vmpage));if (OBD_FAIL_CHECK (OBD_FAIL_LLITE_FAULT_TRUNC_RACE )) -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); size =i_size_read (inode);/* Though we have already held a cl_lock upon this page, but drivers/staging/lustre/lustre/llite/vvp_page.c +0
-0@@ -147,7 +147,7 @@ static void vvp_page_discard(const struct lu_env *env,if (vpg->vpg_defer_uptodate && !vpg->vpg_ra_used)ll_ra_stats_inc (vmpage->mapping->host,RA_STAT_DISCARDED );
Quoted 8 lines
Quoted 8 lines
drivers/staging/lustre/lustre/llite/vvp_page.c +1
-1-ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); } static void vvp_page_delete(const struct lu_env *env,Signature · 1 line
2.14.0.rc0.dirty
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/a2a1b8c7/attachment.sig>
PATCH 1/3 lustre: use generic_error_remove_page()
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines · NeilBrown
lustre's internal
ll_invalidate_page()is behaviourally identical togeneric_error_remove_page().
In the case of lustre it isn't a memory hardware error that requires the page being invalidated, it is the loss of a lock, which will like result in the data changing on the server.
In either case, we don't want the page to be accessed any more, so the same removal is appropriate.Signed-off-by NeilBrown <[email protected]>---
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
I've replaced
[PATCH 08/24] lustre: usetruncate_inode_pagein place oftruncate_complete_pagewith 3 patches, this and the next two.This looks reasonable. Are you running any tests on this?
Just the sanity tests on a 4-node vcluster. They haven't caused any noticeable regressions.
I also have tested this patch set using a single client node with a stand alone MGS server, 2 MDS servers with 2 MDTs each, and a single OSS server with 2 OST.
Quoted 75 lines
Quoted 2 lines
Acked-by Oleg Drokin <[email protected]>Thanks,
NeilBrownQuoted 68 lines
Quoted 68 lines
Thanks,
NeilBrowndrivers/staging/lustre/lustre/llite/llite_internal.h | 17 ----------------- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/llite_internal.h +0
-17@@ -928,23 +928,6 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,struct vm_area_struct *our_vma (struct mm_struct *mm,unsigned long addr,size_t count); -static inline void ll_invalidate_page (struct page *vmpage) -{ -struct address_space *mapping = vmpage->mapping; -loff_t offset = vmpage->index <<PAGE_SHIFT ; - -LASSERT (PageLocked (vmpage)); -if (!mapping) -return ; - -/* -* truncate_complete_page() calls -* a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). -*/ -ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); -} -#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)/* don't need an addref as the sb_info should be holding one */ drivers/staging/lustre/lustre/llite/vvp_io.c +1
-1@@ -1098,7 +1098,7 @@ static int vvp_io_fault_start(const struct lu_env *env,LASSERT (PageLocked (vmpage));if (OBD_FAIL_CHECK (OBD_FAIL_LLITE_FAULT_TRUNC_RACE )) -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); size =i_size_read (inode);/* Though we have already held a cl_lock upon this page, but drivers/staging/lustre/lustre/llite/vvp_page.c +1
-1@@ -147,7 +147,7 @@ static void vvp_page_discard(const struct lu_env *env,if (vpg->vpg_defer_uptodate && !vpg->vpg_ra_used)ll_ra_stats_inc (vmpage->mapping->host,RA_STAT_DISCARDED ); -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); } static void vvp_page_delete(const struct lu_env *env,Signature · 1 line
2.14.0.rc0.dirty
PATCH 1/3 lustre: use generic_error_remove_page()
In reply to NeilBrownQuoted 8 lines
lustre's internal
ll_invalidate_page()is behaviourally identical togeneric_error_remove_page().
In the case of lustre it isn't a memory hardware error that requires the page being invalidated, it is the loss of a lock, which will like result in the data changing on the server.
In either case, we don't want the page to be accessed any more, so the same removal is appropriate.
Quoted 74 lines
Signed-off-by NeilBrown <[email protected]>---
I've replaced
[PATCH 08/24] lustre: usetruncate_inode_pagein place oftruncate_complete_page
with 3 patches, this and the next two.Thanks,
NeilBrowndrivers/staging/lustre/lustre/llite/llite_internal.h | 17 ----------------- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-)drivers/staging/lustre/lustre/llite/llite_internal.h +0
-17@@ -928,23 +928,6 @@ void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma,struct vm_area_struct *our_vma (struct mm_struct *mm,unsigned long addr,size_t count); -static inline void ll_invalidate_page (struct page *vmpage) -{ -struct address_space *mapping = vmpage->mapping; -loff_t offset = vmpage->index <<PAGE_SHIFT ; - -LASSERT (PageLocked (vmpage)); -if (!mapping) -return ; - -/* -* truncate_complete_page() calls -* a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). -*/ -ll_teardown_mmaps (mapping, offset, offset +PAGE_SIZE ); -truncate_complete_page (mapping, vmpage); -} -#define ll_s2sbi (sb) (s2lsi(sb)->lsi_llsbi)/* don't need an addref as the sb_info should be holding one */ drivers/staging/lustre/lustre/llite/vvp_io.c +1
-1@@ -1098,7 +1098,7 @@ static int vvp_io_fault_start(const struct lu_env *env,LASSERT (PageLocked (vmpage));if (OBD_FAIL_CHECK (OBD_FAIL_LLITE_FAULT_TRUNC_RACE )) -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); size =i_size_read (inode);/* Though we have already held a cl_lock upon this page, but drivers/staging/lustre/lustre/llite/vvp_page.c +1
-1@@ -147,7 +147,7 @@ static void vvp_page_discard(const struct lu_env *env,if (vpg->vpg_defer_uptodate && !vpg->vpg_ra_used)ll_ra_stats_inc (vmpage->mapping->host,RA_STAT_DISCARDED ); -ll_invalidate_page (vmpage); +generic_error_remove_page (vmpage->mapping, vmpage); } static void vvp_page_delete(const struct lu_env *env,Signature · 1 line
2.14.0.rc0.dirty
PATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
In reply to NeilBrownUsing spare bits in iattr.ia_valid is not safe as the bits might get used for some other purpose without us noticing.
lustre currently used 4 spare bit, but they are all defined in different places so this isn't immediately obvious.
This patch brings all those bit definitions together and defined a new op_data field (op_xvalid) to hold the extra validity bits.
It also replaces sa_valid in struct cl_setattr_io with sa_avalid and sa_xvalid. Changing the name is helpful as sa_valid already has another use within lustre.
--- drivers/staging/lustre/lustre/include/cl_object.h | 5 +++- .../staging/lustre/lustre/include/lustre_compat.h | 6 ----- .../lustre/include/lustre_patchless_compat.h | 8 ------- drivers/staging/lustre/lustre/include/obd.h | 7 ++++++ drivers/staging/lustre/lustre/llite/file.c | 12 ++++++---- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 5 +++- .../staging/lustre/lustre/llite/llite_internal.h | 5 +++- drivers/staging/lustre/lustre/llite/llite_lib.c | 21 ++++++++++-------- drivers/staging/lustre/lustre/llite/vvp_io.c | 8 +++---- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 5 +++- drivers/staging/lustre/lustre/lov/lov_io.c | 3 ++- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 13 ++++++----- drivers/staging/lustre/lustre/osc/osc_io.c | 23 ++++++++++---------- 13 files changed, 63 insertions(+), 58 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +3 -2
@@ -1773,7 +1773,8 @@ struct cl_io {struct cl_setattr_io {struct ost_lvb sa_attr;unsigned int sa_attr_flags; -unsigned int sa_valid; +unsigned int sa_avalid; +unsigned int sa_xvalid;int sa_stripe_index;const struct lu_fid *sa_parent_fid; } ci_setattr;
@@ -2304,7 +2305,7 @@ static inline int cl_io_is_mkwrite(const struct cl_io *io)static inline int cl_io_is_trunc (const struct cl_io *io) {return io->ci_type ==CIT_SETATTR && - (io->u.ci_setattr.sa_valid &ATTR_SIZE ); + (io->u.ci_setattr.sa_avalid &ATTR_SIZE ); }struct cl_io *cl_io_top (struct cl_io *io);
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -6
@@ -41,12 +41,6 @@#include <lustre_patchless_compat.h> -/* -* set ATTR_BLOCKS to a high value to avoid any risk of collision with other -* ATTR_* attributes (see bug 13828) -*/ -#define ATTR_BLOCKS (1 << 27) -#define current_ngroups current_cred()->group_info->ngroups#define current_groups current_cred()->group_info->small_block
drivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0 -8
@@ -41,12 +41,4 @@#include <linux/hash.h> #include <linux/pagemap.h> -#ifndef ATTR_CTIME_SET -/* -* set ATTR_CTIME_SET to a high value to avoid any risk of collision with other -* ATTR_* attributes (see bug 13828) -*/ -#define ATTR_CTIME_SET (1 << 28) -#endif -#endif /* LUSTRE_PATCHLESS_COMPAT_H */
drivers/staging/lustre/lustre/include/obd.h +7 -0
@@ -723,6 +723,7 @@ struct md_op_data {/* iattr fields and blocks. */ struct iattr op_attr; +unsigned int op_xvalid;/* eXtra validity flags */ unsigned int op_attr_flags;__u64 op_valid;loff_t op_attr_blocks;
@@ -751,6 +752,12 @@ struct md_op_data {__u32 op_default_stripe_offset; }; +/* Flags for op_xvalid */ +#define OP_ATTR_CTIME_SET (1 << 0) +#define OP_ATTR_BLOCKS (1 << 1) +#define OP_ATTR_OWNEROVERRIDE (1 << 2) +#define OP_ATTR_FLAGS (1 << 3) +struct md_callback { int (*md_blocking_ast)(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
drivers/staging/lustre/lustre/llite/file.c +7 -5
@@ -93,9 +93,10 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data, op_data->op_attr.ia_mtime = inode->i_mtime; op_data->op_attr.ia_ctime = inode->i_ctime; op_data->op_attr.ia_size =i_size_read (inode); - op_data->op_attr.ia_valid |=ATTR_MODE |ATTR_ATIME |ATTR_ATIME_SET | -ATTR_MTIME |ATTR_MTIME_SET | -ATTR_CTIME |ATTR_CTIME_SET ; + op_data->op_attr.ia_valid |= (ATTR_MODE |ATTR_ATIME |ATTR_ATIME_SET | +ATTR_MTIME |ATTR_MTIME_SET | +ATTR_CTIME ); + op_data->op_xvalid |=OP_ATTR_CTIME_SET ; op_data->op_attr_blocks = inode->i_blocks; op_data->op_attr_flags =ll_inode_to_ext_flags (inode->i_flags); op_data->op_handle = och->och_fh;
@@ -161,7 +162,8 @@ static int ll_close_inode_openhandle(struct inode *inode, op_data->op_bias |=MDS_HSM_RELEASE ; op_data->op_data_version = *(__u64 *)data; op_data->op_lease_handle = och->och_lease_handle; - op_data->op_attr.ia_valid |=ATTR_SIZE |ATTR_BLOCKS ; + op_data->op_attr.ia_valid |=ATTR_SIZE ; + op_data->op_xvalid |=OP_ATTR_BLOCKS ;break ;default :
@@ -1906,7 +1908,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,inode_lock (inode); - rc =ll_setattr_raw (file->f_path.dentry, attr, true); + rc =ll_setattr_raw (file->f_path.dentry, attr,0 , true);if (rc == -ENODATA ) rc =0 ;
drivers/staging/lustre/lustre/llite/lcommon_cl.c +3 -2
@@ -80,7 +80,7 @@ u16 cl_inode_fini_refcheck;static DEFINE_MUTEX (cl_inode_fini_guard);int cl_setattr_ost (struct cl_object *obj,const struct iattr *attr, -unsigned int attr_flags) +unsigned int xvalid,unsigned int attr_flags) {struct lu_env *env;struct cl_io *io;
@@ -100,7 +100,8 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, io->u.ci_setattr.sa_attr.lvb_ctime =LTIME_S (attr->ia_ctime); io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size; io->u.ci_setattr.sa_attr_flags = attr_flags; - io->u.ci_setattr.sa_valid = attr->ia_valid; + io->u.ci_setattr.sa_avalid = attr->ia_valid; + io->u.ci_setattr.sa_xvalid = xvalid; io->u.ci_setattr.sa_parent_fid =lu_object_fid (&obj->co_lu); again:
drivers/staging/lustre/lustre/llite/llite_internal.h +3 -2
@@ -805,7 +805,8 @@ void ll_kill_super(struct super_block *sb);struct inode *ll_inode_from_resource_lock (struct ldlm_lock *lock);void ll_dir_clear_lsm_md (struct inode *inode);void ll_clear_inode (struct inode *inode); -int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,bool hsm_import); +int ll_setattr_raw (struct dentry *dentry,struct iattr *attr, +unsigned int xvalid,bool hsm_import);int ll_setattr (struct dentry *de,struct iattr *attr);int ll_statfs (struct dentry *de,struct kstatfs *sfs); int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
@@ -1330,7 +1331,7 @@ int ll_getparent(struct file *file, struct getparent __user *arg);/* lcommon_cl.c */ int cl_setattr_ost (struct cl_object *obj,const struct iattr *attr, -unsigned int attr_flags); +unsigned int xvalid,unsigned int attr_flags);extern struct lu_env *cl_inode_fini_env;extern u16 cl_inode_fini_refcheck;
drivers/staging/lustre/lustre/llite/llite_lib.c +12 -9
@@ -1429,7 +1429,8 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data)* * In case of HSMimport, we only set attr on MDS. */ -int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,bool hsm_import) +int ll_setattr_raw (struct dentry *dentry,struct iattr *attr, +unsigned int xvalid,bool hsm_import) {struct inode *inode =d_inode (dentry);struct ll_inode_info *lli =ll_i2info (inode);
@@ -1470,7 +1471,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)/* We mark all of the fields "set" so MDS/OST does not re-set them */ if (attr->ia_valid &ATTR_CTIME ) { attr->ia_ctime =current_time (inode); - attr->ia_valid |=ATTR_CTIME_SET ; + xvalid |=OP_ATTR_CTIME_SET ; }if (!(attr->ia_valid &ATTR_ATIME_SET ) && (attr->ia_valid &ATTR_ATIME )) {
@@ -1506,12 +1507,13 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)* If we are changing file size, file content is * modified, flag it. */ - attr->ia_valid |=MDS_OPEN_OWNEROVERRIDE ; + xvalid |=OP_ATTR_OWNEROVERRIDE ; op_data->op_bias |=MDS_DATA_MODIFIED ;clear_bit (LLIF_DATA_MODIFIED , &lli->lli_flags); } op_data->op_attr = *attr; + op_data->op_xvalid = xvalid; rc =ll_md_setattr (dentry, op_data);if (rc)
@@ -1532,7 +1534,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)* setting times to past, but it is necessary due to possible * time de-synchronization between MDT inode and OST objects */ - rc =cl_setattr_ost (ll_i2info (inode)->lli_clob, attr,0 ); + rc =cl_setattr_ost (ll_i2info (inode)->lli_clob, + attr, xvalid,0 ); }/*
@@ -1589,10 +1592,11 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)int ll_setattr (struct dentry *de,struct iattr *attr) {int mode =d_inode (de)->i_mode; +unsigned int xvalid =0 ;if ((attr->ia_valid & (ATTR_CTIME |ATTR_SIZE |ATTR_MODE )) == (ATTR_CTIME |ATTR_SIZE |ATTR_MODE )) - attr->ia_valid |=MDS_OPEN_OWNEROVERRIDE ; + xvalid |=OP_ATTR_OWNEROVERRIDE ; if (((attr->ia_valid & (ATTR_MODE | ATTR_FORCE | ATTR_SIZE)) == (ATTR_SIZE | ATTR_MODE)) &&
@@ -1613,7 +1617,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr) !(attr->ia_valid & ATTR_KILL_SGID)) attr->ia_valid |=ATTR_KILL_SGID ; -return ll_setattr_raw (de, attr, false); +return ll_setattr_raw (de, attr, xvalid, false); } int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
@@ -1946,7 +1950,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,return PTR_ERR (op_data); op_data->op_attr_flags = flags; - op_data->op_attr.ia_valid |=ATTR_ATTR_FLAG ; + op_data->op_xvalid |=OP_ATTR_FLAGS ; rc =md_setattr (sbi->ll_md_exp, op_data,NULL ,0 , &req);ll_finish_md_op_data (op_data);ptlrpc_req_finished (req);
@@ -1963,8 +1967,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,if (!attr)return -ENOMEM ; - attr->ia_valid =ATTR_ATTR_FLAG ; - rc =cl_setattr_ost (obj, attr, flags); + rc =cl_setattr_ost (obj, attr,OP_ATTR_FLAGS , flags);kfree (attr);return rc; }
drivers/staging/lustre/lustre/llite/vvp_io.c +4 -4
@@ -556,7 +556,7 @@ static int vvp_io_setattr_lock(const struct lu_env *env,if (new_size ==0 ) enqflags =CEF_DISCARD_DATA ; }else { -unsigned int valid = io->u.ci_setattr.sa_valid; +unsigned int valid = io->u.ci_setattr.sa_avalid;if (!(valid &TIMES_SET_FLAGS ))return 0 ;
@@ -603,11 +603,11 @@ static int vvp_io_setattr_time(const struct lu_env *env,cl_object_attr_lock (obj); attr->cat_ctime = io->u.ci_setattr.sa_attr.lvb_ctime; -if (io->u.ci_setattr.sa_valid &ATTR_ATIME_SET ) { +if (io->u.ci_setattr.sa_avalid &ATTR_ATIME_SET ) { attr->cat_atime = io->u.ci_setattr.sa_attr.lvb_atime; valid |=CAT_ATIME ; } -if (io->u.ci_setattr.sa_valid &ATTR_MTIME_SET ) { +if (io->u.ci_setattr.sa_avalid &ATTR_MTIME_SET ) { attr->cat_mtime = io->u.ci_setattr.sa_attr.lvb_mtime; valid |=CAT_MTIME ; }
@@ -632,7 +632,7 @@ static int vvp_io_setattr_start(const struct lu_env *env,inode_lock (inode); } -if (io->u.ci_setattr.sa_valid &TIMES_SET_FLAGS ) +if (io->u.ci_setattr.sa_avalid &TIMES_SET_FLAGS )return vvp_io_setattr_time (env, ios);return 0 ;
drivers/staging/lustre/lustre/lmv/lmv_obd.c +3 -2
@@ -1983,8 +1983,9 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt; -CDEBUG (D_INODE ,"SETATTR for " DFID ", valid 0x%x\n" , -PFID (&op_data->op_fid1), op_data->op_attr.ia_valid); +CDEBUG (D_INODE ,"SETATTR for " DFID ", valid 0x%x/0x%x\n" , +PFID (&op_data->op_fid1), op_data->op_attr.ia_valid, + op_data->op_xvalid); op_data->op_flags |=MF_MDC_CANCEL_FID1 ; tgt =lmv_find_target (lmv, &op_data->op_fid1);
drivers/staging/lustre/lustre/lov/lov_io.c +2 -1
@@ -77,7 +77,8 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; io->u.ci_setattr.sa_attr_flags = parent->u.ci_setattr.sa_attr_flags; - io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid; + io->u.ci_setattr.sa_avalid = parent->u.ci_setattr.sa_avalid; + io->u.ci_setattr.sa_xvalid = parent->u.ci_setattr.sa_xvalid; io->u.ci_setattr.sa_stripe_index = stripe; io->u.ci_setattr.sa_parent_fid = parent->u.ci_setattr.sa_parent_fid;
drivers/staging/lustre/lustre/mdc/mdc_lib.c +7 -6
@@ -234,7 +234,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,set_mrc_cr_flags (rec, cr_flags); } -static inline __u64 attr_pack (unsigned int ia_valid) +static inline __u64 attr_pack (unsigned int ia_valid,unsigned int ia_xvalid) {__u64 sa_valid =0 ;
@@ -258,19 +258,19 @@ static inline __u64 attr_pack(unsigned int ia_valid) sa_valid |=MDS_ATTR_MTIME_SET ;if (ia_valid &ATTR_FORCE ) sa_valid |=MDS_ATTR_FORCE ; -if (ia_valid &ATTR_ATTR_FLAG ) +if (ia_xvalid &OP_ATTR_FLAGS ) sa_valid |=MDS_ATTR_ATTR_FLAG ;if (ia_valid &ATTR_KILL_SUID ) sa_valid |=MDS_ATTR_KILL_SUID ;if (ia_valid &ATTR_KILL_SGID ) sa_valid |=MDS_ATTR_KILL_SGID ; -if (ia_valid &ATTR_CTIME_SET ) +if (ia_xvalid &OP_ATTR_CTIME_SET ) sa_valid |=MDS_ATTR_CTIME_SET ;if (ia_valid &ATTR_OPEN ) sa_valid |=MDS_ATTR_FROM_OPEN ; -if (ia_valid &ATTR_BLOCKS ) +if (ia_xvalid &OP_ATTR_BLOCKS ) sa_valid |=MDS_ATTR_BLOCKS ; -if (ia_valid &MDS_OPEN_OWNEROVERRIDE ) +if (ia_xvalid &OP_ATTR_OWNEROVERRIDE )/* NFSD hack (see bug 5781) */ sa_valid |=MDS_OPEN_OWNEROVERRIDE ;return sa_valid;
@@ -286,7 +286,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec, rec->sa_suppgid =-1 ; rec->sa_fid = op_data->op_fid1; - rec->sa_valid =attr_pack (op_data->op_attr.ia_valid); + rec->sa_valid =attr_pack (op_data->op_attr.ia_valid, + op_data->op_xvalid); rec->sa_mode = op_data->op_attr.ia_mode; rec->sa_uid =from_kuid (&init_user_ns, op_data->op_attr.ia_uid); rec->sa_gid =from_kgid (&init_user_ns, op_data->op_attr.ia_gid);
drivers/staging/lustre/lustre/osc/osc_io.c +12 -11
@@ -499,7 +499,8 @@ static int osc_io_setattr_start(const struct lu_env *env,struct obdo *oa = &oio->oi_oa;struct osc_async_cbargs *cbargs = &oio->oi_cbarg;__u64 size = io->u.ci_setattr.sa_attr.lvb_size; -unsigned int ia_valid = io->u.ci_setattr.sa_valid; +unsigned int ia_avalid = io->u.ci_setattr.sa_avalid; +unsigned int ia_xvalid = io->u.ci_setattr.sa_xvalid;int result =0 ;/* truncate cache dirty pages first */
@@ -514,20 +515,20 @@ static int osc_io_setattr_start(const struct lu_env *env,struct ost_lvb *lvb = &io->u.ci_setattr.sa_attr;unsigned int cl_valid =0 ; -if (ia_valid &ATTR_SIZE ) { +if (ia_avalid &ATTR_SIZE ) { attr->cat_size = size; attr->cat_kms = size; cl_valid =CAT_SIZE |CAT_KMS ; } -if (ia_valid &ATTR_MTIME_SET ) { +if (ia_avalid &ATTR_MTIME_SET ) { attr->cat_mtime = lvb->lvb_mtime; cl_valid |=CAT_MTIME ; } -if (ia_valid &ATTR_ATIME_SET ) { +if (ia_avalid &ATTR_ATIME_SET ) { attr->cat_atime = lvb->lvb_atime; cl_valid |=CAT_ATIME ; } -if (ia_valid &ATTR_CTIME_SET ) { +if (ia_xvalid &OP_ATTR_CTIME_SET ) { attr->cat_ctime = lvb->lvb_ctime; cl_valid |=CAT_CTIME ; }
@@ -542,19 +543,19 @@ static int osc_io_setattr_start(const struct lu_env *env,obdo_set_parent_fid (oa, io->u.ci_setattr.sa_parent_fid); oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index; oa->o_valid |=OBD_MD_FLID |OBD_MD_FLGROUP ; -if (ia_valid &ATTR_CTIME ) { +if (ia_avalid &ATTR_CTIME ) { oa->o_valid |=OBD_MD_FLCTIME ; oa->o_ctime = attr->cat_ctime; } -if (ia_valid &ATTR_ATIME ) { +if (ia_avalid &ATTR_ATIME ) { oa->o_valid |=OBD_MD_FLATIME ; oa->o_atime = attr->cat_atime; } -if (ia_valid &ATTR_MTIME ) { +if (ia_avalid &ATTR_MTIME ) { oa->o_valid |=OBD_MD_FLMTIME ; oa->o_mtime = attr->cat_mtime; } -if (ia_valid &ATTR_SIZE ) { +if (ia_avalid &ATTR_SIZE ) { oa->o_size = size; oa->o_blocks =OBD_OBJECT_EOF ; oa->o_valid |=OBD_MD_FLSIZE |OBD_MD_FLBLOCKS ;
@@ -566,14 +567,14 @@ static int osc_io_setattr_start(const struct lu_env *env, }else {LASSERT (oio->oi_lockless ==0 ); } -if (ia_valid &ATTR_ATTR_FLAG ) { +if (ia_xvalid &OP_ATTR_FLAGS ) { oa->o_flags = io->u.ci_setattr.sa_attr_flags; oa->o_valid |=OBD_MD_FLFLAGS ; }init_completion (&cbargs->opc_sync); -if (ia_valid &ATTR_SIZE ) +if (ia_avalid &ATTR_SIZE ) result =osc_punch_base (osc_export (cl2osc (obj)), oa, osc_async_upcall, cbargs,PTLRPCD_SET );
James Simmons
NAKPATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
Quoted 12 lines
Using spare bits in iattr.ia_valid is not safe as the bits might get used for some other purpose without us noticing.
lustre currently used 4 spare bit, but they are all defined in different places so this isn't immediately obvious.This patch brings all those bit definitions together and defined a new
op_datafield (op_xvalid) to hold the extra validity bits.
Quoted 6 lines
It also replaces
sa_validin structcl_setattr_iowithsa_avalidandsa_xvalid. Changing the name is helpful assa_validalready has another use within lustre.Signed-off-by NeilBrown <[email protected]>
Nak: I see regressions with this patch.
[12368.453655] Lustre: DEBUG MARKER: == sanity test 240: race between ldlm
enqueue and the connection RPC (no ASSERT) ===================== 21:
16:30 (1529543790)
[12368.760832] BUG: Dentry
000000002646a847{i=200004282000008,n=f237.sanity} still in use (1)
[unmount of lustre lustre]
[12368.773746] WARNING: CPU: 1 PID: 10861 at fs/dcache.c:1514
umount_check+0x66/0x70
[12368.783364] Modules linked in: ext4(E) mbcache(E) jbd2(E) loop(E) lustre(CE) obdecho(CE) mgc(CE) lov(CE) osc(CE) mdc(CE) lmv(CE) fid(CE) fld (CE) ptlrpc(CE) obdclass(CE) ksocklnd(CE) sha512_generic(E) lnet(CE) libcfs(CE) xt_comment(E) xt_multiport(E) nfsv3(E) nfs_acl(E) sg(E) ip6t_RE JECT(E) nf_reject_ipv6(E) nf_conntrack_ipv6(E) nf_defrag_ipv6(E) ip6table_filter(E) ip6_tables(E) ipt_REJECT(E) nf_reject_ipv4(E) nf_conntrack_
ipv4(E) nf_defrag_ipv4(E) xt_conntrack(E) nf_conntrack(E) libcrc32c(E) iptable_filter(E) dm_mirror(E) dm_region_hash(E) dm_log(E) dm_mod(E) ib_ isert(E) iscsi_target_mod(E) mgag200(E) ttm(E) target_core_mod(E) drm_kms_helper(E) rpcrdma(E) x86_pkg_temp_thermal(E) drm(E) crc32_pclmul(E) ib_ucm(E) rdma_ucm(E) ib_uverbs(E) fb_sys_fops(E) syscopyarea(E) ib_iser(E) mpt3sas(E) sysfillrect(E)
[12368.869470] ipmi_si(E) sysimgblt(E) raid_class(E) ib_umad(E)
rdma_cm(E) ipmi_devintf(E) scsi_transport_sas(E) wmi(E) ib_ipoib(E) ipmi_msgha
ndler(E) iw_cm(E) libiscsi(E) ib_cm(E) scsi_transport_iscsi(E) mlx4_ib(E) ib_core(E) binfmt_misc(E) ip_tables(E) rpcsec_gss_krb5(E) auth_rpcgss
(E) nfsv4(E) dns_resolver(E) nfs(E) lockd(E) grace(E) fscache(E) mlx4_en(E) mlx4_core(E) igb(E) i2c_algo_bit(E) devlink(E) crc32c_intel(E) i2c_
core(E) sunrpc(E)
[12368.917172] CPU: 1 PID: 10861 Comm: umount Tainted: G WC E 4.17.0+ #1 [12368.926825] Hardware name: Supermicro X9DRT/X9DRT, BIOS 3.0a 02/19/2014 [12368.935595] RIP: 0010:umount_check+0x66/0x70 [12368.941993] RSP: 0018:ffffc90007313da8 EFLAGS: 00010286 [12368.949342] RAX: 000000000000006a RBX: ffff8810557dcb40 RCX: 0000000000000000 [12368.958619] RDX: 0000000000000001 RSI: ffff88085fc954f8 RDI: ffff88085fc954f8 [12368.967868] RBP: ffff880fec9ef600 R08: 0000000000000000 R09: 0000000000000896 [12368.977102] R10: 00000000000003ff R11: 0000000000aaaaaa R12: ffffffff8124a320 [12368.986315] R13: ffff8810557dcbe0 R14: ffff880fec9ef690 R15: ffff8810557dcbe0 [12368.995505] FS: 00007fc174af5880(0000) GS:ffff88085fc80000(0000) knlGS:0000000000000000 [12369.005631] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [12369.013395] CR2: 00007fc174b04000 CR3: 0000000822922002 CR4: 00000000000606e0 [12369.022530] Call Trace: [12369.026962] d_walk+0xe1/0x270 [12369.031970] do_one_tree+0x22/0x40 [12369.037280] shrink_dcache_for_umount+0x28/0x80 [12369.043685] generic_shutdown_super+0x1a/0x110 [12369.049977] kill_anon_super+0xe/0x20 [12369.055463] deactivate_locked_super+0x39/0x70 [12369.061708] cleanup_mnt+0x3b/0x70 [12369.066871] task_work_run+0x7c/0xa0 [12369.072174] exit_to_usermode_loop+0x5a/0x7e [12369.078140] do_syscall_64+0x2b7/0x347 [12369.083547] ? do_page_fault+0x2d/0x110 [12369.089008] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [12369.095655] RIP: 0033:0x7fc173d69bd7 [12369.100789] RSP: 002b:00007ffc4c89fcc8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 [12369.109902] RAX: 0000000000000000 RBX: 000056521cd63040 RCX: 00007fc173d69bd7 [12369.118564] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000056521cd642b0 [12369.127188] RBP: 000056521cd642b0 R08: 0000000000000000 R09: 000000000000000f [12369.135778] R10: 00007ffc4c89f720 R11: 0000000000000246 R12: 00007fc1748e4d58 [12369.144336] R13: 0000000000000000 R14: 000056521cd648a0 R15: 000056521cd63040 [12369.152868] Code: 00 00 48 8b 40 28 4c 8b 08 48 8b 46 30 48 85 c0 74 1d 48 8b 50 40 48 89 0c 24 48 c7 c7 58 5c e6 81 48 89 f1 31 c0 e8 38 cf ea ff <0f> 0b eb b2 31 d2 eb e3 66 90 66 66 66 66 90 55 48 89 fd 53 48 [12369.174646] ---[ end trace 053c2a5a718d3440 ]--- [12369.385564] Lustre: Unmounted lustre-client [12369.393247] VFS: Busy inodes after unmount of lustre. Self-destruct in
5 seconds. Have a nice day...
When I remove this patch things go back to normal. This will not show up if you do a ONLY="240" sh ./sanity.sh. You have to run the sanity.sh in total to make this show up.
Quoted 466 lines
--- drivers/staging/lustre/lustre/include/cl_object.h | 5 +++- .../staging/lustre/lustre/include/lustre_compat.h | 6 ----- .../lustre/include/lustre_patchless_compat.h | 8 ------- drivers/staging/lustre/lustre/include/obd.h | 7 ++++++ drivers/staging/lustre/lustre/llite/file.c | 12 ++++++---- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 5 +++- .../staging/lustre/lustre/llite/llite_internal.h | 5 +++- drivers/staging/lustre/lustre/llite/llite_lib.c | 21 ++++++++++-------- drivers/staging/lustre/lustre/llite/vvp_io.c | 8 +++---- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 5 +++- drivers/staging/lustre/lustre/lov/lov_io.c | 3 ++- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 13 ++++++----- drivers/staging/lustre/lustre/osc/osc_io.c | 23 ++++++++++---------- 13 files changed, 63 insertions(+), 58 deletions(-)drivers/staging/lustre/lustre/include/cl_object.h +3
-2@@ -1773,7 +1773,8 @@ struct cl_io {struct cl_setattr_io {struct ost_lvb sa_attr;unsigned int sa_attr_flags; -unsigned int sa_valid; +unsigned int sa_avalid; +unsigned int sa_xvalid;int sa_stripe_index;const struct lu_fid *sa_parent_fid; } ci_setattr;@@ -2304,7 +2305,7 @@ static inline int cl_io_is_mkwrite(const struct cl_io *io)static inline int cl_io_is_trunc (const struct cl_io *io) {return io->ci_type ==CIT_SETATTR && - (io->u.ci_setattr.sa_valid &ATTR_SIZE ); + (io->u.ci_setattr.sa_avalid &ATTR_SIZE ); }struct cl_io *cl_io_top (struct cl_io *io);drivers/staging/lustre/lustre/include/lustre_compat.h +0
-6@@ -41,12 +41,6 @@#include <lustre_patchless_compat.h> -/* -* set ATTR_BLOCKS to a high value to avoid any risk of collision with other -* ATTR_* attributes (see bug 13828) -*/ -#define ATTR_BLOCKS (1 << 27) -#define current_ngroups current_cred()->group_info->ngroups#define current_groups current_cred()->group_info->small_blockdrivers/staging/lustre/lustre/include/lustre_patchless_compat.h +0
-8@@ -41,12 +41,4 @@#include <linux/hash.h> #include <linux/pagemap.h> -#ifndef ATTR_CTIME_SET -/* -* set ATTR_CTIME_SET to a high value to avoid any risk of collision with other -* ATTR_* attributes (see bug 13828) -*/ -#define ATTR_CTIME_SET (1 << 28) -#endif -#endif /* LUSTRE_PATCHLESS_COMPAT_H */ drivers/staging/lustre/lustre/include/obd.h +7
-0@@ -723,6 +723,7 @@ struct md_op_data {/* iattr fields and blocks. */ struct iattr op_attr; +unsigned int op_xvalid;/* eXtra validity flags */ unsigned int op_attr_flags;__u64 op_valid;loff_t op_attr_blocks;@@ -751,6 +752,12 @@ struct md_op_data {__u32 op_default_stripe_offset; }; +/* Flags for op_xvalid */ +#define OP_ATTR_CTIME_SET (1 << 0) +#define OP_ATTR_BLOCKS (1 << 1) +#define OP_ATTR_OWNEROVERRIDE (1 << 2) +#define OP_ATTR_FLAGS (1 << 3) +struct md_callback { int (*md_blocking_ast)(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,drivers/staging/lustre/lustre/llite/file.c +7
-5@@ -93,9 +93,10 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data, op_data->op_attr.ia_mtime = inode->i_mtime; op_data->op_attr.ia_ctime = inode->i_ctime; op_data->op_attr.ia_size =i_size_read (inode); - op_data->op_attr.ia_valid |=ATTR_MODE |ATTR_ATIME |ATTR_ATIME_SET | -ATTR_MTIME |ATTR_MTIME_SET | -ATTR_CTIME |ATTR_CTIME_SET ; + op_data->op_attr.ia_valid |= (ATTR_MODE |ATTR_ATIME |ATTR_ATIME_SET | +ATTR_MTIME |ATTR_MTIME_SET | +ATTR_CTIME ); + op_data->op_xvalid |=OP_ATTR_CTIME_SET ; op_data->op_attr_blocks = inode->i_blocks; op_data->op_attr_flags =ll_inode_to_ext_flags (inode->i_flags); op_data->op_handle = och->och_fh;@@ -161,7 +162,8 @@ static int ll_close_inode_openhandle(struct inode *inode, op_data->op_bias |=MDS_HSM_RELEASE ; op_data->op_data_version = *(__u64 *)data; op_data->op_lease_handle = och->och_lease_handle; - op_data->op_attr.ia_valid |=ATTR_SIZE |ATTR_BLOCKS ; + op_data->op_attr.ia_valid |=ATTR_SIZE ; + op_data->op_xvalid |=OP_ATTR_BLOCKS ;break ;default :@@ -1906,7 +1908,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,inode_lock (inode); - rc =ll_setattr_raw (file->f_path.dentry, attr, true); + rc =ll_setattr_raw (file->f_path.dentry, attr,0 , true);if (rc == -ENODATA ) rc =0 ;drivers/staging/lustre/lustre/llite/lcommon_cl.c +3
-2@@ -80,7 +80,7 @@ u16 cl_inode_fini_refcheck;static DEFINE_MUTEX (cl_inode_fini_guard);int cl_setattr_ost (struct cl_object *obj,const struct iattr *attr, -unsigned int attr_flags) +unsigned int xvalid,unsigned int attr_flags) {struct lu_env *env;struct cl_io *io;@@ -100,7 +100,8 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, io->u.ci_setattr.sa_attr.lvb_ctime =LTIME_S (attr->ia_ctime); io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size; io->u.ci_setattr.sa_attr_flags = attr_flags; - io->u.ci_setattr.sa_valid = attr->ia_valid; + io->u.ci_setattr.sa_avalid = attr->ia_valid; + io->u.ci_setattr.sa_xvalid = xvalid; io->u.ci_setattr.sa_parent_fid =lu_object_fid (&obj->co_lu); again:drivers/staging/lustre/lustre/llite/llite_internal.h +3
-2@@ -805,7 +805,8 @@ void ll_kill_super(struct super_block *sb);struct inode *ll_inode_from_resource_lock (struct ldlm_lock *lock);void ll_dir_clear_lsm_md (struct inode *inode);void ll_clear_inode (struct inode *inode); -int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,bool hsm_import); +int ll_setattr_raw (struct dentry *dentry,struct iattr *attr, +unsigned int xvalid,bool hsm_import);int ll_setattr (struct dentry *de,struct iattr *attr);int ll_statfs (struct dentry *de,struct kstatfs *sfs); int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,@@ -1330,7 +1331,7 @@ int ll_getparent(struct file *file, struct getparent __user *arg);/* lcommon_cl.c */ int cl_setattr_ost (struct cl_object *obj,const struct iattr *attr, -unsigned int attr_flags); +unsigned int xvalid,unsigned int attr_flags);extern struct lu_env *cl_inode_fini_env;extern u16 cl_inode_fini_refcheck;drivers/staging/lustre/lustre/llite/llite_lib.c +12
-9@@ -1429,7 +1429,8 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data)* * In case of HSMimport, we only set attr on MDS. */ -int ll_setattr_raw (struct dentry *dentry,struct iattr *attr,bool hsm_import) +int ll_setattr_raw (struct dentry *dentry,struct iattr *attr, +unsigned int xvalid,bool hsm_import) {struct inode *inode =d_inode (dentry);struct ll_inode_info *lli =ll_i2info (inode);@@ -1470,7 +1471,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)/* We mark all of the fields "set" so MDS/OST does not re-set them */ if (attr->ia_valid &ATTR_CTIME ) { attr->ia_ctime =current_time (inode); - attr->ia_valid |=ATTR_CTIME_SET ; + xvalid |=OP_ATTR_CTIME_SET ; }if (!(attr->ia_valid &ATTR_ATIME_SET ) && (attr->ia_valid &ATTR_ATIME )) {@@ -1506,12 +1507,13 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)* If we are changing file size, file content is * modified, flag it. */ - attr->ia_valid |=MDS_OPEN_OWNEROVERRIDE ; + xvalid |=OP_ATTR_OWNEROVERRIDE ; op_data->op_bias |=MDS_DATA_MODIFIED ;clear_bit (LLIF_DATA_MODIFIED , &lli->lli_flags); } op_data->op_attr = *attr; + op_data->op_xvalid = xvalid; rc =ll_md_setattr (dentry, op_data);if (rc)@@ -1532,7 +1534,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)* setting times to past, but it is necessary due to possible * time de-synchronization between MDT inode and OST objects */ - rc =cl_setattr_ost (ll_i2info (inode)->lli_clob, attr,0 ); + rc =cl_setattr_ost (ll_i2info (inode)->lli_clob, + attr, xvalid,0 ); }/* @@ -1589,10 +1592,11 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)int ll_setattr (struct dentry *de,struct iattr *attr) {int mode =d_inode (de)->i_mode; +unsigned int xvalid =0 ;if ((attr->ia_valid & (ATTR_CTIME |ATTR_SIZE |ATTR_MODE )) == (ATTR_CTIME |ATTR_SIZE |ATTR_MODE )) - attr->ia_valid |=MDS_OPEN_OWNEROVERRIDE ; + xvalid |=OP_ATTR_OWNEROVERRIDE ; if (((attr->ia_valid & (ATTR_MODE | ATTR_FORCE | ATTR_SIZE)) == (ATTR_SIZE | ATTR_MODE)) &&@@ -1613,7 +1617,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr) !(attr->ia_valid & ATTR_KILL_SGID)) attr->ia_valid |=ATTR_KILL_SGID ; -return ll_setattr_raw (de, attr, false); +return ll_setattr_raw (de, attr, xvalid, false); } int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,@@ -1946,7 +1950,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,return PTR_ERR (op_data); op_data->op_attr_flags = flags; - op_data->op_attr.ia_valid |=ATTR_ATTR_FLAG ; + op_data->op_xvalid |=OP_ATTR_FLAGS ; rc =md_setattr (sbi->ll_md_exp, op_data,NULL ,0 , &req);ll_finish_md_op_data (op_data);ptlrpc_req_finished (req);@@ -1963,8 +1967,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,if (!attr)return -ENOMEM ; - attr->ia_valid =ATTR_ATTR_FLAG ; - rc =cl_setattr_ost (obj, attr, flags); + rc =cl_setattr_ost (obj, attr,OP_ATTR_FLAGS , flags);kfree (attr);return rc; }drivers/staging/lustre/lustre/llite/vvp_io.c +4
-4@@ -556,7 +556,7 @@ static int vvp_io_setattr_lock(const struct lu_env *env,if (new_size ==0 ) enqflags =CEF_DISCARD_DATA ; }else { -unsigned int valid = io->u.ci_setattr.sa_valid; +unsigned int valid = io->u.ci_setattr.sa_avalid;if (!(valid &TIMES_SET_FLAGS ))return 0 ;@@ -603,11 +603,11 @@ static int vvp_io_setattr_time(const struct lu_env *env,cl_object_attr_lock (obj); attr->cat_ctime = io->u.ci_setattr.sa_attr.lvb_ctime; -if (io->u.ci_setattr.sa_valid &ATTR_ATIME_SET ) { +if (io->u.ci_setattr.sa_avalid &ATTR_ATIME_SET ) { attr->cat_atime = io->u.ci_setattr.sa_attr.lvb_atime; valid |=CAT_ATIME ; } -if (io->u.ci_setattr.sa_valid &ATTR_MTIME_SET ) { +if (io->u.ci_setattr.sa_avalid &ATTR_MTIME_SET ) { attr->cat_mtime = io->u.ci_setattr.sa_attr.lvb_mtime; valid |=CAT_MTIME ; }@@ -632,7 +632,7 @@ static int vvp_io_setattr_start(const struct lu_env *env,inode_lock (inode); } -if (io->u.ci_setattr.sa_valid &TIMES_SET_FLAGS ) +if (io->u.ci_setattr.sa_avalid &TIMES_SET_FLAGS )return vvp_io_setattr_time (env, ios);return 0 ;drivers/staging/lustre/lustre/lmv/lmv_obd.c +3
-2@@ -1983,8 +1983,9 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt; -CDEBUG (D_INODE ,"SETATTR for " DFID ", valid 0x%x\n" , -PFID (&op_data->op_fid1), op_data->op_attr.ia_valid); +CDEBUG (D_INODE ,"SETATTR for " DFID ", valid 0x%x/0x%x\n" , +PFID (&op_data->op_fid1), op_data->op_attr.ia_valid, + op_data->op_xvalid); op_data->op_flags |=MF_MDC_CANCEL_FID1 ; tgt =lmv_find_target (lmv, &op_data->op_fid1);drivers/staging/lustre/lustre/lov/lov_io.c +2
-1@@ -77,7 +77,8 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; io->u.ci_setattr.sa_attr_flags = parent->u.ci_setattr.sa_attr_flags; - io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid; + io->u.ci_setattr.sa_avalid = parent->u.ci_setattr.sa_avalid; + io->u.ci_setattr.sa_xvalid = parent->u.ci_setattr.sa_xvalid; io->u.ci_setattr.sa_stripe_index = stripe; io->u.ci_setattr.sa_parent_fid = parent->u.ci_setattr.sa_parent_fid;drivers/staging/lustre/lustre/mdc/mdc_lib.c +7
-6@@ -234,7 +234,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,set_mrc_cr_flags (rec, cr_flags); } -static inline __u64 attr_pack (unsigned int ia_valid) +static inline __u64 attr_pack (unsigned int ia_valid,unsigned int ia_xvalid) {__u64 sa_valid =0 ;@@ -258,19 +258,19 @@ static inline __u64 attr_pack(unsigned int ia_valid) sa_valid |=MDS_ATTR_MTIME_SET ;if (ia_valid &ATTR_FORCE ) sa_valid |=MDS_ATTR_FORCE ; -if (ia_valid &ATTR_ATTR_FLAG ) +if (ia_xvalid &OP_ATTR_FLAGS ) sa_valid |=MDS_ATTR_ATTR_FLAG ;if (ia_valid &ATTR_KILL_SUID ) sa_valid |=MDS_ATTR_KILL_SUID ;if (ia_valid &ATTR_KILL_SGID ) sa_valid |=MDS_ATTR_KILL_SGID ; -if (ia_valid &ATTR_CTIME_SET ) +if (ia_xvalid &OP_ATTR_CTIME_SET ) sa_valid |=MDS_ATTR_CTIME_SET ;if (ia_valid &ATTR_OPEN ) sa_valid |=MDS_ATTR_FROM_OPEN ; -if (ia_valid &ATTR_BLOCKS ) +if (ia_xvalid &OP_ATTR_BLOCKS ) sa_valid |=MDS_ATTR_BLOCKS ; -if (ia_valid &MDS_OPEN_OWNEROVERRIDE ) +if (ia_xvalid &OP_ATTR_OWNEROVERRIDE )/* NFSD hack (see bug 5781) */ sa_valid |=MDS_OPEN_OWNEROVERRIDE ;return sa_valid;@@ -286,7 +286,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec, rec->sa_suppgid =-1 ; rec->sa_fid = op_data->op_fid1; - rec->sa_valid =attr_pack (op_data->op_attr.ia_valid); + rec->sa_valid =attr_pack (op_data->op_attr.ia_valid, + op_data->op_xvalid); rec->sa_mode = op_data->op_attr.ia_mode; rec->sa_uid =from_kuid (&init_user_ns, op_data->op_attr.ia_uid); rec->sa_gid =from_kgid (&init_user_ns, op_data->op_attr.ia_gid);drivers/staging/lustre/lustre/osc/osc_io.c +12
-11@@ -499,7 +499,8 @@ static int osc_io_setattr_start(const struct lu_env *env,struct obdo *oa = &oio->oi_oa;struct osc_async_cbargs *cbargs = &oio->oi_cbarg;__u64 size = io->u.ci_setattr.sa_attr.lvb_size; -unsigned int ia_valid = io->u.ci_setattr.sa_valid; +unsigned int ia_avalid = io->u.ci_setattr.sa_avalid; +unsigned int ia_xvalid = io->u.ci_setattr.sa_xvalid;int result =0 ;/* truncate cache dirty pages first */ @@ -514,20 +515,20 @@ static int osc_io_setattr_start(const struct lu_env *env,struct ost_lvb *lvb = &io->u.ci_setattr.sa_attr;unsigned int cl_valid =0 ; -if (ia_valid &ATTR_SIZE ) { +if (ia_avalid &ATTR_SIZE ) { attr->cat_size = size; attr->cat_kms = size; cl_valid =CAT_SIZE |CAT_KMS ; } -if (ia_valid &ATTR_MTIME_SET ) { +if (ia_avalid &ATTR_MTIME_SET ) { attr->cat_mtime = lvb->lvb_mtime; cl_valid |=CAT_MTIME ; } -if (ia_valid &ATTR_ATIME_SET ) { +if (ia_avalid &ATTR_ATIME_SET ) { attr->cat_atime = lvb->lvb_atime; cl_valid |=CAT_ATIME ; } -if (ia_valid &ATTR_CTIME_SET ) { +if (ia_xvalid &OP_ATTR_CTIME_SET ) { attr->cat_ctime = lvb->lvb_ctime; cl_valid |=CAT_CTIME ; }@@ -542,19 +543,19 @@ static int osc_io_setattr_start(const struct lu_env *env,obdo_set_parent_fid (oa, io->u.ci_setattr.sa_parent_fid); oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index; oa->o_valid |=OBD_MD_FLID |OBD_MD_FLGROUP ; -if (ia_valid &ATTR_CTIME ) { +if (ia_avalid &ATTR_CTIME ) { oa->o_valid |=OBD_MD_FLCTIME ; oa->o_ctime = attr->cat_ctime; } -if (ia_valid &ATTR_ATIME ) { +if (ia_avalid &ATTR_ATIME ) { oa->o_valid |=OBD_MD_FLATIME ; oa->o_atime = attr->cat_atime; } -if (ia_valid &ATTR_MTIME ) { +if (ia_avalid &ATTR_MTIME ) { oa->o_valid |=OBD_MD_FLMTIME ; oa->o_mtime = attr->cat_mtime; } -if (ia_valid &ATTR_SIZE ) { +if (ia_avalid &ATTR_SIZE ) { oa->o_size = size; oa->o_blocks =OBD_OBJECT_EOF ; oa->o_valid |=OBD_MD_FLSIZE |OBD_MD_FLBLOCKS ;@@ -566,14 +567,14 @@ static int osc_io_setattr_start(const struct lu_env *env, }else {LASSERT (oio->oi_lockless ==0 ); } -if (ia_valid &ATTR_ATTR_FLAG ) { +if (ia_xvalid &OP_ATTR_FLAGS ) { oa->o_flags = io->u.ci_setattr.sa_attr_flags; oa->o_valid |=OBD_MD_FLFLAGS ; }init_completion (&cbargs->opc_sync); -if (ia_valid &ATTR_SIZE ) +if (ia_avalid &ATTR_SIZE ) result =osc_punch_base (osc_export (cl2osc (obj)), oa, osc_async_upcall, cbargs,PTLRPCD_SET );
PATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
Quoted 27 lines · James Simmons
Quoted 11 lines
Using spare bits in iattr.ia_valid is not safe as the bits might get used for some other purpose without us noticing.
lustre currently used 4 spare bit, but they are all defined in different places so this isn't immediately obvious.This patch brings all those bit definitions together and defined a new
op_datafield (op_xvalid) to hold the extra validity bits.Quoted 6 lines
It also replaces
sa_validin structcl_setattr_iowithsa_avalidandsa_xvalid. Changing the name is helpful assa_validalready has another use within lustre.Signed-off-by NeilBrown <[email protected]>Nak: I see regressions with this patch.
[12368.453655] Lustre: DEBUG MARKER: == sanity test 240: race between ldlm enqueue and the connection RPC (no ASSERT) ===================== 21: 16:30 (1529543790) [12368.760832] BUG: Dentry 000000002646a847{i=200004282000008,n=f237.sanity} still in use (1) [unmount of lustre lustre] [12368.773746] WARNING: CPU: 1 PID: 10861 at fs/dcache.c:1514
...
Quoted 8 lines
[12369.385564] Lustre: Unmounted lustre-client [12369.393247] VFS: Busy inodes after unmount of lustre. Self-destruct in5 seconds. Have a nice day...
When I remove this patch things go back to normal. This will not show up if you do a ONLY="240" sh ./sanity.sh. You have to run the
sanity.shin total to make this show up.
(clearly I read my email in the wrong order)
Very odd. This suggests some sort of life-time-management problem with inodes, but the changes shouldn't affect that at all. I've gone back over the patch closely and cannot see anything wrong - it is really very simple: it just moves flag bits around.
I haven't got as far as 240 yet as changes to kvmalloc have caused earlier problem (my VMs don't have much RAM). I'll see if I can coax it all the way to 240 and see what happens.
Thanks for the report.
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/0a7c0f77/attachment.sig>
PATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
Quoted 45 lines · NeilBrown
Quoted 27 lines · James Simmons
Quoted 11 lines
Using spare bits in iattr.ia_valid is not safe as the bits might get used for some other purpose without us noticing.
lustre currently used 4 spare bit, but they are all defined in different places so this isn't immediately obvious.This patch brings all those bit definitions together and defined a new
op_datafield (op_xvalid) to hold the extra validity bits.Quoted 6 lines
It also replaces
sa_validin structcl_setattr_iowithsa_avalidandsa_xvalid. Changing the name is helpful assa_validalready has another use within lustre.Signed-off-by NeilBrown <[email protected]>Nak: I see regressions with this patch.
[12368.453655] Lustre: DEBUG MARKER: == sanity test 240: race between ldlm enqueue and the connection RPC (no ASSERT) ===================== 21: 16:30 (1529543790) [12368.760832] BUG: Dentry 000000002646a847{i=200004282000008,n=f237.sanity} still in use (1) [unmount of lustre lustre] [12368.773746] WARNING: CPU: 1 PID: 10861 at fs/dcache.c:1514...
Quoted 8 lines
[12369.385564] Lustre: Unmounted lustre-client [12369.393247] VFS: Busy inodes after unmount of lustre. Self-destruct in5 seconds. Have a nice day...
When I remove this patch things go back to normal. This will not show up if you do a ONLY="240" sh ./sanity.sh. You have to run the
sanity.shin total to make this show up.(clearly I read my email in the wrong order)
Very odd. This suggests some sort of life-time-management problem with inodes, but the changes shouldn't affect that at all. I've gone back over the patch closely and cannot see anything wrong - it is really very simple: it just moves flag bits around.
Quoted 3 lines
I haven't got as far as 240 yet as changes to kvmalloc have caused earlier problem (my VMs don't have much RAM). I'll see if I can coax it all the way to 240 and see what happens.
I've now tested all the way to the end and see no new failures. Specifically test 200 passes.
Have you had it fail more than once? If it was only once, then maybe it was some random occurrence not related to the patch. We clearly still want to fix it if we can...
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180622/9e82110f/attachment.sig>
PATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
Quoted 52 lines · NeilBrown
Quoted 46 lines · James Simmons
Quoted 28 lines
Quoted 12 lines
Using spare bits in iattr.ia_valid is not safe as the bits might get used for some other purpose without us noticing.
lustre currently used 4 spare bit, but they are all defined in different places so this isn't immediately obvious.This patch brings all those bit definitions together and defined a new
op_datafield (op_xvalid) to hold the extra validity bits.Quoted 6 lines
It also replaces
sa_validin structcl_setattr_iowithsa_avalidandsa_xvalid. Changing the name is helpful assa_validalready has another use within lustre.Signed-off-by NeilBrown <[email protected]>Nak: I see regressions with this patch.
[12368.453655] Lustre: DEBUG MARKER: == sanity test 240: race between ldlm enqueue and the connection RPC (no ASSERT) ===================== 21: 16:30 (1529543790) [12368.760832] BUG: Dentry 000000002646a847{i=200004282000008,n=f237.sanity} still in use (1) [unmount of lustre lustre] [12368.773746] WARNING: CPU: 1 PID: 10861 at fs/dcache.c:1514...
Quoted 8 lines
[12369.385564] Lustre: Unmounted lustre-client [12369.393247] VFS: Busy inodes after unmount of lustre. Self-destruct in5 seconds. Have a nice day...
When I remove this patch things go back to normal. This will not show up if you do a ONLY="240" sh ./sanity.sh. You have to run the
sanity.shin total to make this show up.(clearly I read my email in the wrong order)
Very odd. This suggests some sort of life-time-management problem with inodes, but the changes shouldn't affect that at all. I've gone back over the patch closely and cannot see anything wrong - it is really very simple: it just moves flag bits around.Quoted 3 lines
I haven't got as far as 240 yet as changes to kvmalloc have caused earlier problem (my VMs don't have much RAM). I'll see if I can coax it all the way to 240 and see what happens.
Quoted 6 lines
I've now tested all the way to the end and see no new failures. Specifically test 200 passes.
Have you had it fail more than once? If it was only once, then maybe it was some random occurrence not related to the patch. We clearly still want to fix it if we can...
Okay I did some more testing and found I get this error with or without this patch. Its due to a regression from an earlier patch. Can't figure out where its coming from. I looked at the d_lock usage and it seems balanced. So all but the first patch for the lustre_compact* header changes seem okay. BTW they need a rebasing. Also since I have separated out your libcfs tracefile fixes which I will push your okay with it so it might be best to break the patches into two series.
PATCH 9/24 lustre: don't use spare bits in iattr.ia_valid
Quoted 8 lines · James Simmons
Okay I did some more testing and found I get this error with or without this patch. Its due to a regression from an earlier patch. Can't figure out where its coming from. I looked at the
d_lockusage and it seems balanced. So all but the first patch for the lustre_compact* header changes seem okay. BTW they need a rebasing. Also since I have separated out your libcfs tracefile fixes which I will push your okay with it so it might be best to break the patches into two series.
I've changed the problematic lustre_compat patch after a closer look at the code. I'll post the result shortly.
I don't understand your comment about "break the patches into two series".
The goal for these patches isn't to make series', it is to apply them to the "lustre" branch, when they are ready. Some are ready (thanks for the confirmation), some aren't. The ones that aren't will get revised and reposted.
I'm okay with you posting any patches that are useful, whether or not they conflict with anything in my lustre-testing branch. My tendency will be to apply your patches first, then rebase my outstanding lustre-testing patches on top of them.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/f89db3e4/attachment.sig>
PATCH 10/24 lustre: remove lustre_patchless_compat.h
In reply to NeilBrownThis is now mostly empty. A few #includes need
to be added to other files to compensate.
--- drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 .../staging/lustre/lustre/include/lustre_compat.h | 2 - drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 44 -------------------- .../staging/lustre/lustre/llite/llite_internal.h | 1 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 + drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_request.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 17 files changed, 15 insertions(+), 47 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h
drivers/staging/lustre/lustre/fid/lproc_fid.c +1 -0
@@ -40,6 +40,7 @@#define DEBUG_SUBSYSTEM S_FID#include <linux/module.h> +#include <linux/uaccess.h> #include <obd.h> #include <obd_class.h>
drivers/staging/lustre/lustre/fld/lproc_fld.c +1 -0
@@ -41,6 +41,7 @@#define DEBUG_SUBSYSTEM S_FLD#include <linux/module.h> +#include <linux/uaccess.h> #include <obd.h> #include <obd_class.h>
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -2
@@ -39,8 +39,6 @@#include <linux/cred.h> #include <linux/module.h> -#include <lustre_patchless_compat.h> -#define current_ngroups current_cred()->group_info->ngroups#define current_groups current_cred()->group_info->small_block
drivers/staging/lustre/lustre/include/lustre_net.h +1 -0
@@ -51,6 +51,7 @@* @{ */ +#include <linux/mm.h> #include <linux/uio.h> #include <linux/libcfs/libcfs.h> #include <uapi/linux/lnet/nidstr.h>
drivers/staging/lustre/lustre/include/lustre_patchless_compat.h deleted +0 -44
44 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -1
@@ -39,7 +39,6 @@#include <lustre_linkea.h> /* for struct cl_lock_descr and struct cl_io */ -#include <lustre_patchless_compat.h> #include <lustre_compat.h> #include <cl_object.h> #include <lustre_lmv.h>
drivers/staging/lustre/lustre/lov/lov_obd.c +2 -0
@@ -40,6 +40,8 @@#define DEBUG_SUBSYSTEM S_LOV +#include <linux/uaccess.h> +#include <uapi/linux/lustre/lustre_idl.h> #include <uapi/linux/lustre/lustre_ioctl.h>
drivers/staging/lustre/lustre/lov/lov_pack.c +1 -0
@@ -39,6 +39,7 @@#define DEBUG_SUBSYSTEM S_LOV +#include <linux/uaccess.h> #include <lustre_net.h> #include <lustre_swab.h> #include <obd.h>
drivers/staging/lustre/lustre/lov/lov_page.c +1 -0
@@ -38,6 +38,7 @@#define DEBUG_SUBSYSTEM S_LOV +#include <linux/highmem.h> #include "lov_cl_internal.h" /** \addtogroup lov
drivers/staging/lustre/lustre/obdclass/class_obd.c +1 -0
@@ -36,6 +36,7 @@#include <linux/atomic.h> #include <linux/miscdevice.h> #include <linux/libcfs/libcfs.h> +#include <linux/uaccess.h> #include <obd_support.h> #include <obd_class.h>
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -0
@@ -37,6 +37,7 @@#define DEBUG_SUBSYSTEM S_CLASS +#include <linux/uaccess.h> #include <obd_class.h> #include <lprocfs_status.h> #include <uapi/linux/lustre/lustre_idl.h>
drivers/staging/lustre/lustre/obdclass/obd_config.c +1 -0
@@ -37,6 +37,7 @@#define DEBUG_SUBSYSTEM S_CLASS +#include <linux/uaccess.h> #include <linux/string.h> #include <uapi/linux/lustre/lustre_ioctl.h>
drivers/staging/lustre/lustre/obdecho/echo_client.c +1 -0
@@ -33,6 +33,7 @@#define DEBUG_SUBSYSTEM S_ECHO +#include <linux/highmem.h> #include <obd.h> #include <obd_support.h> #include <obd_class.h>
drivers/staging/lustre/lustre/osc/lproc_osc.c +1 -0
@@ -32,6 +32,7 @@*/ #define DEBUG_SUBSYSTEM S_CLASS +#include <linux/uaccess.h> #include <linux/statfs.h> #include <obd_cksum.h> #include <obd_class.h>
drivers/staging/lustre/lustre/osc/osc_request.c +1 -0
@@ -33,6 +33,7 @@#define DEBUG_SUBSYSTEM S_OSC +#include <linux/highmem.h> #include <linux/libcfs/libcfs_hash.h> #include <linux/sched/mm.h>
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +1 -0
@@ -32,6 +32,7 @@*/ #define DEBUG_SUBSYSTEM S_CLASS +#include <linux/uaccess.h> #include <obd_support.h> #include <obd.h> #include <lprocfs_status.h>
drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +1 -0
@@ -37,6 +37,7 @@#define DEBUG_SUBSYSTEM S_SEC +#include <linux/highmem.h> #include <obd_support.h> #include <obd_cksum.h> #include <obd_class.h>
PATCH 11/24 lustre: discard current_n*groups macros.
In reply to NeilBrownJust open-code the access required. This makes
the code clearer.
Also replace the 'memcpy' which violates typing
with a more correct for-loop.
--- .../staging/lustre/lustre/include/lustre_compat.h | 3 --- drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -3
@@ -39,9 +39,6 @@#include <linux/cred.h> #include <linux/module.h> -#define current_ngroups current_cred()->group_info->ngroups -#define current_groups current_cred()->group_info->small_block -/* * OBD need working random driver, thus all our * initialization routines must be called after device
drivers/staging/lustre/lustre/ptlrpc/sec.c +10 -5
@@ -2215,7 +2215,7 @@ int sptlrpc_current_user_desc_size(void) {int ngroups; - ngroups = current_ngroups; + ngroups =current_cred ()->group_info->ngroups;if (ngroups >LUSTRE_MAX_GROUPS ) ngroups =LUSTRE_MAX_GROUPS ;
@@ -2226,6 +2226,9 @@ EXPORT_SYMBOL(sptlrpc_current_user_desc_size);int sptlrpc_pack_user_desc (struct lustre_msg *msg,int offset) {struct ptlrpc_user_desc *pud; +int ngroups; +kgid_t *gid; +int g; pud =lustre_msg_buf (msg, offset,0 );
@@ -2240,10 +2243,12 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset) pud->pud_ngroups = (msg->lm_buflens[offset] -sizeof (*pud)) /4 ;task_lock (current); -if (pud->pud_ngroups > current_ngroups) - pud->pud_ngroups = current_ngroups; -memcpy (pud->pud_groups,current_cred ()->group_info->gid, - pud->pud_ngroups *sizeof (__u32)); + ngroups =current_cred ()->group_info->ngroups; + gid =current_cred ()->group_info->gid; +if (pud->pud_ngroups > ngroups) + pud->pud_ngroups = ngroups; +for (g =0 ; g < pud->pud_ngroups; g++) + pud->pud_groups[g] =from_kgid (&init_user_ns, gid[g]);task_unlock (current);return 0 ;
PATCH 12/24 lustre: discard LTIME_S macro
In reply to NeilBrownRather than using a macro, just access the required field directly.
--- .../staging/lustre/lustre/include/lustre_compat.h | 2 - drivers/staging/lustre/lustre/llite/file.c | 24 +++++++++-------- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 6 ++-- drivers/staging/lustre/lustre/llite/llite_lib.c | 28 ++++++++++---------- drivers/staging/lustre/lustre/llite/namei.c | 16 ++++++----- drivers/staging/lustre/lustre/llite/vvp_object.c | 6 ++-- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 ++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 16 ++++++----- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 6 ++-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 +-- drivers/staging/lustre/lustre/obdclass/obdo.c | 10 ++++--- 11 files changed, 61 insertions(+), 63 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -2
@@ -49,8 +49,6 @@#define module_init (a) late_initcall(a)#endif -#define LTIME_S (time) (time.tv_sec) -#ifndef QUOTA_OK # define QUOTA_OK 0#endif
drivers/staging/lustre/lustre/llite/file.c +12 -12
@@ -956,13 +956,13 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode)/* merge timestamps the most recently obtained from mds with * timestamps obtained from osts */ -LTIME_S (inode->i_atime) = lli->lli_atime; -LTIME_S (inode->i_mtime) = lli->lli_mtime; -LTIME_S (inode->i_ctime) = lli->lli_ctime; + inode->i_atime.tv_sec = lli->lli_atime; + inode->i_mtime.tv_sec = lli->lli_mtime; + inode->i_ctime.tv_sec = lli->lli_ctime; - mtime =LTIME_S (inode->i_mtime); - atime =LTIME_S (inode->i_atime); - ctime =LTIME_S (inode->i_ctime); + mtime = inode->i_mtime.tv_sec; + atime = inode->i_atime.tv_sec; + ctime = inode->i_ctime.tv_sec;cl_object_attr_lock (obj); rc =cl_object_attr_get (env, obj, attr);
@@ -987,9 +987,9 @@ int ll_merge_attr(const struct lu_env *env, struct inode *inode) inode->i_blocks = attr->cat_blocks; -LTIME_S (inode->i_mtime) = mtime; -LTIME_S (inode->i_atime) = atime; -LTIME_S (inode->i_ctime) = ctime; + inode->i_mtime.tv_sec = mtime; + inode->i_atime.tv_sec = atime; + inode->i_ctime.tv_sec = ctime; out_size_unlock:ll_inode_size_unlock (inode);
@@ -2933,9 +2933,9 @@ static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits)return rc; } -LTIME_S (inode->i_atime) =ll_i2info (inode)->lli_atime; -LTIME_S (inode->i_mtime) =ll_i2info (inode)->lli_mtime; -LTIME_S (inode->i_ctime) =ll_i2info (inode)->lli_ctime; + inode->i_atime.tv_sec =ll_i2info (inode)->lli_atime; + inode->i_mtime.tv_sec =ll_i2info (inode)->lli_mtime; + inode->i_ctime.tv_sec =ll_i2info (inode)->lli_ctime; }else {struct ll_inode_info *lli =ll_i2info (inode);
drivers/staging/lustre/lustre/llite/lcommon_cl.c +3 -3
@@ -95,9 +95,9 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, io->ci_obj = obj; io->ci_verify_layout =1 ; - io->u.ci_setattr.sa_attr.lvb_atime =LTIME_S (attr->ia_atime); - io->u.ci_setattr.sa_attr.lvb_mtime =LTIME_S (attr->ia_mtime); - io->u.ci_setattr.sa_attr.lvb_ctime =LTIME_S (attr->ia_ctime); + io->u.ci_setattr.sa_attr.lvb_atime = attr->ia_atime.tv_sec; + io->u.ci_setattr.sa_attr.lvb_mtime = attr->ia_mtime.tv_sec; + io->u.ci_setattr.sa_attr.lvb_ctime = attr->ia_ctime.tv_sec; io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size; io->u.ci_setattr.sa_attr_flags = attr_flags; io->u.ci_setattr.sa_avalid = attr->ia_valid;
drivers/staging/lustre/lustre/llite/llite_lib.c +14 -14
@@ -1108,9 +1108,9 @@ static struct inode *ll_iget_anon_dir(struct super_block *sb,LASSERTF (S_ISDIR (inode->i_mode),"Not slave inode " DFID "\n" ,PFID (fid)); -LTIME_S (inode->i_mtime) =0 ; -LTIME_S (inode->i_atime) =0 ; -LTIME_S (inode->i_ctime) =0 ; + inode->i_mtime.tv_sec =0 ; + inode->i_atime.tv_sec =0 ; + inode->i_ctime.tv_sec =0 ; inode->i_rdev =0 ; inode->i_op = &ll_dir_inode_operations;
@@ -1486,7 +1486,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,if (attr->ia_valid & (ATTR_MTIME |ATTR_CTIME ))CDEBUG (D_INODE ,"setting mtime %lu, ctime %lu, now = %llu\n" , -LTIME_S (attr->ia_mtime),LTIME_S (attr->ia_ctime), + attr->ia_mtime.tv_sec, attr->ia_ctime.tv_sec, (s64 )ktime_get_real_seconds ());if (S_ISREG (inode->i_mode))
@@ -1759,23 +1759,23 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md) inode->i_generation =cl_fid_build_gen (&body->mbo_fid1);if (body->mbo_valid &OBD_MD_FLATIME ) { -if (body->mbo_atime >LTIME_S (inode->i_atime)) -LTIME_S (inode->i_atime) = body->mbo_atime; +if (body->mbo_atime > inode->i_atime.tv_sec) + inode->i_atime.tv_sec = body->mbo_atime; lli->lli_atime = body->mbo_atime; }if (body->mbo_valid &OBD_MD_FLMTIME ) { -if (body->mbo_mtime >LTIME_S (inode->i_mtime)) { +if (body->mbo_mtime > inode->i_mtime.tv_sec) {CDEBUG (D_INODE ,"setting ino %lu mtime from %lu to %llu\n" , - inode->i_ino,LTIME_S (inode->i_mtime), + inode->i_ino, inode->i_mtime.tv_sec, body->mbo_mtime); -LTIME_S (inode->i_mtime) = body->mbo_mtime; + inode->i_mtime.tv_sec = body->mbo_mtime; } lli->lli_mtime = body->mbo_mtime; }if (body->mbo_valid &OBD_MD_FLCTIME ) { -if (body->mbo_ctime >LTIME_S (inode->i_ctime)) -LTIME_S (inode->i_ctime) = body->mbo_ctime; +if (body->mbo_ctime > inode->i_ctime.tv_sec) + inode->i_ctime.tv_sec = body->mbo_ctime; lli->lli_ctime = body->mbo_ctime; }if (body->mbo_valid &OBD_MD_FLMODE )
@@ -1848,9 +1848,9 @@ int ll_read_inode2(struct inode *inode, void *opaque)* it ourselves. They will be overwritten by either MDS or OST * attributes - we just need to make sure they aren't newer. */ -LTIME_S (inode->i_mtime) =0 ; -LTIME_S (inode->i_atime) =0 ; -LTIME_S (inode->i_ctime) =0 ; + inode->i_mtime.tv_sec =0 ; + inode->i_atime.tv_sec =0 ; + inode->i_ctime.tv_sec =0 ; inode->i_rdev =0 ; rc =ll_update_inode (inode, md);if (rc)
drivers/staging/lustre/lustre/llite/namei.c +8 -8
@@ -266,9 +266,9 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,struct ll_inode_info *lli =ll_i2info (inode);spin_lock (&lli->lli_lock); -LTIME_S (inode->i_mtime) =0 ; -LTIME_S (inode->i_atime) =0 ; -LTIME_S (inode->i_ctime) =0 ; + inode->i_mtime.tv_sec =0 ; + inode->i_atime.tv_sec =0 ; + inode->i_ctime.tv_sec =0 ;spin_unlock (&lli->lli_lock); }
@@ -848,15 +848,15 @@ void ll_update_times(struct ptlrpc_request *request, struct inode *inode)LASSERT (body);if (body->mbo_valid &OBD_MD_FLMTIME && - body->mbo_mtime >LTIME_S (inode->i_mtime)) { + body->mbo_mtime > inode->i_mtime.tv_sec) {CDEBUG (D_INODE ,"setting fid " DFID " mtime from %lu to %llu\n" , -PFID (ll_inode2fid (inode)),LTIME_S (inode->i_mtime), +PFID (ll_inode2fid (inode)), inode->i_mtime.tv_sec, body->mbo_mtime); -LTIME_S (inode->i_mtime) = body->mbo_mtime; + inode->i_mtime.tv_sec = body->mbo_mtime; }if (body->mbo_valid &OBD_MD_FLCTIME && - body->mbo_ctime >LTIME_S (inode->i_ctime)) -LTIME_S (inode->i_ctime) = body->mbo_ctime; + body->mbo_ctime > inode->i_ctime.tv_sec) + inode->i_ctime.tv_sec = body->mbo_ctime; } static int ll_new_node(struct inode *dir, struct dentry *dentry,
drivers/staging/lustre/lustre/llite/vvp_object.c +3 -3
@@ -170,9 +170,9 @@ static int vvp_object_glimpse(const struct lu_env *env, {struct inode *inode =vvp_object_inode (obj); - lvb->lvb_mtime =LTIME_S (inode->i_mtime); - lvb->lvb_atime =LTIME_S (inode->i_atime); - lvb->lvb_ctime =LTIME_S (inode->i_ctime); + lvb->lvb_mtime = inode->i_mtime.tv_sec; + lvb->lvb_atime = inode->i_atime.tv_sec; + lvb->lvb_ctime = inode->i_ctime.tv_sec;/* * LU-417: Add dirty pages block count lest i_blocks reports 0, some * "cp" or "tar" on remote node may think it's a completely sparse file
drivers/staging/lustre/lustre/lmv/lmv_intent.c +3 -3
@@ -233,9 +233,9 @@ int lmv_revalidate_slaves(struct obd_export *exp,i_size_write (inode, body->mbo_size); inode->i_blocks = body->mbo_blocks;set_nlink (inode, body->mbo_nlink); -LTIME_S (inode->i_atime) = body->mbo_atime; -LTIME_S (inode->i_ctime) = body->mbo_ctime; -LTIME_S (inode->i_mtime) = body->mbo_mtime; + inode->i_atime.tv_sec = body->mbo_atime; + inode->i_ctime.tv_sec = body->mbo_ctime; + inode->i_mtime.tv_sec = body->mbo_mtime; }md_set_lock_data (tgt->ltd_exp, lockh, inode,NULL );
drivers/staging/lustre/lustre/lmv/lmv_obd.c +8 -8
@@ -3030,8 +3030,8 @@ static int lmv_merge_attr(struct obd_export *exp,CDEBUG (D_INFO ,"" DFID " size %llu, blocks %llu nlink %u, atime %lu ctime %lu, mtime %lu.\n" ,PFID (&lsm->lsm_md_oinfo[i].lmo_fid),i_size_read (inode), (unsigned long long )inode->i_blocks, - inode->i_nlink,LTIME_S (inode->i_atime), -LTIME_S (inode->i_ctime),LTIME_S (inode->i_mtime)); + inode->i_nlink, inode->i_atime.tv_sec, + inode->i_ctime.tv_sec, inode->i_mtime.tv_sec);/* for slave stripe, it needs to subtract nlink for . and .. */ if (i)
@@ -3042,14 +3042,14 @@ static int lmv_merge_attr(struct obd_export *exp, attr->cat_size +=i_size_read (inode); attr->cat_blocks += inode->i_blocks; -if (attr->cat_atime <LTIME_S (inode->i_atime)) - attr->cat_atime =LTIME_S (inode->i_atime); +if (attr->cat_atime < inode->i_atime.tv_sec) + attr->cat_atime = inode->i_atime.tv_sec; -if (attr->cat_ctime <LTIME_S (inode->i_ctime)) - attr->cat_ctime =LTIME_S (inode->i_ctime); +if (attr->cat_ctime < inode->i_ctime.tv_sec) + attr->cat_ctime = inode->i_ctime.tv_sec; -if (attr->cat_mtime <LTIME_S (inode->i_mtime)) - attr->cat_mtime =LTIME_S (inode->i_mtime); +if (attr->cat_mtime < inode->i_mtime.tv_sec) + attr->cat_mtime = inode->i_mtime.tv_sec; }return 0 ; }
drivers/staging/lustre/lustre/mdc/mdc_lib.c +3 -3
@@ -293,9 +293,9 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec, rec->sa_gid =from_kgid (&init_user_ns, op_data->op_attr.ia_gid); rec->sa_size = op_data->op_attr.ia_size; rec->sa_blocks = op_data->op_attr_blocks; - rec->sa_atime =LTIME_S (op_data->op_attr.ia_atime); - rec->sa_mtime =LTIME_S (op_data->op_attr.ia_mtime); - rec->sa_ctime =LTIME_S (op_data->op_attr.ia_ctime); + rec->sa_atime = op_data->op_attr.ia_atime.tv_sec; + rec->sa_mtime = op_data->op_attr.ia_mtime.tv_sec; + rec->sa_ctime = op_data->op_attr.ia_ctime.tv_sec; rec->sa_attr_flags = op_data->op_attr_flags;if ((op_data->op_attr.ia_valid &ATTR_GID ) &&in_group_p (op_data->op_attr.ia_gid))
drivers/staging/lustre/lustre/mdc/mdc_reint.c +2 -2
@@ -130,8 +130,8 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,if (op_data->op_attr.ia_valid & (ATTR_MTIME |ATTR_CTIME ))CDEBUG (D_INODE ,"setting mtime %ld, ctime %ld\n" , -LTIME_S (op_data->op_attr.ia_mtime), -LTIME_S (op_data->op_attr.ia_ctime)); + op_data->op_attr.ia_mtime.tv_sec, + op_data->op_attr.ia_ctime.tv_sec);mdc_setattr_pack (req, op_data, ea, ealen); req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
drivers/staging/lustre/lustre/obdclass/obdo.c +5 -5
@@ -61,19 +61,19 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)if (valid & (OBD_MD_FLCTIME |OBD_MD_FLMTIME ))CDEBUG (D_INODE ,"valid %x, new time %lu/%lu\n" , - valid,LTIME_S (src->i_mtime), -LTIME_S (src->i_ctime)); + valid, src->i_mtime.tv_sec, + src->i_ctime.tv_sec);if (valid &OBD_MD_FLATIME ) { - dst->o_atime =LTIME_S (src->i_atime); + dst->o_atime = src->i_atime.tv_sec; newvalid |=OBD_MD_FLATIME ; }if (valid &OBD_MD_FLMTIME ) { - dst->o_mtime =LTIME_S (src->i_mtime); + dst->o_mtime = src->i_mtime.tv_sec; newvalid |=OBD_MD_FLMTIME ; }if (valid &OBD_MD_FLCTIME ) { - dst->o_ctime =LTIME_S (src->i_ctime); + dst->o_ctime = src->i_ctime.tv_sec; newvalid |=OBD_MD_FLCTIME ; }if (valid &OBD_MD_FLSIZE ) {
PATCH 13/24 lustre: discard NO_QUOTA and QUOTA_OK
In reply to NeilBrownThey don't help readability.
--- .../staging/lustre/lustre/include/lustre_compat.h | 7 ------- drivers/staging/lustre/lustre/osc/osc_cache.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -7
@@ -49,13 +49,6 @@#define module_init (a) late_initcall(a)#endif -#ifndef QUOTA_OK -# define QUOTA_OK 0 -#endif -#ifndef NO_QUOTA -# define NO_QUOTA (-EDQUOT) -#endif -#if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit)# define ext2_set_bit __test_and_set_bit_le# define ext2_clear_bit __test_and_clear_bit_le
drivers/staging/lustre/lustre/osc/osc_cache.c +2 -2
@@ -2404,8 +2404,8 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, qid[USRQUOTA ] = attr->cat_uid; qid[GRPQUOTA ] = attr->cat_gid; -if (rc ==0 &&osc_quota_chkdq (cli, qid) ==NO_QUOTA ) - rc = -EDQUOT ; +if (rc ==0 ) + rc =osc_quota_chkdq (cli, qid);if (rc)return rc; }
drivers/staging/lustre/lustre/osc/osc_quota.c +2 -2
@@ -64,11 +64,11 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])*/ CDEBUG (D_QUOTA ,"chkdq found noquota for %s %d\n" , type ==USRQUOTA ?"user" :"grout" , qid[type]); -return NO_QUOTA ; +return -EDQUOT ; } } -return QUOTA_OK ; +return 0 ; }static void osc_quota_free (struct rcu_head *head)
PATCH 14/24 lustre: discard ext2* bit operations
In reply to NeilBrownJust use the relevant *_le bit operation directly.
--- .../staging/lustre/lustre/include/lustre_compat.h | 8 -------- drivers/staging/lustre/lustre/obdclass/llog.c | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -8
@@ -49,14 +49,6 @@#define module_init (a) late_initcall(a)#endif -#if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit) -# define ext2_set_bit __test_and_set_bit_le -# define ext2_clear_bit __test_and_clear_bit_le -# define ext2_test_bit test_bit_le -# define ext2_find_first_zero_bit find_first_zero_bit_le -# define ext2_find_next_zero_bit find_next_zero_bit_le -#endif -#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)#endif /* _LUSTRE_COMPAT_H */
drivers/staging/lustre/lustre/obdclass/llog.c +3 -3
@@ -137,7 +137,7 @@ static int llog_read_header(const struct lu_env *env,*/ len = llh->llh_hdr.lrh_len - llh->llh_bitmap_offset;memset (LLOG_HDR_BITMAP (llh),0 , len -sizeof (llh->llh_tail)); -ext2_set_bit (0 ,LLOG_HDR_BITMAP (llh)); +set_bit_le (0 ,LLOG_HDR_BITMAP (llh));LLOG_HDR_TAIL (llh)->lrt_len = llh->llh_hdr.lrh_len;LLOG_HDR_TAIL (llh)->lrt_index = llh->llh_hdr.lrh_index; rc =0 ;
@@ -264,7 +264,7 @@ static int llog_process_thread(void *arg)/* skip records not set in bitmap */ while (index <= last_index && - !ext2_test_bit (index,LLOG_HDR_BITMAP (llh))) + !test_bit_le (index,LLOG_HDR_BITMAP (llh))) ++index;if (index > last_index)
@@ -365,7 +365,7 @@ static int llog_process_thread(void *arg) chunk_offset;/* if set, process the callback on this record */ -if (ext2_test_bit (index,LLOG_HDR_BITMAP (llh))) { +if (test_bit_le (index,LLOG_HDR_BITMAP (llh))) { rc = lpi->lpi_cb (lpi->lpi_env, loghandle, rec, lpi->lpi_cbdata); last_called_index = index;
PATCH 15/24 lustre: centralize TIMES_SET_FLAGS
In reply to NeilBrownThis macro is only used in llite, so move both definitions to llite_internal.h.
--- .../staging/lustre/lustre/include/lustre_compat.h | 2 -- .../staging/lustre/lustre/llite/llite_internal.h | 2 ++ drivers/staging/lustre/lustre/llite/llite_lib.c | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -2
@@ -49,6 +49,4 @@#define module_init (a) late_initcall(a)#endif -#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) -#endif /* _LUSTRE_COMPAT_H */
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -0
@@ -69,6 +69,8 @@#define LL_IT2STR (it) ((it) ? ldlm_it2str((it)->it_op) : "0")#define LUSTRE_FPRIVATE (file) ((file)->private_data) +#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) +struct ll_dentry_data {struct lookup_intent *lld_it;unsigned int lld_sa_generation;
drivers/staging/lustre/lustre/llite/llite_lib.c +0 -2
@@ -1353,8 +1353,6 @@ void ll_clear_inode(struct inode *inode)cl_inode_fini (inode); } -#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) -static int ll_md_setattr (struct dentry *dentry,struct md_op_data *op_data) {struct lustre_md md;
PATCH 16/24 lustre: remove redefinition of module_init().
In reply to NeilBrownAs lustre has only recently support building as non-modules, this code must be very old. If there is a dependency ordering, this is not the way to handle it - random numbers should be generated when filesystem is activated, not when the module is loaded.
So just remove this code.
--- .../staging/lustre/lustre/include/lustre_compat.h | 10 ---------- 1 file changed, 10 deletions(-)
drivers/staging/lustre/lustre/include/lustre_compat.h +0 -10
@@ -39,14 +39,4 @@#include <linux/cred.h> #include <linux/module.h> -/* -* OBD need working random driver, thus all our -* initialization routines must be called after device -* driver initialization -*/ -#ifndef MODULE -#undef module_init -#define module_init (a) late_initcall(a) -#endif -#endif /* _LUSTRE_COMPAT_H */
PATCH 17/24 lustre: remove lustre_compat.h
In reply to NeilBrownOnly thing it provided was one include file,
so include that directly where needed.
--- drivers/staging/lustre/lustre/include/cl_object.h | 1 .../staging/lustre/lustre/include/lustre_compat.h | 42 -------------------- .../staging/lustre/lustre/include/obd_support.h | 1 .../staging/lustre/lustre/llite/llite_internal.h | 1 drivers/staging/lustre/lustre/llite/llite_lib.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/ptlrpc/import.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 10 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h
drivers/staging/lustre/lustre/include/cl_object.h +0 -1
@@ -90,7 +90,6 @@* super-class definitions. */ #include <lu_object.h> -#include <lustre_compat.h> #include <linux/atomic.h> #include <linux/mutex.h> #include <linux/radix-tree.h>
drivers/staging/lustre/lustre/include/lustre_compat.h deleted +0 -42
42 lines not on this page · raw message
drivers/staging/lustre/lustre/include/obd_support.h +0 -1
@@ -37,7 +37,6 @@#include <linux/slab.h> #include <linux/sched/signal.h> -#include <lustre_compat.h> #include <lprocfs_status.h> /* global variables */
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -1
@@ -39,7 +39,6 @@#include <lustre_linkea.h> /* for struct cl_lock_descr and struct cl_io */ -#include <lustre_compat.h> #include <cl_object.h> #include <lustre_lmv.h> #include <lustre_mdc.h>
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -0
@@ -42,6 +42,7 @@#include <linux/types.h> #include <linux/mm.h> #include <linux/random.h> +#include <linux/fs_struct.h> #include <uapi/linux/lustre/lustre_ioctl.h> #include <lustre_ha.h>
drivers/staging/lustre/lustre/obdclass/llog.c +1 -0
@@ -45,6 +45,7 @@#define DEBUG_SUBSYSTEM S_LOG#include <linux/kthread.h> +#include <linux/fs_struct.h> #include <llog_swab.h> #include <lustre_log.h> #include <obd_class.h>
drivers/staging/lustre/lustre/obdclass/obd_mount.c +0 -1
@@ -43,7 +43,6 @@#include <linux/random.h> #include <obd.h> -#include <lustre_compat.h> #include <obd_class.h> #include <uapi/linux/lustre/lustre_idl.h> #include <lustre_log.h>
drivers/staging/lustre/lustre/ptlrpc/import.c +1 -0
@@ -38,6 +38,7 @@#define DEBUG_SUBSYSTEM S_RPC#include <linux/kthread.h> +#include <linux/fs_struct.h> #include <obd_support.h> #include <lustre_ha.h> #include <lustre_net.h>
drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +1 -0
@@ -53,6 +53,7 @@#define DEBUG_SUBSYSTEM S_RPC#include <linux/kthread.h> +#include <linux/fs_struct.h> #include <linux/libcfs/libcfs.h> #include <linux/libcfs/libcfs_cpu.h> #include <linux/libcfs/libcfs_string.h>
drivers/staging/lustre/lustre/ptlrpc/service.c +1 -0
@@ -34,6 +34,7 @@#define DEBUG_SUBSYSTEM S_RPC#include <linux/kthread.h> +#include <linux/fs_struct.h> #include <obd_support.h> #include <obd_class.h> #include <lustre_net.h>
PATCH 18/24 lustre/lnet: move tracefile locking from linux-tracefile.c to tracefile.c
In reply to NeilBrownThere is no value in keeping it separate.
--- .../staging/lustre/lnet/libcfs/linux-tracefile.c | 22 ------------------ drivers/staging/lustre/lnet/libcfs/tracefile.c | 25 ++++++++++---------- drivers/staging/lustre/lnet/libcfs/tracefile.h | 5 ---- 3 files changed, 13 insertions(+), 39 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux-tracefile.c +0 -22
@@ -47,8 +47,6 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; -static DECLARE_RWSEM (cfs_tracefile_sem); -int cfs_tracefile_init_arch (void ) {int i;
@@ -109,26 +107,6 @@ void cfs_tracefile_fini_arch(void) } } -void cfs_tracefile_read_lock (void ) -{ -down_read (&cfs_tracefile_sem); -} - -void cfs_tracefile_read_unlock (void ) -{ -up_read (&cfs_tracefile_sem); -} - -void cfs_tracefile_write_lock (void ) -{ -down_write (&cfs_tracefile_sem); -} - -void cfs_tracefile_write_unlock (void ) -{ -up_write (&cfs_tracefile_sem); -} -enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) {if (in_irq ())
drivers/staging/lustre/lnet/libcfs/tracefile.c +13 -12
@@ -59,6 +59,7 @@ static DEFINE_MUTEX(cfs_trace_thread_mutex);static int thread_running;static atomic_t cfs_tage_allocated =ATOMIC_INIT (0 ); +static DECLARE_RWSEM (cfs_tracefile_sem);struct page_collection {struct list_head pc_pages;
@@ -711,7 +712,7 @@ int cfs_tracefile_dump_all_pages(char *filename)mm_segment_t __oldfs;int rc; -cfs_tracefile_write_lock (); +down_write (&cfs_tracefile_sem); filp =filp_open (filename,O_CREAT |O_EXCL |O_WRONLY |O_LARGEFILE ,0600 );
@@ -759,7 +760,7 @@ int cfs_tracefile_dump_all_pages(char *filename) close:filp_close (filp,NULL ); out: -cfs_tracefile_write_unlock (); +up_write (&cfs_tracefile_sem);return rc; }
@@ -873,12 +874,12 @@ int cfs_trace_daemon_command(char *str) {int rc =0 ; -cfs_tracefile_write_lock (); +down_write (&cfs_tracefile_sem);if (!strcmp (str,"stop" )) { -cfs_tracefile_write_unlock (); +up_write (&cfs_tracefile_sem);cfs_trace_stop_thread (); -cfs_tracefile_write_lock (); +down_write (&cfs_tracefile_sem);memset (cfs_tracefile,0 ,sizeof (cfs_tracefile)); }else if (!strncmp (str,"size=" ,5 )) {
@@ -905,7 +906,7 @@ int cfs_trace_daemon_command(char *str)cfs_trace_start_thread (); } -cfs_tracefile_write_unlock (); +up_write (&cfs_tracefile_sem);return rc; }
@@ -950,12 +951,12 @@ int cfs_trace_set_debug_mb(int mb) mb /=num_possible_cpus (); pages = mb << (20 -PAGE_SHIFT ); -cfs_tracefile_write_lock (); +down_write (&cfs_tracefile_sem);cfs_tcd_for_each (tcd, i, j) tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) /100 ; -cfs_tracefile_write_unlock (); +up_write (&cfs_tracefile_sem);return 0 ; }
@@ -967,12 +968,12 @@ int cfs_trace_get_debug_mb(void)struct cfs_trace_cpu_data *tcd;int total_pages =0 ; -cfs_tracefile_read_lock (); +down_read (&cfs_tracefile_sem);cfs_tcd_for_each (tcd, i, j) total_pages += tcd->tcd_max_pages; -cfs_tracefile_read_unlock (); +up_read (&cfs_tracefile_sem);return (total_pages >> (20 -PAGE_SHIFT )) +1 ; }
@@ -1002,7 +1003,7 @@ static int tracefiled(void *arg) goto end_loop; filp =NULL ; -cfs_tracefile_read_lock (); +down_read (&cfs_tracefile_sem);if (cfs_tracefile[0 ]) { filp = filp_open(cfs_tracefile, O_CREAT | O_RDWR | O_LARGEFILE,
@@ -1014,7 +1015,7 @@ static int tracefiled(void *arg) rc); } } -cfs_tracefile_read_unlock (); +up_read (&cfs_tracefile_sem);if (!filp) {put_pages_on_daemon_list (&pc);__LASSERT (list_empty (&pc.pc_pages));
drivers/staging/lustre/lnet/libcfs/tracefile.h +0 -5
@@ -65,11 +65,6 @@ void libcfs_run_debug_log_upcall(char *file);int cfs_tracefile_init_arch (void );void cfs_tracefile_fini_arch (void ); -void cfs_tracefile_read_lock (void ); -void cfs_tracefile_read_unlock (void ); -void cfs_tracefile_write_lock (void ); -void cfs_tracefile_write_unlock (void ); -int cfs_tracefile_dump_all_pages (char *filename);void cfs_trace_debug_print (void );void cfs_trace_flush_pages (void );
PATCH 19/24 lustre: open code cfs_trace_max_debug_mb() into cfs_trace_set_debug_mb()
In reply to NeilBrownThis function in used twice.
In libcfs_debug_init() the usage is pointless as the only place that set libcfs_debug_mb ensures that it does not exceed the maximum. So checking again can never help.
So open-code the small function into the only other place that it is used - in cfs_trace_set_debug_mb(), which is used to set libcfs_debug_mb.
--- drivers/staging/lustre/lnet/libcfs/debug.c | 6 +++--- .../staging/lustre/lnet/libcfs/linux-tracefile.c | 7 ------- drivers/staging/lustre/lnet/libcfs/tracefile.c | 3 ++- 3 files changed, 5 insertions(+), 11 deletions(-)
drivers/staging/lustre/lnet/libcfs/debug.c +3 -3
@@ -411,10 +411,10 @@ int libcfs_debug_init(unsigned long bufsize) sizeof(libcfs_debug_file_path_arr)); } -/* If libcfs_debug_mb is set to an invalid value or uninitialized -* then just make the total buffers smp_num_cpus * TCD_MAX_PAGES +/* If libcfs_debug_mb is uninitialized then just make the +* total buffers smp_num_cpus * TCD_MAX_PAGES */ -if (max >cfs_trace_max_debug_mb () || max <num_possible_cpus ()) { +if (max <num_possible_cpus ()) { max =TCD_MAX_PAGES ; }else { max = max /num_possible_cpus ();
drivers/staging/lustre/lnet/libcfs/linux-tracefile.c +0 -7
@@ -227,10 +227,3 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, hdr->ph_line_num, fn, len, buf); } } - -int cfs_trace_max_debug_mb (void ) -{ -int total_mb = (totalram_pages >> (20 -PAGE_SHIFT )); - -return max (512 , (total_mb *80 ) /100 ); -}
drivers/staging/lustre/lnet/libcfs/tracefile.c +2 -1
@@ -933,7 +933,8 @@ int cfs_trace_set_debug_mb(int mb)int i;int j;int pages; -int limit =cfs_trace_max_debug_mb (); +int total_mb = (totalram_pages >> (20 -PAGE_SHIFT )); +int limit =max (512 , (total_mb *80 ) /100 );struct cfs_trace_cpu_data *tcd;if (mb <num_possible_cpus ()) {
PATCH 20/24 lustre: move tcd locking across to tracefile.c
In reply to NeilBrownNo need to have this in linux-tracefile.c
--- .../staging/lustre/lnet/libcfs/linux-tracefile.c | 35 ------------ drivers/staging/lustre/lnet/libcfs/tracefile.c | 59 ++++++++++++++++++++ drivers/staging/lustre/lnet/libcfs/tracefile.h | 28 --------- 3 files changed, 59 insertions(+), 63 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux-tracefile.c +0 -35
@@ -116,41 +116,6 @@ enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)return CFS_TCD_TYPE_PROC ; } -/* -* The walking argument indicates the locking comes from all tcd types -* iterator and we must lock it and dissable local irqs to avoid deadlocks -* with other interrupt locks that might be happening. See LU-1311 -* for details. -*/ -int cfs_trace_lock_tcd (struct cfs_trace_cpu_data *tcd,int walking) - __acquires(&tcd->tc_lock) -{ -__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_MAX ); -if (tcd->tcd_type ==CFS_TCD_TYPE_IRQ ) -spin_lock_irqsave (&tcd->tcd_lock, tcd->tcd_lock_flags); -else if (tcd->tcd_type ==CFS_TCD_TYPE_SOFTIRQ ) -spin_lock_bh (&tcd->tcd_lock); -else if (unlikely (walking)) -spin_lock_irq (&tcd->tcd_lock); -else -spin_lock (&tcd->tcd_lock); -return 1 ; -} - -void cfs_trace_unlock_tcd (struct cfs_trace_cpu_data *tcd,int walking) - __releases(&tcd->tcd_lock) -{ -__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_MAX ); -if (tcd->tcd_type ==CFS_TCD_TYPE_IRQ ) -spin_unlock_irqrestore (&tcd->tcd_lock, tcd->tcd_lock_flags); -else if (tcd->tcd_type ==CFS_TCD_TYPE_SOFTIRQ ) -spin_unlock_bh (&tcd->tcd_lock); -else if (unlikely (walking)) -spin_unlock_irq (&tcd->tcd_lock); -else -spin_unlock (&tcd->tcd_lock); -} - void cfs_set_ptldebug_header(struct ptldebug_header *header, struct libcfs_debug_msg_data *msgdata,
drivers/staging/lustre/lnet/libcfs/tracefile.c +59 -0
65 lines not on this page · raw message
drivers/staging/lustre/lnet/libcfs/tracefile.h +0 -28
@@ -49,8 +49,6 @@ enum cfs_trace_buf_type { CFS_TCD_TYPE_MAX }; -/* trace file lock routines */ -#define TRACEFILE_NAME_SIZE 1024extern char cfs_tracefile[TRACEFILE_NAME_SIZE ];extern long long cfs_tracefile_size;
@@ -195,11 +193,6 @@ extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS]; j <num_possible_cpus (); \ j++, (tcd) = &(*cfs_trace_data[i])[j].tcd) -#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ - (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ - cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++) -void cfs_set_ptldebug_header (struct ptldebug_header *header,struct libcfs_debug_msg_data *m,unsigned long stack);
@@ -207,9 +200,6 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, const char *buf, int len, const char *file, const char *fn); -int cfs_trace_lock_tcd (struct cfs_trace_cpu_data *tcd,int walking); -void cfs_trace_unlock_tcd (struct cfs_trace_cpu_data *tcd,int walking); -extern char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ];enum cfs_trace_buf_type cfs_trace_buf_idx_get (void );
@@ -222,24 +212,6 @@ cfs_trace_get_console_buffer(void)return cfs_trace_console_buffers[i][j]; } -static inline struct cfs_trace_cpu_data * -cfs_trace_get_tcd (void ) -{ -struct cfs_trace_cpu_data *tcd = - &(*cfs_trace_data[cfs_trace_buf_idx_get ()])[get_cpu ()].tcd; - -cfs_trace_lock_tcd (tcd,0 ); - -return tcd; -} - -static inline void cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd) -{ -cfs_trace_unlock_tcd (tcd,0 ); - -put_cpu (); -} -int cfs_trace_refill_stock (struct cfs_trace_cpu_data *tcd,gfp_t gfp,struct list_head *stock);
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
In reply to NeilBrownIt's good to keep related code together.
--- drivers/staging/lustre/lnet/libcfs/Makefile | 2 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 194 -------------------- drivers/staging/lustre/lnet/libcfs/tracefile.c | 155 ++++++++++++++++ 3 files changed, 156 insertions(+), 195 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c
drivers/staging/lustre/lnet/libcfs/Makefile +1 -1
@@ -3,7 +3,7 @@ ccflags-y += -I$(srctree)/drivers/staging/lustre/include ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include ccflags-y += -DKBUILD_MODNAME='"lnet"' -libcfs-obj-y += linux-tracefile.o linux-debug.o +libcfs-obj-y += linux-debug.o libcfs-obj-y += linux-crypto.o libcfs-obj-y += linux-crypto-adler.o
drivers/staging/lustre/lnet/libcfs/linux-tracefile.c deleted +0 -194
194 lines not on this page · raw message
drivers/staging/lustre/lnet/libcfs/tracefile.c +155 -0
161 lines not on this page · raw message
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
Quoted 4 lines
It's good to keep related code together.
Signed-off-by NeilBrown <[email protected]>
Nak. For some reason this corrupts my dmesg output. Its really strange and I haven't figured it out yet.
Quoted 389 lines
--- drivers/staging/lustre/lnet/libcfs/Makefile | 2 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 194 -------------------- drivers/staging/lustre/lnet/libcfs/tracefile.c | 155 ++++++++++++++++ 3 files changed, 156 insertions(+), 195 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.cdrivers/staging/lustre/lnet/libcfs/Makefile +1
-1@@ -3,7 +3,7 @@ ccflags-y += -I$(srctree)/drivers/staging/lustre/include ccflags-y += -I$(srctree)/drivers/staging/lustre/lustre/include ccflags-y += -DKBUILD_MODNAME='"lnet"' -libcfs-obj-y += linux-tracefile.o linux-debug.o +libcfs-obj-y += linux-debug.o libcfs-obj-y += linux-crypto.o libcfs-obj-y += linux-crypto-adler.odrivers/staging/lustre/lnet/libcfs/linux-tracefile.c deleted +0
-194@@ -1,194 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* GPL HEADER START -* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 only, -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License version 2 for more details (a copy is included -* in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU General Public License -* version 2 along with this program; If not, see -* http://www.gnu.org/licenses/gpl-2.0.html -* -* GPL HEADER END -*/ -/* -* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -* Use is subject to license terms. -* -* Copyright (c) 2012, Intel Corporation. -*/ -/* -* This file is part of Lustre, http://www.lustre.org/ -* Lustre is a trademark of Sun Microsystems, Inc. -*/ - -#define DEBUG_SUBSYSTEM S_LNET -#define LUSTRE_TRACEFILE_PRIVATE - -#include <linux/slab.h> -#include <linux/mm.h> -#include "tracefile.h" - -/* percents to share the total debug memory for each type */ -static unsigned int pages_factor[CFS_TCD_TYPE_MAX ] = { -80 ,/* 80% pages for CFS_TCD_TYPE_PROC */ -10 ,/* 10% pages for CFS_TCD_TYPE_SOFTIRQ */ -10 /* 10% pages for CFS_TCD_TYPE_IRQ */ -}; - -char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; - -int cfs_tracefile_init_arch (void ) -{ -int i; -int j; -struct cfs_trace_cpu_data *tcd; - -/* initialize trace_data */ -memset (cfs_trace_data,0 ,sizeof (cfs_trace_data)); -for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) { - cfs_trace_data[i] = -kmalloc_array (num_possible_cpus (), -sizeof (union cfs_trace_data_union ), -GFP_KERNEL ); -if (!cfs_trace_data[i]) - goto out; - } - -/* arch related info initialized */ -cfs_tcd_for_each (tcd, i, j) { -spin_lock_init (&tcd->tcd_lock); - tcd->tcd_pages_factor = pages_factor[i]; - tcd->tcd_type = i; - tcd->tcd_cpu = j; - } - -for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { - cfs_trace_console_buffers[i][j] = -kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE , -GFP_KERNEL ); - -if (!cfs_trace_console_buffers[i][j]) - goto out; - } - -return 0 ; - -out: -cfs_tracefile_fini_arch (); -pr_err ("lnet: Not enough memory\n" ); -return -ENOMEM ; -} - -void cfs_tracefile_fini_arch (void ) -{ -int i; -int j; - -for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { -kfree (cfs_trace_console_buffers[i][j]); - cfs_trace_console_buffers[i][j] =NULL ; - } - -for (i =0 ; cfs_trace_data[i]; i++) { -kfree (cfs_trace_data[i]); - cfs_trace_data[i] =NULL ; - } -} - -enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) -{ -if (in_irq ()) -return CFS_TCD_TYPE_IRQ ; -if (in_softirq ()) -return CFS_TCD_TYPE_SOFTIRQ ; -return CFS_TCD_TYPE_PROC ; -} - -void -cfs_set_ptldebug_header (struct ptldebug_header *header, -struct libcfs_debug_msg_data *msgdata, -unsigned long stack) -{ -struct timespec64 ts; - -ktime_get_real_ts64 (&ts); - - header->ph_subsys = msgdata->msg_subsys; - header->ph_mask = msgdata->msg_mask; - header->ph_cpu_id =smp_processor_id (); - header->ph_type =cfs_trace_buf_idx_get (); -/* y2038 safe since all user space treats this as unsigned, but -* will overflow in 2106 -*/ - header->ph_sec = (u32 )ts.tv_sec; - header->ph_usec = ts.tv_nsec /NSEC_PER_USEC ; - header->ph_stack = stack; - header->ph_pid = current->pid; - header->ph_line_num = msgdata->msg_line; - header->ph_extern_pid =0 ; -} - -static char * -dbghdr_to_err_string (struct ptldebug_header *hdr) -{ -switch (hdr->ph_subsys) { -case S_LND : -case S_LNET : -return "LNetError" ; -default : -return "LustreError" ; - } -} - -static char * -dbghdr_to_info_string (struct ptldebug_header *hdr) -{ -switch (hdr->ph_subsys) { -case S_LND : -case S_LNET : -return "LNet" ; -default : -return "Lustre" ; - } -} - -void cfs_print_to_console (struct ptldebug_header *hdr,int mask, -const char *buf,int len,const char *file, -const char *fn) -{ -char *prefix ="Lustre" , *ptype =NULL ; - -if (mask &D_EMERG ) { - prefix =dbghdr_to_err_string (hdr); - ptype =KERN_EMERG ; - }else if (mask &D_ERROR ) { - prefix =dbghdr_to_err_string (hdr); - ptype =KERN_ERR ; - }else if (mask &D_WARNING ) { - prefix =dbghdr_to_info_string (hdr); - ptype =KERN_WARNING ; - }else if (mask & (D_CONSOLE | libcfs_printk)) { - prefix =dbghdr_to_info_string (hdr); - ptype =KERN_INFO ; - } - -if (mask &D_CONSOLE ) { -pr_info ("%s%s: %.*s" , ptype, prefix, len, buf); - }else { -pr_info ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - hdr->ph_pid, hdr->ph_extern_pid, file, - hdr->ph_line_num, fn, len, buf); - } -}drivers/staging/lustre/lnet/libcfs/tracefile.c +155
-0@@ -168,6 +168,161 @@ static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)put_cpu (); } +/* percents to share the total debug memory for each type */ +static unsigned int pages_factor[CFS_TCD_TYPE_MAX ] = { +80 ,/* 80% pages for CFS_TCD_TYPE_PROC */ +10 ,/* 10% pages for CFS_TCD_TYPE_SOFTIRQ */ +10 /* 10% pages for CFS_TCD_TYPE_IRQ */ +}; + +char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; + +int cfs_tracefile_init_arch (void ) +{ +int i; +int j; +struct cfs_trace_cpu_data *tcd; + +/* initialize trace_data */ +memset (cfs_trace_data,0 ,sizeof (cfs_trace_data)); +for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) { + cfs_trace_data[i] = +kmalloc_array (num_possible_cpus (), +sizeof (union cfs_trace_data_union ), +GFP_KERNEL ); +if (!cfs_trace_data[i]) + goto out; + } + +/* arch related info initialized */ +cfs_tcd_for_each (tcd, i, j) { +spin_lock_init (&tcd->tcd_lock); + tcd->tcd_pages_factor = pages_factor[i]; + tcd->tcd_type = i; + tcd->tcd_cpu = j; + } + +for (i =0 ; i <num_possible_cpus (); i++) +for (j =0 ; j <3 ; j++) { + cfs_trace_console_buffers[i][j] = +kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE , +GFP_KERNEL ); + +if (!cfs_trace_console_buffers[i][j]) + goto out; + } + +return 0 ; + +out: +cfs_tracefile_fini_arch (); +pr_err ("lnet: Not enough memory\n" ); +return -ENOMEM ; +} + +void cfs_tracefile_fini_arch (void ) +{ +int i; +int j; + +for (i =0 ; i <num_possible_cpus (); i++) +for (j =0 ; j <3 ; j++) { +kfree (cfs_trace_console_buffers[i][j]); + cfs_trace_console_buffers[i][j] =NULL ; + } + +for (i =0 ; cfs_trace_data[i]; i++) { +kfree (cfs_trace_data[i]); + cfs_trace_data[i] =NULL ; + } +} + +enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) +{ +if (in_irq ()) +return CFS_TCD_TYPE_IRQ ; +if (in_softirq ()) +return CFS_TCD_TYPE_SOFTIRQ ; +return CFS_TCD_TYPE_PROC ; +} + +void +cfs_set_ptldebug_header (struct ptldebug_header *header, +struct libcfs_debug_msg_data *msgdata, +unsigned long stack) +{ +struct timespec64 ts; + +ktime_get_real_ts64 (&ts); + + header->ph_subsys = msgdata->msg_subsys; + header->ph_mask = msgdata->msg_mask; + header->ph_cpu_id =smp_processor_id (); + header->ph_type =cfs_trace_buf_idx_get (); +/* y2038 safe since all user space treats this as unsigned, but +* will overflow in 2106 +*/ + header->ph_sec = (u32 )ts.tv_sec; + header->ph_usec = ts.tv_nsec /NSEC_PER_USEC ; + header->ph_stack = stack; + header->ph_pid = current->pid; + header->ph_line_num = msgdata->msg_line; + header->ph_extern_pid =0 ; +} + +static char * +dbghdr_to_err_string (struct ptldebug_header *hdr) +{ +switch (hdr->ph_subsys) { +case S_LND : +case S_LNET : +return "LNetError" ; +default : +return "LustreError" ; + } +} + +static char * +dbghdr_to_info_string (struct ptldebug_header *hdr) +{ +switch (hdr->ph_subsys) { +case S_LND : +case S_LNET : +return "LNet" ; +default : +return "Lustre" ; + } +} + +void cfs_print_to_console (struct ptldebug_header *hdr,int mask, +const char *buf,int len,const char *file, +const char *fn) +{ +char *prefix ="Lustre" , *ptype =NULL ; + +if (mask &D_EMERG ) { + prefix =dbghdr_to_err_string (hdr); + ptype =KERN_EMERG ; + }else if (mask &D_ERROR ) { + prefix =dbghdr_to_err_string (hdr); + ptype =KERN_ERR ; + }else if (mask &D_WARNING ) { + prefix =dbghdr_to_info_string (hdr); + ptype =KERN_WARNING ; + }else if (mask & (D_CONSOLE | libcfs_printk)) { + prefix =dbghdr_to_info_string (hdr); + ptype =KERN_INFO ; + } + +if (mask &D_CONSOLE ) { +pr_info ("%s%s: %.*s" , ptype, prefix, len, buf); + }else { +pr_info ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, + hdr->ph_line_num, fn, len, buf); + } +} +static inline struct cfs_trace_page *cfs_tage_from_list (struct list_head *list) {
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
Quoted 6 lines · James Simmons
Quoted 3 lines
It's good to keep related code together.
Signed-off-by NeilBrown <[email protected]>Nak. For some reason this corrupts my dmesg output. Its really strange and I haven't figured it out yet.
This patch cannot possibly be the cause of any such behavioural change. It purely moves code from one file to another, it doesn't change the code at all.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180622/aaa02fe3/attachment.sig>
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
Quoted 13 lines · James Simmons
Quoted 7 lines
Quoted 4 lines
It's good to keep related code together.
Signed-off-by NeilBrown <[email protected]>Nak. For some reason this corrupts my dmesg output. Its really strange and I haven't figured it out yet.
This patch cannot possibly be the cause of any such behavioural change. It purely moves code from one file to another, it doesn't change the code at all.
In a way you are correct. What this patch does is expose how badly messed up cfs_print_to_console() is. Originally it was a printk() call but some newbie changed it incorrectly into a pr_info() for all cases. This is totally incorrect but it landed anyways :-( For some bizarre reason it works even with it being completely wrong. I did fix this patch up and redid the later patches due the changes from the fix up. Is it okay it I push the newer version of these patches with my changes?
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
Quoted 13 lines · James Simmons
Quoted 12 lines · James Simmons
Quoted 7 lines
Quoted 4 lines
It's good to keep related code together.
Signed-off-by NeilBrown <[email protected]>Nak. For some reason this corrupts my dmesg output. Its really strange and I haven't figured it out yet.
This patch cannot possibly be the cause of any such behavioural change. It purely moves code from one file to another, it doesn't change the code at all.
Quoted 5 lines
In a way you are correct. What this patch does is expose how badly messed up
cfs_print_to_console()is. Originally it was aprintk()call but some newbie changed it incorrectly into apr_info()for all cases. This is totally incorrect but it landed anyways :-( For some bizarre reason it works even with it being completely wrong.
I see the problem with cfs_print_to_console(). It chooses a message type (KERN_EMERG, KERN_ERR, KERN_WARNING, KERN_INFO) then uses pr_info() to print that, which adds another KERN_INFO.
However vprintk_emit() calls printk_get_level() repeatedly while it succeeds, so the extra KERNE_INFO is ignored.
So while the code is strange and should use printk(), I don't see how it could mess up your dmesg output.
Quoted 3 lines
I did fix this patch up
and redid the later patches due the changes from the fix up. Is it okay it I push the newer version of these patches with my changes?
I'm not really sure what you are asking here, but the answer is probably "yes, it is okay".
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/5ef026fb/attachment.sig>
PATCH 21/24 lustre: move remainder of linux-tracefile.c to tracefile.c
Quoted 29 lines
Quoted 14 lines
Quoted 13 lines · James Simmons
Quoted 7 lines
Quoted 4 lines
It's good to keep related code together.
Signed-off-by NeilBrown <[email protected]>Nak. For some reason this corrupts my dmesg output. Its really strange and I haven't figured it out yet.
This patch cannot possibly be the cause of any such behavioural change. It purely moves code from one file to another, it doesn't change the code at all.
Quoted 5 lines
In a way you are correct. What this patch does is expose how badly messed up
cfs_print_to_console()is. Originally it was aprintk()call but some newbie changed it incorrectly into apr_info()for all cases. This is totally incorrect but it landed anyways :-( For some bizarre reason it works even with it being completely wrong.I see the problem with
cfs_print_to_console(). It chooses a message type (KERN_EMERG,KERN_ERR,KERN_WARNING,KERN_INFO) then usespr_info()to print that, which adds anotherKERN_INFO.
Howevervprintk_emit()callsprintk_get_level()repeatedly while it succeeds, so the extraKERNE_INFOis ignored.So while the code is strange and should use
printk(), I don't see how it could mess up your dmesg output.
Quoted 6 lines
Quoted 3 lines
I did fix this patch up
and redid the later patches due the changes from the fix up. Is it okay it I push the newer version of these patches with my changes?I'm not really sure what you are asking here, but the answer is probably "yes, it is okay".
Pushed the updated patches. Sorry I wasn't clear on what I was asking. I was weird stuff like Lustre: LNet6: .....
Well in any case the pushed patch set cleans all that mess up.
PATCH 22/24 lustre: fold cfs_tracefile_*_arch into their only callers.
In reply to NeilBrownThere is no need to separate "arch" init/fini from the rest, so fold it all in.
This requires some slightly subtle changes to clean-up to make sure we don't walk lists before they are initialized.
--- drivers/staging/lustre/lnet/libcfs/tracefile.c | 116 ++++++++++-------------- 1 file changed, 49 insertions(+), 67 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +49 -67
@@ -177,65 +177,6 @@ static unsigned int pages_factor[CFS_TCD_TYPE_MAX] = {char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; -int cfs_tracefile_init_arch (void ) -{ -int i; -int j; -struct cfs_trace_cpu_data *tcd; - -/* initialize trace_data */ -memset (cfs_trace_data,0 ,sizeof (cfs_trace_data)); -for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) { - cfs_trace_data[i] = -kmalloc_array (num_possible_cpus (), -sizeof (union cfs_trace_data_union ), -GFP_KERNEL ); -if (!cfs_trace_data[i]) - goto out; - } - -/* arch related info initialized */ -cfs_tcd_for_each (tcd, i, j) { -spin_lock_init (&tcd->tcd_lock); - tcd->tcd_pages_factor = pages_factor[i]; - tcd->tcd_type = i; - tcd->tcd_cpu = j; - } - -for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { - cfs_trace_console_buffers[i][j] = -kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE , -GFP_KERNEL ); - -if (!cfs_trace_console_buffers[i][j]) - goto out; - } - -return 0 ; - -out: -cfs_tracefile_fini_arch (); -pr_err ("lnet: Not enough memory\n" ); -return -ENOMEM ; -} - -void cfs_tracefile_fini_arch (void ) -{ -int i; -int j; - -for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { -kfree (cfs_trace_console_buffers[i][j]); - cfs_trace_console_buffers[i][j] =NULL ; - } - -for (i =0 ; cfs_trace_data[i]; i++) { -kfree (cfs_trace_data[i]); - cfs_trace_data[i] =NULL ; - } -}enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) {
@@ -1343,21 +1284,33 @@ void cfs_trace_stop_thread(void)mutex_unlock (&cfs_trace_thread_mutex); } +static void cfs_trace_cleanup (void ); +int cfs_tracefile_init (int max_pages) {struct cfs_trace_cpu_data *tcd;int i;int j; -int rc; -int factor; - rc =cfs_tracefile_init_arch (); -if (rc) -return rc; +/* initialize trace_data */ +memset (cfs_trace_data,0 ,sizeof (cfs_trace_data)); +for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) { + cfs_trace_data[i] = +kmalloc_array (num_possible_cpus (), +sizeof (union cfs_trace_data_union ), +GFP_KERNEL ); +if (!cfs_trace_data[i]) + goto out; + } +/* arch related info initialized */ cfs_tcd_for_each (tcd, i, j) { -/* tcd_pages_factor is initialized int tracefile_init_arch. */ - factor = tcd->tcd_pages_factor; +int factor = pages_factor[i]; + +spin_lock_init (&tcd->tcd_lock); + tcd->tcd_pages_factor = factor; + tcd->tcd_type = i; + tcd->tcd_cpu = j;INIT_LIST_HEAD (&tcd->tcd_pages);INIT_LIST_HEAD (&tcd->tcd_stock_pages);INIT_LIST_HEAD (&tcd->tcd_daemon_pages);
@@ -1369,7 +1322,21 @@ int cfs_tracefile_init(int max_pages) tcd->tcd_shutting_down =0 ; } +for (i =0 ; i <num_possible_cpus (); i++) +for (j =0 ; j <3 ; j++) { + cfs_trace_console_buffers[i][j] = +kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE , +GFP_KERNEL ); + +if (!cfs_trace_console_buffers[i][j]) + goto out; + } +return 0 ; +out: +cfs_trace_cleanup (); +pr_err ("lnet: Not enough memory\n" ); +return -ENOMEM ; }static void trace_cleanup_on_all_cpus (void )
@@ -1381,6 +1348,9 @@ static void trace_cleanup_on_all_cpus(void)for_each_possible_cpu (cpu) {cfs_tcd_for_each_type_lock (tcd, i, cpu) { +if (!tcd->tcd_pages_factor) +/* Not initialised */ +continue ; tcd->tcd_shutting_down =1 ; list_for_each_entry_safe(tage, tmp, &tcd->tcd_pages,
@@ -1399,12 +1369,24 @@ static void trace_cleanup_on_all_cpus(void)static void cfs_trace_cleanup (void ) {struct page_collection pc; +int i; +int j;INIT_LIST_HEAD (&pc.pc_pages);trace_cleanup_on_all_cpus (); -cfs_tracefile_fini_arch (); +for (i =0 ; i <num_possible_cpus (); i++) +for (j =0 ; j <3 ; j++) { +kfree (cfs_trace_console_buffers[i][j]); + cfs_trace_console_buffers[i][j] =NULL ; + } + +for (i =0 ; cfs_trace_data[i]; i++) { +kfree (cfs_trace_data[i]); + cfs_trace_data[i] =NULL ; + } + }void cfs_tracefile_exit (void )
PATCH 23/24 lustre: renamed CFS_TCD_TYPE_MAX to CFS_TCD_TYPE_CNT
In reply to NeilBrownThe possible TCD types are 0, 1, 2.
So the MAX is 2.
The count of the number of types is 3.
CFS_TCD_TYPE_MAX is 3 - obviously wrong.
So rename it to CFS_TCD_TYPE_CNT.
Also there are 2 places where "3" is used rather
than the macro - fix them.
--- drivers/staging/lustre/lnet/libcfs/tracefile.c | 15 +++++++-------- drivers/staging/lustre/lnet/libcfs/tracefile.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +7 -8
@@ -119,7 +119,7 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc,int cfs_trace_lock_tcd (struct cfs_trace_cpu_data *tcd,int walking) __acquires(&tcd->tc_lock) { -__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_MAX ); +__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_CNT );if (tcd->tcd_type ==CFS_TCD_TYPE_IRQ )spin_lock_irqsave (&tcd->tcd_lock, tcd->tcd_lock_flags);else if (tcd->tcd_type ==CFS_TCD_TYPE_SOFTIRQ )
@@ -134,7 +134,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)void cfs_trace_unlock_tcd (struct cfs_trace_cpu_data *tcd,int walking) __releases(&tcd->tcd_lock) { -__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_MAX ); +__LASSERT (tcd->tcd_type <CFS_TCD_TYPE_CNT );if (tcd->tcd_type ==CFS_TCD_TYPE_IRQ )spin_unlock_irqrestore (&tcd->tcd_lock, tcd->tcd_lock_flags);else if (tcd->tcd_type ==CFS_TCD_TYPE_SOFTIRQ )
@@ -169,14 +169,13 @@ static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd) }/* percents to share the total debug memory for each type */ -static unsigned int pages_factor[CFS_TCD_TYPE_MAX ] = { +static unsigned int pages_factor[CFS_TCD_TYPE_CNT ] = {80 ,/* 80% pages for CFS_TCD_TYPE_PROC */ 10 ,/* 10% pages for CFS_TCD_TYPE_SOFTIRQ */ 10 /* 10% pages for CFS_TCD_TYPE_IRQ */ }; -char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; - +char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_CNT ];enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) {
@@ -1294,7 +1293,7 @@ int cfs_tracefile_init(int max_pages)/* initialize trace_data */ memset (cfs_trace_data,0 ,sizeof (cfs_trace_data)); -for (i =0 ; i <CFS_TCD_TYPE_MAX ; i++) { +for (i =0 ; i <CFS_TCD_TYPE_CNT ; i++) { cfs_trace_data[i] = kmalloc_array(num_possible_cpus(), sizeof(union cfs_trace_data_union),
@@ -1323,7 +1322,7 @@ int cfs_tracefile_init(int max_pages) }for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { +for (j =0 ; j <CFS_TCD_TYPE_CNT ; j++) { cfs_trace_console_buffers[i][j] =kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE ,GFP_KERNEL );
@@ -1377,7 +1376,7 @@ static void cfs_trace_cleanup(void)trace_cleanup_on_all_cpus ();for (i =0 ; i <num_possible_cpus (); i++) -for (j =0 ; j <3 ; j++) { +for (j =0 ; j <CFS_TCD_TYPE_CNT ; j++) {kfree (cfs_trace_console_buffers[i][j]); cfs_trace_console_buffers[i][j] =NULL ; }
drivers/staging/lustre/lnet/libcfs/tracefile.h +2 -2
@@ -46,7 +46,7 @@ enum cfs_trace_buf_type {CFS_TCD_TYPE_PROC =0 ,CFS_TCD_TYPE_SOFTIRQ ,CFS_TCD_TYPE_IRQ , - CFS_TCD_TYPE_MAX + CFS_TCD_TYPE_CNT };#define TRACEFILE_NAME_SIZE 1024
@@ -200,7 +200,7 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, const char *buf, int len, const char *file, const char *fn); -extern char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; +extern char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_CNT ];enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ); static inline char *
PATCH 24/24 lustre: discard TCD_MAX_TYPES
In reply to NeilBrownAs well as CFS_TCD_TYPE_CNT we have TCD_MAX_TYPES which has a larger value but a similar meaning. Discard it and just use CFS_TCD_TYPE_CNT.
Two places relied on the fact that TCD_MAX_TYPES was larger and so there would be NULLs at the end of the array. Change them to check the array size properly.
--- drivers/staging/lustre/lnet/libcfs/tracefile.c | 8 ++++---- drivers/staging/lustre/lnet/libcfs/tracefile.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +4 -4
@@ -50,7 +50,7 @@#include "tracefile.h" /* XXX move things up to the top, comment */ -union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned; +union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT])[NR_CPUS] __cacheline_aligned;char cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ;
@@ -145,8 +145,8 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)spin_unlock (&tcd->tcd_lock); } -#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ +#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i] && \ (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
@@ -1381,7 +1381,7 @@ static void cfs_trace_cleanup(void) cfs_trace_console_buffers[i][j] =NULL ; } -for (i =0 ; cfs_trace_data[i]; i++) { +for (i =0 ; cfs_trace_data[i] && i <CFS_TCD_TYPE_CNT ; i++) {kfree (cfs_trace_data[i]); cfs_trace_data[i] =NULL ; }
drivers/staging/lustre/lnet/libcfs/tracefile.h +1 -2
@@ -184,8 +184,7 @@ union cfs_trace_data_union {char __pad[L1_CACHE_ALIGN (sizeof (struct cfs_trace_cpu_data ))]; }; -#define TCD_MAX_TYPES 8 -extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES ])[NR_CPUS ]; +extern union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT ])[NR_CPUS ];#define cfs_tcd_for_each (tcd, i, j) \ for (i = 0; cfs_trace_data[i]; i++) \
James Simmons
NAKPATCH 24/24 lustre: discard TCD_MAX_TYPES
Quoted 10 lines
As well as
CFS_TCD_TYPE_CNTwe haveTCD_MAX_TYPESwhich has a larger value but a similar meaning. Discard it and just useCFS_TCD_TYPE_CNT.Two places relied on the fact that
TCD_MAX_TYPESwas larger and so there would be NULLs at the end of the array. Change them to check the array size properly.Signed-off-by NeilBrown <[email protected]>
Nak: This one really makes my nodes go up in flames when I mount a file system.
Quoted 55 lines
--- drivers/staging/lustre/lnet/libcfs/tracefile.c | 8 ++++---- drivers/staging/lustre/lnet/libcfs/tracefile.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-)drivers/staging/lustre/lnet/libcfs/tracefile.c +4
-4@@ -50,7 +50,7 @@#include "tracefile.h" /* XXX move things up to the top, comment */ -union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned; +union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT])[NR_CPUS] __cacheline_aligned;char cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ;@@ -145,8 +145,8 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)spin_unlock (&tcd->tcd_lock); } -#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ +#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i] && \ (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)@@ -1381,7 +1381,7 @@ static void cfs_trace_cleanup(void) cfs_trace_console_buffers[i][j] =NULL ; } -for (i =0 ; cfs_trace_data[i]; i++) { +for (i =0 ; cfs_trace_data[i] && i <CFS_TCD_TYPE_CNT ; i++) {kfree (cfs_trace_data[i]); cfs_trace_data[i] =NULL ; }drivers/staging/lustre/lnet/libcfs/tracefile.h +1
-2@@ -184,8 +184,7 @@ union cfs_trace_data_union {char __pad[L1_CACHE_ALIGN (sizeof (struct cfs_trace_cpu_data ))]; }; -#define TCD_MAX_TYPES 8 -extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES ])[NR_CPUS ]; +extern union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT ])[NR_CPUS ];#define cfs_tcd_for_each (tcd, i, j) \ for (i = 0; cfs_trace_data[i]; i++) \
PATCH 24/24 lustre: discard TCD_MAX_TYPES
As well as CFS_TCD_TYPE_CNT we have TCD_MAX_TYPES which has a larger value but a similar meaning. Discard it and just use CFS_TCD_TYPE_CNT.
Two places relied on the fact that TCD_MAX_TYPES was larger and so there would be NULLs at the end of the array. Change them to check the array size properly.
---
Thanks for testing James!
I found two problems.
1/ I had
- for (i = 0; cfs_trace_data[i] && i < CFS_TCD_TYPE_CNT; i++) {
instead of
+ for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) {
So it could dereference beyond the end of an array. I don't this was the problem.
2/ I hadn't changed
- for (i = 0; cfs_trace_data[i]; i++) \
to
+ for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) \
so if cfs_trace_data[4] was non NULL, bad things could happen. I suspect this is what happened to you.
Thanks,
NeilBrown
drivers/staging/lustre/lnet/libcfs/tracefile.c | 8 ++++---- drivers/staging/lustre/lnet/libcfs/tracefile.h | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/staging/lustre/lnet/libcfs/tracefile.c +4 -4
@@ -50,7 +50,7 @@#include "tracefile.h" /* XXX move things up to the top, comment */ -union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned; +union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT])[NR_CPUS] __cacheline_aligned;char cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ;
@@ -145,8 +145,8 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)spin_unlock (&tcd->tcd_lock); } -#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ +#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i] && \ (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
@@ -1381,7 +1381,7 @@ static void cfs_trace_cleanup(void) cfs_trace_console_buffers[i][j] =NULL ; } -for (i =0 ; cfs_trace_data[i]; i++) { +for (i =0 ; i <CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) {kfree (cfs_trace_data[i]); cfs_trace_data[i] =NULL ; }
drivers/staging/lustre/lnet/libcfs/tracefile.h +2 -3
@@ -184,11 +184,10 @@ union cfs_trace_data_union {char __pad[L1_CACHE_ALIGN (sizeof (struct cfs_trace_cpu_data ))]; }; -#define TCD_MAX_TYPES 8 -extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES ])[NR_CPUS ]; +extern union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT ])[NR_CPUS ];#define cfs_tcd_for_each (tcd, i, j) \ - for (i = 0; cfs_trace_data[i]; i++) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) \ for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ j < num_possible_cpus(); \ j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
Signature · 9 lines
2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/7a937256/attachment.sig>
PATCH 24/24 lustre: discard TCD_MAX_TYPES
Quoted 27 lines
As well as
CFS_TCD_TYPE_CNTwe haveTCD_MAX_TYPESwhich has a larger value but a similar meaning. Discard it and just useCFS_TCD_TYPE_CNT.Two places relied on the fact that
TCD_MAX_TYPESwas larger and so there would be NULLs at the end of the array. Change them to check the array size properly.Signed-off-by NeilBrown <[email protected]>---
Thanks for testing James!
I found two problems.
1/ I had
- for (i = 0; cfs_trace_data[i] && i <CFS_TCD_TYPE_CNT; i++) {
instead of
+ for (i = 0; i <CFS_TCD_TYPE_CNT&& cfs_trace_data[i]; i++) {So it could dereference beyond the end of an array. I don't this was the problem.
2/ I hadn't changed
- for (i = 0; cfs_trace_data[i]; i++) \
to
+ for (i = 0; i <CFS_TCD_TYPE_CNT&& cfs_trace_data[i]; i++) \
Quoted 5 lines
so if cfs_trace_data[4] was non NULL, bad things could happen. I suspect this is what happened to you.
Thanks,
NeilBrown
Much better :-)
Quoted 59 lines
drivers/staging/lustre/lnet/libcfs/tracefile.c | 8 ++++---- drivers/staging/lustre/lnet/libcfs/tracefile.h | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-)drivers/staging/lustre/lnet/libcfs/tracefile.c +4
-4@@ -50,7 +50,7 @@#include "tracefile.h" /* XXX move things up to the top, comment */ -union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned; +union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT])[NR_CPUS] __cacheline_aligned;char cfs_tracefile[TRACEFILE_NAME_SIZE ];long long cfs_tracefile_size =CFS_TRACEFILE_SIZE ;@@ -145,8 +145,8 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)spin_unlock (&tcd->tcd_lock); } -#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ +#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i] && \ (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)@@ -1381,7 +1381,7 @@ static void cfs_trace_cleanup(void) cfs_trace_console_buffers[i][j] =NULL ; } -for (i =0 ; cfs_trace_data[i]; i++) { +for (i =0 ; i <CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) {kfree (cfs_trace_data[i]); cfs_trace_data[i] =NULL ; }drivers/staging/lustre/lnet/libcfs/tracefile.h +2
-3@@ -184,11 +184,10 @@ union cfs_trace_data_union {char __pad[L1_CACHE_ALIGN (sizeof (struct cfs_trace_cpu_data ))]; }; -#define TCD_MAX_TYPES 8 -extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES ])[NR_CPUS ]; +extern union cfs_trace_data_union (*cfs_trace_data[CFS_TCD_TYPE_CNT ])[NR_CPUS ];#define cfs_tcd_for_each (tcd, i, j) \ - for (i = 0; cfs_trace_data[i]; i++) \ + for (i = 0; i < CFS_TCD_TYPE_CNT && cfs_trace_data[i]; i++) \ for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ j < num_possible_cpus(); \ j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)Signature · 1 line
2.14.0.rc0.dirty
PATCH 24/24 lustre: discard TCD_MAX_TYPES
Quoted 26 lines · James Simmons
Quoted 26 lines
As well as
CFS_TCD_TYPE_CNTwe haveTCD_MAX_TYPESwhich has a larger value but a similar meaning. Discard it and just useCFS_TCD_TYPE_CNT.Two places relied on the fact that
TCD_MAX_TYPESwas larger and so there would be NULLs at the end of the array. Change them to check the array size properly.Signed-off-by NeilBrown <[email protected]>---
Thanks for testing James!
I found two problems.
1/ I had
- for (i = 0; cfs_trace_data[i] && i <CFS_TCD_TYPE_CNT; i++) {
instead of
+ for (i = 0; i <CFS_TCD_TYPE_CNT&& cfs_trace_data[i]; i++) {So it could dereference beyond the end of an array. I don't this was the problem.
2/ I hadn't changed
- for (i = 0; cfs_trace_data[i]; i++) \
to
+ for (i = 0; i <CFS_TCD_TYPE_CNT&& cfs_trace_data[i]; i++) \
Quoted 7 lines
Quoted 5 lines
so if cfs_trace_data[4] was non NULL, bad things could happen. I suspect this is what happened to you.
Thanks,
NeilBrownMuch better :-)
Thanks for the confirmation!
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/499fd3ae/attachment.sig>
cover lustre - more cleanups including module reduction.
In reply to NeilBrownQuoted 9 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.
That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
do lmv.a and the other *.a files get relinked int lustre.ko ?
Quoted 5 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disableKBUILD_MODNAMEwhen building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.
This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
lustre: use
truncate_inode_pagein place oftruncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: removelustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discardLTIME_Smacro
lustre: discardNO_QUOTAandQUOTA_OK
lustre: discard ext2* bit operations
lustre: centralizeTIMES_SET_FLAGS
lustre: remove redefinition ofmodule_init().
lustre: removelustre_compat.h
The first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move truncate_inode_page() to lustre_mdc.h for now. The next patch does break things.
Quoted 7 lines
lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c
lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()
lustre: move tcd locking across totracefile.c
lustre: move remainder oflinux-tracefile.ctotracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
lustre: discardTCD_MAX_TYPES
I see breakage in this code as well.
Quoted 67 lines
Documentation/kbuild/makefiles.txt | 65 +++++ drivers/staging/lustre/lnet/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/debug.c | 6 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 258 -------------------- drivers/staging/lustre/lnet/libcfs/module.c | 26 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 241 +++++++++++++++++-- drivers/staging/lustre/lnet/libcfs/tracefile.h | 40 --- drivers/staging/lustre/lnet/lnet/Makefile | 11 - drivers/staging/lustre/lnet/lnet/module.c | 9 + drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 drivers/staging/lustre/lustre/include/cl_object.h | 6 .../staging/lustre/lustre/include/lustre_compat.h | 82 ------ drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 68 ----- drivers/staging/lustre/lustre/include/obd.h | 7 + .../staging/lustre/lustre/include/obd_support.h | 1 drivers/staging/lustre/lustre/ldlm/Makefile | 11 + drivers/staging/lustre/lustre/llite/dir.c | 3 drivers/staging/lustre/lustre/llite/file.c | 36 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 11 - .../staging/lustre/lustre/llite/llite_internal.h | 13 + drivers/staging/lustre/lustre/llite/llite_lib.c | 52 ++-- drivers/staging/lustre/lustre/llite/namei.c | 16 + drivers/staging/lustre/lustre/llite/vvp_io.c | 8 - drivers/staging/lustre/lustre/llite/vvp_object.c | 6 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 19 + drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 7 - .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/obdclass/obdo.c | 10 - .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 drivers/staging/lustre/lustre/osc/osc_io.c | 23 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 drivers/staging/lustre/lustre/osc/osc_request.c | 1 drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 - drivers/staging/lustre/lustre/ptlrpc/import.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 + drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 scripts/Makefile.build | 57 +++- scripts/Makefile.lib | 63 +++-- 57 files changed, 584 insertions(+), 685 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile--
Signature
cover lustre - more cleanups including module reduction.
Huh? Very little of the client is used on the server. The vast majority of the client is llite, vvp, then lov, osc, and mdc. These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients". They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is. But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me. It's like this:
vfs
client code
ptlrpc
networking
------ PHYSICAL BOUNDARY --------
networking
ptlrpc
server code
ldiskfs
with LDLM also being explicitly shared, though client & server code is not all shared. Very little to nothing outside of the networking & ldlm layers is shared.
________________________________
From: lustre-devel <[email protected]> on behalf of James Simmons <[email protected]>
Sent: Wednesday, June 20, 2018 8:48:07 PM
To: NeilBrown
Cc: Oleg Drokin; Andreas Dilger; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.
That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
do lmv.a and the other *.a files get relinked int lustre.ko ?
Quoted 5 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disableKBUILD_MODNAMEwhen building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.
This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
lustre: use
truncate_inode_pagein place oftruncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: removelustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discardLTIME_Smacro
lustre: discardNO_QUOTAandQUOTA_OK
lustre: discard ext2* bit operations
lustre: centralizeTIMES_SET_FLAGS
lustre: remove redefinition ofmodule_init().
lustre: removelustre_compat.h
The first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move truncate_inode_page() to lustre_mdc.h for now. The next patch does break things.
Quoted 7 lines
lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c
lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()
lustre: move tcd locking across totracefile.c
lustre: move remainder oflinux-tracefile.ctotracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
lustre: discardTCD_MAX_TYPES
I see breakage in this code as well.
Quoted 63 lines
Documentation/kbuild/makefiles.txt | 65 +++++ drivers/staging/lustre/lnet/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/debug.c | 6 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 258 -------------------- drivers/staging/lustre/lnet/libcfs/module.c | 26 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 241 +++++++++++++++++-- drivers/staging/lustre/lnet/libcfs/tracefile.h | 40 --- drivers/staging/lustre/lnet/lnet/Makefile | 11 - drivers/staging/lustre/lnet/lnet/module.c | 9 + drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 drivers/staging/lustre/lustre/include/cl_object.h | 6 .../staging/lustre/lustre/include/lustre_compat.h | 82 ------ drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 68 ----- drivers/staging/lustre/lustre/include/obd.h | 7 + .../staging/lustre/lustre/include/obd_support.h | 1 drivers/staging/lustre/lustre/ldlm/Makefile | 11 + drivers/staging/lustre/lustre/llite/dir.c | 3 drivers/staging/lustre/lustre/llite/file.c | 36 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 11 - .../staging/lustre/lustre/llite/llite_internal.h | 13 + drivers/staging/lustre/lustre/llite/llite_lib.c | 52 ++-- drivers/staging/lustre/lustre/llite/namei.c | 16 + drivers/staging/lustre/lustre/llite/vvp_io.c | 8 - drivers/staging/lustre/lustre/llite/vvp_object.c | 6 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 19 + drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 7 - .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/obdclass/obdo.c | 10 - .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 drivers/staging/lustre/lustre/osc/osc_io.c | 23 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 drivers/staging/lustre/lustre/osc/osc_request.c | 1 drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 - drivers/staging/lustre/lustre/ptlrpc/import.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 + drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 scripts/Makefile.build | 57 +++- scripts/Makefile.lib | 63 +++-- 57 files changed, 584 insertions(+), 685 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile
Quoted 4 lines
--
Signature
_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/c4685e67/attachment-0001.html>
cover lustre - more cleanups including module reduction.
Quoted 25 lines
Huh?? Very little of the client is used on the server.? The vast majority of the client is llite, vvp, then lov,?osc, and?mdc.? These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients".? They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is.? But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me.? It's like this:
vfs
client codeptlrpc
networking
------ PHYSICAL BOUNDARY --------
networkingptlrpc
Quoted 8 lines
server code
ldiskfs
with LDLM also being explicitly shared, though client & server code is not all shared.? Very little to nothing outside of the networking & ldlm layers is shared.
When I first started this (pre 2.3 days) that is how it was explained to me. I just took it at face value but when it comes to the separation as I don't have a clue. Patrick since you have a better grasp of the architecture can you provide details to Neil. Perhaps to documentation on this separation if it exist.
Quoted 148 lines
Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
do lmv.a and the other *.a files get relinked int lustre.ko ? ?
Quoted 5 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
?????? kbuild: detect directories in components of a module. ?????? kbuild: treat a directory listed in a composite object as foo/mod.a ?????? kbuild: support building of per-directory mod.a
?????? kbuild: disableKBUILD_MODNAMEwhen building for mod.a ?????? kbuild: Add documentation for modobj-m
?????? lustre: build ldlm in the ldlm directory.
?????? lustre: merge libcfs module into lnet.This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
?????? lustre: use
truncate_inode_pagein place oftruncate_complete_page?????? lustre: don't use spare bits in iattr.ia_valid
?????? lustre: removelustre_patchless_compat.h
?????? lustre: discard current_n*groups macros.
?????? lustre: discardLTIME_Smacro
?????? lustre: discardNO_QUOTAandQUOTA_OK
?????? lustre: discard ext2* bit operations
?????? lustre: centralizeTIMES_SET_FLAGS
?????? lustre: remove redefinition ofmodule_init().
?????? lustre: removelustre_compat.hThe first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move
truncate_inode_page()tolustre_mdc.hfor now. The next patch does break things.Quoted 7 lines
?????? lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c?????? lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()?????? lustre: move tcd locking across totracefile.c
?????? lustre: move remainder oflinux-tracefile.ctotracefile.c?????? lustre: fold cfs_tracefile_*_arch into their only callers. ?????? lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
?????? lustre: discardTCD_MAX_TYPESI see breakage in this code as well.
Quoted 57 lines
? Documentation/kbuild/makefiles.txt???????????????? |?? 65 +++++ ? drivers/staging/lustre/lnet/Makefile?????????????? |??? 7 - ? drivers/staging/lustre/lnet/libcfs/Makefile??????? |??? 7 - ? drivers/staging/lustre/lnet/libcfs/debug.c???????? |??? 6 ? .../staging/lustre/lnet/libcfs/linux-tracefile.c?? |? 258 -------------------- ? drivers/staging/lustre/lnet/libcfs/module.c??????? |?? 26 +- ? drivers/staging/lustre/lnet/libcfs/tracefile.c???? |? 241 +++++++++++++++++-- ? drivers/staging/lustre/lnet/libcfs/tracefile.h???? |?? 40 --- ? drivers/staging/lustre/lnet/lnet/Makefile????????? |?? 11 - ? drivers/staging/lustre/lnet/lnet/module.c????????? |??? 9 + ? drivers/staging/lustre/lustre/fid/lproc_fid.c????? |??? 1 ? drivers/staging/lustre/lustre/fld/lproc_fld.c????? |??? 1 ? drivers/staging/lustre/lustre/include/cl_object.h? |??? 6 ? .../staging/lustre/lustre/include/lustre_compat.h? |?? 82 ------ ? drivers/staging/lustre/lustre/include/lustre_net.h |??? 1 ? .../lustre/include/lustre_patchless_compat.h?????? |?? 68 ----- ? drivers/staging/lustre/lustre/include/obd.h??????? |??? 7 + ? .../staging/lustre/lustre/include/obd_support.h??? |??? 1 ? drivers/staging/lustre/lustre/ldlm/Makefile??????? |?? 11 + ? drivers/staging/lustre/lustre/llite/dir.c????????? |??? 3 ? drivers/staging/lustre/lustre/llite/file.c???????? |?? 36 +-- ? drivers/staging/lustre/lustre/llite/lcommon_cl.c?? |?? 11 - ? .../staging/lustre/lustre/llite/llite_internal.h?? |?? 13 + ? drivers/staging/lustre/lustre/llite/llite_lib.c??? |?? 52 ++-- ? drivers/staging/lustre/lustre/llite/namei.c??????? |?? 16 + ? drivers/staging/lustre/lustre/llite/vvp_io.c?????? |??? 8 - ? drivers/staging/lustre/lustre/llite/vvp_object.c?? |??? 6 ? drivers/staging/lustre/lustre/lmv/lmv_intent.c???? |??? 6 ? drivers/staging/lustre/lustre/lmv/lmv_obd.c??????? |?? 21 +- ? drivers/staging/lustre/lustre/lov/lov_io.c???????? |??? 3 ? drivers/staging/lustre/lustre/lov/lov_obd.c??????? |??? 2 ? drivers/staging/lustre/lustre/lov/lov_pack.c?????? |??? 1 ? drivers/staging/lustre/lustre/lov/lov_page.c?????? |??? 1 ? drivers/staging/lustre/lustre/mdc/mdc_lib.c??????? |?? 19 + ? drivers/staging/lustre/lustre/mdc/mdc_reint.c????? |??? 4 ? drivers/staging/lustre/lustre/mdc/mdc_request.c??? |?? 12 - ? drivers/staging/lustre/lustre/obdclass/class_obd.c |??? 1 ? drivers/staging/lustre/lustre/obdclass/llog.c????? |??? 7 - ? .../lustre/lustre/obdclass/lprocfs_status.c??????? |??? 1 ? .../staging/lustre/lustre/obdclass/obd_config.c??? |??? 1 ? drivers/staging/lustre/lustre/obdclass/obd_mount.c |??? 1 ? drivers/staging/lustre/lustre/obdclass/obdo.c????? |?? 10 - ? .../staging/lustre/lustre/obdecho/echo_client.c??? |??? 1 ? drivers/staging/lustre/lustre/osc/lproc_osc.c????? |??? 1 ? drivers/staging/lustre/lustre/osc/osc_cache.c????? |??? 4 ? drivers/staging/lustre/lustre/osc/osc_io.c???????? |?? 23 +- ? drivers/staging/lustre/lustre/osc/osc_quota.c????? |??? 4 ? drivers/staging/lustre/lustre/osc/osc_request.c??? |??? 1 ? drivers/staging/lustre/lustre/ptlrpc/Makefile????? |?? 12 - ? drivers/staging/lustre/lustre/ptlrpc/import.c????? |??? 1 ? .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c??? |??? 1 ? drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c???? |??? 1 ? drivers/staging/lustre/lustre/ptlrpc/sec.c???????? |?? 15 + ? drivers/staging/lustre/lustre/ptlrpc/sec_plain.c?? |??? 1 ? drivers/staging/lustre/lustre/ptlrpc/service.c???? |??? 1 ? scripts/Makefile.build???????????????????????????? |?? 57 +++- ? scripts/Makefile.lib?????????????????????????????? |?? 63 +++--Quoted 10 lines
? 57 files changed, 584 insertions(+), 685 deletions(-)
? delete mode 100644drivers/staging/lustre/lnet/libcfs/linux-tracefile.c? delete mode 100644drivers/staging/lustre/lustre/include/lustre_compat.h? delete mode 100644drivers/staging/lustre/lustre/include/lustre_patchless_compat.h? create mode 100644drivers/staging/lustre/lustre/ldlm/Makefile--
Signature_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
cover lustre - more cleanups including module reduction.
Quoted 26 lines · James Simmons
Quoted 26 lines
Huh? Very little of the client is used on the server. The vast majority of the client is llite, vvp, then lov, osc, and mdc. These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients". They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is. But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me. It's like this:
vfs
client code
ptlrpc
networking
------ PHYSICAL BOUNDARY --------
networking
ptlrpc
server code
ldiskfs
Quoted 8 lines
Quoted 2 lines
with LDLM also being explicitly shared, though client & server code is not all shared. Very little to nothing outside of the networking & ldlm layers is shared.
When I first started this (pre 2.3 days) that is how it was explained to me. I just took it at face value but when it comes to the separation as I don't have a clue. Patrick since you have a better grasp of the architecture can you provide details to Neil. Perhaps to documentation on this separation if it exist.
James,
you are (or were) correct, but the code has evolved over the years. The lov/osc and modules were formerly used on the MDS in order to connect to the OSS, and lmv/mdc were used with the old CMD code to connect to other MDS nodes. However, that ended up with a lot of code that was in those modules that was only used on the client or server. In the CMD code it also meant that a lot of complexity existed with making "fake" RPCs to other MDS nodes that tried to keep the same RPC opcode but were interpreted differently at the MDS when they were being sent from another MDS.
In the 2.4 release (which included both DNE and the OSD rewrite for ZFS) the lov/osc server code was copied/split into lod/osp, and this is used for remote connections to both the OSSs and other MDS nodes. The MDS is still a client of the OSS for precreate and recovery operations (and soon also statfs), but the code is no longer shared with the regular clients.
Cheers, Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 873 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/d24975d1/attachment.sig>
cover lustre - more cleanups including module reduction.
Ah, thanks Andreas. Perhaps not coincidentally, Lustre 2.4 is the first release I worked on.
Neil, I am really unenamored of the idea of the shared ptlrpc ldlm module being named ptlrpc...
Also, Lustre currently has a bunch of module parameters which are used for configuration. Thoughts on that?
________________________________
From: Andreas Dilger <[email protected]>
Sent: Thursday, June 21, 2018 2:22:45 AM
To: James Simmons
Cc: Patrick Farrell; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 26 lines · James Simmons
Quoted 26 lines
Huh? Very little of the client is used on the server. The vast majority of the client is llite, vvp, then lov, osc, and mdc. These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients". They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is. But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me. It's like this:
vfs
client code
ptlrpc
networking
------ PHYSICAL BOUNDARY --------
networking
ptlrpc
server code
ldiskfs
Quoted 8 lines
Quoted 2 lines
with LDLM also being explicitly shared, though client & server code is not all shared. Very little to nothing outside of the networking & ldlm layers is shared.
When I first started this (pre 2.3 days) that is how it was explained to me. I just took it at face value but when it comes to the separation as I don't have a clue. Patrick since you have a better grasp of the architecture can you provide details to Neil. Perhaps to documentation on this separation if it exist.
James,
you are (or were) correct, but the code has evolved over the years. The lov/osc and modules were formerly used on the MDS in order to connect to the OSS, and lmv/mdc were used with the old CMD code to connect to other MDS nodes. However, that ended up with a lot of code that was in those modules that was only used on the client or server. In the CMD code it also meant that a lot of complexity existed with making "fake" RPCs to other MDS nodes that tried to keep the same RPC opcode but were interpreted differently at the MDS when they were being sent from another MDS.
In the 2.4 release (which included both DNE and the OSD rewrite for ZFS) the lov/osc server code was copied/split into lod/osp, and this is used for remote connections to both the OSSs and other MDS nodes. The MDS is still a client of the OSS for precreate and recovery operations (and soon also statfs), but the code is no longer shared with the regular clients.
Cheers, Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/79f84741/attachment-0001.html>
cover lustre - more cleanups including module reduction.
Quoted 6 lines
Ah, thanks Andreas.? Perhaps not coincidentally, Lustre 2.4 is the first release I worked on.
Neil, I am really unenamored of the idea of the shared ptlrpc ldlm module being named ptlrpc...
Also, Lustre currently has a bunch of module parameters which are used for configuration.? Thoughts on that?
Currently ldlm is built into the ptlrpc module for the OpenSFS branch. Are you suggesting a different approach?
cover lustre - more cleanups including module reduction.
In reply to Patrick FarrellQuoted 3 lines · Patrick Farrell
Ah, thanks Andreas. Perhaps not coincidentally, Lustre 2.4 is the first release I worked on.
Neil, I am really unenamored of the idea of the shared ptlrpc ldlm module being named ptlrpc...
Can you say why? Is it the choice of name that bothers you, or the combining of two things into the one kernel module, or something else? Currently in git://git.hpdd.intel.com/fs/lustre-release.git
(or the git tree that was until recently at the above address), the module named "ptlrpc" contains ptlrpc code, ldlm code, and target code. I wonder what "target" means in this context.
Quoted 2 lines
Also, Lustre currently has a bunch of module parameters which are used for configuration. Thoughts on that?
Yes, the module parameters are an interesting part of the story. libcfs has a bunch of module parameters that are symlinked from debugfs. It seems that user-space largely uses the debugfs links to access them, so they can become part of the "lnet" module with minimal pain. Other modules have parameters that I haven't yet looked in to.
There probably will need to be user-space changes to support reduction in the number of modules.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/0350635b/attachment.sig>
cover lustre - more cleanups including module reduction.
Quoted 11 lines
Quoted 4 lines
Ah, thanks Andreas. Perhaps not coincidentally, Lustre 2.4 is the first release I worked on.
Neil, I am really unenamored of the idea of the shared ptlrpc ldlm module being named ptlrpc...
Can you say why? Is it the choice of name that bothers you, or the combining of two things into the one kernel module, or something else? Currently in
git://git.hpdd.intel.com/fs/lustre-release.git
(or the git tree that was until recently at the above address), the module named "ptlrpc" contains ptlrpc code, ldlm code, and target code. I wonder what "target" means in this context.
target is the server code built into ptlrpc which is for the "Unified Target". Its the shared code that is used by both the MDS and OSS code. Andreas or Oleg can add more details than this. BTW also the nodemap code also get built into ptlrpc module as well for the server side.
Quoted 10 lines
Quoted 1 line
Also, Lustre currently has a bunch of module parameters which are used for configuration. Thoughts on that?
Yes, the module parameters are an interesting part of the story. libcfs has a bunch of module parameters that are symlinked from debugfs. It seems that user-space largely uses the debugfs links to access them, so they can become part of the "lnet" module with minimal pain. Other modules have parameters that I haven't yet looked in to.
There probably will need to be user-space changes to support reduction in the number of modules.
The test suite will need some changes since it loads the modules. We need to handle the case if its built into the kernel as well.
cover lustre - more cleanups including module reduction.
Ah, sorry, lost your mail in the shuffle, Neil.
The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server?
________________________________
From: James Simmons <[email protected]>
Sent: Monday, June 25, 2018 8:13:22 PM
To: NeilBrown
Cc: Patrick Farrell; Andreas Dilger; Oleg Drokin; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 10 lines
Quoted 3 lines
Ah, thanks Andreas. Perhaps not coincidentally, Lustre 2.4 is the first release I worked on.
Neil, I am really unenamored of the idea of the shared ptlrpc ldlm module being named ptlrpc...
Can you say why? Is it the choice of name that bothers you, or the combining of two things into the one kernel module, or something else? Currently in
git://git.hpdd.intel.com/fs/lustre-release.git
(or the git tree that was until recently at the above address), the module named "ptlrpc" contains ptlrpc code, ldlm code, and target code. I wonder what "target" means in this context.
target is the server code built into ptlrpc which is for the "Unified Target". Its the shared code that is used by both the MDS and OSS code. Andreas or Oleg can add more details than this. BTW also the nodemap code also get built into ptlrpc module as well for the server side.
Quoted 10 lines
Quoted 1 line
Also, Lustre currently has a bunch of module parameters which are used for configuration. Thoughts on that?
Yes, the module parameters are an interesting part of the story. libcfs has a bunch of module parameters that are symlinked from debugfs. It seems that user-space largely uses the debugfs links to access them, so they can become part of the "lnet" module with minimal pain. Other modules have parameters that I haven't yet looked in to.
There probably will need to be user-space changes to support reduction in the number of modules.
The test suite will need some changes since it loads the modules. We
need to handle the case if its built into the kernel as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180626/bc8c6124/attachment.html>
cover lustre - more cleanups including module reduction.
Quoted 4 lines · Patrick Farrell
Ah, sorry, lost your mail in the shuffle, Neil.
The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server?
Thanks for clarifying.
Note that I'm still feeling my way around here so "intended" can at most be a soft intention, open to change. But yes, I expect this module would ultimately be shared with the server.
I think things should only be in different modules if it might sometimes make sense to use one without the other.
So everything that is always used for a lustre client mount, and is only used for a lustre client mount, should be in a module called "lustre". And everything always and only used for a lustre server should be in a module called (something like) "lustre-server".
It appears to me that ptlrpc, ldlm, and obdclass are always and only used together, but can be used for client or server. So I think they should be together in a module.
I'm tempted to add lnet to that list. There has been mention that cray has some other functionality that uses lnet - if that doesn't use ptlrpc, then maybe that is a case for keeping lnet separate. However I would rather see it as a potential case to separate lnet from the others at a later date if that functionality from cray ever goes into mainline.
The klnds modules can presumably be used independently(?) so they can sensibly remain as separate modules, though I'm beginning to wonder if lnet can actually function without socklnd, so I wonder if that should be permanently part of the lnet module (with NFS, the xprt_sock code is a permanent part of "sunrpc", while the xprt_rdma (aka rpcrdma) code can be a separate module).
In the interests of a concrete strawman, what objections would I get if I suggested that ptlrpc, ldlm, obdclass, lnet, and socklnd were all included in the one module named "lnet" ??
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180627/02d56082/attachment.sig>
cover lustre - more cleanups including module reduction.
Hello, Neil.
Cray does indeed have another user of LNet. While it is now GPL, I can't say if it will ever be in mainline. However, even without it there is a case for LNet to live on its own as Andreas pointed out recently with http://lists.lustre.org/pipermail/lustre-devel-lustre.org/2018-June/007098.html.
But, if you want to group everything together now, we can hopefully tease it apart again in the future. If so, I think that it would be misleading to call a module lnet if it contained distributed locking functionality (ldlm). How about lustre-common, lustre-core, or some such?
Thanks,
-Cory
?On 6/26/18, 10:09 PM, "lustre-devel on behalf of NeilBrown" <lustre-devel-bounces at lists.lustre.org on behalf of [email protected]> wrote:
On Tue, Jun 26 2018, Patrick Farrell wrote:
> Ah, sorry, lost your mail in the shuffle, Neil.
>
> The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server? >
Thanks for clarifying.
Note that I'm still feeling my way around here so "intended" can at most be a soft intention, open to change. But yes, I expect this module would ultimately be shared with the server.
I think things should only be in different modules if it might sometimes make sense to use one without the other.
So everything that is always used for a lustre client mount, and is only used for a lustre client mount, should be in a module called "lustre". And everything always and only used for a lustre server should be in a module called (something like) "lustre-server".
It appears to me that ptlrpc, ldlm, and obdclass are always and only used together, but can be used for client or server. So I think they should be together in a module.
I'm tempted to add lnet to that list. There has been mention that cray has some other functionality that uses lnet - if that doesn't use ptlrpc, then maybe that is a case for keeping lnet separate. However I would rather see it as a potential case to separate lnet from the others at a later date if that functionality from cray ever goes into mainline.
The klnds modules can presumably be used independently(?) so they can sensibly remain as separate modules, though I'm beginning to wonder if lnet can actually function without socklnd, so I wonder if that should be permanently part of the lnet module (with NFS, the xprt_sock code is a permanent part of "sunrpc", while the xprt_rdma (aka rpcrdma) code can be a separate module).
In the interests of a concrete strawman, what objections would I get if I suggested that ptlrpc, ldlm, obdclass, lnet, and socklnd were all included in the one module named "lnet" ??
Thanks,
NeilBrown
cover lustre - more cleanups including module reduction.
Quoted 6 lines · Cory Spitz
Hello, Neil.
Cray does indeed have another user of LNet. While it is now GPL, I can't say if it will ever be in mainline. However, even without it there is a case for LNet to live on its own as Andreas pointed out recently with http://lists.lustre.org/pipermail/lustre-devel-lustre.org/2018-June/007098.html.
But, if you want to group everything together now, we can hopefully tease it apart again in the future. If so, I think that it would be misleading to call a module lnet if it contained distributed locking functionality (ldlm). How about lustre-common, lustre-core, or some such?
Do you have a link to this open-source thing that uses LNet? Does it have a name? Is it the Zest thing that Andreas' email linked to? Or maybe it's Cray-DVS?? A link to a git tree would be very helpful.
(I'm not committed to any name before I understand what the encapsulated functionality would be)
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180628/2a55161c/attachment.sig>
cover lustre - more cleanups including module reduction.
In reply to NeilBrownQuoted 31 lines · NeilBrown
Quoted 4 lines · Patrick Farrell
Ah, sorry, lost your mail in the shuffle, Neil.
The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server?
Thanks for clarifying.
Note that I'm still feeling my way around here so "intended" can at most be a soft intention, open to change. But yes, I expect this module would ultimately be shared with the server.I think things should only be in different modules if it might sometimes make sense to use one without the other.
So everything that is always used for a lustre client mount, and is only used for a lustre client mount, should be in a module called "lustre". And everything always and only used for a lustre server should be in a module called (something like) "lustre-server".
It appears to me that ptlrpc, ldlm, and obdclass are always and only used together, but can be used for client or server. So I think they should be together in a module.
I'm tempted to add lnet to that list. There has been mention that Cray has some other functionality that uses lnet - if that doesn't use ptlrpc, then maybe that is a case for keeping lnet separate. However I would rather see it as a potential case to separate lnet from the others at a later date if that functionality from cray ever goes into mainline.
Quoted 6 lines
The klnds modules can presumably be used independently(?) so they can sensibly remain as separate modules, though I'm beginning to wonder if lnet can actually function without socklnd, so I wonder if that should be permanently part of the lnet module (with NFS, the
xprt_sockcode is a permanent part of "sunrpc", while thexprt_rdma(aka rpcrdma) code can be a separate module).
Definitely LNet can run without ksocklnd, and it does so on clients that only have IB connections. Lots of HPC systems have client nodes that do not have Ethernet interfaces, since it is a cabling/networking nightmare to add a few thousand additional Ethernet cables/ports in addition to the IB cables/ports, and it is always possible to run IPoIB for TCP traffic.
Quoted 3 lines
In the interests of a concrete strawman, what objections would I get if I suggested that ptlrpc, ldlm, obdclass, lnet, and socklnd were all included in the one module named "lnet" ??
This would break all of the module parameters for ptlrpc. There are only a few obdclass module parameters that are rarely used, so I'm less worried about those ones.
Given that lnet is a separate thing, I'd prefer to keep "ptlrpc" and "lnet" as separate modules, then "lustre" for the remainder of the client code.
The "ptlrpc" module should also include the "fld", "fid", "quota", "mgc" modules, since these are shared with the server as well.
Server modules:
[adilger at mookie ~]$ lsmod | grep ^obdclass
obdclass 1731964 83 mdd,lod,mdt,osp,ofd,lfsck,ost,mgs,mgc,osd_ldiskfs,fid,fld,lquota,ptlrpc
Client modules:
[adilger at twoshoes ~]$ lsmod | grep ^obdclass
obdclass 1568040 86 osc,mgc,lustre,lov,mdc,fid,lmv,fld,ptlrpc
James, if we are going to move in the direction of having a separate "lustre-server" module, it would make sense to land a patch to master now that adds both a module alias, as well as a filesystem type alias for lustre-server, so that we can start moving systems over to using "lustre-server" as the filesystem type in /etc/fstab or HA mounting scripts, and it will auto-load the module at the same time. This might also allow the Lustre mount code to be simplified, since I think it has some messy code to have the same code, but distinguish between client and server mounts.
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180627/91d93896/attachment-0001.sig>
cover lustre - more cleanups including module reduction.
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
- Patrick
________________________________
From: Andreas Dilger <[email protected]>
Sent: Wednesday, June 27, 2018 6:01:27 AM
To: NeilBrown; James Simmons
Cc: Patrick Farrell; Oleg Drokin; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 31 lines · NeilBrown
Quoted 4 lines · Patrick Farrell
Ah, sorry, lost your mail in the shuffle, Neil.
The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server?
Thanks for clarifying.
Note that I'm still feeling my way around here so "intended" can at most be a soft intention, open to change. But yes, I expect this module would ultimately be shared with the server.I think things should only be in different modules if it might sometimes make sense to use one without the other.
So everything that is always used for a lustre client mount, and is only used for a lustre client mount, should be in a module called "lustre". And everything always and only used for a lustre server should be in a module called (something like) "lustre-server".
It appears to me that ptlrpc, ldlm, and obdclass are always and only used together, but can be used for client or server. So I think they should be together in a module.
I'm tempted to add lnet to that list. There has been mention that Cray has some other functionality that uses lnet - if that doesn't use ptlrpc, then maybe that is a case for keeping lnet separate. However I would rather see it as a potential case to separate lnet from the others at a later date if that functionality from cray ever goes into mainline.
Quoted 6 lines
The klnds modules can presumably be used independently(?) so they can sensibly remain as separate modules, though I'm beginning to wonder if lnet can actually function without socklnd, so I wonder if that should be permanently part of the lnet module (with NFS, the
xprt_sockcode is a permanent part of "sunrpc", while thexprt_rdma(aka rpcrdma) code can be a separate module).
Definitely LNet can run without ksocklnd, and it does so on clients that only have IB connections. Lots of HPC systems have client nodes that do not have Ethernet interfaces, since it is a cabling/networking nightmare to add a few thousand additional Ethernet cables/ports in addition to the IB cables/ports, and it is always possible to run IPoIB for TCP traffic.
Quoted 3 lines
In the interests of a concrete strawman, what objections would I get if I suggested that ptlrpc, ldlm, obdclass, lnet, and socklnd were all included in the one module named "lnet" ??
This would break all of the module parameters for ptlrpc. There are only a few obdclass module parameters that are rarely used, so I'm less worried about those ones.
Given that lnet is a separate thing, I'd prefer to keep "ptlrpc" and "lnet" as separate modules, then "lustre" for the remainder of the client code.
The "ptlrpc" module should also include the "fld", "fid", "quota", "mgc" modules, since these are shared with the server as well.
Server modules:
[adilger at mookie ~]$ lsmod | grep ^obdclass
obdclass 1731964 83 mdd,lod,mdt,osp,ofd,lfsck,ost,mgs,mgc,osd_ldiskfs,fid,fld,lquota,ptlrpc
Client modules:
[adilger at twoshoes ~]$ lsmod | grep ^obdclass
obdclass 1568040 86 osc,mgc,lustre,lov,mdc,fid,lmv,fld,ptlrpc
James, if we are going to move in the direction of having a separate "lustre-server" module, it would make sense to land a patch to master now that adds both a module alias, as well as a filesystem type alias for lustre-server, so that we can start moving systems over to using "lustre-server" as the filesystem type in /etc/fstab or HA mounting scripts, and it will auto-load the module at the same time. This might also allow the Lustre mount code to be simplified, since I think it has some messy code to have the same code, but distinguish between client and server mounts.
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180627/b0c53d64/attachment.html>
cover lustre - more cleanups including module reduction.
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.
I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.
In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180628/d261f326/attachment-0001.sig>
cover lustre - more cleanups including module reduction.
I will ask about source and plans to publish it, Neil - I?m almost certain it has not been publicly released yet and I?m not actually sure the relicensing is really complete. So I?d be shocked and possibly mildly concerned if you found the source online today.
Understood about the rest, and thanks! I have no idea which DVS uses, and I understand that as an out of tree user, we are in the end responsible for it. DVS has in fact had this relationship with the master branch for a long time - Andreas and company are accommodating about interface changes, but in the end, we are responsible for keeping in sync.
I would say about the acceptor and sock lnd: I believe Lustre assumes some IP transport is available for configuration, but does NOT necessarily use it for primary communication. Fabrics - Like infiniband or Cray Aries - are more or less always configured to provide IP transport, to enable the panoply of tools and apps that rely on it. But they perform better if their native protocols are used, which is of course what the other LNDs do.
________________________________
From: NeilBrown <[email protected]>
Sent: Wednesday, June 27, 2018 8:59:05 PM
To: Patrick Farrell; Andreas Dilger; James Simmons
Cc: Oleg Drokin; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.
I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.
In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.
Thanks,
NeilBrown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180628/6750beca/attachment.html>
cover lustre - more cleanups including module reduction.
Quoted 2 lines · Patrick Farrell
I would say about the acceptor and sock lnd: I believe Lustre assumes some IP transport is available for configuration, but does NOT necessarily use it for primary communication. Fabrics - Like infiniband or Cray Aries - are more or less always configured to provide IP transport, to enable the panoply of tools and apps that rely on it. But they perform better if their native protocols are used, which is of course what the other LNDs do.
It is worthwhile to clarify this a bit - LNet uses IP for *addressing* of the nodes at connection time, but I don't think it even uses the TCP interface for any communication itself (though I could be mistaken, as LNet isn't my specialty). After the initial connection, the only other thing the IP addresses are used for is printing in error messages.
At one time or another we've discussed how we might get rid of the need for IPoIB on client nodes, since some sites don't want any IP connectivity to the client nodes for security and performance reasons. That said, I don't think we've come up with a good solution yet. LNet itself allows alternate addressing schemes to be used. The former qswlnd (for Quadrics Elan networks) just used an integer node number, like 1 at elan for the NID, but I don't think there is any such alternative for IB node addresses except using a MAC hardware address or similar.
Cheers, Andreas
Quoted 48 lines
Quoted 46 lines · Neil Brown
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.
Quoted 8 lines
Quoted 8 lines
In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.Thanks,
NeilBrown
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180628/9e2591e1/attachment.sig>
cover lustre - more cleanups including module reduction.
Quoted 6 lines
Quoted 2 lines
I would say about the acceptor and sock lnd: I believe Lustre assumes some IP transport is available for configuration, but does NOT necessarily use it for primary communication. Fabrics - Like infiniband or Cray Aries - are more or less always configured to provide IP transport, to enable the panoply of tools and apps that rely on it. But they perform better if their native protocols are used, which is of course what the other LNDs do.
It is worthwhile to clarify this a bit - LNet uses IP for *addressing* of the nodes at connection time, but I don't think it even uses the TCP interface for any communication itself (though I could be mistaken, as LNet isn't my specialty). After the initial connection, the only other thing the IP addresses are used for is printing in error messages.
At one time or another we've discussed how we might get rid of the need for IPoIB on client nodes, since some sites don't want any IP connectivity to the client nodes for security and performance reasons. That said, I don't think we've come up with a good solution yet. LNet itself allows alternate addressing schemes to be used. The former qswlnd (for Quadrics Elan networks) just used an integer node number, like 1 at elan for the NID, but I don't think there is any such alternative for IB node addresses except using a MAC hardware address or similar.
The challenge to moving away from IP address for addressing is the NID address itself. Currently it is 64 bits which is composed for two parts.
static inline lnet_nid_t LNET_MKNID(__u32 net, __u32 addr)
{
return (((__u64)net) << 32) | addr;
}To use IB harware addressing would require a full 64 bit space so lnet_nid_t is to small. This is reason IPv6 is not supported. Ideas have floated around on how to get around this but nothing yet. It would be a massive API change currently.
Quoted 69 lines
Quoted 47 lines
Quoted 46 lines · Neil Brown
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.Quoted 8 lines
Quoted 8 lines
In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.Thanks,
NeilBrownCheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
cover lustre - more cleanups including module reduction.
Unfortunately, NIDs get stored outside of LNet in the Lustre configuration. That?s why changing the nature of NIDs requires a lot of changes in many places in and out of LNet.
In my opinion, the best gameplay is to get Lustre to stop even knowing what a NID is. Have Lustre identify nodes via a name which LNet converts to a NID (sort of like how DNS works). At that point, LNet can make the NID be anything you want: IPv6, IB address, etc. This also means you don?t have to run writeconf (or something like that) when the network changes. Only LNet needs to be updated.
Doug
Quoted 94 lines · James Simmons
Quoted 7 lines
Quoted 3 lines
I would say about the acceptor and sock lnd: I believe Lustre assumes some IP transport is available for configuration, but does NOT necessarily use it for primary communication. Fabrics - Like infiniband or Cray Aries - are more or less always configured to provide IP transport, to enable the panoply of tools and apps that rely on it. But they perform better if their native protocols are used, which is of course what the other LNDs do.
It is worthwhile to clarify this a bit - LNet uses IP for *addressing* of the nodes at connection time, but I don't think it even uses the TCP interface for any communication itself (though I could be mistaken, as LNet isn't my specialty). After the initial connection, the only other thing the IP addresses are used for is printing in error messages.
At one time or another we've discussed how we might get rid of the need for IPoIB on client nodes, since some sites don't want any IP connectivity to the client nodes for security and performance reasons. That said, I don't think we've come up with a good solution yet. LNet itself allows alternate addressing schemes to be used. The former qswlnd (for Quadrics Elan networks) just used an integer node number, like 1 at elan for the NID, but I don't think there is any such alternative for IB node addresses except using a MAC hardware address or similar.
The challenge to moving away from IP address for addressing is the NID address itself. Currently it is 64 bits which is composed for two parts.
static inline
lnet_nid_tLNET_MKNID(__u32 net, __u32 addr){ return (((__u64)net) << 32) | addr; }To use IB harware addressing would require a full 64 bit space so
lnet_nid_tis to small. This is reason IPv6 is not supported. Ideas have floated around on how to get around this but nothing yet. It would be a massive API change currently.Quoted 53 lines
Quoted 53 lines
Quoted 52 lines · Neil Brown
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.Quoted 15 lines
Quoted 2 lines
Quoted 2 lines
Thanks,
NeilBrownCheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
cover lustre - more cleanups including module reduction.
In reply to NeilBrownI know that Doug follows this list closely, but I'm going to flag him here directly, because I know that he has an opinion about kiov / iovec (and a 3rd if I recall correctly).
Doug told me that (possibly) Al Viro had a proposal or submitted code to simply the kiov usage and that Doug was in favor of it. Let's choose to make the right architectural call for Lustre/LNet and let Cray worry about keeping our out-of-tree code working. As Patrick said, Cray pays the price of keeping DVS off to the side (we're wising up, which is why it is now GPL... but don't expect us to publish it on the Internet necessarily... baby-steps).
Doug, can you weigh-in on this case?
Thanks,
-Cory
?On 6/27/18, 8:59 PM, "lustre-devel on behalf of NeilBrown" <lustre-devel-bounces at lists.lustre.org on behalf of [email protected]> wrote:
On Wed, Jun 27 2018, Patrick Farrell wrote:
> Neil,
>
> We do indeed have such functionality (it?s called DVS and it?s > basically a high speed file system projection framework, ala NFS but > faster), so the ability to build lnet separately is valuable to us. > While it is being open sourced under the GPL, I don?t think there?s > any intention to try to upstream it. The current code isn?t even > usable off of Cray systems as it depends on info from user space (that > is provided, in the end, from Cray proprietary hardware) to keep its > connection/routing tables up to date. That?s supposedly in the > pipeline to get fixed, but it?s still pretty far from generally > usable.
>
> But we?d still really appreciate it if lnet stayed separate. Don?t > know if that?s enough for you - I know sometimes *small* stuff is done > for out of tree users. Hopefully this meets that standard. >
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.
I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.
In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.
Thanks,
NeilBrown
cover lustre - more cleanups including module reduction.
Yes, Al Viro had started the process of getting Lustre in the upstream staging area to use iov_iter and, I believe, biovec. A very good change in my opinion as it gets rid of the duality. Unfortunately, those changes have not made their way into the Whamcloud tree yet so there is a disconnect when working between the two trees. James Simmons might know more, but I don?t believe Al?s changes are complete so there is still a need to support iovec and kvec. Could we replace these two with biovecs? James?
As Cory says, lets make the right architectural decisions and let companies (Whamcloud, Cray, etc) absorb the improvements. We can adapt DVS as required.
As for LNet as a module: please keep it as a separate module. Merging it into Lustre would create a dependency for DVS to have Lustre installed and possibly running. This would also stand in the way of any potential future users of LNet. Andreas pointed out one, Zest (search for LNET in this paper: https://www.psc.edu/images/zest/zest-pdsw08-paper.pdf), but there may be others developing. LNet could become its own project at some point because of multiple users.
Doug
Quoted 70 lines · Cory Spitz
I know that Doug follows this list closely, but I'm going to flag him here directly, because I know that he has an opinion about kiov / iovec (and a 3rd if I recall correctly).
Doug told me that (possibly) Al Viro had a proposal or submitted code to simply the kiov usage and that Doug was in favor of it. Let's choose to make the right architectural call for Lustre/LNet and let Cray worry about keeping our out-of-tree code working. As Patrick said, Cray pays the price of keeping DVS off to the side (we're wising up, which is why it is now GPL... but don't expect us to publish it on the Internet necessarily... baby-steps).
Doug, can you weigh-in on this case?
Thanks,
-Cory?On 6/27/18, 8:59 PM, "lustre-devel on behalf of NeilBrown" <lustre-devel-bounces at lists.lustre.org on behalf of [email protected]> wrote:
Quoted 13 lines · Patrick Farrell
Neil,
We do indeed have such functionality (it?s called DVS and it?s basically a high speed file system projection framework, ala NFS but faster), so the ability to build lnet separately is valuable to us. While it is being open sourced under the GPL, I don?t think there?s any intention to try to upstream it. The current code isn?t even usable off of Cray systems as it depends on info from user space (that is provided, in the end, from Cray proprietary hardware) to keep its connection/routing tables up to date. That?s supposedly in the pipeline to get fixed, but it?s still pretty far from generally usable.
Quoted 4 lines
But we?d still really appreciate it if lnet stayed separate. Don?t know if that?s enough for you - I know sometimes *small* stuff is done for out of tree users. Hopefully this meets that standard.
Ahh - DVS. That answers a question I just asked in another email. My google-skills don't seem to be up to locating the source code though :-(
While I wouldn't knowingly break an interface used by some out-of-tree code without good reason, it is hard to avoid if you don't know what the out-of-tree code does. It can be very tempting to remove something that isn't being used, but that can certainly hurt out-of-tree code sometimes.
A particular example I'm exploring at present is the dual data paths in LNet. Or maybe it is dual types of Memory Descriptors. There is 'kiov' which uses kernel-virtual addresses and 'iovec' which uses page+offset.
The kiov option isn't used in the client code and it seems likely that the server-side code could be converted to use iovec without problems.I'd like to remove the kiov as I wouldn't be able to justify its existence when submitting the client-only code upstream. But I don't want to remove the option of having an alternate MD type if it really is significantly more efficient in some context.
If I know whether DVS used kiov or iovec - and in what way - that would help me to know if I might break something, and to be able to assess the cost.In my mind, the "standard" that you mention is always about
practicality. Code needs to be maintainable - easy to understand and
hard to break. If the LNet interface is clean and well documented in the kernel, then I don't see why we would not at least attempt to preserve it.Thanks,
NeilBrown
cover lustre - more cleanups including module reduction.
Doug,
What about LNet API change to use sge list? It's more natively structure for variable page list, which is may a short sized for MDC links and full sized for OST links.
?On 28/06/2018, 20:04, "Doug Oucharek" <[email protected]> wrote:
Yes, Al Viro had started the process of getting Lustre in the upstream staging area to use iov_iter and, I believe, biovec. A very good change in my opinion as it gets rid of the duality. Unfortunately, those changes have not made their way into the Whamcloud tree yet so there is a disconnect when working between the two trees. James Simmons might know more, but I don?t believe Al?s changes are complete so there is still a need to support iovec and kvec. Could we replace these two with biovecs? James?
As Cory says, lets make the right architectural decisions and let companies (Whamcloud, Cray, etc) absorb the improvements. We can adapt DVS as required.
As for LNet as a module: please keep it as a separate module. Merging it into Lustre would create a dependency for DVS to have Lustre installed and possibly running. This would also stand in the way of any potential future users of LNet. Andreas pointed out one, Zest (search for LNET in this paper: https://www.psc.edu/images/zest/zest-pdsw08-paper.pdf), but there may be others developing. LNet could become its own project at some point because of multiple users.
Doug
> On Jun 28, 2018, at 8:03 AM, Cory Spitz <[email protected]> wrote:
>
> I know that Doug follows this list closely, but I'm going to flag him here directly, because I know that he has an opinion about kiov / iovec (and a 3rd if I recall correctly).
>
> Doug told me that (possibly) Al Viro had a proposal or submitted code to simply the kiov usage and that Doug was in favor of it. Let's choose to make the right architectural call for Lustre/LNet and let Cray worry about keeping our out-of-tree code working. As Patrick said, Cray pays the price of keeping DVS off to the side (we're wising up, which is why it is now GPL... but don't expect us to publish it on the Internet necessarily... baby-steps). >
> Doug, can you weigh-in on this case?
>
> Thanks,
> -Cory
>
> --
>
> On 6/27/18, 8:59 PM, "lustre-devel on behalf of NeilBrown" <lustre-devel-bounces at lists.lustre.org on behalf of [email protected]> wrote:
>
> On Wed, Jun 27 2018, Patrick Farrell wrote:
>
>> Neil,
>>
>> We do indeed have such functionality (it?s called DVS and it?s
>> basically a high speed file system projection framework, ala NFS but
>> faster), so the ability to build lnet separately is valuable to us.
>> While it is being open sourced under the GPL, I don?t think there?s
>> any intention to try to upstream it. The current code isn?t even
>> usable off of Cray systems as it depends on info from user space (that
>> is provided, in the end, from Cray proprietary hardware) to keep its
>> connection/routing tables up to date. That?s supposedly in the
>> pipeline to get fixed, but it?s still pretty far from generally
>> usable.
>>
>> But we?d still really appreciate it if lnet stayed separate. Don?t
>> know if that?s enough for you - I know sometimes *small* stuff is done
>> for out of tree users. Hopefully this meets that standard.
>>
>
> Ahh - DVS. That answers a question I just asked in another email.
> My google-skills don't seem to be up to locating the source code though
> :-(
>
> While I wouldn't knowingly break an interface used by some out-of-tree
> code without good reason, it is hard to avoid if you don't know what the
> out-of-tree code does. It can be very tempting to remove something that
> isn't being used, but that can certainly hurt out-of-tree code
> sometimes.
>
> A particular example I'm exploring at present is the dual data paths in
> LNet. Or maybe it is dual types of Memory Descriptors.
> There is 'kiov' which uses kernel-virtual addresses and 'iovec' which
> uses page+offset.
> The kiov option isn't used in the client code and it seems likely that
> the server-side code could be converted to use iovec without problems.
>
> I'd like to remove the kiov as I wouldn't be able to justify its
> existence when submitting the client-only code upstream. But I don't
> want to remove the option of having an alternate MD type if it really is
> significantly more efficient in some context.
> If I know whether DVS used kiov or iovec - and in what way - that would
> help me to know if I might break something, and to be able to assess the
> cost.
>
> In my mind, the "standard" that you mention is always about
> practicality. Code needs to be maintainable - easy to understand and
> hard to break. If the LNet interface is clean and well documented in
> the kernel, then I don't see why we would not at least attempt to
> preserve it.
>
> Thanks,
> NeilBrown
>
>
cover lustre - more cleanups including module reduction.
In reply to Andreas DilgerQuoted 39 lines · Andreas Dilger
Quoted 31 lines · NeilBrown
Quoted 4 lines · Patrick Farrell
Ah, sorry, lost your mail in the shuffle, Neil.
The name, mostly. ptlrpc is one subdirectory and one subsystem, so I don?t want to use it for a module that explicitly includes all of several. I?m not sure of a better name immediately - is this module intended to be shared between client and server?
Thanks for clarifying.
Note that I'm still feeling my way around here so "intended" can at most be a soft intention, open to change. But yes, I expect this module would ultimately be shared with the server.I think things should only be in different modules if it might sometimes make sense to use one without the other.
So everything that is always used for a lustre client mount, and is only used for a lustre client mount, should be in a module called "lustre". And everything always and only used for a lustre server should be in a module called (something like) "lustre-server".
It appears to me that ptlrpc, ldlm, and obdclass are always and only used together, but can be used for client or server. So I think they should be together in a module.
I'm tempted to add lnet to that list. There has been mention that Cray has some other functionality that uses lnet - if that doesn't use ptlrpc, then maybe that is a case for keeping lnet separate. However I would rather see it as a potential case to separate lnet from the others at a later date if that functionality from cray ever goes into mainline.
Quoted 6 lines
The klnds modules can presumably be used independently(?) so they can sensibly remain as separate modules, though I'm beginning to wonder if lnet can actually function without socklnd, so I wonder if that should be permanently part of the lnet module (with NFS, the
xprt_sockcode is a permanent part of "sunrpc", while thexprt_rdma(aka rpcrdma) code can be a separate module).
Quoted 5 lines
Definitely LNet can run without ksocklnd, and it does so on clients that only have IB connections. Lots of HPC systems have client nodes that do not have Ethernet interfaces, since it is a cabling/networking nightmare to add a few thousand additional Ethernet cables/ports in addition to the IB cables/ports, and it is always possible to run IPoIB for TCP traffic.
Thanks for the clarification.
This came up because I'd been looking at lnet/lib-socket.c and wondering why that code wasn't in socklnd. If found that it was also used by lnet/acceptor which seems to always run a thread that listens on a TCP port (I think - I skim lots of code while trying to figure out the big-picture structure).
If there is always a socket acceptor, I thought you might always need a socket back-end (lnd).
Should the 'acceptor' thing really be part of socklnd?
Quoted 5 lines
Quoted 4 lines
In the interests of a concrete strawman, what objections would I get if I suggested that ptlrpc, ldlm, obdclass, lnet, and socklnd were all included in the one module named "lnet" ??
Quoted 7 lines
This would break all of the module parameters for ptlrpc. There are only a few obdclass module parameters that are rarely used, so I'm less worried about those ones.
Given that lnet is a separate thing, I'd prefer to keep "ptlrpc" and "lnet" as separate modules, then "lustre" for the remainder of the client code.
This does seem to be the idea that will be most widely accepted. The module parameters seem to be the main practical issue with merging modules. I wouldn't want that to force us to keep things separate that should be together, but nor do I want to introduce unnecessary breakage.
Quoted 11 lines
The "ptlrpc" module should also include the "fld", "fid", "quota", "mgc" modules, since these are shared with the server as well.
Server modules:
[adilger at mookie ~]$ lsmod | grep ^obdclass
obdclass 1731964 83 mdd,lod,mdt,osp,ofd,lfsck,ost,mgs,mgc,osd_ldiskfs,fid,fld,lquota,ptlrpcClient modules:
[adilger at twoshoes ~]$ lsmod | grep ^obdclass
obdclass 1568040 86 osc,mgc,lustre,lov,mdc,fid,lmv,fld,ptlrpc
Thanks for this - a useful perspective.
I don't see quota (or lquota) on the client side though ??
Quoted 11 lines
James, if we are going to move in the direction of having a separate "lustre-server" module, it would make sense to land a patch to master now that adds both a module alias, as well as a filesystem type alias for lustre-server, so that we can start moving systems over to using "lustre-server" as the filesystem type in
/etc/fstabor HA mounting scripts, and it will auto-load the module at the same time. This might also allow the Lustre mount code to be simplified, since I think it has some messy code to have the same code, but distinguish between client and server mounts.
This sounds like an excellent idea!
I have a patch in my lustre-testing tree (probably will post next week) which moves the client-side mounting from obdclass to llite. It is a nice simplification.
Thanks,
NeilBrown
Quoted 6 lines
Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180628/5d3ab435/attachment.sig>
cover lustre - more cleanups including module reduction.
In reply to Patrick FarrellQuoted 8 lines · Patrick Farrell
Huh? Very little of the client is used on the server. The vast majority of the client is llite, vvp, then lov, osc, and mdc. These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients". They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is. But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me. It's like this:
So llite fid fld lmv lov mdc mgc osc and obdclass can all be in a "lustre" module.
ldlm and ptlrpc should be in a separate "ptlrpc" module. And lnet and the klnds are also separate.
On the server side we would have
lod mdd mdt mgs ofd osp ost
does that seem approximately right?
Thanks,
NeilBrown
Quoted 168 lines
vfs
client codeptlrpc
networking
------ PHYSICAL BOUNDARY --------
networkingptlrpc
server code
ldiskfs
with LDLM also being explicitly shared, though client & server code is not all shared. Very little to nothing outside of the networking & ldlm layers is shared.
________________________________
From: lustre-devel <[email protected]> on behalf of James Simmons <[email protected]>
Sent: Wednesday, June 20, 2018 8:48:07 PM
To: NeilBrown
Cc: Oleg Drokin; Andreas Dilger; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
do lmv.a and the other *.a files get relinked int lustre.ko ?
Quoted 5 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disableKBUILD_MODNAMEwhen building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
lustre: use
truncate_inode_pagein place oftruncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: removelustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discardLTIME_Smacro
lustre: discardNO_QUOTAandQUOTA_OK
lustre: discard ext2* bit operations
lustre: centralizeTIMES_SET_FLAGS
lustre: remove redefinition ofmodule_init().
lustre: removelustre_compat.hThe first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move
truncate_inode_page()tolustre_mdc.hfor now. The next patch does break things.Quoted 7 lines
lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c
lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()
lustre: move tcd locking across totracefile.c
lustre: move remainder oflinux-tracefile.ctotracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
lustre: discardTCD_MAX_TYPESI see breakage in this code as well.
Quoted 63 lines
Documentation/kbuild/makefiles.txt | 65 +++++ drivers/staging/lustre/lnet/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/debug.c | 6 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 258 -------------------- drivers/staging/lustre/lnet/libcfs/module.c | 26 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 241 +++++++++++++++++-- drivers/staging/lustre/lnet/libcfs/tracefile.h | 40 --- drivers/staging/lustre/lnet/lnet/Makefile | 11 - drivers/staging/lustre/lnet/lnet/module.c | 9 + drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 drivers/staging/lustre/lustre/include/cl_object.h | 6 .../staging/lustre/lustre/include/lustre_compat.h | 82 ------ drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 68 ----- drivers/staging/lustre/lustre/include/obd.h | 7 + .../staging/lustre/lustre/include/obd_support.h | 1 drivers/staging/lustre/lustre/ldlm/Makefile | 11 + drivers/staging/lustre/lustre/llite/dir.c | 3 drivers/staging/lustre/lustre/llite/file.c | 36 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 11 - .../staging/lustre/lustre/llite/llite_internal.h | 13 + drivers/staging/lustre/lustre/llite/llite_lib.c | 52 ++-- drivers/staging/lustre/lustre/llite/namei.c | 16 + drivers/staging/lustre/lustre/llite/vvp_io.c | 8 - drivers/staging/lustre/lustre/llite/vvp_object.c | 6 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 19 + drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 7 - .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/obdclass/obdo.c | 10 - .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 drivers/staging/lustre/lustre/osc/osc_io.c | 23 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 drivers/staging/lustre/lustre/osc/osc_request.c | 1 drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 - drivers/staging/lustre/lustre/ptlrpc/import.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 + drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 scripts/Makefile.build | 57 +++- scripts/Makefile.lib | 63 +++-- 57 files changed, 584 insertions(+), 685 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile
Quoted 8 lines
Quoted 4 lines
--
Signature_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/c2bc7f0e/attachment-0001.sig>
cover lustre - more cleanups including module reduction.
I?m hoping someone with a better memory or who?s in a position to check this a bit better (no computer access this second) will speak up, but...
To a first approximation, yes, that sounds close. Probably missing something but...
Also, not sure about fid and fld. Might be needed on the server...? But you will of course find you when you try.
________________________________
From: NeilBrown <[email protected]>
Sent: Wednesday, June 20, 2018 10:00:54 PM
To: Patrick Farrell; James Simmons
Cc: Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.
Quoted 8 lines · Patrick Farrell
Huh? Very little of the client is used on the server. The vast majority of the client is llite, vvp, then lov, osc, and mdc. These are not used on the servers at all, the modules won't even be loaded.
Servers are definitely *not* clients of one another in the sense of "Lustre clients". They interact with each other, but in a manner very different from client to server.
The ldlm and ptlrpc layers are *partly* shared, and of course, the networking from lnet down is. But that's not "the client".
The statement that the server layer is a middle layer on top of the client code doesn't make any sense to me. It's like this:
So llite fid fld lmv lov mdc mgc osc and obdclass can all be in a "lustre" module.
ldlm and ptlrpc should be in a separate "ptlrpc" module. And lnet and the klnds are also separate.
On the server side we would have
lod mdd mdt mgs ofd osp ost
does that seem approximately right?
Thanks,
NeilBrown
Quoted 168 lines
vfs
client codeptlrpc
networking
------ PHYSICAL BOUNDARY --------
networkingptlrpc
server code
ldiskfs
with LDLM also being explicitly shared, though client & server code is not all shared. Very little to nothing outside of the networking & ldlm layers is shared.
________________________________
From: lustre-devel <[email protected]> on behalf of James Simmons <[email protected]>
Sent: Wednesday, June 20, 2018 8:48:07 PM
To: NeilBrown
Cc: Oleg Drokin; Andreas Dilger; Lustre Development List
Subject: Re: [lustre-devel] [PATCH 00/24] lustre - more cleanups including module reduction.Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
do lmv.a and the other *.a files get relinked int lustre.ko ?
Quoted 5 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disableKBUILD_MODNAMEwhen building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
lustre: use
truncate_inode_pagein place oftruncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: removelustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discardLTIME_Smacro
lustre: discardNO_QUOTAandQUOTA_OK
lustre: discard ext2* bit operations
lustre: centralizeTIMES_SET_FLAGS
lustre: remove redefinition ofmodule_init().
lustre: removelustre_compat.hThe first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move
truncate_inode_page()tolustre_mdc.hfor now. The next patch does break things.Quoted 7 lines
lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c
lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()
lustre: move tcd locking across totracefile.c
lustre: move remainder oflinux-tracefile.ctotracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
lustre: discardTCD_MAX_TYPESI see breakage in this code as well.
Quoted 63 lines
Documentation/kbuild/makefiles.txt | 65 +++++ drivers/staging/lustre/lnet/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/Makefile | 7 - drivers/staging/lustre/lnet/libcfs/debug.c | 6 .../staging/lustre/lnet/libcfs/linux-tracefile.c | 258 -------------------- drivers/staging/lustre/lnet/libcfs/module.c | 26 +- drivers/staging/lustre/lnet/libcfs/tracefile.c | 241 +++++++++++++++++-- drivers/staging/lustre/lnet/libcfs/tracefile.h | 40 --- drivers/staging/lustre/lnet/lnet/Makefile | 11 - drivers/staging/lustre/lnet/lnet/module.c | 9 + drivers/staging/lustre/lustre/fid/lproc_fid.c | 1 drivers/staging/lustre/lustre/fld/lproc_fld.c | 1 drivers/staging/lustre/lustre/include/cl_object.h | 6 .../staging/lustre/lustre/include/lustre_compat.h | 82 ------ drivers/staging/lustre/lustre/include/lustre_net.h | 1 .../lustre/include/lustre_patchless_compat.h | 68 ----- drivers/staging/lustre/lustre/include/obd.h | 7 + .../staging/lustre/lustre/include/obd_support.h | 1 drivers/staging/lustre/lustre/ldlm/Makefile | 11 + drivers/staging/lustre/lustre/llite/dir.c | 3 drivers/staging/lustre/lustre/llite/file.c | 36 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 11 - .../staging/lustre/lustre/llite/llite_internal.h | 13 + drivers/staging/lustre/lustre/llite/llite_lib.c | 52 ++-- drivers/staging/lustre/lustre/llite/namei.c | 16 + drivers/staging/lustre/lustre/llite/vvp_io.c | 8 - drivers/staging/lustre/lustre/llite/vvp_object.c | 6 drivers/staging/lustre/lustre/lmv/lmv_intent.c | 6 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 21 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 drivers/staging/lustre/lustre/lov/lov_pack.c | 1 drivers/staging/lustre/lustre/lov/lov_page.c | 1 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 19 + drivers/staging/lustre/lustre/mdc/mdc_reint.c | 4 drivers/staging/lustre/lustre/mdc/mdc_request.c | 12 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 drivers/staging/lustre/lustre/obdclass/llog.c | 7 - .../lustre/lustre/obdclass/lprocfs_status.c | 1 .../staging/lustre/lustre/obdclass/obd_config.c | 1 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 1 drivers/staging/lustre/lustre/obdclass/obdo.c | 10 - .../staging/lustre/lustre/obdecho/echo_client.c | 1 drivers/staging/lustre/lustre/osc/lproc_osc.c | 1 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 drivers/staging/lustre/lustre/osc/osc_io.c | 23 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 4 drivers/staging/lustre/lustre/osc/osc_request.c | 1 drivers/staging/lustre/lustre/ptlrpc/Makefile | 12 - drivers/staging/lustre/lustre/ptlrpc/import.c | 1 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 drivers/staging/lustre/lustre/ptlrpc/sec.c | 15 + drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 1 drivers/staging/lustre/lustre/ptlrpc/service.c | 1 scripts/Makefile.build | 57 +++- scripts/Makefile.lib | 63 +++-- 57 files changed, 584 insertions(+), 685 deletions(-) delete mode 100644 drivers/staging/lustre/lnet/libcfs/linux-tracefile.c delete mode 100644 drivers/staging/lustre/lustre/include/lustre_compat.h delete mode 100644 drivers/staging/lustre/lustre/include/lustre_patchless_compat.h create mode 100644 drivers/staging/lustre/lustre/ldlm/Makefile
Quoted 8 lines
Quoted 4 lines
--
Signature_______________________________________________
lustre-devel mailing list
lustre-devel at lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/75c72d16/attachment-0001.html>
cover lustre - more cleanups including module reduction.
In reply to NeilBrownQuoted 11 lines
So llite fid fld lmv lov mdc mgc osc and obdclass
can all be in a "lustre" module.ldlm and ptlrpc should be in a separate "ptlrpc" module. And lnet and the klnds are also separate.
On the server side we would have
lod mdd mdt mgs ofd osp ostdoes that seem approximately right?
The best way to see what modules contain both server and client code is to search for HAVE_SERVER_SUPPROT in the OpenSFS source tree.
cover lustre - more cleanups including module reduction.
In reply to James SimmonsQuoted 9 lines · James Simmons
Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.
Quoted 5 lines
That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
Why would you do that? SUBDIRS= is for building external modules. What are you trying to achieve?
Quoted 2 lines
do lmv.a and the other *.a files get relinked int lustre.ko ?
It isn't "lmv.a", it is ".../lustre/lmv/mod.a".
Quoted 44 lines
Quoted 6 lines
I've haven't progressed further in lustre because I'm not sure which - if any - modules are also used by the server.
I'd rather shared code was in a separate module to client-only.Which parts of lustre/lustre/* are also used by server?
Basically all the client code is reused on the server except for llite. The reason is each server type MDS, MGS, or OSS is treated as a client to each other. So in affect the server code is a middle layer level on top of the client code.
Quoted 9 lines
After that, it is all fairly simple cleanups.
I plan to submit the kbuild stuff upstream next week.
Thanks,
NeilBrown---
Quoted 8 lines
NeilBrown (24):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disableKBUILD_MODNAMEwhen building for mod.a
kbuild: Add documentation for modobj-m
lustre: build ldlm in the ldlm directory.
lustre: merge libcfs module into lnet.This seems to work when I tried the lustre-testing tree. I did see regression to related to this work in that tree.
Quoted 10 lines
lustre: use
truncate_inode_pagein place oftruncate_complete_page
lustre: don't use spare bits in iattr.ia_valid
lustre: removelustre_patchless_compat.h
lustre: discard current_n*groups macros.
lustre: discardLTIME_Smacro
lustre: discardNO_QUOTAandQUOTA_OK
lustre: discard ext2* bit operations
lustre: centralizeTIMES_SET_FLAGS
lustre: remove redefinition ofmodule_init().
lustre: removelustre_compat.h
Quoted 4 lines
The first two patches of the above seem to break things. The first one was pointed out so I avoid issues in my testing by changing the patch to just move
truncate_inode_page()tolustre_mdc.hfor now. The next patch does break things.
Can you be specific about what things (or just one thing) that the next patch breaks? I haven't seen anything in my testing.
The only problem I've seen is that kvmalloc(GFP_NOFS) has been changed to silently become kmalloc(GFP_NOFS) so there are memory allocation problems.
Quoted 10 lines
Quoted 8 lines
lustre/lnet: move tracefile locking from
linux-tracefile.ctotracefile.c
lustre: open codecfs_trace_max_debug_mb()intocfs_trace_set_debug_mb()
lustre: move tcd locking across totracefile.c
lustre: move remainder oflinux-tracefile.ctotracefile.c
lustre: fold cfs_tracefile_*_arch into their only callers.
lustre: renamedCFS_TCD_TYPE_MAXtoCFS_TCD_TYPE_CNT
lustre: discardTCD_MAX_TYPESI see breakage in this code as well.
Specifically??...
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180621/ed188aeb/attachment.sig>
cover lustre - more cleanups including module reduction.
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.Quoted 5 lines
That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
Quoted 7 lines
Why would you do that? SUBDIRS= is for building external modules. What are you trying to achieve?
Quoted 2 lines
do lmv.a and the other *.a files get relinked int lustre.ko ?
It isn't "lmv.a", it is ".../lustre/lmv/mod.a".
Sorry I forgot the mod.a naming. I was asking to get a feel of how the work flow would change. It is common for lustre developers to build in tree and test without installing anything. The many module approach might of been a way for people to rebuild a module, unload module and then reload module quickly to test a change. I don't work this way so I can't say. I was looking to see if that work flow could still be done.
cover lustre - more cleanups including module reduction.
Quoted 23 lines · James Simmons
Quoted 15 lines
Quoted 9 lines
Quoted 8 lines
Here are a bunch more cleanups that will appear in my lustre-testing tree shortly.
The interesting stuff is some enhancements to kbuild to let us build modules from multiple directories.
I've used that to clean up the build of ptlrpc+ldlm and to merge libcfs and lnet into the one module - I've left the lnds separate.Quoted 5 lines
That looks pretty good. It doesn't apply to the stable lustre tree but I did try it out on lustre-testing. The module building does seem to function well. Only thing not clear is if do a
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
Quoted 7 lines
Why would you do that? SUBDIRS= is for building external modules. What are you trying to achieve?
Quoted 2 lines
do lmv.a and the other *.a files get relinked int lustre.ko ?
It isn't "lmv.a", it is ".../lustre/lmv/mod.a".
Quoted 7 lines
Sorry I forgot the mod.a naming. I was asking to get a feel of how the work flow would change. It is common for lustre developers to build in tree and test without installing anything. The many module approach might of been a way for people to rebuild a module, unload module and then reload module quickly to test a change. I don't work this way so I can't say. I was looking to see if that work flow could still be done.
This general approach should still work.
You wouldn't do
make SUBDIRS=drivers/staging/lustre/lustre/lmv modules
unless there was a module built in that directory, but you might
make SUBDIRS=drivers/staging/lustre modules
to just build whatever lustre modules there are.
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180625/d09e4f75/attachment.sig>