lustre: sync to OpenSFS branch as of March 1
cover lustre: sync to OpenSFS branch as of March 1
Backport various patches for the start of 2.15 development cycle. This covers the USDP feature landing. I did hold back the fake symlink work as well as IPv6 LNet support. Newer kernels have isses with the ports which I need to investigate.
Alex Zhuravlev (1):
lustre: obdclass: try to skip corrupted llog records
Amir Shehata (9):
lnet: UDSP storage and marshalled structs
lnet: foundation patch for selection mod
lnet: Preferred gateway selection
lnet: Select NI/peer NI with highest prio
lnet: select best peer and local net
lnet: UDSP handling
lnet: Apply UDSP on local and remote NIs
lnet: Add the kernel level Marshalling API
lnet: ioctl handler for get policy info
Andreas Dilger (4):
lustre: lov: avoid NULL dereference in cleanup
lustre: llite: quiet spurious ioctl warning
lsutre: ldlm: return error from ldlm_namespace_new()
lustre: llite: remove unused ll_teardown_mmaps()
Andrew Perepechko (1):
lustre: llite: data corruption due to RPC reordering
Andriy Skulysh (1):
lustre: lov: grant deadlock if same OSC in two components
Bobi Jam (1):
lustre: lov: fix layout generation inc for mirror split
James Simmons (1):
lnet: place wire protocol data int own headers
John L. Hammond (1):
lustre: change EWOULDBLOCK to EAGAIN
Mr NeilBrown (11):
lustre: lov: style cleanups in lov_set_osc_active()
lustre: change various operations structs to const
lustre: mark strings in char arrays as const
lustre: convert snprintf to scnprintf as appropriate
lustre: remove non-static 'inline' markings.
lustre: llite: use is_root_inode()
lnet: libcfs: discard cfs_firststr
lnet: libcfs: use wait_event_timeout() in tracefiled().
lnet: use init_wait() rather than init_waitqueue_entry()
lnet: discard LNET_MD_PHYS
lnet: o2iblnd: convert peers hash table to hashtable.h
Oleg Drokin (2):
lustre: update version to 2.14.0
lustre: update version to 2.14.50
Rahul Deshmkuh (1):
lustre: lov: fixes bitfield in lod qos code
Sebastien Buisson (3):
lustre: ptlrpc: do not output error when imp_sec is freed
lustre: gss: handle empty reqmsg in sptlrpc_req_ctx_switch
lustre: sec: file ioctls to handle encryption policies
Serguei Smirnov (1):
lnet: modify assertion in lnet_post_send_locked
Sonia Sharma (3):
lnet: Add the kernel level De-Marshalling API
lnet: Add the ioctl handler for "add policy"
lnet: ioctl handler for "delete policy"
Wang Shilong (1):
lustre: llite: make readahead aware of hints
fs/lustre/fld/fld_request.c | 2 +-
fs/lustre/include/cl_object.h | 18 +-
fs/lustre/include/lu_object.h | 17 +-
fs/lustre/include/lustre_log.h | 10 +-
fs/lustre/include/lustre_net.h | 2 +-
fs/lustre/include/lustre_osc.h | 2 +
fs/lustre/include/obd_cksum.h | 2 +-
fs/lustre/{llite => include}/range_lock.h | 0
fs/lustre/ldlm/ldlm_lib.c | 10 +-
fs/lustre/ldlm/ldlm_resource.c | 32 +-
fs/lustre/llite/Makefile | 2 +-
fs/lustre/llite/crypto.c | 8 +-
fs/lustre/llite/file.c | 33 +-
fs/lustre/llite/glimpse.c | 2 +-
fs/lustre/llite/llite_internal.h | 5 +-
fs/lustre/llite/llite_mmap.c | 59 +-
fs/lustre/llite/lproc_llite.c | 32 +-
fs/lustre/llite/pcc.c | 38 +-
fs/lustre/llite/rw.c | 20 +-
fs/lustre/llite/super25.c | 2 +-
fs/lustre/llite/vvp_page.c | 2 +-
fs/lustre/lmv/lmv_obd.c | 2 +-
fs/lustre/lmv/lproc_lmv.c | 6 +-
fs/lustre/lov/lov_ea.c | 4 +-
fs/lustre/lov/lov_io.c | 4 +
fs/lustre/lov/lov_obd.c | 17 +-
fs/lustre/lov/lov_object.c | 3 +-
fs/lustre/lov/lov_pack.c | 8 -
fs/lustre/mdc/mdc_dev.c | 3 +-
fs/lustre/obdclass/Makefile | 3 +-
fs/lustre/obdclass/cl_io.c | 14 +-
fs/lustre/obdclass/llog.c | 80 +-
fs/lustre/obdclass/llog_cat.c | 14 +-
fs/lustre/obdclass/llog_internal.h | 5 +
fs/lustre/obdclass/llog_obd.c | 2 +-
fs/lustre/obdclass/lu_tgt_descs.c | 38 +-
fs/lustre/obdclass/obd_sysfs.c | 6 +-
fs/lustre/{llite => obdclass}/range_lock.c | 6 +-
fs/lustre/osc/osc_io.c | 17 +-
fs/lustre/osc/osc_lock.c | 2 +-
fs/lustre/osc/osc_request.c | 2 +-
fs/lustre/ptlrpc/client.c | 2 +-
fs/lustre/ptlrpc/errno.c | 4 +-
fs/lustre/ptlrpc/llog_client.c | 2 +-
fs/lustre/ptlrpc/pers.c | 1 -
fs/lustre/ptlrpc/sec.c | 14 +-
include/linux/lnet/lib-lnet.h | 45 +
include/linux/lnet/lib-types.h | 72 +-
include/linux/lnet/udsp.h | 144 +++
include/uapi/linux/lnet/libcfs_debug.h | 1 +
include/uapi/linux/lnet/libcfs_ioctl.h | 8 +-
include/uapi/linux/lnet/lnet-dlc.h | 91 +-
include/uapi/linux/lnet/lnet-idl.h | 241 +++++
include/uapi/linux/lnet/lnet-types.h | 220 +---
include/uapi/linux/lnet/lnetctl.h | 1 +
include/uapi/linux/lnet/lnetst.h | 2 +
include/uapi/linux/lnet/nidstr.h | 5 +
include/uapi/linux/lnet/socklnd.h | 1 +
include/uapi/linux/lustre/lustre_user.h | 2 +-
include/uapi/linux/lustre/lustre_ver.h | 6 +-
net/lnet/klnds/o2iblnd/o2iblnd-idl.h | 157 +++
net/lnet/klnds/o2iblnd/o2iblnd.c | 267 +++--
net/lnet/klnds/o2iblnd/o2iblnd.h | 133 +--
net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 +-
net/lnet/klnds/socklnd/socklnd_cb.c | 4 +-
net/lnet/libcfs/libcfs_string.c | 28 -
net/lnet/libcfs/tracefile.c | 37 +-
net/lnet/lnet/Makefile | 2 +-
net/lnet/lnet/api-ni.c | 278 ++++-
net/lnet/lnet/config.c | 4 +
net/lnet/lnet/lib-move.c | 399 ++++---
net/lnet/lnet/nidstrings.c | 66 ++
net/lnet/lnet/peer.c | 267 +++--
net/lnet/lnet/udsp.c | 1553 ++++++++++++++++++++++++++++
74 files changed, 3744 insertions(+), 865 deletions(-)
rename fs/lustre/{llite => include}/range_lock.h (100%)
rename fs/lustre/{llite => obdclass}/range_lock.c (96%)
create mode 100644 include/linux/lnet/udsp.h
create mode 100644 include/uapi/linux/lnet/lnet-idl.h
create mode 100644 net/lnet/klnds/o2iblnd/o2iblnd-idl.h
create mode 100644 net/lnet/lnet/udsp.cSignature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 1/41 lustre: llite: data corruption due to RPC reordering
From: Andrew Perepechko <[email protected]>
Without read-only cache, it is possible that a client resends a BRW RPC, receives a reply from the original BRW RPC, modifies the same data and sends a new BRW RPC, however, because of RPC reordering stale data gets to disk.
Let's use range locking to protect against this race. For Linux clients it just a simple move of the range lock code to obdclass.
WC-bug-id: https://jira.whamcloud.com/browse/LU-10958
Lustre-commit: 35679a730bf0b7a ("LU-10958 ofd: data corruption due to RPC reordering")
Cray-bug-id: LUS-5578,LUS-8943
Reviewed-on: https://review.whamcloud.com/32281
---
fs/lustre/{llite => include}/range_lock.h | 0
fs/lustre/llite/Makefile | 2 +-
fs/lustre/llite/llite_internal.h | 2 +-
fs/lustre/obdclass/Makefile | 3 ++-
fs/lustre/{llite => obdclass}/range_lock.c | 6 +++++-
5 files changed, 9 insertions(+), 4 deletions(-)
rename fs/lustre/{llite => include}/range_lock.h (100%)
rename fs/lustre/{llite => obdclass}/range_lock.c (96%)fs/lustre/include/range_lock.h renamed from fs/lustre/llite/range_lock.h +0 -0
fs/lustre/llite/Makefile +1 -1
@@ -3,7 +3,7 @@ ccflags-y += -I$(srctree)/$(src)/../include obj-$(CONFIG_LUSTRE_FS) += lustre.o lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \ - rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \ + rw.o rw26.o namei.o symlink.o llite_mmap.o \ xattr.o xattr_cache.o xattr_security.o \ super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \ vvp_dev.o vvp_page.o vvp_io.o vvp_object.o \
fs/lustre/llite/llite_internal.h +1 -1
@@ -45,12 +45,12 @@#include <lustre_intent.h> #include <linux/compat.h> #include <lustre_crypto.h> +#include <range_lock.h> #include <linux/namei.h> #include <linux/xattr.h> #include <linux/posix_acl_xattr.h> #include "vvp_internal.h" -#include "range_lock.h" #include "pcc.h" /** Only used on client-side for indicating the tail of dir hash/offset. */
fs/lustre/obdclass/Makefile +2 -1
@@ -8,4 +8,5 @@ obdclass-y := llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o \ lustre_handles.o lustre_peer.o statfs_pack.o linkea.o \ obdo.o obd_config.o obd_mount.o lu_object.o lu_ref.o \ cl_object.o cl_page.o cl_lock.o cl_io.o kernelcomm.o \ - jobid.o integrity.o obd_cksum.o lu_tgt_descs.o + jobid.o integrity.o obd_cksum.o lu_tgt_descs.o \ + range_lock.o
fs/lustre/obdclass/range_lock.c renamed from fs/lustre/llite/range_lock.c +5 -1
@@ -35,8 +35,8 @@* Author: Bobi Jam <[email protected]> */ #include <linux/sched/signal.h> -#include "range_lock.h" #include <uapi/linux/lustre/lustre_idl.h> +#include <range_lock.h> #include <linux/libcfs/libcfs.h> #include <linux/interval_tree_generic.h>
@@ -59,6 +59,7 @@ void range_lock_tree_init(struct range_lock_tree *tree) tree->rlt_sequence =0 ;spin_lock_init (&tree->rlt_lock); } +EXPORT_SYMBOL (range_lock_tree_init);/** * Initialize a range lock node
@@ -86,6 +87,7 @@ int range_lock_init(struct range_lock *lock, u64 start, u64 end) lock->rl_sequence =0 ;return 0 ; } +EXPORT_SYMBOL (range_lock_init);/** * Unlock a range lock, wake up locks blocked by this lock.
@@ -117,6 +119,7 @@ void range_unlock(struct range_lock_tree *tree, struct range_lock *lock)spin_unlock (&tree->rlt_lock); } +EXPORT_SYMBOL (range_unlock);/** * Lock a region
@@ -167,3 +170,4 @@ int range_lock(struct range_lock_tree *tree, struct range_lock *lock) out:return rc; } +EXPORT_SYMBOL (range_lock);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 2/41 lustre: llite: make readahead aware of hints
In reply to James SimmonsFrom: Wang Shilong <[email protected]>
Calling madvise(MADV_SEQUENTIAL) and madvise(MADV_RANDOM) sets the VM_SEQ_READ and VM_RAND_READ hints in vma->vm_flags. These should be used to guide the Lustre readahead for better performance.
Disable the kernel readahead for mmap() pages and use the llite readahead instead. There was also a bug in __ll_fault() that would set both VM_SEQ_READ and VM_RAND_READ at the same time, which was confusing the detection of the VM_SEQ_READ case, since VM_RAND_READ was being checked first.
This changes the readahead for mmap from submitting mostly 4KB RPCs to a large number of 1MB RPCs for the application profiled:
llite.*.read_ahead_stats before patched ------------------------ ------ -------
hits 2408 135924 samples [pages]
misses 34160 2384 samples [pages]
osc.*.rpc_stats read before read patched
--------------- ------------- --------------
pages per rpc rpcs % cum% rpcs % cum%
1: 6542 95 95 351 55 55
2: 224 3 99 76 12 67
4: 32 0 99 28 4 72
8: 2 0 99 9 1 73
16: 25 0 99 32 5 78
32: 0 0 99 8 1 80
64: 0 0 99 5 0 80
128: 0 0 99 15 2 83
256: 2 0 99 102 16 99
512: 0 0 99 0 0 99
1024: 1 0 100 3 0 100Readahead hit rate improved from 6% to 98%, and 4KB RPCs dropped from 95% to 55% and 1MB+ RPCs increased from 0% to 16% (79% of all pages).
Add debug to ll_file_mmap(), ll_fault() and ll_fault_io_init() to allow tracing VMA state functions for future IO optimizations.
WC-bug-id: https://jira.whamcloud.com/browse/LU-13669
Lustre-commit: 7542820698696ed ("LU-13669 llite: make readahead aware of hints")
Reviewed-on: https://review.whamcloud.com/41228
--- fs/lustre/include/cl_object.h | 10 +++++++++- fs/lustre/llite/file.c | 2 ++ fs/lustre/llite/llite_mmap.c | 42 ++++++++++++++++++++++-------------------- fs/lustre/llite/rw.c | 20 ++++++++++++++++---- 4 files changed, 49 insertions(+), 25 deletions(-)
fs/lustre/include/cl_object.h +9 -1
@@ -1974,7 +1974,15 @@ struct cl_io {* the read IO will check to-be-read OSCs' status, and make fast-switch * another mirror if some of the OSTs are not healthy. */ - ci_tried_all_mirrors:1 ; + ci_tried_all_mirrors:1, + /** + * Random read hints, readahead will be disabled. + */ + ci_rand_read:1, + /** + * Sequential read hints. + */ + ci_seq_read:1;/** * Bypass quota check */
fs/lustre/llite/file.c +2 -0
@@ -736,6 +736,8 @@ static int ll_local_open(struct file *file, struct lookup_intent *it, file->private_data = fd;ll_readahead_init (inode, &fd->fd_ras); fd->fd_omode = it->it_flags & (FMODE_READ |FMODE_WRITE |FMODE_EXEC ); +/* turn off the kernel's read-ahead */ + file->f_ra.ra_pages =0 ;/* ll_cl_context initialize */ rwlock_init (&fd->fd_lock);
fs/lustre/llite/llite_mmap.c +22 -20
100 lines not on this page · raw message
fs/lustre/llite/rw.c +16 -4
@@ -1255,7 +1255,7 @@ static bool index_in_stride_window(struct ll_readahead_state *ras,*/ static void ras_update (struct ll_sb_info *sbi,struct inode *inode,struct ll_readahead_state *ras,pgoff_t index, -enum ras_update_flags flags) +enum ras_update_flags flags,struct cl_io *io) {struct ll_ra_info *ra = &sbi->ll_ra_info;bool hit = flags &LL_RAS_HIT ;
@@ -1276,6 +1276,18 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode,if (ras->ras_no_miss_check) goto out_unlock; +if (io && io->ci_rand_read) + goto out_unlock; + +if (io && io->ci_seq_read) { +if (!hit) { +/* to avoid many small read RPC here */ + ras->ras_window_pages = sbi->ll_ra_info.ra_range_pages; +ll_ra_stats_inc_sbi (sbi,RA_STAT_MMAP_RANGE_READ ); + } + goto skip; + } +if (flags &LL_RAS_MMAP ) {unsigned long ra_pages;
@@ -1594,7 +1606,7 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io, flags |=LL_RAS_HIT ;if (!vio->vui_ra_valid) flags |=LL_RAS_MMAP ; -ras_update (sbi, inode, ras,vvp_index (vpg), flags); +ras_update (sbi, inode, ras,vvp_index (vpg), flags, io); }cl_2queue_init (queue);
@@ -1613,7 +1625,7 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io, io_start_index =cl_index (io->ci_obj, io->u.ci_rw.crw_pos); io_end_index =cl_index (io->ci_obj, io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count -1 ); -if (ll_readahead_enabled (sbi) && ras) { +if (ll_readahead_enabled (sbi) && ras && !io->ci_rand_read) {pgoff_t skip_index =0 ;if (ras->ras_next_readahead_idx <vvp_index (vpg))
@@ -1802,7 +1814,7 @@ int ll_readpage(struct file *file, struct page *vmpage)* if the page is hit in cache because non cache page * case will be handled by slow read later. */ -ras_update (sbi, inode, ras,vvp_index (vpg), flags); +ras_update (sbi, inode, ras,vvp_index (vpg), flags, io);/* avoid duplicate ras_update() call */ vpg->vpg_ra_updated =1 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 3/41 lustre: lov: avoid NULL dereference in cleanup
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Running racer concurrently with file migration crashes easily when the layout changes for a file in an unexpected way:
lov_init_composite() lustre-clilov: DOM entries with different sizes lov_layout_change() lustre-clilov: cannot apply new layout on
[0x200000402:0x3e6a:0x0] : rc = -22
BUG: unable to handle kernel NULL pointer dereference at 0x00000014
IP: [<ffffffffa08baef4>] lov_delete_composite+0x104/0x540 [lov]
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
CPU: 1 PID: 20227 Comm: lnAvoid the NULL dereference if the entry is not fully initialized during cleanup.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14389
Lustre-commit: 5da049d9ef1d26e ("LU-14389 lov: avoid NULL dereference in cleanup")
Reviewed-on: https://review.whamcloud.com/41398
--- fs/lustre/lov/lov_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lustre/lov/lov_object.c +1 -1
@@ -860,7 +860,7 @@ static int lov_delete_composite(const struct lu_env *env,lov_layout_wait (env, lov);if (comp->lo_entries) lov_foreach_layout_entry(lov, entry) { -if (lsme_is_foreign (entry->lle_lsme)) +if (entry->lle_lsme &&lsme_is_foreign (entry->lle_lsme))continue ;lov_delete_raid0 (env, lov, entry);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 4/41 lustre: llite: quiet spurious ioctl warning
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Calling "lfs setstripe" prints a suprious warning about using the old ioctl(LL_IOC_LOV_GETSTRIPE) when that is not actually the case.
Remove the ioctl warning for now and deal with related issues later.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14316
Lustre-commit: c6f65d8af11647 ("LU-14316 llite: quiet spurious ioctl warning")
Reviewed-on: https://review.whamcloud.com/41427
--- fs/lustre/lov/lov_pack.c | 8 -------- 1 file changed, 8 deletions(-)
fs/lustre/lov/lov_pack.c +0 -8
@@ -351,7 +351,6 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj,struct lov_user_md_v1 lum;size_t lmmk_size, lum_size =0 ;ssize_t lmm_size; -static bool printed;int rc =0 ; if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3 &&
@@ -363,13 +362,6 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, goto out; } -if (!printed) { -LCONSOLE_WARN ("%s: using old ioctl(LL_IOC_LOV_GETSTRIPE) on " DFID ", use llapi_layout_get_by_path()\n" , - current->comm, -PFID (&obj->lo_cl.co_lu.lo_header->loh_fid)); - printed = true; - } - lmmk_size =lov_comp_md_size (lsm); lmmk =kvzalloc (lmmk_size,GFP_KERNEL );if (!lmmk) {
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 5/41 lustre: ptlrpc: do not output error when imp_sec is freed
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
There is a race condition on client reconnect when the import is being destroyed. Some outstanding client bound requests are being processed when the imp_sec has already been freed.
Ensure to output the error message in import_sec_validate_get() only if import is not already in the zombie work queue.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14355
Lustre-commit: 20cbbb084b671a1 ("LU-14355 ptlrpc: do not output error when imp_sec is freed")
Reviewed-on: https://review.whamcloud.com/41310
--- fs/lustre/ptlrpc/sec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/lustre/ptlrpc/sec.c +5 -2
@@ -345,8 +345,11 @@ static int import_sec_validate_get(struct obd_import *imp, *sec =sptlrpc_import_sec_ref (imp);if (!*sec) { -CERROR ("import %p (%s) with no sec\n" , - imp,ptlrpc_import_state_name (imp->imp_state)); +/* Only output an error when the import is still active */ +if (!test_bit (WORK_STRUCT_PENDING_BIT , +work_data_bits (&imp->imp_zombie_work))) +CERROR ("import %p (%s) with no sec\n" , + imp,ptlrpc_import_state_name (imp->imp_state));return -EACCES ; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 6/41 lustre: update version to 2.14.0
In reply to James SimmonsFrom: Oleg Drokin <[email protected]>
New tag 2.14.0
--- include/uapi/linux/lustre/lustre_ver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/lustre/lustre_ver.h +3 -3
@@ -2,10 +2,10 @@#define _LUSTRE_VER_H_#define LUSTRE_MAJOR 2 -#define LUSTRE_MINOR 13 -#define LUSTRE_PATCH 57 +#define LUSTRE_MINOR 14 +#define LUSTRE_PATCH 0#define LUSTRE_FIX 0 -#define LUSTRE_VERSION_STRING "2.13.57" +#define LUSTRE_VERSION_STRING "2.14.0"#define OBD_OCD_VERSION (major, minor, patch, fix) \ (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 7/41 lnet: UDSP storage and marshalled structs
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Commit the structures which will be used by kernel space to store the UDSPs. This commit also adds the IOCTL structures which are used for marshalling the UDSPs between user and kernel space.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 6427da97ef6e90e5 ("LU-9121 lnet: UDSP storage and marshalled structs")
Reviewed-on: https://review.whamcloud.com/34253
--- include/linux/lnet/lib-types.h | 45 ++++++++++++++++++ include/uapi/linux/lnet/lnet-dlc.h | 90 ++++++++++++++++++++++++++++++++++-- include/uapi/linux/lnet/lnet-types.h | 14 ++++++ net/lnet/lnet/api-ni.c | 1 + 4 files changed, 147 insertions(+), 3 deletions(-)
include/linux/lnet/lib-types.h +45 -0
@@ -995,6 +995,49 @@ struct lnet_msg_container {void **msc_resenders; }; +/* This UDSP structures need to match the user space liblnetconfig structures +* in order for the marshall and unmarshall functions to be common. +*/ + +/* Net is described as a +* 1. net type +* 2. num range +*/ +struct lnet_ud_net_descr { +u32 udn_net_type; +struct list_head udn_net_num_range; +}; + +/* each NID range is defined as +* 1. net descriptor +* 2. address range descriptor +*/ +struct lnet_ud_nid_descr { +struct lnet_ud_net_descr ud_net_id; +struct list_head ud_addr_range; +u32 ud_mem_size; +}; + +/* a UDSP rule can have up to three user defined NID descriptors +* - src: defines the local NID range for the rule +* - dst: defines the peer NID range for the rule +* - rte: defines the router NID range for the rule +* +* An action union defines the action to take when the rule +* is matched +*/ +struct lnet_udsp { +struct list_head udsp_on_list; +u32 udsp_idx; +struct lnet_ud_nid_descr udsp_src; +struct lnet_ud_nid_descr udsp_dst; +struct lnet_ud_nid_descr udsp_rte; +enum lnet_udsp_action_type udsp_action_type; +union { +u32 udsp_priority; + } udsp_action; +}; +/* Peer Discovery states */ #define LNET_DC_STATE_SHUTDOWN 0/* not started */ #define LNET_DC_STATE_RUNNING 1/* started up OK */
@@ -1176,6 +1219,8 @@ struct lnet {* work loops */ struct completion ln_started; +/* UDSP list */ + struct list_head ln_udsp_list; };#endif
include/uapi/linux/lnet/lnet-dlc.h +87 -3
99 lines not on this page · raw message
include/uapi/linux/lnet/lnet-types.h +14 -0
@@ -709,6 +709,20 @@ enum lnet_ack_req {/** Request that no acknowledgment should be generated. */ LNET_NOACK_REQ }; + +/** +* UDSP action types. There are two available actions: +* 1. PRIORITY - set priority of matching LNet constructs +* 2. PREFERRED LIST - set preferred list of matching LNet constructs +*/ +enum lnet_udsp_action_type { +EN_LNET_UDSP_ACTION_NONE =0 , +/** assign a priority to matching constructs */ +EN_LNET_UDSP_ACTION_PRIORITY =1 , +/** assign a preferred list of NIDs to matching constructs */ +EN_LNET_UDSP_ACTION_PREFERRED_LIST =2 , +}; +/** @} lnet_data */ /** @} lnet */
net/lnet/lnet/api-ni.c +1 -0
@@ -1154,6 +1154,7 @@ struct list_head **INIT_LIST_HEAD (&the_lnet.ln_dc_expired);INIT_LIST_HEAD (&the_lnet.ln_mt_localNIRecovq);INIT_LIST_HEAD (&the_lnet.ln_mt_peerNIRecovq); +INIT_LIST_HEAD (&the_lnet.ln_udsp_list);init_waitqueue_head (&the_lnet.ln_dc_waitq); the_lnet.ln_mt_handler =NULL ;init_completion (&the_lnet.ln_started);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 8/41 lnet: foundation patch for selection mod
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Add the priority and preferred NIDs fields in the lnet_ni, lnet_net, lnet_peer_net and lnet_peer_ni. Switched
the implementation of the preferred NIDs list to list_head instead of array, because the code is more straight forward. There is more memory overhead due to list_head, but these lists are expected to be small, so I chose code simplicity over memory.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 51b2c0f75f727f0 ("LU-9121 lnet: foundation patch for selection mod")
Reviewed-on: https://review.whamcloud.com/34350
--- include/linux/lnet/lib-types.h | 24 +++++++- net/lnet/lnet/config.c | 4 ++ net/lnet/lnet/peer.c | 134 ++++++++++++++++++++++------------------- 3 files changed, 100 insertions(+), 62 deletions(-)
include/linux/lnet/lib-types.h +23 -1
@@ -58,6 +58,7 @@* All local and peer NIs created have their health default to this value. */ #define LNET_MAX_HEALTH_VALUE 1000 +#define LNET_MAX_SELECTION_PRIORITY UINT_MAX/* forward refs */ struct lnet_libmd ;
@@ -364,6 +365,9 @@ struct lnet_net {/* cumulative CPTs of all NIs in this net */ u32 *net_cpts; +/* relative net selection priority */ +u32 net_sel_priority; +/* network tunables */ struct lnet_ioctl_config_lnd_cmn_tunables net_tunables;
@@ -388,6 +392,9 @@ struct lnet_net {/* protects access to net_last_alive */ spinlock_t net_lock; + +/* list of router nids preferred for this network */ +struct list_head net_rtr_pref_nids; };struct lnet_ni {
@@ -466,6 +473,9 @@ struct lnet_ni {*/ atomic_t ni_fatal_error_on; +/* the relative selection priority of this NI */ +u32 ni_sel_priority; +/* * equivalent interfaces to use * This is an array because socklnd bonding can still be configured
@@ -498,6 +508,11 @@ struct lnet_ping_buffer {#define LNET_PING_INFO_TO_BUFFER (PINFO ) \ container_of((PINFO), struct lnet_ping_buffer, pb_info) +struct lnet_nid_list { +struct list_head nl_list; +lnet_nid_t nl_nid; +}; +struct lnet_peer_ni {/* chain on lpn_peer_nis */ struct list_head lpni_peer_nis;
@@ -557,8 +572,12 @@ struct lnet_peer_ni {/* preferred local nids: if only one, use lpni_pref.nid */ union lpni_pref {lnet_nid_t nid; -lnet_nid_t *nids; +struct list_head nids; } lpni_pref; +/* list of router nids preferred for this peer NI */ +struct list_head lpni_rtr_pref_nids; +/* The relative selection priority of this peer NI */ +u32 lpni_sel_priority;/* number of preferred NIDs in lnpi_pref_nids */ u32 lpni_pref_nnids; };
@@ -752,6 +771,9 @@ struct lnet_peer_net {/* selection sequence number */ u32 lpn_seq; +/* relative peer net selection priority */ +u32 lpn_sel_priority; +/* reference count */ atomic_t lpn_refcount; };
net/lnet/lnet/config.c +4 -0
@@ -366,11 +366,14 @@ struct lnet_net *INIT_LIST_HEAD (&net->net_ni_list);INIT_LIST_HEAD (&net->net_ni_added);INIT_LIST_HEAD (&net->net_ni_zombie); +INIT_LIST_HEAD (&net->net_rtr_pref_nids);spin_lock_init (&net->net_lock); net->net_id = net_id; net->net_last_alive =ktime_get_real_seconds (); + net->net_sel_priority =LNET_MAX_SELECTION_PRIORITY ; +/* initialize global paramters to undefiend */ net->net_tunables.lct_peer_timeout =-1 ; net->net_tunables.lct_max_tx_credits =-1 ;
@@ -470,6 +473,7 @@ struct lnet_net * ni->ni_net_ns =get_net (&init_net); ni->ni_state =LNET_NI_STATE_INIT ; + ni->ni_sel_priority =LNET_MAX_SELECTION_PRIORITY ;list_add_tail (&ni->ni_netlist, &net->net_ni_added);/*
net/lnet/lnet/peer.c +73 -61
227 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 9/41 lnet: Preferred gateway selection
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Add mechanism for managing preferred gateway lists. When selecting a route through a gateway, if there exists a preferred gateway list for the destination peer, then choose the preferred gateway. If there are multiple preferred gateways, to make the selection, use in order of decreasing
importance: route priority, number of hops, number of available tx credits on the associated lpni and route sequence counters. If there are no preferred routes, select the best route available using the same criteria.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 66acff74d0da31e ("LU-9121 lnet: Preferred gateway selection")
Reviewed-on: https://review.whamcloud.com/34353
--- include/linux/lnet/lib-lnet.h | 5 ++ net/lnet/lnet/lib-move.c | 119 ++++++++++++++++++++++++++++++------------ net/lnet/lnet/peer.c | 111 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+), 34 deletions(-)
include/linux/lnet/lib-lnet.h +5 -0
@@ -806,6 +806,11 @@ struct lnet_peer_ni *lnet_peer_get_ni_locked(struct lnet_peer *lp,struct lnet_peer_net *lnet_peer_get_net_locked (struct lnet_peer *peer,u32 net_id);bool lnet_peer_is_pref_nid_locked (struct lnet_peer_ni *lpni,lnet_nid_t nid); +int lnet_peer_add_pref_nid (struct lnet_peer_ni *lpni,lnet_nid_t nid); +void lnet_peer_clr_pref_nids (struct lnet_peer_ni *lpni); +bool lnet_peer_is_pref_rtr_locked (struct lnet_peer_ni *lpni,lnet_nid_t gw_nid); +void lnet_peer_clr_pref_rtrs (struct lnet_peer_ni *lpni); +int lnet_peer_add_pref_rtr (struct lnet_peer_ni *lpni,lnet_nid_t nid);int lnet_peer_ni_set_non_mr_pref_nid (struct lnet_peer_ni *lpni,lnet_nid_t nid);int lnet_add_peer_ni (lnet_nid_t key_nid,lnet_nid_t nid,bool mr);int lnet_del_peer_ni (lnet_nid_t key_nid,lnet_nid_t nid);
net/lnet/lnet/lib-move.c +85 -34
192 lines not on this page · raw message
net/lnet/lnet/peer.c +111 -0
123 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 10/41 lnet: Select NI/peer NI with highest prio
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Modify the selection algorithm to select the highest priority local and peer NI. Health always trumps all other selection criteria
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 374fcb2caea3ca0 ("LU-9121 lnet: Select NI/peer NI with highest prio")
Reviewed-on: https://review.whamcloud.com/34351
--- net/lnet/lnet/lib-move.c | 148 ++++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 53 deletions(-)
net/lnet/lnet/lib-move.c +95 -53
@@ -1112,65 +1112,91 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,*/ struct lnet_peer_ni *lpni =NULL ;int best_lpni_credits = (best_lpni) ? best_lpni->lpni_txcredits : -INT_MIN ; +INT_MIN ;int best_lpni_healthv = (best_lpni) ?atomic_read (&best_lpni->lpni_healthv) :0 ; -bool preferred = false; -bool ni_is_pref; +bool best_lpni_is_preferred = false; +bool lpni_is_preferred;int lpni_healthv; +u32 lpni_sel_prio; +u32 best_sel_prio =LNET_MAX_SELECTION_PRIORITY ;while ((lpni =lnet_get_next_peer_ni_locked (peer, peer_net, lpni))) {/* if the best_ni we've chosen aleady has this lpni * preferred, then let's use it */ if (best_ni) { - ni_is_pref =lnet_peer_is_pref_nid_locked (lpni, - best_ni->ni_nid); -CDEBUG (D_NET ,"%s ni_is_pref = %d\n" , -libcfs_nid2str (best_ni->ni_nid), ni_is_pref); + lpni_is_preferred =lnet_peer_is_pref_nid_locked (lpni, + best_ni->ni_nid); +CDEBUG (D_NET ,"%s lpni_is_preferred = %d\n" , +libcfs_nid2str (best_ni->ni_nid), + lpni_is_preferred); }else { - ni_is_pref = false; + lpni_is_preferred = false; } lpni_healthv =atomic_read (&lpni->lpni_healthv); + lpni_sel_prio = lpni->lpni_sel_priority;if (best_lpni) -CDEBUG (D_NET ,"%s c:[%d, %d], s:[%d, %d]\n" , +CDEBUG (D_NET , +"n:[%s, %s] h:[%d, %d] p:[%d, %d] c:[%d, %d] s:[%d, %d]\n" ,libcfs_nid2str (lpni->lpni_nid), +libcfs_nid2str (best_lpni->lpni_nid), + lpni_healthv, best_lpni_healthv, + lpni_sel_prio, best_sel_prio, lpni->lpni_txcredits, best_lpni_credits, lpni->lpni_seq, best_lpni->lpni_seq); +else + goto select_lpni;/* pick the healthiest peer ni */ if (lpni_healthv < best_lpni_healthv) {continue ; }else if (lpni_healthv > best_lpni_healthv) { - best_lpni_healthv = lpni_healthv; +if (best_lpni_is_preferred) + best_lpni_is_preferred = false; + goto select_lpni; + } + +if (lpni_sel_prio > best_sel_prio) { +continue ; + }else if (lpni_sel_prio < best_sel_prio) { +if (best_lpni_is_preferred) + best_lpni_is_preferred = false; + goto select_lpni; + } +/* if this is a preferred peer use it */ - }else if (!preferred && ni_is_pref) { - preferred = true; - }else if (preferred && !ni_is_pref) { +if (!best_lpni_is_preferred && lpni_is_preferred) { + best_lpni_is_preferred = true; + goto select_lpni; + }else if (best_lpni_is_preferred && !lpni_is_preferred) {/* this is not the preferred peer so let's ignore * it. */ continue ; - }else if (lpni->lpni_txcredits < best_lpni_credits) { + } + +if (lpni->lpni_txcredits < best_lpni_credits)/* We already have a peer that has more credits * available than this one. No need to consider * this peer further. */ continue ; - }else if (lpni->lpni_txcredits == best_lpni_credits) { -/* The best peer found so far and the current peer -* have the same number of available credits let's -* make sure to select between them using Round -* Robin -*/ -if (best_lpni) { -if (best_lpni->lpni_seq <= lpni->lpni_seq) -continue ; - } - } +else if (lpni->lpni_txcredits > best_lpni_credits) + goto select_lpni; +/* The best peer found so far and the current peer +* have the same number of available credits let's +* make sure to select between them using Round Robin +*/ +if (best_lpni && best_lpni->lpni_seq <= lpni->lpni_seq) +continue ; +select_lpni: + best_lpni_is_preferred = lpni_is_preferred; + best_lpni_healthv = lpni_healthv; + best_sel_prio = lpni_sel_prio; best_lpni = lpni; best_lpni_credits = lpni->lpni_txcredits; }
@@ -1178,7 +1204,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,/* if we still can't find a peer ni then we can't reach it */ if (!best_lpni) {u32 net_id = (peer_net) ? peer_net->lpn_net_id : -LNET_NIDNET (dst_nid); +LNET_NIDNET (dst_nid);CDEBUG (D_NET ,"no peer_ni found on peer net %s\n" ,libcfs_net2str (net_id));return NULL ;
@@ -1396,6 +1422,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,unsigned int shortest_distance;int best_credits;int best_healthv; +u32 best_sel_prio;/* If there is no peer_ni that we can send to on this network, * then there is no point in looking for a new best_ni here.
@@ -1404,6 +1431,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,return best_ni;if (!best_ni) { + best_sel_prio =LNET_MAX_SELECTION_PRIORITY ; shortest_distance =UINT_MAX ; best_credits =INT_MIN ; best_healthv =0 ;
@@ -1412,6 +1440,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, best_ni->ni_dev_cpt); best_credits =atomic_read (&best_ni->ni_tx_credits); best_healthv =atomic_read (&best_ni->ni_healthv); + best_sel_prio = best_ni->ni_sel_priority; }while ((ni =lnet_get_next_ni_locked (local_net, ni))) {
@@ -1419,10 +1448,12 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,int ni_credits;int ni_healthv;int ni_fatal; +u32 ni_sel_prio; ni_credits =atomic_read (&ni->ni_tx_credits); ni_healthv =atomic_read (&ni->ni_healthv); ni_fatal =atomic_read (&ni->ni_fatal_error_on); + ni_sel_prio = ni->ni_sel_priority;/* * calculate the distance from the CPT on which
@@ -1433,13 +1464,6 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, md_cpt, ni->ni_dev_cpt); -CDEBUG (D_NET , -"compare ni %s [c:%d, d:%d, s:%d] with best_ni %s [c:%d, d:%d, s:%d]\n" , -libcfs_nid2str (ni->ni_nid), ni_credits, distance, - ni->ni_seq, (best_ni) ?libcfs_nid2str (best_ni->ni_nid) - :"not seleced" , best_credits, shortest_distance, - (best_ni) ? best_ni->ni_seq :0 ); -/* * All distances smaller than the NUMA range * are treated equally.
@@ -1451,30 +1475,48 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,* Select on health, shorter distance, available * credits, then round-robin. */ -if (ni_fatal) { +if (ni_fatal)continue ; - }else if (ni_healthv < best_healthv) { + +if (best_ni) +CDEBUG (D_NET , +"compare ni %s [c:%d, d:%d, s:%d, p:%u] with best_ni %s [c:%d, d:%d, s:%d, p:%u]\n" , +libcfs_nid2str (ni->ni_nid), ni_credits, distance, + ni->ni_seq, ni_sel_prio, + (best_ni) ?libcfs_nid2str (best_ni->ni_nid) + :"not selected" , best_credits, shortest_distance, + (best_ni) ? best_ni->ni_seq :0 , + best_sel_prio); +else + goto select_ni; + +if (ni_healthv < best_healthv)continue ; - }else if (ni_healthv > best_healthv) { - best_healthv = ni_healthv; -/* If we're going to prefer this ni because it's -* the healthiest, then we should set the -* shortest_distance in the algorithm in case -* there are multiple NIs with the same health but -* different distances. -*/ -if (distance < shortest_distance) - shortest_distance = distance; - }else if (distance > shortest_distance) { +else if (ni_healthv > best_healthv) + goto select_ni; + +if (ni_sel_prio > best_sel_prio)continue ; - }else if (distance < shortest_distance) { - shortest_distance = distance; - }else if (ni_credits < best_credits) { +else if (ni_sel_prio < best_sel_prio) + goto select_ni; + +if (distance > shortest_distance)continue ; - }else if (ni_credits == best_credits) { -if (best_ni && best_ni->ni_seq <= ni->ni_seq) -continue ; - } +else if (distance < shortest_distance) + goto select_ni; + +if (ni_credits < best_credits) +continue ; +else if (ni_credits > best_credits) + goto select_ni; + +if (best_ni && best_ni->ni_seq <= ni->ni_seq) +continue ; + +select_ni: + best_sel_prio = ni_sel_prio; + shortest_distance = distance; + best_healthv = ni_healthv; best_ni = ni; best_credits = ni_credits; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 11/41 lnet: select best peer and local net
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Select the healthiest and highest priority peer and local net when sending a message.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 7d309d57fd843f1 ("LU-9121 lnet: select best peer and local net")
Reviewed-on: https://review.whamcloud.com/34352
--- include/linux/lnet/lib-lnet.h | 2 + include/linux/lnet/lib-types.h | 3 + net/lnet/lnet/api-ni.c | 15 +++++ net/lnet/lnet/lib-move.c | 125 +++++++++++++++++++++++++++++++---------- 4 files changed, 116 insertions(+), 29 deletions(-)
include/linux/lnet/lib-lnet.h +2 -0
@@ -507,6 +507,8 @@ int lnet_get_route(int idx, u32 *net, u32 *hops,struct lnet_ni *lnet_get_next_ni_locked (struct lnet_net *mynet,struct lnet_ni *prev);struct lnet_ni *lnet_get_ni_idx_locked (int idx); +int lnet_get_net_healthv_locked (struct lnet_net *net); +int lnet_get_peer_list (u32 *countp,u32 *sizep,struct lnet_process_id __user *ids);extern void lnet_peer_ni_set_healthv (lnet_nid_t nid,int value,bool all);
include/linux/lnet/lib-types.h +3 -0
@@ -359,6 +359,9 @@ struct lnet_net {* lnet/include/lnet/nidstr.h */ u32 net_id; +/* round robin selection */ +u32 net_seq; +/* total number of CPTs in the array */ u32 net_ncpts;
net/lnet/lnet/api-ni.c +15 -0
@@ -2931,6 +2931,21 @@ struct lnet_ni *return NULL ; } +int lnet_get_net_healthv_locked (struct lnet_net *net) +{ +struct lnet_ni *ni; +int best_healthv =0 ; +int healthv; + +list_for_each_entry (ni, &net->net_ni_list, ni_netlist) { + healthv =atomic_read (&ni->ni_healthv); +if (healthv > best_healthv) + best_healthv = healthv; + } + +return best_healthv; +} +struct lnet_ni *lnet_get_next_ni_locked (struct lnet_net *mynet,struct lnet_ni *prev) {
net/lnet/lnet/lib-move.c +96 -29
194 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 12/41 lnet: UDSP handling
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
This patch adds the following functionality:
1. Add UDSPs
2. Delete UDSPs
3. Apply UDSPs
- Adding a local network udsp: if multiple local networks are available, each one can have a priority.
- Adding a local NID udsp: after a local network is chosen, if there are multiple NIs, each one can have a priority.
- Adding a remote NID udsp: assign priority to peer NIDs.
- Adding a NID pair udsp: allows to specify local] NIDs to be added to the list on the specified peer NIs. When selecting a peer NI, the one with the local NID being used on its list is preferred.
- Adding a Router udsp: similar to the NID pair udsp. Specified router NIDs are added on the list on the specified peer NIs. When sending to the remote peer, remote net is selected and the peer NID is selected. The router which has its nid on the peer NI list is preferred.
- Deleting a udsp: use the specified policy index to remove it from the policy list.
Generally, the syntax is as follows
lnetctl policy <add | del | show>
--src: ip2nets syntax specifying the local NID to match --dst: ip2nets syntax specifying the remote NID to match --rte: ip2nets syntax specifying the router NID to match --priority: Priority to apply to rule matches
--idx: Index of where to insert the rule. By default it appends
to the end of the rule list
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: e5ea6387eb9f882 ("LU-9121 lnet: UDSP handling")
Reviewed-on: https://review.whamcloud.com/34354
--- include/linux/lnet/lib-lnet.h | 38 ++ include/linux/lnet/udsp.h | 117 +++++ include/uapi/linux/lnet/nidstr.h | 4 + net/lnet/lnet/Makefile | 2 +- net/lnet/lnet/api-ni.c | 87 ++++ net/lnet/lnet/nidstrings.c | 66 +++ net/lnet/lnet/peer.c | 6 + net/lnet/lnet/udsp.c | 1051 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 1370 insertions(+), 1 deletion(-) create mode 100644 include/linux/lnet/udsp.h create mode 100644 net/lnet/lnet/udsp.c
include/linux/lnet/lib-lnet.h +38 -0
@@ -95,6 +95,7 @@extern struct kmem_cache *lnet_small_mds_cachep;/* <= LNET_SMALL_MD_SIZE bytes * MDs kmem_cache */ +extern struct kmem_cache *lnet_udsp_cachep;extern struct kmem_cache *lnet_rspt_cachep;extern struct kmem_cache *lnet_msg_cachep;
@@ -513,6 +514,11 @@ int lnet_get_peer_list(u32 *countp, u32 *sizep, struct lnet_process_id __user *ids);extern void lnet_peer_ni_set_healthv (lnet_nid_t nid,int value,bool all);extern void lnet_peer_ni_add_to_recoveryq_locked (struct lnet_peer_ni *lpni); +extern int lnet_peer_add_pref_nid (struct lnet_peer_ni *lpni,lnet_nid_t nid); +extern void lnet_peer_clr_pref_nids (struct lnet_peer_ni *lpni); +extern int lnet_peer_del_pref_nid (struct lnet_peer_ni *lpni,lnet_nid_t nid); +void lnet_peer_ni_set_selection_priority (struct lnet_peer_ni *lpni, +u32 priority);void lnet_router_debugfs_init (void );void lnet_router_debugfs_fini (void );
@@ -531,6 +537,8 @@ void lnet_rtr_transfer_to_peer(struct lnet_peer *src,int lnet_dyn_del_ni (struct lnet_ioctl_config_ni *conf);int lnet_clear_lazy_portal (struct lnet_ni *ni,int portal,char *reason);struct lnet_net *lnet_get_net_locked (u32 net_id); +void lnet_net_clr_pref_rtrs (struct lnet_net *net); +int lnet_net_add_pref_rtr (struct lnet_net *net,lnet_nid_t gw_nid);int lnet_islocalnid (lnet_nid_t nid);int lnet_islocalnet (u32 net);
@@ -670,6 +678,17 @@ int lnet_delay_rule_list(int pos, struct lnet_fault_attr *attr,void lnet_counters_get_common (struct lnet_counters_common *common);int lnet_counters_get (struct lnet_counters *counters);void lnet_counters_reset (void ); +static inline void +lnet_ni_set_sel_priority_locked (struct lnet_ni *ni,u32 priority) +{ + ni->ni_sel_priority = priority; +} + +static inline void +lnet_net_set_sel_priority_locked (struct lnet_net *net,u32 priority) +{ + net->net_sel_priority = priority; +}unsigned int lnet_iov_nob (unsigned int niov,struct kvec *iov);unsigned int lnet_kiov_nob (unsigned int niov,struct bio_vec *iov);
@@ -825,6 +844,13 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid, u32 *peer_tx_qnob);int lnet_get_peer_ni_hstats (struct lnet_ioctl_peer_ni_hstats *stats); +static inline void +lnet_peer_net_set_sel_priority_locked (struct lnet_peer_net *lpn,u32 priority) +{ + lpn->lpn_sel_priority = priority; +} + +static inline struct lnet_peer_net *lnet_find_peer_net_locked (struct lnet_peer *peer,u32 net_id) {
@@ -968,6 +994,18 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,lnet_atomic_add_unless_max (healthv, value,LNET_MAX_HEALTH_VALUE ); } +static inline int +lnet_get_list_len (struct list_head *list) +{ +struct list_head *l; +int count =0 ; + +list_for_each (l, list) + count++; + +return count; +} +void lnet_incr_stats (struct lnet_element_stats *stats,enum lnet_msg_type msg_type,enum lnet_stats_type stats_type);
include/linux/lnet/udsp.h new file +117 -0
117 lines not on this page · raw message
include/uapi/linux/lnet/nidstr.h +4 -0
@@ -97,6 +97,10 @@ static inline char *libcfs_nid2str(lnet_nid_t nid)int cfs_parse_nidlist (char *str,int len,struct list_head *list);int cfs_print_nidlist (char *buffer,int count,struct list_head *list);int cfs_match_nid (lnet_nid_t nid,struct list_head *list); +int cfs_match_nid_net (lnet_nid_t nid,__u32 net,struct list_head *net_num_list, +struct list_head *addr); +int cfs_match_net (__u32 net_id,__u32 net_type, +struct list_head *net_num_list);int cfs_ip_addr_parse (char *str,int len,struct list_head *list);int cfs_ip_addr_match (__u32 addr,struct list_head *list);
net/lnet/lnet/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_LNET) += lnet.o -lnet-y := api-ni.o config.o nidstrings.o net_fault.o \ +lnet-y := api-ni.o config.o nidstrings.o net_fault.o udsp.o \ lib-me.o lib-msg.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
net/lnet/lnet/api-ni.c +87 -0
123 lines not on this page · raw message
net/lnet/lnet/nidstrings.c +66 -0
72 lines not on this page · raw message
net/lnet/lnet/peer.c +6 -0
@@ -1054,6 +1054,12 @@ struct lnet_peer_ni *return rc; } +void +lnet_peer_ni_set_selection_priority (struct lnet_peer_ni *lpni,u32 priority) +{ + lpni->lpni_sel_priority = priority; +} +/* * Clear the preferred NIDs from a non-multi-rail peer. */
net/lnet/lnet/udsp.c new file +1051 -0
1,051 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 13/41 lnet: Apply UDSP on local and remote NIs
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
When a peer net, peer ni, local net or local ni are created apply the UDSPs in the system on these constructs.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: a29151e30d8b89d ("LU-9121 lnet: Apply UDSP on local and remote NIs")
Reviewed-on: https://review.whamcloud.com/34355
--- net/lnet/lnet/api-ni.c | 26 +++++++++++++++++++++----- net/lnet/lnet/peer.c | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-)
net/lnet/lnet/api-ni.c +21 -5
@@ -3164,12 +3164,13 @@ int lnet_get_ni_stats(struct lnet_ioctl_element_msg_stats *msg_stats)static int lnet_add_net_common (struct lnet_net *net,struct lnet_ioctl_config_lnd_tunables *tun) { -u32 net_id; -struct lnet_ping_buffer *pbuf;struct lnet_handle_md ping_mdh; -int rc; +struct lnet_ping_buffer *pbuf;struct lnet_remotenet *rnet; +struct lnet_ni *ni;int net_ni_count; +u32 net_id; +int rc;lnet_net_lock (LNET_LOCK_EX ); rnet =lnet_find_rnet_locked (net->net_id);
@@ -3219,10 +3220,25 @@ static int lnet_add_net_common(struct lnet_net *net,lnet_net_lock (LNET_LOCK_EX ); net =lnet_get_net_locked (net_id); -lnet_net_unlock (LNET_LOCK_EX ); -LASSERT (net); +/* apply the UDSPs */ + rc =lnet_udsp_apply_policies_on_net (net); +if (rc) +CERROR ("Failed to apply UDSPs on local net %s\n" , +libcfs_net2str (net->net_id)); + +/* At this point we lost track of which NI was just added, so we +* just re-apply the policies on all of the NIs on this net +*/ +list_for_each_entry (ni, &net->net_ni_list, ni_netlist) { + rc =lnet_udsp_apply_policies_on_ni (ni); +if (rc) +CERROR ("Failed to apply UDSPs on ni %s\n" , +libcfs_nid2str (ni->ni_nid)); + } +lnet_net_unlock (LNET_LOCK_EX ); +/* * Start the acceptor thread if this is the first network * being added that requires the thread.
net/lnet/lnet/peer.c +16 -0
@@ -35,6 +35,7 @@#define DEBUG_SUBSYSTEM S_LNET +#include <linux/lnet/udsp.h> #include <linux/lnet/lib-lnet.h> #include <uapi/linux/lnet/lnet-dlc.h>
@@ -1357,6 +1358,8 @@ struct lnet_peer_net * unsigned int flags) {struct lnet_peer_table *ptable; +bool new_lpn = false; +int rc;/* Install the new peer_ni */ lnet_net_lock (LNET_LOCK_EX );
@@ -1387,6 +1390,7 @@ struct lnet_peer_net */* Add peer_net to peer */ if (!lpn->lpn_peer) { + new_lpn = true; lpn->lpn_peer = lp;list_add_tail (&lpn->lpn_peer_nets, &lp->lp_peer_nets);lnet_peer_addref_locked (lp);
@@ -1416,6 +1420,18 @@ struct lnet_peer_net * lp->lp_nnis++; +/* apply UDSPs */ +if (new_lpn) { + rc =lnet_udsp_apply_policies_on_lpn (lpn); +if (rc) +CERROR ("Failed to apply UDSPs on lpn %s\n" , +libcfs_net2str (lpn->lpn_net_id)); + } + rc =lnet_udsp_apply_policies_on_lpni (lpni); +if (rc) +CERROR ("Failed to apply UDSPs on lpni %s\n" , +libcfs_nid2str (lpni->lpni_nid)); +CDEBUG (D_NET ,"peer %s NID %s flags %#x\n" ,libcfs_nid2str (lp->lp_primary_nid),libcfs_nid2str (lpni->lpni_nid), flags);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 14/41 lnet: Add the kernel level Marshalling API
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Given a UDSP, Marshal the UDSP pointed to by udsp into the memory block that is allocated from userspace.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: cd0ef3165e1d1b5f ("LU-9121 lnet: Add the kernel level Marshalling API")
Reviewed-on: https://review.whamcloud.com/34403
--- include/linux/lnet/udsp.h | 13 +++ net/lnet/lnet/udsp.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+)
include/linux/lnet/udsp.h +13 -0
@@ -114,4 +114,17 @@*/ void lnet_udsp_destroy (bool shutdown); +/** +* lnet_get_udsp_size +* Return the size needed to store the marshalled UDSP +*/ +size_t lnet_get_udsp_size (struct lnet_udsp *udsp); + +/** +* lnet_udsp_marshal +* Marshal the udsp into the bulk memory provided. +* Return success/failure. +*/ +int lnet_udsp_marshal (struct lnet_udsp *udsp, +struct lnet_ioctl_udsp *ioc_udsp);#endif /* UDSP_H */
net/lnet/lnet/udsp.c +214 -0
217 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 15/41 lnet: Add the kernel level De-Marshalling API
In reply to James SimmonsFrom: Sonia Sharma <[email protected]>
Given a bulk allocated from userspace containing a single UDSP, De-Marshalling API demarshals it and populate the provided udsp structure.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 764d16bf7803908 ("LU-9121 lnet: Add the kernel level De-Marshalling API")
Reviewed-on: https://review.whamcloud.com/34488
--- include/linux/lnet/udsp.h | 7 ++ net/lnet/lnet/udsp.c | 202 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 208 insertions(+), 1 deletion(-)
include/linux/lnet/udsp.h +7 -0
@@ -127,4 +127,11 @@*/ int lnet_udsp_marshal (struct lnet_udsp *udsp,struct lnet_ioctl_udsp *ioc_udsp); +/** +* lnet_udsp_demarshal_add +* Given a bulk containing a single UDSP, +* demarshal and populate a udsp structure then add policy +*/ +int lnet_udsp_demarshal_add (void *bulk,u32 bulk_size); +#endif /* UDSP_H */
net/lnet/lnet/udsp.c +201 -1
211 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 16/41 lnet: Add the ioctl handler for "add policy"
In reply to James SimmonsFrom: Sonia Sharma <[email protected]>
The ioctl handler for "add policy" de-marshals the udsp rules passed from userspace and then add the rules if there is no copy of the same rules already added. Apply the rules to the existing LNet constructs.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 1fdb21ac697c368 ("LU-9121 lnet: Add the ioctl handler for "add policy"")
Reviewed-on: https://review.whamcloud.com/34514
--- include/uapi/linux/lnet/libcfs_ioctl.h | 3 ++- net/lnet/lnet/api-ni.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
include/uapi/linux/lnet/libcfs_ioctl.h +2 -1
@@ -150,6 +150,7 @@ struct libcfs_ioctl_data {#define IOC_LIBCFS_SET_HEALHV _IOWR(IOC_LIBCFS_TYPE, 102, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_LOCAL_HSTATS _IOWR(IOC_LIBCFS_TYPE, 103, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_RECOVERY_QUEUE _IOWR(IOC_LIBCFS_TYPE, 104, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 104 +#define IOC_LIBCFS_ADD_UDSP _IOWR(IOC_LIBCFS_TYPE, 105, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 105#endif /* __LIBCFS_IOCTL_H__ */
net/lnet/lnet/api-ni.c +16 -0
@@ -4126,6 +4126,22 @@ u32 lnet_get_dlc_seq_locked(void)return 0 ; } +case IOC_LIBCFS_ADD_UDSP : { +struct lnet_ioctl_udsp *ioc_udsp = arg; +u32 bulk_size = ioc_udsp->iou_hdr.ioc_len; + +mutex_lock (&the_lnet.ln_api_mutex); + rc =lnet_udsp_demarshal_add (arg, bulk_size); +if (!rc) { + rc =lnet_udsp_apply_policies (NULL , false); +CDEBUG (D_NET ,"policy application returned %d\n" , rc); + rc =0 ; + } +mutex_unlock (&the_lnet.ln_api_mutex); + +return rc; + } +default : ni =lnet_net2ni_addref (data->ioc_net);if (!ni)
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 17/41 lnet: ioctl handler for "delete policy"
In reply to James SimmonsFrom: Sonia Sharma <[email protected]>
The ioctl handler for "delete policy" deletes
a policy with the given index value. It
returns 0 if a policy with that index is found
else it returns -EINVAL.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 8258e7235c7047b ("LU-9121 lnet: ioctl handler for "delete policy"")
Reviewed-on: https://review.whamcloud.com/34552
--- include/uapi/linux/lnet/libcfs_ioctl.h | 3 ++- net/lnet/lnet/api-ni.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
include/uapi/linux/lnet/libcfs_ioctl.h +2 -1
@@ -151,6 +151,7 @@ struct libcfs_ioctl_data {#define IOC_LIBCFS_GET_LOCAL_HSTATS _IOWR(IOC_LIBCFS_TYPE, 103, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_RECOVERY_QUEUE _IOWR(IOC_LIBCFS_TYPE, 104, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_ADD_UDSP _IOWR(IOC_LIBCFS_TYPE, 105, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 105 +#define IOC_LIBCFS_DEL_UDSP _IOWR(IOC_LIBCFS_TYPE, 106, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 106#endif /* __LIBCFS_IOCTL_H__ */
net/lnet/lnet/api-ni.c +20 -0
@@ -4142,6 +4142,26 @@ u32 lnet_get_dlc_seq_locked(void)return rc; } +case IOC_LIBCFS_DEL_UDSP : { +struct lnet_ioctl_udsp *ioc_udsp = arg; +int idx = ioc_udsp->iou_idx; + +if (ioc_udsp->iou_hdr.ioc_len <sizeof (*ioc_udsp)) +return -EINVAL ; + +mutex_lock (&the_lnet.ln_api_mutex); + rc =lnet_udsp_del_policy (idx); +if (!rc) { + rc =lnet_udsp_apply_policies (NULL , false); +CDEBUG (D_NET ,"policy re-application returned %d\n" , + rc); + rc =0 ; + } +mutex_unlock (&the_lnet.ln_api_mutex); + +return rc; + } +default : ni =lnet_net2ni_addref (data->ioc_net);if (!ni)
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 18/41 lnet: ioctl handler for get policy info
In reply to James SimmonsFrom: Amir Shehata <[email protected]>
Add ioctl handler for GET_UDSP_SIZE and GET_UDSP
WC-bug-id: https://jira.whamcloud.com/browse/LU-9121
Lustre-commit: 6248e1cd7fb70f4 ("LU-9121 lnet: ioctl handler for get policy info")
Reviewed-on: https://review.whamcloud.com/34579
--- include/linux/lnet/udsp.h | 7 +++ include/uapi/linux/lnet/libcfs_ioctl.h | 5 +- net/lnet/lnet/api-ni.c | 64 +++++++++++++++++++++++++ net/lnet/lnet/udsp.c | 88 ++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 1 deletion(-)
include/linux/lnet/udsp.h +7 -0
@@ -134,4 +134,11 @@ int lnet_udsp_marshal(struct lnet_udsp *udsp,*/ int lnet_udsp_demarshal_add (void *bulk,u32 bulk_size); +/** +* lnet_udsp_get_construct_info +* get information of how the UDSP policies impacted the given +* construct. +*/ +void lnet_udsp_get_construct_info (struct lnet_ioctl_construct_udsp_info *info); +#endif /* UDSP_H */
include/uapi/linux/lnet/libcfs_ioctl.h +4 -1
@@ -152,6 +152,9 @@ struct libcfs_ioctl_data {#define IOC_LIBCFS_GET_RECOVERY_QUEUE _IOWR(IOC_LIBCFS_TYPE, 104, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_ADD_UDSP _IOWR(IOC_LIBCFS_TYPE, 105, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_DEL_UDSP _IOWR(IOC_LIBCFS_TYPE, 106, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 106 +#define IOC_LIBCFS_GET_UDSP_SIZE _IOWR(IOC_LIBCFS_TYPE, 107, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_UDSP _IOWR(IOC_LIBCFS_TYPE, 108, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_CONST_UDSP_INFO _IOWR(IOC_LIBCFS_TYPE, 109, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 109#endif /* __LIBCFS_IOCTL_H__ */
net/lnet/lnet/api-ni.c +64 -0
70 lines not on this page · raw message
net/lnet/lnet/udsp.c +88 -0
94 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 19/41 lustre: update version to 2.14.50
In reply to James SimmonsFrom: Oleg Drokin <[email protected]>
New tag 2.14.50
--- include/uapi/linux/lustre/lustre_ver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/lustre/lustre_ver.h +2 -2
@@ -3,9 +3,9 @@#define LUSTRE_MAJOR 2#define LUSTRE_MINOR 14 -#define LUSTRE_PATCH 0 +#define LUSTRE_PATCH 50#define LUSTRE_FIX 0 -#define LUSTRE_VERSION_STRING "2.14.0" +#define LUSTRE_VERSION_STRING "2.14.50"#define OBD_OCD_VERSION (major, minor, patch, fix) \ (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 20/41 lustre: gss: handle empty reqmsg in sptlrpc_req_ctx_switch
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
In sptlrpc_req_ctx_switch(), everything is already there to handle the case of a ptlrpc_request that has an empty rq_reqmsg. But assertions were left over at the beginning of the function, so just remove them from here.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14444
Lustre-commit: dfe87b089b66266 ("LU-14444 gss: handle empty reqmsg in sptlrpc_req_ctx_switch")
Reviewed-on: https://review.whamcloud.com/41685
--- fs/lustre/ptlrpc/sec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/lustre/ptlrpc/sec.c +1 -4
@@ -431,10 +431,6 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,int reqmsg_size;int rc =0 ; -LASSERT (req->rq_reqmsg); -LASSERT (req->rq_reqlen); -LASSERT (req->rq_replen); - CDEBUG(D_SEC, "req %p: switch ctx %p(%u->%s) -> %p(%u->%s), switch sec %p(%s) -> %p(%s)\n", req,
@@ -449,6 +445,7 @@ int sptlrpc_req_ctx_switch(struct ptlrpc_request *req,/* save request message */ reqmsg_size = req->rq_reqlen;if (reqmsg_size !=0 ) { +LASSERT (req->rq_reqmsg); reqmsg =kvzalloc (reqmsg_size,GFP_NOFS );if (!reqmsg)return -ENOMEM ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 21/41 lustre: sec: file ioctls to handle encryption policies
In reply to James SimmonsFrom: Sebastien Buisson <[email protected]>
Introduce support for fscrypt IOCTLs that handle encryption policies v2. It enables setting/getting encryption policies on individual directories, letting users decide how they want to encrypt specific directories. Add file IOCTls this time.
fscrypt encryption policies v2 are supported from Linux 5.4.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12275
Lustre-commit: 3973cf8dc955c77 ("LU-12275 sec: ioctls to handle encryption policies")
Reviewed-on: https://review.whamcloud.com/37673
--- fs/lustre/llite/file.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
fs/lustre/llite/file.c +27 -0
@@ -3989,6 +3989,33 @@ static int ll_heat_set(struct inode *inode, enum lu_heat_flag flags)kfree (state);return rc; } +#ifdef CONFIG_FS_ENCRYPTION +case FS_IOC_SET_ENCRYPTION_POLICY : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_set_policy (file, (const void __user *)arg); +case FS_IOC_GET_ENCRYPTION_POLICY_EX : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_get_policy_ex (file, (void __user *)arg); +case FS_IOC_ADD_ENCRYPTION_KEY : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_add_key (file, (void __user *)arg); +case FS_IOC_REMOVE_ENCRYPTION_KEY : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_remove_key (file, (void __user *)arg); +case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_remove_key_all_users (file, + (void __user *)arg); +case FS_IOC_GET_ENCRYPTION_KEY_STATUS : +if (!ll_sbi_has_encrypt (ll_i2sbi (inode))) +return -EOPNOTSUPP ; +return llcrypt_ioctl_get_key_status (file, (void __user *)arg); +#endif default :return obd_iocontrol (cmd,ll_i2dtexp (inode),0 ,NULL , (void __user *)arg);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 22/41 lustre: obdclass: try to skip corrupted llog records
In reply to James SimmonsFrom: Alex Zhuravlev <[email protected]>
if llog's header or record is found corrupted, then ignore the remaining records and try with the next one.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14098
Lustre-commit: 910eb97c1b43a44 ("LU-14098 obdclass: try to skip corrupted llog records")
Reviewed-on: https://review.whamcloud.com/40754
--- fs/lustre/obdclass/llog.c | 76 ++++++++++++++++++++++++++++++-------- fs/lustre/obdclass/llog_cat.c | 14 +++---- fs/lustre/obdclass/llog_internal.h | 5 +++ 3 files changed, 72 insertions(+), 23 deletions(-)
fs/lustre/obdclass/llog.c +60 -16
@@ -184,7 +184,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, (llh->llh_flags & LLOG_F_IS_CAT && flags & LLOG_F_IS_PLAIN))) {CERROR ("%s: llog type is %s but initializing %s\n" , - handle->lgh_ctxt->loc_obd->obd_name, +loghandle2name (handle), llh->llh_flags &LLOG_F_IS_CAT ?"catalog" :"plain" , flags &LLOG_F_IS_CAT ?"catalog" :"plain" );
@@ -206,7 +206,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,if (unlikely (uuid && !obd_uuid_equals (uuid, &llh->llh_tgtuuid))) {CERROR ("%s: llog uuid mismatch: %s/%s\n" , - handle->lgh_ctxt->loc_obd->obd_name, +loghandle2name (handle), (char *)uuid->uuid, (char *)llh->llh_tgtuuid.uuid); rc = -EEXIST ;
@@ -220,8 +220,8 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, llh->llh_flags |=LLOG_F_IS_FIXSIZE ; }else if (!(flags &LLOG_F_IS_PLAIN )) {CERROR ("%s: unknown flags: %#x (expected %#x or %#x)\n" , - handle->lgh_ctxt->loc_obd->obd_name, - flags,LLOG_F_IS_CAT ,LLOG_F_IS_PLAIN ); +loghandle2name (handle), flags,LLOG_F_IS_CAT , +LLOG_F_IS_PLAIN ); rc = -EINVAL ; } llh->llh_flags |= fmt;
@@ -234,6 +234,29 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, }EXPORT_SYMBOL (llog_init_handle); +int llog_verify_record (const struct llog_handle *llh,struct llog_rec_hdr *rec) +{ +int chunk_size = llh->lgh_hdr->llh_hdr.lrh_len; + +if (rec->lrh_len ==0 || rec->lrh_len > chunk_size) { +CERROR ("%s: record is too large: %d > %d\n" , +loghandle2name (llh), rec->lrh_len, chunk_size); +return -EINVAL ; + } +if (rec->lrh_index >=LLOG_HDR_BITMAP_SIZE (llh->lgh_hdr)) { +CERROR ("%s: index is too high: %d\n" , +loghandle2name (llh), rec->lrh_index); +return -EINVAL ; + } +if ((rec->lrh_type &LLOG_OP_MASK ) !=LLOG_OP_MAGIC ) { +CERROR ("%s: magic %x is bad\n" , +loghandle2name (llh), rec->lrh_type); +return -EINVAL ; + } + +return 0 ; +} +static int llog_process_thread (void *arg) {struct llog_process_info *lpi = arg;
@@ -247,6 +270,7 @@ static int llog_process_thread(void *arg)int saved_index =0 ;int last_called_index =0 ;bool repeated = false; +bool refresh_idx = false;if (!llh)return -EINVAL ;
@@ -380,12 +404,21 @@ static int llog_process_thread(void *arg) repeated = false; -if (!rec->lrh_len || rec->lrh_len > chunk_size) { -CWARN ("invalid length %d in llog record for index %d/%d\n" , - rec->lrh_len, - rec->lrh_index, index); - rc = -EINVAL ; - goto out; + rc =llog_verify_record (loghandle, rec); +if (rc) { +CERROR ("%s: invalid record in llog " DFID " record for index %d/%d: rc = %d\n" , +loghandle2name (loghandle), +PFID (&loghandle->lgh_id.lgl_oi.oi_fid), + rec->lrh_len, index, rc); +/* +* the block seem to be corrupted, let's try +* with the next one. reset rc to go to the +* next chunk. +*/ + refresh_idx = true; + index =0 ; + rc =0 ; + goto repeat; }if (rec->lrh_index < index) {
@@ -395,11 +428,22 @@ static int llog_process_thread(void *arg) }if (rec->lrh_index != index) { -CERROR ("%s: Invalid record: index %u but expected %u\n" , - loghandle->lgh_ctxt->loc_obd->obd_name, - rec->lrh_index, index); - rc = -ERANGE ; - goto out; +/* +* the last time we couldn't parse the block due +* to corruption, thus has no idea about the +* next index, take it from the block, once. +*/ +if (refresh_idx) { + refresh_idx = false; + index = rec->lrh_index; + }else { +CERROR ("%s: " DFID " Invalid record: index %u but expected %u\n" , +loghandle2name (loghandle), +PFID (&loghandle->lgh_id.lgl_oi.oi_fid), + rec->lrh_index, index); + rc = -ERANGE ; + goto out; + } } CDEBUG(D_OTHER,
@@ -501,7 +545,7 @@ int llog_process_or_fork(const struct lu_env *env,if (IS_ERR (task)) { rc =PTR_ERR (task);CERROR ("%s: cannot start thread: rc = %d\n" , - loghandle->lgh_ctxt->loc_obd->obd_name, rc); +loghandle2name (loghandle), rc); goto out_lpi; }wait_for_completion (&lpi->lpi_completion);
fs/lustre/obdclass/llog_cat.c +7 -7
@@ -80,7 +80,7 @@ static int llog_cat_id2handle(const struct lu_env *env, ostid_seq(&cgl->lgl_oi) == ostid_seq(&logid->lgl_oi)) {if (cgl->lgl_ogen != logid->lgl_ogen) {CWARN ("%s: log " DFID " generation %x != %x\n" , - loghandle->lgh_ctxt->loc_obd->obd_name, +loghandle2name (loghandle),PFID (&logid->lgl_oi.oi_fid), cgl->lgl_ogen, logid->lgl_ogen);continue ;
@@ -88,7 +88,7 @@ static int llog_cat_id2handle(const struct lu_env *env, *res =llog_handle_get (loghandle);if (!*res) {CERROR ("%s: log " DFID " refcount is zero!\n" , - loghandle->lgh_ctxt->loc_obd->obd_name, +loghandle2name (loghandle),PFID (&logid->lgl_oi.oi_fid));continue ; }
@@ -103,8 +103,8 @@ static int llog_cat_id2handle(const struct lu_env *env, LLOG_OPEN_EXISTS);if (rc <0 ) {CERROR ("%s: error opening log id " DFID ":%x: rc = %d\n" , - cathandle->lgh_ctxt->loc_obd->obd_name, -PFID (&logid->lgl_oi.oi_fid), logid->lgl_ogen, rc); +loghandle2name (cathandle),PFID (&logid->lgl_oi.oi_fid), + logid->lgl_ogen, rc);return rc; }
@@ -155,7 +155,7 @@ static int llog_cat_process_common(const struct lu_env *env,if (rec->lrh_type !=le32_to_cpu (LLOG_LOGID_MAGIC )) { rc = -EINVAL ;CWARN ("%s: invalid record in catalog " DFID ":%x: rc = %d\n" , - cat_llh->lgh_ctxt->loc_obd->obd_name, +loghandle2name (cat_llh),PFID (&cat_llh->lgh_id.lgl_oi.oi_fid), cat_llh->lgh_id.lgl_ogen, rc);
@@ -170,7 +170,7 @@ static int llog_cat_process_common(const struct lu_env *env, rc =llog_cat_id2handle (env, cat_llh, llhp, &lir->lid_id);if (rc) {CWARN ("%s: can't find llog handle " DFID ":%x: rc = %d\n" , - cat_llh->lgh_ctxt->loc_obd->obd_name, +loghandle2name (cat_llh),PFID (&lir->lid_id.lgl_oi.oi_fid), lir->lid_id.lgl_ogen, rc);
@@ -235,7 +235,7 @@ static int llog_cat_process_or_fork(const struct lu_env *env,struct llog_process_cat_data cd;CWARN ("%s: catlog " DFID " crosses index zero\n" , - cat_llh->lgh_ctxt->loc_obd->obd_name, +loghandle2name (cat_llh),PFID (&cat_llh->lgh_id.lgl_oi.oi_fid));/*startcat = 0 is default value for general processing */ if ((startcat != LLOG_CAT_FIRST &&
fs/lustre/obdclass/llog_internal.h +5 -0
@@ -74,4 +74,9 @@ static inline struct llog_rec_hdr *llog_rec_hdr_next(struct llog_rec_hdr *rec) {return (struct llog_rec_hdr *)((char *)rec + rec->lrh_len); } + +static inline char *loghandle2name (const struct llog_handle *lgh) +{ +return lgh->lgh_ctxt->loc_obd->obd_name; +}#endif
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 23/41 lustre: lov: fix layout generation inc for mirror split
In reply to James SimmonsFrom: Bobi Jam <[email protected]>
Mirror split does not increase the layout generation properly.
Mirror split does not change FLR state of the file, even when it contains 1 mirror afterwards, and FLR state should be LCM_FL_NONE instead.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14268
Lustre-commit: ffa858b1657145c ("LU-14268 lod: fix layout generation inc for mirror split")
Reviewed-on: https://review.whamcloud.com/41068
--- fs/lustre/lov/lov_ea.c | 4 ++-- fs/lustre/lov/lov_object.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
fs/lustre/lov/lov_ea.c +2 -2
@@ -635,10 +635,10 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm)int i, j;CDEBUG_LIMIT (level, -"lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, refc: %d, entry: %u, layout_gen %u\n" , +"lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, refc: %d, entry: %u, mirror: %u, flags: %u,layout_gen %u\n" , lsm,POSTID (&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic,atomic_read (&lsm->lsm_refc), lsm->lsm_entry_count, - lsm->lsm_layout_gen); + lsm->lsm_mirror_count, lsm->lsm_flags, lsm->lsm_layout_gen);if (lsm->lsm_magic ==LOV_MAGIC_FOREIGN ) {struct lov_foreign_md *lfm = (void *)lsm_foreign (lsm);
fs/lustre/lov/lov_object.c +1 -0
@@ -1374,6 +1374,7 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj,if ((!lsm && !lov->lo_lsm) || ((lsm && lov->lo_lsm) && (lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) && + (lov->lo_lsm->lsm_flags == lsm->lsm_flags) && (lov->lo_lsm->lsm_entries[0 ]->lsme_pattern == lsm->lsm_entries[0 ]->lsme_pattern))) {/* same version of layout */
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 24/41 lnet: modify assertion in lnet_post_send_locked
In reply to James SimmonsFrom: Serguei Smirnov <[email protected]>
Check that the pointer to the local interface is not NULL before asserting. While checking if local ni is the destination, the assertion may attempt to dereference pointer to local interface after it has already been cleaned up on shutdown.
WC-bug-id: https://jira.whamcloud.com/browse/LU-13929
Lustre-commit: e5a8f3fc12840ae ("LU-13929 lnet: modify assertion in lnet_post_send_locked")
Reviewed-on: https://review.whamcloud.com/40749
--- net/lnet/lnet/lib-move.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/lnet/lnet/lib-move.c +6 -1
@@ -646,8 +646,10 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,LASSERT (!do_send || msg->msg_tx_delayed);LASSERT (!msg->msg_receiving);LASSERT (msg->msg_tx_committed); +/* can't get here if we're sending to the loopback interface */ -LASSERT (lp->lpni_nid != the_lnet.ln_loni->ni_nid); +if (the_lnet.ln_loni) +LASSERT (lp->lpni_nid != the_lnet.ln_loni->ni_nid);/* NB 'lp' is always the next hop */ if (!(msg->msg_target.pid & LNET_PID_USERFLAG) &&
@@ -1576,6 +1578,9 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,struct lnet_msg *msg = sd->sd_msg;int cpt = sd->sd_cpt; +if (the_lnet.ln_state !=LNET_STATE_RUNNING ) +return -ESHUTDOWN ; +/* No send credit hassles with LOLND */ lnet_ni_addref_locked (the_lnet.ln_loni, cpt); msg->msg_hdr.dest_nid =cpu_to_le64 (the_lnet.ln_loni->ni_nid);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 25/41 lustre: lov: fixes bitfield in lod qos code
In reply to James SimmonsFrom: Rahul Deshmkuh <[email protected]>
Updating bitfields in struct lod_qos struct is protected by lq_rw_sem in most places but an update can be lost due unprotected bitfield access from lod_qos_thresholdrr_seq_write() and qos_prio_free_store(). This patch fixes it by replacing bitfields with named bits and atomic bitops.
Cray-bug-id: LUS-4651
WC-bug-id: https://jira.whamcloud.com/browse/LU-7853
Lustre-commit: 3bae39f0a5b98a2 ("LU-7853 lod: fixes bitfield in lod qos code")
Reviewed-on: https://review.whamcloud.com/18812
--- fs/lustre/include/lu_object.h | 17 +++++++++++------ fs/lustre/lmv/lmv_obd.c | 2 +- fs/lustre/lmv/lproc_lmv.c | 6 +++--- fs/lustre/obdclass/lu_tgt_descs.c | 38 ++++++++++++++++++++------------------ 4 files changed, 35 insertions(+), 28 deletions(-)
fs/lustre/include/lu_object.h +11 -6
@@ -1405,6 +1405,15 @@ struct lu_kmem_descr {extern u32 lu_context_tags_default;extern u32 lu_session_tags_default; +/* bitflags used in rr / qos allocation */ +enum lq_flag { +LQ_DIRTY =0 ,/* recalc qos data */ +LQ_SAME_SPACE ,/* the OSTs all have approx. +* the same space avail +*/ +LQ_RESET ,/* zero current penalties */ +}; +/* round-robin QoS data for LOD/LMV */ struct lu_qos_rr {spinlock_t lqr_alloc;/* protect allocation index */
@@ -1412,7 +1421,7 @@ struct lu_qos_rr {u32 lqr_offset_idx;/* aliasing for start_idx */ int lqr_start_count;/* reseed counter */ struct lu_tgt_pool lqr_pool;/* round-robin optimized list */ - unsigned long lqr_dirty:1; /* recalc round-robin list */ +unsigned long lqr_flags; };/* QoS data per MDS/OSS */
@@ -1482,11 +1491,7 @@ struct lu_qos {unsigned int lq_prio_free;/* priority for free space */ unsigned int lq_threshold_rr;/* priority for rr */ struct lu_qos_rr lq_rr;/* round robin qos data */ - unsigned long lq_dirty:1, /* recalc qos data */ - lq_same_space:1,/* the servers all have approx. -* the same space avail -*/ - lq_reset:1; /* zero current penalties */ +unsigned long lq_flags; };struct lu_tgt_descs {
fs/lustre/lmv/lmv_obd.c +1 -1
@@ -1303,7 +1303,7 @@ static int lmv_statfs_update(void *cookie, int rc) tgt->ltd_statfs = *osfs; tgt->ltd_statfs_age =ktime_get_seconds ();spin_unlock (&lmv->lmv_lock); - lmv->lmv_qos.lq_dirty =1 ; +set_bit (LQ_DIRTY , &lmv->lmv_qos.lq_flags); }return rc;
fs/lustre/lmv/lproc_lmv.c +3 -3
@@ -133,8 +133,8 @@ static ssize_t qos_prio_free_store(struct kobject *kobj,return -EINVAL ; lmv->lmv_qos.lq_prio_free = (val <<8 ) /100 ; - lmv->lmv_qos.lq_dirty =1 ; - lmv->lmv_qos.lq_reset =1 ; +set_bit (LQ_DIRTY , &lmv->lmv_qos.lq_flags); +set_bit (LQ_RESET , &lmv->lmv_qos.lq_flags);return count; }
@@ -170,7 +170,7 @@ static ssize_t qos_threshold_rr_store(struct kobject *kobj,return -EINVAL ; lmv->lmv_qos.lq_threshold_rr = (val <<8 ) /100 ; - lmv->lmv_qos.lq_dirty =1 ; +set_bit (LQ_DIRTY , &lmv->lmv_qos.lq_flags);return count; }
fs/lustre/obdclass/lu_tgt_descs.c +20 -18
@@ -80,7 +80,7 @@ u64 lu_prandom_u64_max(u64 ep_ro)void lu_qos_rr_init (struct lu_qos_rr *lqr) {spin_lock_init (&lqr->lqr_alloc); - lqr->lqr_dirty =1 ; +set_bit (LQ_DIRTY , &lqr->lqr_flags); }EXPORT_SYMBOL (lu_qos_rr_init);
@@ -158,9 +158,8 @@ int lu_qos_add_tgt(struct lu_qos *qos, struct lu_tgt_desc *tgt)*/ list_add_tail (&svr->lsq_svr_list, &tempsvr->lsq_svr_list); - qos->lq_dirty =1 ; - qos->lq_rr.lqr_dirty =1 ; - +set_bit (LQ_DIRTY , &qos->lq_flags); +set_bit (LQ_DIRTY , &qos->lq_rr.lqr_flags); out:up_write (&qos->lq_rw_sem);return rc;
@@ -200,8 +199,8 @@ static int lu_qos_del_tgt(struct lu_qos *qos, struct lu_tgt_desc *ltd)kfree (svr); } - qos->lq_dirty =1 ; - qos->lq_rr.lqr_dirty =1 ; +set_bit (LQ_DIRTY , &qos->lq_flags); +set_bit (LQ_DIRTY , &qos->lq_rr.lqr_flags); out:up_write (&qos->lq_rw_sem);return rc;
@@ -273,8 +272,8 @@ int lu_tgt_descs_init(struct lu_tgt_descs *ltd, bool is_mdt)/* Set up allocation policy (QoS and RR) */ INIT_LIST_HEAD (<d->ltd_qos.lq_svr_list);init_rwsem (<d->ltd_qos.lq_rw_sem); - ltd->ltd_qos.lq_dirty =1 ; - ltd->ltd_qos.lq_reset =1 ; +set_bit (LQ_DIRTY , <d->ltd_qos.lq_flags); +set_bit (LQ_RESET , <d->ltd_qos.lq_flags);/* Default priority is toward free space balance */ ltd->ltd_qos.lq_prio_free =232 ;/* Default threshold for rr (roughly 17%) */
@@ -416,7 +415,8 @@ void ltd_del_tgt(struct lu_tgt_descs *ltd, struct lu_tgt_desc *tgt)*/ bool ltd_qos_is_usable (struct lu_tgt_descs *ltd) { -if (!ltd->ltd_qos.lq_dirty && ltd->ltd_qos.lq_same_space) +if (!test_bit (LQ_DIRTY , <d->ltd_qos.lq_flags) && +test_bit (LQ_SAME_SPACE , <d->ltd_qos.lq_flags))return false;if (ltd->ltd_lov_desc.ld_active_tgt_count <2 )
@@ -456,7 +456,7 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd)time64_t now, age;int rc; -if (!qos->lq_dirty) { +if (!test_bit (LQ_DIRTY , &qos->lq_flags)) { rc =0 ; goto out; }
@@ -531,7 +531,8 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd) tgt->ltd_qos.ltq_penalty_per_obj >>=1 ; age = (now - tgt->ltd_qos.ltq_used) >>3 ; -if (qos->lq_reset || age >32 * desc->ld_qos_maxage) +if (test_bit (LQ_RESET , &qos->lq_flags) || + age >32 * desc->ld_qos_maxage) tgt->ltd_qos.ltq_penalty =0 ;else if (age > desc->ld_qos_maxage)/* Decay tgt penalty. */
@@ -566,31 +567,32 @@ int ltd_qos_penalties_calc(struct lu_tgt_descs *ltd) svr->lsq_penalty_per_obj >>=1 ; age = (now - svr->lsq_used) >>3 ; -if (qos->lq_reset || age >32 * desc->ld_qos_maxage) +if (test_bit (LQ_RESET , &qos->lq_flags) || + age >32 * desc->ld_qos_maxage) svr->lsq_penalty =0 ;else if (age > desc->ld_qos_maxage)/* Decay server penalty. */ svr->lsq_penalty >>= age / desc->ld_qos_maxage; } - qos->lq_dirty =0 ; - qos->lq_reset =0 ; +clear_bit (LQ_DIRTY , &qos->lq_flags); +clear_bit (LQ_RESET , &qos->lq_flags);/* * If each tgt has almost same free space, do rr allocation for better * creation performance */ - qos->lq_same_space =0 ; +clear_bit (LQ_SAME_SPACE , &qos->lq_flags);if ((ba_max * (256 - qos->lq_threshold_rr)) >>8 < ba_min && (ia_max * (256 - qos->lq_threshold_rr)) >>8 < ia_min) { - qos->lq_same_space =1 ; +set_bit (LQ_SAME_SPACE , &qos->lq_flags);/* Reset weights for the next time we enter qos mode */ - qos->lq_reset =1 ; +set_bit (LQ_RESET , &qos->lq_flags); } rc =0 ; out: -if (!rc && qos->lq_same_space) +if (!rc &&test_bit (LQ_SAME_SPACE , &qos->lq_flags))return -EAGAIN ;return rc;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 26/41 lustre: lov: grant deadlock if same OSC in two components
In reply to James SimmonsFrom: Andriy Skulysh <[email protected]>
The same osc can be involved in several components but osc layer leaves active last used extent, so an RPC can't be sent if grants are required from the same OST for another component.
Add cl_io_extent_release() to release active extent before switching to the next component.
Cray-bug-id: LUS-8038
WC-bug-id: https://jira.whamcloud.com/browse/LU-13100
Lustre-commit: 2070e9bcc0c1bd2 ("LU-13100 lov: grant deadlock if same OSC in two components")
Reviewed-on: https://review.whamcloud.com/37095
--- fs/lustre/include/cl_object.h | 6 ++++++ fs/lustre/include/lustre_osc.h | 2 ++ fs/lustre/lov/lov_io.c | 4 ++++ fs/lustre/mdc/mdc_dev.c | 1 + fs/lustre/obdclass/cl_io.c | 12 ++++++++++++ fs/lustre/osc/osc_io.c | 15 ++++++++++++++- 6 files changed, 39 insertions(+), 1 deletion(-)
fs/lustre/include/cl_object.h +6 -0
@@ -1611,6 +1611,11 @@ struct cl_io_operations { struct cl_page_list *queue, int from, int to, cl_commit_cbt cb);/** +* Release active extent. +*/ +void (*cio_extent_release)(const struct lu_env *env, +const struct cl_io_slice *slice); +/** * Decide maximum read ahead extent * * \pre io->ci_type == CIT_READ
@@ -2439,6 +2444,7 @@ int cl_io_submit_sync(const struct lu_env *env, struct cl_io *io,int cl_io_commit_async (const struct lu_env *env,struct cl_io *io,struct cl_page_list *queue,int from,int to,cl_commit_cbt cb); +void cl_io_extent_release (const struct lu_env *env,struct cl_io *io);int cl_io_read_ahead (const struct lu_env *env,struct cl_io *io,pgoff_t start,struct cl_read_ahead *ra);
fs/lustre/include/lustre_osc.h +2 -0
@@ -689,6 +689,8 @@ int osc_io_commit_async(const struct lu_env *env,const struct cl_io_slice *ios, struct cl_page_list *qin, int from, int to, cl_commit_cbt cb); +void osc_io_extent_release (const struct lu_env *env, +const struct cl_io_slice *ios);int osc_io_iter_init (const struct lu_env *env,const struct cl_io_slice *ios);void osc_io_iter_fini (const struct lu_env *env,const struct cl_io_slice *ios);
fs/lustre/lov/lov_io.c +4 -0
@@ -1318,6 +1318,10 @@ static int lov_io_commit_async(const struct lu_env *env,break ; from =0 ; + +if (lov_comp_entry (index) != +lov_comp_entry (page->cp_lov_index)) +cl_io_extent_release (sub->sub_env, &sub->sub_io); }/* for error case, add the page back into the qin list */
fs/lustre/mdc/mdc_dev.c +1 -0
@@ -1325,6 +1325,7 @@ static void mdc_io_data_version_end(const struct lu_env *env, .cio_read_ahead = mdc_io_read_ahead, .cio_submit = osc_io_submit, .cio_commit_async = osc_io_commit_async, + .cio_extent_release = osc_io_extent_release, }; int mdc_io_init(const struct lu_env *env, struct cl_object *obj,
fs/lustre/obdclass/cl_io.c +12 -0
@@ -597,6 +597,18 @@ int cl_io_commit_async(const struct lu_env *env, struct cl_io *io, }EXPORT_SYMBOL (cl_io_commit_async); +void cl_io_extent_release (const struct lu_env *env,struct cl_io *io) +{ +const struct cl_io_slice *scan; + +list_for_each_entry (scan, &io->ci_layers, cis_linkage) { +if (!scan->cis_iop->cio_extent_release) +continue ; + scan->cis_iop->cio_extent_release (env, scan); + } +} +EXPORT_SYMBOL (cl_io_extent_release); +/** * Submits a list of pages for immediate io. *
fs/lustre/osc/osc_io.c +14 -1
@@ -373,6 +373,18 @@ int osc_io_commit_async(const struct lu_env *env, }EXPORT_SYMBOL (osc_io_commit_async); +void osc_io_extent_release (const struct lu_env *env, +const struct cl_io_slice *ios) +{ +struct osc_io *oio =cl2osc_io (env, ios); + +if (oio->oi_active) { +osc_extent_release (env, oio->oi_active); + oio->oi_active =NULL ; + } +} +EXPORT_SYMBOL (osc_io_extent_release); +static bool osc_import_not_healthy (struct obd_import *imp) { return imp->imp_invalid || imp->imp_deactive ||
@@ -1218,7 +1230,8 @@ void osc_io_lseek_end(const struct lu_env *env, }, .cio_read_ahead = osc_io_read_ahead, .cio_submit = osc_io_submit, - .cio_commit_async = osc_io_commit_async + .cio_commit_async = osc_io_commit_async, + .cio_extent_release = osc_io_extent_release };/*****************************************************************************
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 27/41 lustre: change EWOULDBLOCK to EAGAIN
In reply to James SimmonsFrom: "John L. Hammond" <[email protected]>
On linux, EWOULDBLOCK has always been defined as an alias for EAGAIN. In the interest of readability we should not use two names for the same thing. So change the remaining uses of EWOULDBLOCK to EAGAIN.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14047
Lustre-commit: a7f48e6c15e28617 ("LU-14047 lustre: change EWOULDBLOCK to EAGAIN")
Reviewed-on: https://review.whamcloud.com/40307
--- fs/lustre/fld/fld_request.c | 2 +- fs/lustre/include/cl_object.h | 2 +- fs/lustre/llite/glimpse.c | 2 +- fs/lustre/llite/vvp_page.c | 2 +- fs/lustre/obdclass/cl_io.c | 2 +- fs/lustre/osc/osc_io.c | 2 +- fs/lustre/osc/osc_lock.c | 2 +- fs/lustre/osc/osc_request.c | 2 +- fs/lustre/ptlrpc/client.c | 2 +- fs/lustre/ptlrpc/errno.c | 4 ++-- fs/lustre/ptlrpc/sec.c | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-)
fs/lustre/fld/fld_request.c +1 -1
@@ -364,7 +364,7 @@ int fld_client_rpc(struct obd_export *exp,if (OBD_FAIL_CHECK (OBD_FAIL_FLD_QUERY_REQ && req->rq_no_delay)) {/* the same error returned by ptlrpc_import_delay_req */ - rc = -EWOULDBLOCK ; + rc = -EAGAIN ; req->rq_status = rc; }else {obd_get_request_slot (&exp->exp_obd->u.cli);
fs/lustre/include/cl_object.h +1 -1
@@ -1637,7 +1637,7 @@ struct cl_io_operations {enum cl_enq_flags {/** * instruct server to not block, if conflicting lock is found. Instead -* -EWOULDBLOCK is returned immediately. +* -EAGAIN is returned immediately. */ CEF_NONBLOCK =0x00000001 ,/**
fs/lustre/llite/glimpse.c +1 -1
@@ -207,7 +207,7 @@ int __cl_glimpse_size(struct inode *inode, int agl) }else if (result ==0 ) { result =cl_glimpse_lock (env, io, inode, io->ci_obj, agl); -if (!agl && result == -EWOULDBLOCK ) +if (!agl && result == -EAGAIN ) io->ci_need_restart =1 ; }
fs/lustre/llite/vvp_page.c +1 -1
@@ -272,7 +272,7 @@ static void vvp_page_completion_read(const struct lu_env *env,cl_page_export (env, page,1 ); }else if (vpg->vpg_defer_uptodate) { vpg->vpg_defer_uptodate =0 ; -if (ioret == -EWOULDBLOCK ) { +if (ioret == -EAGAIN ) {/* mirror read failed, it needs to destroy the page * because subpage would be from wrong osc when trying * to read from a new mirror
fs/lustre/obdclass/cl_io.c +1 -1
@@ -749,7 +749,7 @@ int cl_io_loop(const struct lu_env *env, struct cl_io *io)if (rc && !result) result = rc; -if (result == -EWOULDBLOCK && io->ci_ndelay) { +if (result == -EAGAIN && io->ci_ndelay) { io->ci_need_restart =1 ; result =0 ; }
fs/lustre/osc/osc_io.c +1 -1
@@ -406,7 +406,7 @@ int osc_io_iter_init(const struct lu_env *env, const struct cl_io_slice *ios)*/ if (ios->cis_io->ci_type ==CIT_READ && ios->cis_io->ci_ndelay && !ios->cis_io->ci_tried_all_mirrors &&osc_import_not_healthy (imp)) { - rc = -EWOULDBLOCK ; + rc = -EAGAIN ; }else if (likely (!imp->imp_invalid)) {atomic_inc (&osc->oo_nr_ios); oio->oi_is_active =1 ;
fs/lustre/osc/osc_lock.c +1 -1
@@ -306,7 +306,7 @@ static int osc_lock_upcall(void *cookie, struct lustre_handle *lockh,/* Hide the error. */ rc =0 ; }else if (rc <0 && oscl->ols_flags &LDLM_FL_NDELAY ) { - rc = -EWOULDBLOCK ; + rc = -EAGAIN ; }if (oscl->ols_owner)
fs/lustre/osc/osc_request.c +1 -1
@@ -2430,7 +2430,7 @@ static int brw_interpret(const struct lu_env *env,list_for_each_entry_safe (ext, tmp, &aa->aa_exts, oe_link) {list_del_init (&ext->oe_link);osc_extent_finish (env, ext,1 , - rc && req->rq_no_delay ? -EWOULDBLOCK : rc); + rc && req->rq_no_delay ? -EAGAIN : rc); }LASSERT (list_empty (&aa->aa_exts));LASSERT (list_empty (&aa->aa_oaps));
fs/lustre/ptlrpc/client.c +1 -1
@@ -1236,7 +1236,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, }else if (req->rq_no_delay && imp->imp_generation != imp->imp_initiated_at) {/* ignore nodelay for requests initiating connections */ - *status = -EWOULDBLOCK ; + *status = -EAGAIN ; } else if (req->rq_allow_replay && (imp->imp_state == LUSTRE_IMP_REPLAY || imp->imp_state == LUSTRE_IMP_REPLAY_LOCKS ||
fs/lustre/ptlrpc/errno.c +2 -2
@@ -36,8 +36,8 @@* The two translation tables below must define a one-to-one mapping between * host and network errnos. * -* EWOULDBLOCK is equal to EAGAIN on all architectures except for parisc, which -* appears irrelevant. Thus, existing references to EWOULDBLOCK are fine. +* EAGAIN is equal to EAGAIN on all architectures except for parisc, which +* appears irrelevant. Thus, existing references to EAGAIN are fine. * * EDEADLOCK is equal to EDEADLK on x86 but not on sparc, at least. A sparc * host has no context-free way to determine if a LUSTRE_EDEADLK represents an
fs/lustre/ptlrpc/sec.c +1 -1
@@ -720,7 +720,7 @@ int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout)spin_unlock (&ctx->cc_lock);if (timeout ==0 ) -return -EWOULDBLOCK ; +return -EAGAIN ;/* Clear any flags that may be present from previous sends */ LASSERT (req->rq_receiving_reply ==0 );
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 28/41 lsutre: ldlm: return error from ldlm_namespace_new()
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
Return the underlying error in ldlm_namespace_new() from ldlm_namespace_sysfs_register() to the caller instead of NULL. Otherwise, the callers convert the NULL to -ENOMEM and this is incorrectly reported as an allocation error to the user.
sysfs: cannot create duplicate filename
'/fs/lustre/ldlm/namespaces/lustre-OST0002-osc-ffff89f33be70000'
mount.lustre: mount mgs:/lfs at /lfs failed: Cannot allocate memory
Change ldlm_namespace_new() to return errors via PTR_ERR() and change the callers to use IS_ERR().
Fix associated CERROR() messages to follow proper code style.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14178
Lutsre-commit: e9c3b89bdacdb90 ("LU-14178 ldlm: return error from ldlm_namespace_new()")
Reviewed-on: https://review.whamcloud.com/40851
--- fs/lustre/ldlm/ldlm_lib.c | 10 ++++++---- fs/lustre/ldlm/ldlm_resource.c | 32 +++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 15 deletions(-)
fs/lustre/ldlm/ldlm_lib.c +6 -4
@@ -524,10 +524,11 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)LDLM_NAMESPACE_CLIENT ,LDLM_NAMESPACE_GREEDY , ns_type); -if (!obd->obd_namespace) { -CERROR ("Unable to create client namespace - %s\n" , - obd->obd_name); - rc = -ENOMEM ; +if (IS_ERR (obd->obd_namespace)) { + rc =PTR_ERR (obd->obd_namespace); +CERROR ("%s: unable to create client namespace: rc = %d\n" , + obd->obd_name, rc); + obd->obd_namespace =NULL ; goto err_import; }
@@ -540,6 +541,7 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg) err:kfree (cli->cl_mod_tag_bitmap); cli->cl_mod_tag_bitmap =NULL ; +return rc; }EXPORT_SYMBOL (client_obd_setup);
fs/lustre/ldlm/ldlm_resource.c +21 -11
@@ -630,19 +630,23 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, rc =ldlm_get_ref ();if (rc) { -CERROR ("ldlm_get_ref failed: %d\n" , rc); -return NULL ; +CERROR ("%s: ldlm_get_ref failed: rc = %d\n" , name, rc); +return ERR_PTR (rc); }if (ns_type >=ARRAY_SIZE (ldlm_ns_hash_defs) || ldlm_ns_hash_defs[ns_type].nsd_bkt_bits ==0 ) { -CERROR ("Unknown type %d for ns %s\n" , ns_type, name); + rc = -EINVAL ; +CERROR ("%s: unknown namespace type %d: rc = %d\n" , + name, ns_type, rc); goto out_ref; } ns =kzalloc (sizeof (*ns),GFP_NOFS ); -if (!ns) +if (!ns) { + rc = -ENOMEM ; goto out_ref; + } ns->ns_rs_hash = cfs_hash_create(name, ldlm_ns_hash_defs[ns_type].nsd_all_bits,
@@ -656,8 +660,10 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,CFS_HASH_BIGNAME |CFS_HASH_SPIN_BKTLOCK | CFS_HASH_NO_ITEMREF); -if (!ns->ns_rs_hash) +if (!ns->ns_rs_hash) { + rc = -ENOMEM ; goto out_ns; + } ns->ns_bucket_bits = ldlm_ns_hash_defs[ns_type].nsd_all_bits - ldlm_ns_hash_defs[ns_type].nsd_bkt_bits;
@@ -665,8 +671,10 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ns->ns_rs_buckets =kvzalloc ((1 << ns->ns_bucket_bits) *sizeof (*ns->ns_rs_buckets),GFP_KERNEL ); -if (!ns->ns_rs_buckets) +if (!ns->ns_rs_buckets) { + rc = -ENOMEM ; goto out_hash; + }for (idx =0 ; idx < (1 << ns->ns_bucket_bits); idx++) {struct ldlm_ns_bucket *nsb = &ns->ns_rs_buckets[idx];
@@ -680,8 +688,10 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, ns->ns_appetite = apt; ns->ns_client = client; ns->ns_name =kstrdup (name,GFP_KERNEL ); -if (!ns->ns_name) +if (!ns->ns_name) { + rc = -ENOMEM ; goto out_hash; + }INIT_LIST_HEAD (&ns->ns_list_chain);INIT_LIST_HEAD (&ns->ns_unused_list);
@@ -704,20 +714,20 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, rc =ldlm_namespace_sysfs_register (ns);if (rc !=0 ) { -CERROR ("Can't initialize ns sysfs, rc %d\n" , rc); +CERROR ("%s: cannot initialize ns sysfs: rc = %d\n" , name, rc); goto out_hash; } rc =ldlm_namespace_debugfs_register (ns);if (rc !=0 ) { -CERROR ("Can't initialize ns proc, rc %d\n" , rc); +CERROR ("%s: cannot initialize ns proc: rc = %d\n" , name, rc); goto out_sysfs; } idx =ldlm_namespace_nr_read (client); rc =ldlm_pool_init (&ns->ns_pool, ns, idx, client);if (rc) { -CERROR ("Can't initialize lock pool, rc %d\n" , rc); +CERROR ("%s: cannot initialize lock pool, rc = %d\n" , name, rc); goto out_proc; }
@@ -736,7 +746,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,kfree (ns); out_ref:ldlm_put_ref (); -return NULL ; +return ERR_PTR (rc); }EXPORT_SYMBOL (ldlm_namespace_new);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 29/41 lustre: llite: remove unused ll_teardown_mmaps()
In reply to James SimmonsFrom: Andreas Dilger <[email protected]>
The ll_teardown_mmaps() function is no longer used and can be removed.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12477
Lustre-commit: 647c96562b27cef ("LU-12477 llite: remove unused ll_teardown_mmaps()")
Reviewed-on: https://review.whamcloud.com/41086
--- fs/lustre/llite/llite_internal.h | 1 - fs/lustre/llite/llite_mmap.c | 17 ----------------- 2 files changed, 18 deletions(-)
fs/lustre/llite/llite_internal.h +0 -1
@@ -1265,7 +1265,6 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write,/* llite/llite_mmap.c */ -int ll_teardown_mmaps (struct address_space *mapping,u64 first,u64 last);int ll_file_mmap (struct file *file,struct vm_area_struct *vma);void policy_from_vma (union ldlm_policy_data *policy,struct vm_area_struct *vma,unsigned long addr,size_t count);
fs/lustre/llite/llite_mmap.c +0 -17
@@ -511,23 +511,6 @@ static void ll_vm_close(struct vm_area_struct *vma)pcc_vm_close (vma); } -/* XXX put nice comment here. talk about __free_pte -> dirty pages and -* nopage's reference passing to the pte -*/ -int ll_teardown_mmaps (struct address_space *mapping,u64 first,u64 last) -{ -int rc = -ENOENT ; - -LASSERTF (last > first,"last %llu first %llu\n" , last, first); -if (mapping_mapped (mapping)) { - rc =0 ; -unmap_mapping_range (mapping, first +PAGE_SIZE -1 , - last - first +1 ,0 ); - } - -return rc; -} -static const struct vm_operations_struct ll_file_vm_ops = { .fault = ll_fault, .page_mkwrite = ll_page_mkwrite,
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 30/41 lustre: lov: style cleanups in lov_set_osc_active()
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
1/ don't pre-declare the function as it is not used before it
is defined.
2/ " TEST ? 1 : 0" is identical to "TEST", so remove the "? 1 : 0". 3/ When the 'then' part of an 'if' ends with a goto, there is
not point having an 'else', particularly if there is also code in the block following the "if". The 'else' code and the following code should be together.
4/ other minor changes, and conversion of spaces to tabs.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: cab152600ebe8a0 ("LU-6142 lov: style cleanups in lov_set_osc_active()")
Reviewed-on: https://review.whamcloud.com/39382
--- fs/lustre/lov/lov_obd.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
fs/lustre/lov/lov_obd.c +7 -10
@@ -114,8 +114,6 @@ void lov_tgts_putref(struct obd_device *obd) } } -static int lov_set_osc_active (struct obd_device *obd,struct obd_uuid *uuid, -enum obd_notify_event ev);static int lov_notify (struct obd_device *obd,struct obd_device *watched,enum obd_notify_event ev);
@@ -354,7 +352,8 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, {struct lov_obd *lov = &obd->u.lov;struct lov_tgt_desc *tgt; -int index, activate, active; +int index; +bool activate, active;CDEBUG (D_INFO ,"Searching in lov %p for uuid %s event(%d)\n" , lov, uuid->uuid, ev);
@@ -362,9 +361,7 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,lov_tgts_getref (obd);for (index =0 ; index < lov->desc.ld_tgt_count; index++) { tgt = lov->lov_tgts[index]; -if (!tgt) -continue ; -if (obd_uuid_equals (uuid, &tgt->ltd_uuid)) +if (tgt &&obd_uuid_equals (uuid, &tgt->ltd_uuid))break ; }
@@ -374,7 +371,7 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, }if (ev ==OBD_NOTIFY_DEACTIVATE || ev ==OBD_NOTIFY_ACTIVATE ) { - activate = (ev ==OBD_NOTIFY_ACTIVATE ) ?1 :0 ; + activate = (ev ==OBD_NOTIFY_ACTIVATE );/* * LU-642, initially inactive OSC could miss the obd_connect,
@@ -401,9 +398,8 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,CDEBUG (D_CONFIG ,"%sactivate OSC %s\n" , activate ?"" :"de" ,obd_uuid2str (uuid)); } - }else if (ev ==OBD_NOTIFY_INACTIVE || ev ==OBD_NOTIFY_ACTIVE ) { - active = (ev ==OBD_NOTIFY_ACTIVE ) ?1 :0 ; + active = (ev ==OBD_NOTIFY_ACTIVE );if (lov->lov_tgts[index]->ltd_active == active) { CDEBUG(D_INFO, "OSC %s already %sactive!\n",
@@ -422,7 +418,8 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, lov->lov_tgts[index]->ltd_exp->exp_obd->obd_inactive =1 ; } }else { -CERROR ("Unknown event(%d) for uuid %s" , ev, uuid->uuid); +CERROR ("%s: unknown event %d for uuid %s\n" , obd->obd_name, + ev, uuid->uuid); }if (tgt->ltd_exp)
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 31/41 lustre: change various operations structs to const
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
Nearly all of
struct cl_io_operations
struct cl_lock_operations
struct super_operations
struct llog_operations
are now const. The one exception is changelog_orig_logops.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: c20b866ba374ea3 ("LU-6142 lustre: change various operations structs to const")
Reviewed-on: https://review.whamcloud.com/39400
--- fs/lustre/include/lustre_log.h | 10 +++++----- fs/lustre/include/lustre_net.h | 2 +- fs/lustre/llite/llite_internal.h | 2 +- fs/lustre/llite/super25.c | 2 +- fs/lustre/mdc/mdc_dev.c | 2 +- fs/lustre/obdclass/llog.c | 4 ++-- fs/lustre/obdclass/llog_obd.c | 2 +- fs/lustre/ptlrpc/llog_client.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-)
fs/lustre/include/lustre_log.h +5 -5
@@ -134,7 +134,7 @@ int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,/* llog_obd.c */ int llog_setup (const struct lu_env *env,struct obd_device *obd,struct obd_llog_group *olg,int index, -struct obd_device *disk_obd,struct llog_operations *op); +struct obd_device *disk_obd,const struct llog_operations *op);int __llog_ctxt_put (const struct lu_env *env,struct llog_ctxt *ctxt);int llog_cleanup (const struct lu_env *env,struct llog_ctxt *);
@@ -225,7 +225,7 @@ struct llog_handle { } u;char *lgh_name;void *private_data; -struct llog_operations *lgh_logops; +const struct llog_operations *lgh_logops;refcount_t lgh_refcount;bool lgh_destroyed; };
@@ -241,7 +241,7 @@ struct llog_ctxt {struct obd_import *loc_imp;/* to use in RPC's: can be backward * pointing import */ -struct llog_operations *loc_logops; +const struct llog_operations *loc_logops;struct llog_handle *loc_handle;struct mutex loc_mutex;/* protect loc_imp */ refcount_t loc_refcount;
@@ -257,7 +257,7 @@ struct llog_ctxt {#define LLOG_DEL_RECORD 0x0002static inline int llog_handle2ops (struct llog_handle *loghandle, -struct llog_operations **lop) +const struct llog_operations **lop) {if (!loghandle || !loghandle->lgh_logops)return -EINVAL ;
@@ -351,7 +351,7 @@ static inline int llog_next_block(const struct lu_env *env, int next_idx, u64 *cur_offset, void *buf, int len) { - struct llog_operations *lop; + const struct llog_operations *lop;int rc; rc =llog_handle2ops (loghandle, &lop);
fs/lustre/include/lustre_net.h +1 -1
@@ -2409,7 +2409,7 @@ enum timeout_event {/** @} */ /* ptlrpc/llog_client.c */ -extern struct llog_operations llog_client_ops; +extern const struct llog_operations llog_client_ops;/** @} net */ #endif
fs/lustre/llite/llite_internal.h +1 -1
@@ -1131,7 +1131,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request, struct lookup_intent *it, struct inode *inode);/* llite/llite_lib.c */ -extern struct super_operations lustre_super_operations; +extern const struct super_operations lustre_super_operations;void ll_common_put_super (struct super_block *sb);void ll_lli_init (struct ll_inode_info *lli);
fs/lustre/llite/super25.c +1 -1
@@ -83,7 +83,7 @@ static int ll_drop_inode(struct inode *inode) }/* exported operations */ -struct super_operations lustre_super_operations = { +const struct super_operations lustre_super_operations = { .alloc_inode = ll_alloc_inode, .destroy_inode = ll_destroy_inode, .drop_inode = ll_drop_inode,
fs/lustre/mdc/mdc_dev.c +1 -1
@@ -1284,7 +1284,7 @@ static void mdc_io_data_version_end(const struct lu_env *env, } } -static struct cl_io_operations mdc_io_ops = { +static const struct cl_io_operations mdc_io_ops = { .op = { [CIT_READ ] = { .cio_iter_init = osc_io_rw_iter_init,
fs/lustre/obdclass/llog.c +2 -2
@@ -100,7 +100,7 @@ int llog_handle_put(const struct lu_env *env, struct llog_handle *loghandle)int rc =0 ;if (refcount_dec_and_test (&loghandle->lgh_refcount)) { -struct llog_operations *lop; +const struct llog_operations *lop; rc =llog_handle2ops (loghandle, &lop);if (!rc) {
@@ -118,7 +118,7 @@ static int llog_read_header(const struct lu_env *env,struct llog_handle *handle, struct obd_uuid *uuid) { - struct llog_operations *lop; + const struct llog_operations *lop;int rc; rc =llog_handle2ops (handle, &lop);
fs/lustre/obdclass/llog_obd.c +1 -1
@@ -135,7 +135,7 @@ int llog_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt)int llog_setup (const struct lu_env *env,struct obd_device *obd,struct obd_llog_group *olg,int index, -struct obd_device *disk_obd,struct llog_operations *op) +struct obd_device *disk_obd,const struct llog_operations *op) {struct llog_ctxt *ctxt;int rc =0 ;
fs/lustre/ptlrpc/llog_client.c +1 -1
@@ -352,7 +352,7 @@ static int llog_client_close(const struct lu_env *env,return 0 ; } -struct llog_operations llog_client_ops = { +const struct llog_operations llog_client_ops = { .lop_next_block = llog_client_next_block, .lop_prev_block = llog_client_prev_block, .lop_read_header = llog_client_read_header,
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 32/41 lustre: mark strings in char arrays as const
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
Most array of strings are marked 'const', but the strings within the arrays often aren't.
This patch mark all strings in const arrays of strings as const. This allows them to be placed in read-only memory.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: 734d6eb11b572a9a ("LU-6142 lustre: mark strings in char arrays as const")
Reviewed-on: https://review.whamcloud.com/39742
--- fs/lustre/include/obd_cksum.h | 2 +- fs/lustre/llite/lproc_llite.c | 2 +- include/uapi/linux/lustre/lustre_user.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
fs/lustre/include/obd_cksum.h +1 -1
@@ -127,7 +127,7 @@ enum cksum_types obd_cksum_type_select(const char *obd_name,/* Checksum algorithm names. Must be defined in the same order as the * OBD_CKSUM_* flags. */ -#define DECLARE_CKSUM_NAME const char *cksum_name[] = {"crc32", "adler", \ +#define DECLARE_CKSUM_NAME const char *const cksum_name[] = {"crc32", "adler", \ "crc32c", "reserved", "t10ip512", "t10ip4K", "t10crc512", "t10crc4K"}typedef u16 (obd_dif_csum_fn ) (void *,unsigned int );
fs/lustre/llite/lproc_llite.c +1 -1
@@ -995,7 +995,7 @@ static ssize_t default_easize_store(struct kobject *kobj,static int ll_sbi_flags_seq_show (struct seq_file *m,void *v) { -const char *str[] =LL_SBI_FLAGS ; +const char *const str[] =LL_SBI_FLAGS ;struct super_block *sb = m->private;int flags =ll_s2sbi (sb)->ll_flags;int i =0 ;
include/uapi/linux/lustre/lustre_user.h +1 -1
@@ -1213,7 +1213,7 @@ enum changelog_rec_type {static inline const char *changelog_type2str (int type) { -static const char *changelog_str[] = { +static const char *const changelog_str[] = {"MARK" ,"CREAT" ,"MKDIR" ,"HLINK" ,"SLINK" ,"MKNOD" ,"UNLNK" ,"RMDIR" ,"RENME" ,"RNMTO" ,"OPEN" ,"CLOSE" ,"LYOUT" ,"TRUNC" ,"SATTR" ,"XATTR" ,"HSM" ,"MTIME" ,"CTIME" ,"ATIME" ,"" ,
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 33/41 lustre: convert snprintf to scnprintf as appropriate
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
The return value of snprintf() is the number of bytes that would have been copies into the buffer if it was large enough.
Many places in the code use it as though it were the number of bytes actually copied. In practice this (almost?) never makes a difference. However it is poor style to use the wrong interfaces as it might one day be copied to somewhere that it does make a difference.
So change these instances of snprintf to scnprintf which DOES return the number of bytes actually copied.
This is all places where the return value is simply returned to the call, and a couple of others.
Also change the declared buffer size in a couple of places to the actual buffer size (PAGE_SIZE in these cases).
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: a03765b2da70fb92 ("LU-6142 lustre: convert snprintf to scnprintf as appropriate")
Reviewed-on: https://review.whamcloud.com/39744
--- fs/lustre/llite/lproc_llite.c | 30 +++++++++++++++--------------- fs/lustre/llite/pcc.c | 38 +++++++++++++++++++------------------- fs/lustre/obdclass/obd_sysfs.c | 6 +++--- 3 files changed, 37 insertions(+), 37 deletions(-)
fs/lustre/llite/lproc_llite.c +15 -15
@@ -726,7 +726,7 @@ static ssize_t statahead_running_max_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,16 ,"%u\n" , sbi->ll_sa_running_max); +return scnprintf (buf,16 ,"%u\n" , sbi->ll_sa_running_max); } static ssize_t statahead_running_max_store(struct kobject *kobj,
@@ -882,7 +882,7 @@ static ssize_t statfs_max_age_show(struct kobject *kobj, struct attribute *attr, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%u\n" , sbi->ll_statfs_max_age); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , sbi->ll_statfs_max_age); } static ssize_t statfs_max_age_store(struct kobject *kobj,
@@ -920,8 +920,8 @@ static ssize_t max_easize_show(struct kobject *kobj,return rc;/* Limit xattr size returned to userspace based on kernel maximum */ -return snprintf (buf,PAGE_SIZE ,"%u\n" , - ealen >XATTR_SIZE_MAX ?XATTR_SIZE_MAX : ealen); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , + ealen >XATTR_SIZE_MAX ?XATTR_SIZE_MAX : ealen); }LUSTRE_RO_ATTR (max_easize);
@@ -951,8 +951,8 @@ static ssize_t default_easize_show(struct kobject *kobj,return rc;/* Limit xattr size returned to userspace based on kernel maximum */ -return snprintf (buf,PAGE_SIZE ,"%u\n" , - ealen >XATTR_SIZE_MAX ?XATTR_SIZE_MAX : ealen); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , + ealen >XATTR_SIZE_MAX ?XATTR_SIZE_MAX : ealen); }/**
@@ -1094,8 +1094,8 @@ static ssize_t max_read_ahead_async_active_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%u\n" , - sbi->ll_ra_info.ra_async_max_active); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , + sbi->ll_ra_info.ra_async_max_active); } static ssize_t max_read_ahead_async_active_store(struct kobject *kobj,
@@ -1139,8 +1139,8 @@ static ssize_t read_ahead_async_file_threshold_mb_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%lu\n" , -PAGES_TO_MiB (sbi->ll_ra_info.ra_async_pages_per_file_threshold)); +return scnprintf (buf,PAGE_SIZE ,"%lu\n" , +PAGES_TO_MiB (sbi->ll_ra_info.ra_async_pages_per_file_threshold)); } static ssize_t
@@ -1260,8 +1260,8 @@ static ssize_t file_heat_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%u\n" , - !!(sbi->ll_flags &LL_SBI_FILE_HEAT )); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , + !!(sbi->ll_flags &LL_SBI_FILE_HEAT )); } static ssize_t file_heat_store(struct kobject *kobj,
@@ -1296,8 +1296,8 @@ static ssize_t heat_decay_percentage_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%u\n" , - (sbi->ll_heat_decay_weight *100 +128 ) /256 ); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , + (sbi->ll_heat_decay_weight *100 +128 ) /256 ); } static ssize_t heat_decay_percentage_store(struct kobject *kobj,
@@ -1330,7 +1330,7 @@ static ssize_t heat_period_second_show(struct kobject *kobj, struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, ll_kset.kobj); -return snprintf (buf,PAGE_SIZE ,"%u\n" , sbi->ll_heat_period_second); +return scnprintf (buf,PAGE_SIZE ,"%u\n" , sbi->ll_heat_period_second); } static ssize_t heat_period_second_store(struct kobject *kobj,
fs/lustre/llite/pcc.c +19 -19
@@ -1088,15 +1088,15 @@ void pcc_inode_free(struct inode *inode)#define MAX_PCC_DATABASE_PATH (6 * 5 + FID_NOBRACE_LEN + 1)static int pcc_fid2dataset_path (char *buf,int sz,struct lu_fid *fid) { -return snprintf (buf, sz,"%04x/%04x/%04x/%04x/%04x/%04x/" -DFID_NOBRACE , - (fid)->f_oid &0xFFFF , - (fid)->f_oid >>16 &0xFFFF , - (unsigned int )((fid)->f_seq &0xFFFF ), - (unsigned int )((fid)->f_seq >>16 &0xFFFF ), - (unsigned int )((fid)->f_seq >>32 &0xFFFF ), - (unsigned int )((fid)->f_seq >>48 &0xFFFF ), -PFID (fid)); +return scnprintf (buf, sz,"%04x/%04x/%04x/%04x/%04x/%04x/" +DFID_NOBRACE , + (fid)->f_oid &0xFFFF , + (fid)->f_oid >>16 &0xFFFF , + (unsigned int )((fid)->f_seq &0xFFFF ), + (unsigned int )((fid)->f_seq >>16 &0xFFFF ), + (unsigned int )((fid)->f_seq >>32 &0xFFFF ), + (unsigned int )((fid)->f_seq >>48 &0xFFFF ), +PFID (fid)); }static inline const struct cred *pcc_super_cred (struct super_block *sb)
@@ -1163,16 +1163,16 @@ static int pcc_get_layout_info(struct inode *inode, struct cl_layout *clt)static int pcc_fid2dataset_fullpath (char *buf,int sz,struct lu_fid *fid,struct pcc_dataset *dataset) { -return snprintf (buf, sz,"%s/%04x/%04x/%04x/%04x/%04x/%04x/" -DFID_NOBRACE , - dataset->pccd_pathname, - (fid)->f_oid &0xFFFF , - (fid)->f_oid >>16 &0xFFFF , - (unsigned int )((fid)->f_seq &0xFFFF ), - (unsigned int )((fid)->f_seq >>16 &0xFFFF ), - (unsigned int )((fid)->f_seq >>32 &0xFFFF ), - (unsigned int )((fid)->f_seq >>48 &0xFFFF ), -PFID (fid)); +return scnprintf (buf, sz,"%s/%04x/%04x/%04x/%04x/%04x/%04x/" +DFID_NOBRACE , + dataset->pccd_pathname, + (fid)->f_oid &0xFFFF , + (fid)->f_oid >>16 &0xFFFF , + (unsigned int )((fid)->f_seq &0xFFFF ), + (unsigned int )((fid)->f_seq >>16 &0xFFFF ), + (unsigned int )((fid)->f_seq >>32 &0xFFFF ), + (unsigned int )((fid)->f_seq >>48 &0xFFFF ), +PFID (fid)); }/* Must be called with pcci->pcci_lock held */
fs/lustre/obdclass/obd_sysfs.c +3 -3
@@ -218,7 +218,7 @@ static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr,static ssize_t jobid_var_show (struct kobject *kobj,struct attribute *attr,char *buf) { -return snprintf (buf,PAGE_SIZE ,"%s\n" , obd_jobid_var); +return scnprintf (buf,PAGE_SIZE ,"%s\n" , obd_jobid_var); } static ssize_t jobid_var_store(struct kobject *kobj, struct attribute *attr,
@@ -252,7 +252,7 @@ static ssize_t jobid_var_store(struct kobject *kobj, struct attribute *attr,static ssize_t jobid_name_show (struct kobject *kobj,struct attribute *attr,char *buf) { -return snprintf (buf,PAGE_SIZE ,"%s\n" , obd_jobid_name); +return scnprintf (buf,PAGE_SIZE ,"%s\n" , obd_jobid_name); } static ssize_t jobid_name_store(struct kobject *kobj, struct attribute *attr,
@@ -283,7 +283,7 @@ static ssize_t jobid_this_session_show(struct kobject *kobj,rcu_read_lock (); jid =jobid_current ();if (jid) - ret =snprintf (buf,PAGE_SIZE ,"%s\n" , jid); + ret =scnprintf (buf,PAGE_SIZE ,"%s\n" , jid);rcu_read_unlock ();return ret; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 34/41 lustre: remove non-static 'inline' markings.
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
There is rarely any point in marking a non-static function as 'inline'. The result is to compile a state-alone function that other files can refer to, and also to inline the code where it is used in the same file.
In many cases the non-static inline functions are not used in the same file, so the 'inline' marking has no effect. In other cases it may have an effect, but it can only be needed in highly performance critical situations where a function call must be avoided, and that doesn't seem like in any of these cases.
So just remove the "inline".
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: f0736a6a52ed9581 ("LU-6142 lustre: remove non-static 'inline' markings.")
Reviewed-on: https://review.whamcloud.com/40289
--- fs/lustre/llite/crypto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/lustre/llite/crypto.c +3 -3
@@ -114,7 +114,7 @@ static int ll_set_context(struct inode *inode, const void *ctx, size_t len,#define llcrypto_free_ctx kfree -inline bool ll_sbi_has_test_dummy_encryption (struct ll_sb_info *sbi) +bool ll_sbi_has_test_dummy_encryption (struct ll_sb_info *sbi) {return unlikely (sbi->ll_flags &LL_SBI_TEST_DUMMY_ENCRYPTION ); }
@@ -126,12 +126,12 @@ static bool ll_dummy_context(struct inode *inode)return sbi ?ll_sbi_has_test_dummy_encryption (sbi) : false; } -inline bool ll_sbi_has_encrypt (struct ll_sb_info *sbi) +bool ll_sbi_has_encrypt (struct ll_sb_info *sbi) {return sbi->ll_flags &LL_SBI_ENCRYPT ; } -inline void ll_sbi_set_encrypt (struct ll_sb_info *sbi,bool set) +void ll_sbi_set_encrypt (struct ll_sb_info *sbi,bool set) {if (set) sbi->ll_flags |=LL_SBI_ENCRYPT ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 35/41 lustre: llite: use is_root_inode()
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
Lustre has multiple tests to see if a given inode is the root of the filesystem. Linux has (since 3.19) a helper function is_root_inode(). Use that throughout.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: fca56be02b8fe074 ("LU-6142 lustre: use is_root_inode()")
Reviewed-on: https://review.whamcloud.com/40293
--- fs/lustre/llite/crypto.c | 2 +- fs/lustre/llite/file.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/lustre/llite/crypto.c +1 -1
@@ -100,7 +100,7 @@ static int ll_set_context(struct inode *inode, const void *ctx, size_t len, }/* Encrypting the root directory is not allowed */ -if (inode->i_ino == inode->i_sb->s_root->d_inode->i_ino) +if (is_root_inode (inode))return -EPERM ; dentry = (struct dentry *)fs_data;
fs/lustre/llite/file.c +2 -2
@@ -421,7 +421,7 @@ int ll_file_release(struct inode *inode, struct file *file)libcfs_debug_dumplog (); out: -if (!rc && inode->i_sb->s_root !=file_dentry (file)) +if (!rc && !is_root_inode (inode))ll_stats_ops_tally (sbi,LPROC_LL_RELEASE ,ktime_us_delta (ktime_get (), kstart));return rc;
@@ -4455,7 +4455,7 @@ int ll_migrate(struct inode *parent, struct file *file, struct lmv_user_md *lum,* by checking the migrate FID against the FID of the * filesystem root. */ -if (child_inode == parent->i_sb->s_root->d_inode) { +if (is_root_inode (child_inode)) { rc = -EINVAL ; goto out_iput; }
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 36/41 lnet: libcfs: discard cfs_firststr
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
The effect of cfs_firststr() can easily achieved with skip_space() and strsep().
So use that instead.
WC-bug-id: https://jira.whamcloud.com/browse/LU-6142
Lustre-commit: ee5eb07d2f41ac60 ("LU-6142 libcfs: discard cfs_firststr")
Reviewed-on: https://review.whamcloud.com/40860
--- net/lnet/libcfs/libcfs_string.c | 28 ---------------------------- 1 file changed, 28 deletions(-)
net/lnet/libcfs/libcfs_string.c +0 -28
@@ -115,34 +115,6 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),return 0 ; } -/* get the first string out of @str */ -char *cfs_firststr (char *str,size_t size) -{ -size_t i =0 ; -char *end; - -/* trim leading spaces */ -while (i < size && *str &&isspace (*str)) { - ++i; - ++str; - } - -/* string with all spaces */ -if (*str =='\0' ) - goto out; - - end = str; -while (i < size && *end !='\0' && !isspace (*end)) { - ++i; - ++end; - } - - *end ='\0' ; -out: -return str; -} -EXPORT_SYMBOL (cfs_firststr); -/** * Extracts tokens from strings. *
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 37/41 lnet: place wire protocol data int own headers
In reply to James SimmonsThis macro adds nothing of value, and make the code harder to read for new readers so it was remove for the Linux client. We still want to keep track of what data structures are transmitted over the wire and ensure the protocol does not get broken. Move the wire protocol structures to their own header files and add wire checking.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: 6ae187404a8d7f8a ("LU-12678 lnet: discard WIRE_ATTR")
Reviewed-on: https://review.whamcloud.com/37914
--- include/uapi/linux/lnet/libcfs_debug.h | 1 + include/uapi/linux/lnet/libcfs_ioctl.h | 1 + include/uapi/linux/lnet/lnet-dlc.h | 1 + include/uapi/linux/lnet/lnet-idl.h | 241 +++++++++++++++++++++++++++++++++ include/uapi/linux/lnet/lnet-types.h | 203 +-------------------------- include/uapi/linux/lnet/lnetctl.h | 1 + include/uapi/linux/lnet/lnetst.h | 2 + include/uapi/linux/lnet/nidstr.h | 1 + include/uapi/linux/lnet/socklnd.h | 1 + net/lnet/klnds/o2iblnd/o2iblnd-idl.h | 157 +++++++++++++++++++++ net/lnet/klnds/o2iblnd/o2iblnd.c | 166 ++++++++++++++++++++++- net/lnet/klnds/o2iblnd/o2iblnd.h | 114 +--------------- net/lnet/lnet/api-ni.c | 49 ++++++- 13 files changed, 616 insertions(+), 322 deletions(-) create mode 100644 include/uapi/linux/lnet/lnet-idl.h create mode 100644 net/lnet/klnds/o2iblnd/o2iblnd-idl.h
include/uapi/linux/lnet/libcfs_debug.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * GPL HEADER START *
include/uapi/linux/lnet/libcfs_ioctl.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * GPL HEADER START *
include/uapi/linux/lnet/lnet-dlc.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: LGPL-2.0+ WITH Linux-syscall-note */ /* * LGPL HEADER START *
include/uapi/linux/lnet/lnet-idl.h new file +241 -0
241 lines not on this page · raw message
include/uapi/linux/lnet/lnet-types.h +2 -201
230 lines not on this page · raw message
include/uapi/linux/lnet/lnetctl.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file is part of Portals, http://www.sf.net/projects/lustre/ *
include/uapi/linux/lnet/lnetst.h +2 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * GPL HEADER START *
@@ -556,6 +557,7 @@ struct lst_test_ping_param {int png_flags;/* reserved flags */ }; +/* Both struct srpc_counters and struct sfw_counters are sent over the wire */ struct srpc_counters {__u32 errors;__u32 rpcs_sent;
include/uapi/linux/lnet/nidstr.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * GPL HEADER START *
include/uapi/linux/lnet/socklnd.h +1 -0
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * GPL HEADER START *
net/lnet/klnds/o2iblnd/o2iblnd-idl.h new file +157 -0
157 lines not on this page · raw message
net/lnet/klnds/o2iblnd/o2iblnd.c +159 -7
178 lines not on this page · raw message
net/lnet/klnds/o2iblnd/o2iblnd.h +1 -113
126 lines not on this page · raw message
net/lnet/lnet/api-ni.c +48 -1
61 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 38/41 lnet: libcfs: use wait_event_timeout() in tracefiled().
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
By using wait_event_timeout() we can make it more clear what is being waited for, and when the loop terminates.
WC-bug-id: https://jira.whamcloud.com/browse/LU-9859
Lustre-commit: 0269ac4a0069b0e4 ("LU-9859 libcfs: use wait_event_timeout() in tracefiled().")
Reviewed-on: https://review.whamcloud.com/39293
--- net/lnet/libcfs/tracefile.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
net/lnet/libcfs/tracefile.c +15 -22
@@ -1085,13 +1085,18 @@ static int tracefiled(void *arg)complete (&tctl->tctl_start); -while (1 ) { -wait_queue_entry_t __wait; - - pc.pc_want_daemon_pages =0 ; -collect_pages (&pc); + pc.pc_want_daemon_pages =0 ; + +while (!last_loop) { +wait_event_timeout (tctl->tctl_waitq, + ({collect_pages (&pc); + !list_empty (&pc.pc_pages); }) || +atomic_read (&tctl->tctl_shutdown), +HZ ); +if (atomic_read (&tctl->tctl_shutdown)) + last_loop =1 ;if (list_empty (&pc.pc_pages)) - goto end_loop; +continue ; filp =NULL ;down_read (&cfs_tracefile_sem);
@@ -1110,18 +1115,19 @@ static int tracefiled(void *arg)if (!filp) {put_pages_on_daemon_list (&pc);__LASSERT (list_empty (&pc.pc_pages)); - goto end_loop; +continue ; }list_for_each_entry_safe (tage, tmp, &pc.pc_pages, linkage) { +struct dentry *de =file_dentry (filp);static loff_t f_pos;__LASSERT_TAGE_INVARIANT (tage);if (f_pos >= (off_t )cfs_tracefile_size) f_pos =0 ; -else if (f_pos >i_size_read (file_inode (filp))) - f_pos =i_size_read (file_inode (filp)); +else if (f_pos >i_size_read (de->d_inode)) + f_pos =i_size_read (de->d_inode); buf =kmap (tage->page); rc =kernel_write (filp, buf, tage->used, &f_pos);
@@ -1158,19 +1164,6 @@ static int tracefiled(void *arg)pr_err ("Lustre: There are %d pages unwritten\n" , i); }__LASSERT (list_empty (&pc.pc_pages)); -end_loop: -if (atomic_read (&tctl->tctl_shutdown)) { -if (!last_loop) { - last_loop =1 ; -continue ; - }else { -break ; - } - } -init_wait (&__wait); -add_wait_queue (&tctl->tctl_waitq, &__wait); -schedule_timeout_interruptible (HZ ); -remove_wait_queue (&tctl->tctl_waitq, &__wait); }complete (&tctl->tctl_stop);return 0 ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 39/41 lnet: use init_wait() rather than init_waitqueue_entry()
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
init_waitqueue_entry(foo, current)
is equivalent to
init_wait(foo)
So use the shorter version.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: dd0e7523e10202d2 ("LU-12678 lnet: use init_wait() rather than init_waitqueue_entry()")
Reviewed-on: https://review.whamcloud.com/39295
--- net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 6 +++--- net/lnet/klnds/socklnd/socklnd_cb.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +3 -3
@@ -3389,7 +3389,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,int peer_index =0 ;unsigned long deadline = jiffies; -init_waitqueue_entry (&wait, current); +init_wait (&wait); kiblnd_data.kib_connd = current;spin_lock_irqsave (lock, flags);
@@ -3680,7 +3680,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,int did_something;int rc; -init_waitqueue_entry (&wait, current); +init_wait (&wait); sched = kiblnd_data.kib_scheds[KIB_THREAD_CPT (id)];
@@ -3812,7 +3812,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,LASSERT (*kiblnd_tunables.kib_dev_failover); -init_waitqueue_entry (&wait, current); +init_wait (&wait);write_lock_irqsave (glock, flags);while (!kiblnd_data.kib_shutdown) {
net/lnet/klnds/socklnd/socklnd_cb.c +2 -2
@@ -2075,7 +2075,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)wait_queue_entry_t wait;int cons_retry =0 ; -init_waitqueue_entry (&wait, current); +init_wait (&wait);spin_lock_bh (connd_lock);
@@ -2458,7 +2458,7 @@ void ksocknal_write_callback(struct ksock_conn *conn)int peer_index =0 ;time64_t deadline =ktime_get_seconds (); -init_waitqueue_entry (&wait, current); +init_wait (&wait);spin_lock_bh (&ksocknal_data.ksnd_reaper_lock);
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 40/41 lnet: discard LNET_MD_PHYS
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
This macro has no value and is never set.
It claims "compatibility with Cray Portals", yet cray-dvs
git://github.com/glennklockwood/cray-dvs.git
does not use it in any non-trivial way.
Much has changed in lnet and lib-md since 2007 when this value was added - it seems likely that this really is dead.
So remove it. If/when this results in problems, it can easily be re-added and more details can be provided at that time.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: aa57e829867caa9 ("LU-12678 lnet: discard LNET_MD_PHYS")
Reviewed-on: https://review.whamcloud.com/39301
--- fs/lustre/ptlrpc/pers.c | 1 - include/uapi/linux/lnet/lnet-types.h | 3 --- 2 files changed, 4 deletions(-)
fs/lustre/ptlrpc/pers.c +0 -1
@@ -50,7 +50,6 @@ void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc,LASSERT (mdidx < desc->bd_md_max_brw);LASSERT (desc->bd_iov_count <=PTLRPC_MAX_BRW_PAGES ); -LASSERT (!(md->options & (LNET_MD_KIOV |LNET_MD_PHYS )));/* just send a lnet header */ if (mdidx >= desc->bd_md_count) {
include/uapi/linux/lnet/lnet-types.h +0 -3
@@ -357,9 +357,6 @@ struct lnet_md {/** See struct lnet_md::options. */ #define LNET_MD_NO_TRACK_RESPONSE (1 << 11) -/* For compatibility with Cray Portals */ -#define LNET_MD_PHYS 0 -/** Infinite threshold on MD operations. See lnet_md::threshold */ #define LNET_MD_THRESH_INF (-1)
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
PATCH 41/41 lnet: o2iblnd: convert peers hash table to hashtable.h
In reply to James SimmonsFrom: Mr NeilBrown <[email protected]>
Using a hashtable.h hashtable, rather than bespoke code, has several advantages:
- the table is comprised of hlist_head, rather than list_head, so it consumes less memory (though we need to make it a little bigger as it must be a power-of-2)
- there are existing macros for easily walking the whole table
- it uses a "real" hash function rather than "mod a prime number".
In some ways, rhashtable might be even better, but it can change the ordering of objects in the table are arbitrary moments, and that could hurt the user-space API. It also does not support the partitioned walking that ksocknal_check_peer_timeouts() depends on.
Note that new peers are inserted at the top of a hash chain, rather than appended at the end. I don't think that should be a problem.
Also various white-space cleanups etc.
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: c66668387a11492e ("LU-12678 o2iblnd: convert peers hash table to hashtable.h")
Reviewed-on: https://review.whamcloud.com/39303
--- net/lnet/klnds/o2iblnd/o2iblnd.c | 101 +++++++++++++++--------------------- net/lnet/klnds/o2iblnd/o2iblnd.h | 19 ++----- net/lnet/klnds/o2iblnd/o2iblnd_cb.c | 12 ++--- 3 files changed, 52 insertions(+), 80 deletions(-)
net/lnet/klnds/o2iblnd/o2iblnd.c +42 -59
@@ -339,7 +339,7 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, peer_ni->ibp_queue_depth_mod =0 ;/* try to use the default */ atomic_set (&peer_ni->ibp_refcount,1 );/* 1 ref for caller */ -INIT_LIST_HEAD (&peer_ni->ibp_list); +INIT_HLIST_NODE (&peer_ni->ibp_list);INIT_LIST_HEAD (&peer_ni->ibp_conns);INIT_LIST_HEAD (&peer_ni->ibp_tx_queue);
@@ -385,10 +385,10 @@ struct kib_peer_ni *kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid)* the caller is responsible for accounting the additional reference * that this creates */ -struct list_head *peer_list =kiblnd_nid2peerlist (nid);struct kib_peer_ni *peer_ni; -list_for_each_entry (peer_ni, peer_list, ibp_list) { +hash_for_each_possible (kiblnd_data.kib_peers, peer_ni, + ibp_list, nid) {LASSERT (!kiblnd_peer_idle (peer_ni));/*
@@ -415,7 +415,7 @@ void kiblnd_unlink_peer_locked(struct kib_peer_ni *peer_ni)LASSERT (list_empty (&peer_ni->ibp_conns));LASSERT (kiblnd_peer_active (peer_ni)); -list_del_init (&peer_ni->ibp_list); +hlist_del_init (&peer_ni->ibp_list);/* lose peerlist's ref */ kiblnd_peer_decref (peer_ni); }
@@ -429,24 +429,20 @@ static int kiblnd_get_peer_info(struct lnet_ni *ni, int index,read_lock_irqsave (&kiblnd_data.kib_global_lock, flags); -for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) { -list_for_each_entry (peer_ni, &kiblnd_data.kib_peers[i], - ibp_list) { -LASSERT (!kiblnd_peer_idle (peer_ni)); +hash_for_each (kiblnd_data.kib_peers, i, peer_ni, ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer_ni->ibp_ni != ni) -continue ; +if (peer_ni->ibp_ni != ni) +continue ; -if (index-- >0 ) -continue ; +if (index-- >0 ) +continue ; - *nidp = peer_ni->ibp_nid; - *count =atomic_read (&peer_ni->ibp_refcount); + *nidp = peer_ni->ibp_nid; + *count =atomic_read (&peer_ni->ibp_refcount); -read_unlock_irqrestore (&kiblnd_data.kib_global_lock, - flags); -return 0 ; - } +read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags); +return 0 ; }read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags);
@@ -476,7 +472,7 @@ static void kiblnd_del_peer_locked(struct kib_peer_ni *peer_ni)static int kiblnd_del_peer (struct lnet_ni *ni,lnet_nid_t nid) {LIST_HEAD (zombies); -struct kib_peer_ni *pnxt; +struct hlist_node *pnxt;struct kib_peer_ni *peer_ni;int lo;int hi;
@@ -487,16 +483,16 @@ static int kiblnd_del_peer(struct lnet_ni *ni, lnet_nid_t nid)write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);if (nid !=LNET_NID_ANY ) { - lo =kiblnd_nid2peerlist (nid) - kiblnd_data.kib_peers; - hi =kiblnd_nid2peerlist (nid) - kiblnd_data.kib_peers; + lo =hash_min (nid,HASH_BITS (kiblnd_data.kib_peers)); + hi = lo; }else { lo =0 ; - hi = kiblnd_data.kib_peer_hash_size -1 ; + hi =HASH_SIZE (kiblnd_data.kib_peers) -1 ; }for (i = lo; i <= hi; i++) { -list_for_each_entry_safe (peer_ni, pnxt, - &kiblnd_data.kib_peers[i], ibp_list) { +hlist_for_each_entry_safe (peer_ni, pnxt, + &kiblnd_data.kib_peers[i], ibp_list) {LASSERT (!kiblnd_peer_idle (peer_ni));if (peer_ni->ibp_ni != ni)
@@ -533,25 +529,21 @@ static struct kib_conn *kiblnd_get_conn_by_idx(struct lnet_ni *ni, int index)read_lock_irqsave (&kiblnd_data.kib_global_lock, flags); -for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) { -list_for_each_entry (peer_ni, &kiblnd_data.kib_peers[i], - ibp_list) { -LASSERT (!kiblnd_peer_idle (peer_ni)); +hash_for_each (kiblnd_data.kib_peers, i, peer_ni, ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer_ni->ibp_ni != ni) -continue ; +if (peer_ni->ibp_ni != ni) +continue ; -list_for_each_entry (conn, &peer_ni->ibp_conns, - ibc_list) { -if (index-- >0 ) -continue ; +list_for_each_entry (conn, &peer_ni->ibp_conns, + ibc_list) { +if (index-- >0 ) +continue ; -kiblnd_conn_addref (conn); -read_unlock_irqrestore ( - &kiblnd_data.kib_global_lock, - flags); -return conn; - } +kiblnd_conn_addref (conn); +read_unlock_irqrestore (&kiblnd_data.kib_global_lock, + flags); +return conn; } }
@@ -1014,7 +1006,7 @@ int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni,static int kiblnd_close_matching_conns (struct lnet_ni *ni,lnet_nid_t nid) {struct kib_peer_ni *peer_ni; -struct kib_peer_ni *pnxt; +struct hlist_node *pnxt;int lo;int hi;int i;
@@ -1024,16 +1016,16 @@ static int kiblnd_close_matching_conns(struct lnet_ni *ni, lnet_nid_t nid)write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);if (nid !=LNET_NID_ANY ) { - lo =kiblnd_nid2peerlist (nid) - kiblnd_data.kib_peers; - hi =kiblnd_nid2peerlist (nid) - kiblnd_data.kib_peers; + lo =hash_min (nid,HASH_BITS (kiblnd_data.kib_peers)); + hi = lo; }else { lo =0 ; - hi = kiblnd_data.kib_peer_hash_size -1 ; + hi =HASH_SIZE (kiblnd_data.kib_peers) -1 ; }for (i = lo; i <= hi; i++) { -list_for_each_entry_safe (peer_ni, pnxt, - &kiblnd_data.kib_peers[i], ibp_list) { +hlist_for_each_entry_safe (peer_ni, pnxt, + &kiblnd_data.kib_peers[i], ibp_list) {LASSERT (!kiblnd_peer_idle (peer_ni));if (peer_ni->ibp_ni != ni)
@@ -2499,6 +2491,7 @@ void kiblnd_destroy_dev(struct kib_dev *dev)static void kiblnd_base_shutdown (void ) {struct kib_sched_info *sched; +struct kib_peer_ni *peer_ni;int i;LASSERT (list_empty (&kiblnd_data.kib_devs));
@@ -2509,9 +2502,8 @@ static void kiblnd_base_shutdown(void)case IBLND_INIT_ALL :case IBLND_INIT_DATA : -LASSERT (kiblnd_data.kib_peers); -for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) -LASSERT (list_empty (&kiblnd_data.kib_peers[i])); +hash_for_each (kiblnd_data.kib_peers, i, peer_ni, ibp_list) +LASSERT (0 );LASSERT (list_empty (&kiblnd_data.kib_connd_zombies));LASSERT (list_empty (&kiblnd_data.kib_connd_conns));LASSERT (list_empty (&kiblnd_data.kib_reconn_list));
@@ -2541,8 +2533,6 @@ static void kiblnd_base_shutdown(void)break ; } -kvfree (kiblnd_data.kib_peers); -if (kiblnd_data.kib_scheds)cfs_percpt_free (kiblnd_data.kib_scheds);
@@ -2628,14 +2618,7 @@ static int kiblnd_base_startup(struct net *ns)INIT_LIST_HEAD (&kiblnd_data.kib_devs);INIT_LIST_HEAD (&kiblnd_data.kib_failed_devs); - kiblnd_data.kib_peer_hash_size =IBLND_PEER_HASH_SIZE ; - kiblnd_data.kib_peers =kvmalloc_array (kiblnd_data.kib_peer_hash_size, -sizeof (struct list_head ), -GFP_KERNEL ); -if (!kiblnd_data.kib_peers) - goto failed; -for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) -INIT_LIST_HEAD (&kiblnd_data.kib_peers[i]); +hash_init (kiblnd_data.kib_peers);spin_lock_init (&kiblnd_data.kib_connd_lock);INIT_LIST_HEAD (&kiblnd_data.kib_connd_conns);
net/lnet/klnds/o2iblnd/o2iblnd.h +4 -15
@@ -66,7 +66,7 @@#include <linux/lnet/lib-lnet.h> #include "o2iblnd-idl.h" -#define IBLND_PEER_HASH_SIZE 101/* # peer_ni lists */ +#define IBLND_PEER_HASH_BITS 7/* log2 of # peer_ni lists */ #define IBLND_N_SCHED 2#define IBLND_N_SCHED_HIGH 4
@@ -342,9 +342,7 @@ struct kib_data {/* stabilize net/dev/peer_ni/conn ops */ rwlock_t kib_global_lock;/* hash table of all my known peers */ -struct list_head *kib_peers; -/* size of kib_peers */ -int kib_peer_hash_size; +DECLARE_HASHTABLE (kib_peers,IBLND_PEER_HASH_BITS );/* the connd task (serialisation assertions) */ void *kib_connd;/* connections to setup/teardown */
@@ -488,7 +486,7 @@ struct kib_conn {#define IBLND_CONN_DISCONNECTED 5/* disconnected */ struct kib_peer_ni { -struct list_head ibp_list;/* stash on global peer_ni list */ +struct hlist_node ibp_list;/* on peer_ni hash chain */ lnet_nid_t ibp_nid;/* who's on the other end(s) */ struct lnet_ni *ibp_ni;/* LNet interface */ struct list_head ibp_conns;/* all active connections */
@@ -642,20 +640,11 @@ static inline int kiblnd_timeout(void)list_empty (&peer_ni->ibp_conns); } -static inline struct list_head * -kiblnd_nid2peerlist (lnet_nid_t nid) -{ -unsigned int hash = - ((unsigned int )nid) % kiblnd_data.kib_peer_hash_size; - -return &kiblnd_data.kib_peers[hash]; -} -static inline int kiblnd_peer_active (struct kib_peer_ni *peer_ni) {/* Am I in the peer_ni hash table? */ -return !list_empty (&peer_ni->ibp_list); +return !hlist_unhashed (&peer_ni->ibp_list); } static inline struct kib_conn *
net/lnet/klnds/o2iblnd/o2iblnd_cb.c +6 -6
@@ -1494,7 +1494,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,list_add_tail (&tx->tx_list, &peer_ni->ibp_tx_queue);kiblnd_peer_addref (peer_ni); -list_add_tail (&peer_ni->ibp_list,kiblnd_nid2peerlist (nid)); +hash_add (kiblnd_data.kib_peers, &peer_ni->ibp_list, nid);write_unlock_irqrestore (g_lock, flags);
@@ -2533,7 +2533,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,LASSERT (!net->ibn_shutdown);kiblnd_peer_addref (peer_ni); -list_add_tail (&peer_ni->ibp_list,kiblnd_nid2peerlist (nid)); +hash_add (kiblnd_data.kib_peers, &peer_ni->ibp_list, nid);write_unlock_irqrestore (g_lock, flags); }
@@ -3257,7 +3257,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,LIST_HEAD (closes);LIST_HEAD (checksends);LIST_HEAD (timedout_txs); -struct list_head *peers = &kiblnd_data.kib_peers[idx]; +struct hlist_head *peers = &kiblnd_data.kib_peers[idx];struct kib_peer_ni *peer_ni;struct kib_tx *tx_tmp, *tx;struct kib_conn *conn;
@@ -3270,7 +3270,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,*/ write_lock_irqsave (&kiblnd_data.kib_global_lock, flags); -list_for_each_entry (peer_ni, peers, ibp_list) { +hlist_for_each_entry (peer_ni, peers, ibp_list) {/* Check tx_deadline */ list_for_each_entry_safe (tx, tx_tmp, &peer_ni->ibp_tx_queue, tx_list) {if (ktime_compare (ktime_get (), tx->tx_deadline) >=0 ) {
@@ -3499,7 +3499,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,if (timeout <=0 ) {const int n =4 ;const int p =1 ; -int chunk = kiblnd_data.kib_peer_hash_size; +int chunk =HASH_SIZE (kiblnd_data.kib_peers);unsigned int lnd_timeout;spin_unlock_irqrestore (lock, flags);
@@ -3524,7 +3524,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx,for (i =0 ; i < chunk; i++) {kiblnd_check_conns (peer_index); peer_index = (peer_index +1 ) % - kiblnd_data.kib_peer_hash_size; +HASH_SIZE (kiblnd_data.kib_peers); } deadline += p *HZ ;
Signature · 6 lines
1.8.3.1 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org