Whamcloud - gitweb
LU-6142 lustre: don't take spinlock to read a 'long'. 43/39743/2
authorMr NeilBrown <neilb@suse.de>
Thu, 27 Aug 2020 06:30:57 +0000 (16:30 +1000)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Sep 2020 14:13:24 +0000 (14:13 +0000)
commit023a9e4cde5498aae89971028dc35c1e3279da5b
treeefd31e98e9f542baa32ed05efd108224af56e06f
parentdd43ff345254f255d40c68488dcd913bcee93514
LU-6142 lustre: don't take spinlock to read a 'long'.

Reading a 'long' (or unsigned long) is always an atomic operation.
There is never a need to take a spinlock to just read a single 'long'.

There are several procfs/debugfs/sysfs handlers which needlessly take
a spinlock for this purpose.

This patch:
 - removes the taking of the spinlock
 - changes the printf to scnprintf() as appropriate
 - directly returns the value returned by scnprintf rather than
   storing it in a variable
 - accesses the 'long' as an arg to the scnprintf(), rather than
   introducing a variabe to hold it.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: If4a6454b46844864e1177536a9c7b91e4c97de86
Reviewed-on: https://review.whamcloud.com/39743
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
lustre/llite/lproc_llite.c
lustre/mdc/lproc_mdc.c
lustre/osc/lproc_osc.c