I can't read data from COM1

2001-04-09 Thread Green



Hi all,
 
I write a sample code(user mode) to test the serial 
driver.
I can open COM1 and write string to COM1.
But, when I want to read data from COM1, the program will 
block at read function.
I trace the driver source code.
 
1.
When the program execute write operation, it will call 
tty_write( ) at 
/drivers/char/tty_io.c.
Then it will call gs_write( ) at 
/drivers/char/general.c.
 
2.
When the program execute read operation,it will call 
tty_read( ) at 
/drivers/char/tty_io.c.
Then I don't know which function would be 
called.
But it was blocked at operation which called 
(tty->ldisc.read)(tty,file,buf,count), as the 
following
 
/* Function tty_read( ) in 
tty_io.c */
if 
(tty->ldisc.read){  /* Program will be blocked 
here */  i = 
(tty->ldisc.read)(tty,file,buf,count); } else {  /* Error 
happened */  i = 
-EIO; }
 
What parameter should I reset?
Thanks in advance.
            
                
                
                
                
                
                
                
Green
 


Re: 2.4.2 TCP window shrinking

2001-03-03 Thread green

Hello!

In article <[EMAIL PROTECTED]> you wrote:
>  > TCP: peer xxx.xxx.1.11:41154/80 shrinks window 2442047470:1072:2442050944.
>  > Bad, what else can I say?
> We need desperately to know exactly what OS the xxx.xxx.1.14 machine
> is running.  Because you've commented out the first two octets, I
> cannot check this myself using nmap.
Hope that helps:
TCP: peer 192.115.216.67:4965/80 shrinks window 1189646194:1024:1189647309. Bad, what 
else can I say?
TCP: peer 192.115.216.66:48184/80 shrinks window 1233448155:1024:1233449294. Bad, what 
else can I say?
TCP: peer 192.115.216.67:4388/80 shrinks window 2353869396:1024:2353870499. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2228/80 shrinks window 3072654250:512:3072655786. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2228/80 shrinks window 3072657834:512:3072659370. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2228/80 shrinks window 3072658346:0:3072659370. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2228/80 shrinks window 3072658346:512:3072659370. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126499925:512:3126501461. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126500437:0:3126501461. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126500437:512:3126501461. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126503509:512:3126504533. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126505045:512:3126505591. Bad, what 
else can I say?
TCP: peer 212.100.133.70:2243/80 shrinks window 3126505557:0:3126505591. Bad, what 
else can I say?
TCP: peer 168.97.99.66:1759/80 shrinks window 3811940743:1460:3811943663. Bad, what 
else can I say?
TCP: peer 192.115.216.67:1117/80 shrinks window 821320812:1024:821321847. Bad, what 
else can I say?
TCP: peer 194.85.201.96:1231/80 shrinks window 1491890080:3072:1491893832. Bad, what 
else can I say?
TCP: peer 194.85.201.96:1231/80 shrinks window 1491894368:3072:1491898120. Bad, what 
else can I say?
TCP: peer 194.85.202.100:3072/80 shrinks window 1517168757:1536:1517171677. Bad, what 
else can I say?
TCP: peer 147.226.5.4:18052/80 shrinks window 3091312994:2864:3091316312. Bad, what 
else can I say?
TCP: peer 208.152.106.86:1496/80 shrinks window 1047754391:1072:1047755999. Bad, what 
else can I say?
TCP: peer 193.235.226.2:57881/80 shrinks window 3860496316:2920:3860503895. Bad, what 
else can I say?
TCP: peer 199.103.141.186:4260/80 shrinks window 1544210503:4380:1544216343. Bad, what 
else can I say?
TCP: peer 194.85.204.37:62553/80 shrinks window 1582101904:0:1582101905. Bad, what 
else can I say?
TCP: peer 168.97.99.66:4077/80 shrinks window 2705297980:1460:2705300900. Bad, what 
else can I say?
TCP: peer 194.85.201.4:1483/80 shrinks window 3797292442:0:3797293210. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1483/80 shrinks window 3797293978:0:3797294746. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1483/80 shrinks window 3797295514:0:3797296282. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1483/80 shrinks window 3797297050:0:3797297818. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1483/80 shrinks window 3797298586:0:3797299354. Bad, what else 
can I say?
TCP: peer 168.97.99.66:2466/80 shrinks window 879491421:1460:879494341. Bad, what else 
can I say?
TCP: peer 140.140.59.101:2839/80 shrinks window 2408864318:1460:2408867238. Bad, what 
else can I say?
TCP: peer 209.47.130.2:2166/80 shrinks window 2408449733:1072:2408450854. Bad, what 
else can I say?
TCP: peer 194.85.201.4:1988/80 shrinks window 2620331555:0:2620332323. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1988/80 shrinks window 2620333091:0:2620333859. Bad, what else 
can I say?
TCP: peer 194.85.201.4:1988/80 shrinks window 2620334627:0:2620335395. Bad, what else 
can I say?
TCP: peer 213.189.85.106:1875/80 shrinks window 3265282896:2920:3265290197. Bad, what 
else can I say?
TCP: peer 204.100.181.6:3081/80 shrinks window 3215499301:2920:3215503041. Bad, what 
else can I say?
TCP: peer 140.228.46.0:1218/80 shrinks window 3743350500:1072:3743351700. Bad, what 
else can I say?
TCP: peer 212.248.7.86:2382/80 shrinks window 3235025401:512:3235026937. Bad, what 
else can I say?
TCP: peer 195.129.34.34:51780/80 shrinks window 1301988509:2920:1301992794. Bad, what 
else can I say?
TCP: peer 195.75.131.34:34715/80 shrinks window 4249402792:1024:4249404950. Bad, what 
else can I say?
TCP: peer 195.75.131.34:34715/80 shrinks window 4249403304:1024:4249404950. Bad, what 
else can I say?
TCP: peer 195.75.131.34:34715/80 shrinks window 4249403816:1024:4249404950. Bad, what 
else can I say?
TCP: peer 193.235.226.2:19253/80 shrinks window 180598643:2920:180603811. Bad, what 
else can I say?  
TCP: peer 194.85.202.123:1713/80 shrinks window 2313955067:0:2313955161. Bad, what 
else can I say?
TCP: peer 193.235.226.2:50139/80 shrinks window 2386493452:2920:2386498376. Bad, what 
el

Pcmcia driver on Mips r39xx.

2001-03-29 Thread Green



Hi all,
 
I want to port pcmcia driver to my MIPS box.
How could I begin?
 
I find that there is a line in the 
/init/main.c such like the following:
 
#ifdef 
CONFIG_PCMCIA init_pcmcia_ds();  /* Do this last 
*/#endif
 
The init_pcmcia_ds() function is implemented at 
/drivers/pcmcia/ds.c.
Should I add a CONFIG_PCMCIA label to the 
.config file and enable this config ?
 
Which file should I trace and modify?
 
Any reply is appreciated.
 
Best regards,
Green


Serial Console!!

2001-04-02 Thread Green



Hi all,
 
I want to login to my MIPS box through serial 
port.
I execute 'make menuconfig' and select the 'serial 
console'.
But I can't see the login prompt in my window(I use 
netterm).
 
May I ask how serial console work?
Or I forget something?
 
P.S I skip /sbin/init program.
 
            
                
                
        Green


[PATCH 0/2] Fix a couple of dri drivers memory leaks

2015-04-25 Thread green
From: Oleg Drokin 

A couple of memory leaks found by smatch.

Oleg Drokin (2):
  drm/qlx: Fix a memory leak on error path
  drm: fix a memleak on mutex failure path

 drivers/gpu/drm/drm_modeset_lock.c | 4 +++-
 drivers/gpu/drm/qxl/qxl_fb.c   | 7 +--
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] drm/qlx: Fix a memory leak on error path

2015-04-25 Thread green
From: Oleg Drokin 

shadow allocation could be leaked if framebuffer allocation failed,
so need to free it.
Also added handling for shadow allocation failure itself instead
of causing a crash.

Found with smatch.

Signed-off-by: Oleg Drokin 
---
 drivers/gpu/drm/qxl/qxl_fb.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index f778c0e..2a88eae 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -526,8 +526,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 mode_cmd.height, mode_cmd.pitches[0]);
 
shadow = vmalloc(mode_cmd.pitches[0] * mode_cmd.height);
-   /* TODO: what's the usual response to memory allocation errors? */
-   BUG_ON(!shadow);
+   if (!shadow) {
+   ret = -ENOMEM;
+   goto out_unref;
+   }
QXL_INFO(qdev,
"surface0 at gpu offset %lld, mmap_offset %lld (virt %p, shadow %p)\n",
 qxl_bo_gpu_offset(qbo),
@@ -538,6 +540,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
info = framebuffer_alloc(0, device);
if (info == NULL) {
+   vfree(shadow);
ret = -ENOMEM;
goto out_unref;
}
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] drm: fix a memleak on mutex failure path

2015-04-25 Thread green
From: Oleg Drokin 

Need to free just allocated ctx allocation if we cannot
get our config mutex.

This one has been flagged by kbuild bot all the way back in August,
but somehow nobody picked it up:
https://lists.01.org/pipermail/kbuild/2014-August/001691.html

Found with smatch.

Signed-off-by: Oleg Drokin 
CC: Daniel Vetter 
---
 drivers/gpu/drm/drm_modeset_lock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index 51cc47d..1e8c52f 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -80,8 +80,10 @@ int __drm_modeset_lock_all(struct drm_device *dev,
return -ENOMEM;
 
if (trylock) {
-   if (!mutex_trylock(&config->mutex))
+   if (!mutex_trylock(&config->mutex)) {
+   kfree(ctx);
return -EBUSY;
+   }
} else {
mutex_lock(&config->mutex);
}
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] drbd: fix memory leak in drbd_adm_resize

2015-04-25 Thread green
From: Oleg Drokin 

new_disk_conf could be leaked if the follow on checks fail,
so make sure to free it on error if it was not assigned yet.

Found with smatch.

Signed-off-by: Oleg Drokin 
---
I thought about just moving the allocation around so that
there is is no failure path after allocation, but looking
at the history of changes in that file, people tend to insert
extra checks at random places and that's how we ended up
with the current bug, so better let it fail and handle the failure.


 drivers/block/drbd/drbd_nl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 74df8cf..87fa774 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2585,6 +2585,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info 
*info)
mutex_unlock(&device->resource->conf_update);
synchronize_rcu();
kfree(old_disk_conf);
+   new_disk_conf = NULL;
}
 
ddsf = (rs.resize_force ? DDSF_FORCED : 0) | (rs.no_resync ? 
DDSF_NO_RESYNC : 0);
@@ -2618,6 +2619,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info 
*info)
 
  fail_ldev:
put_ldev(device);
+   kfree(new_disk_conf);
goto fail;
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] drm: fix a memleak on mutex failure path

2015-04-27 Thread green
From: Oleg Drokin 

Need to free just allocated ctx allocation if we cannot
get our config mutex.

This one has been flagged by kbuild bot all the way back in August,
but somehow nobody picked it up:
https://lists.01.org/pipermail/kbuild/2014-August/001691.html

In addition there is another failure path that leaks the same
ctx reference that is fixed.

Found with smatch.

Signed-off-by: Oleg Drokin 
CC: Daniel Vetter 
---
 drivers/gpu/drm/drm_modeset_lock.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_modeset_lock.c 
b/drivers/gpu/drm/drm_modeset_lock.c
index 51cc47d..c0a5cd8 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -80,8 +80,10 @@ int __drm_modeset_lock_all(struct drm_device *dev,
return -ENOMEM;
 
if (trylock) {
-   if (!mutex_trylock(&config->mutex))
-   return -EBUSY;
+   if (!mutex_trylock(&config->mutex)) {
+   ret = -EBUSY;
+   goto out;
+   }
} else {
mutex_lock(&config->mutex);
}
@@ -114,6 +116,8 @@ fail:
goto retry;
}
 
+out:
+   kfree(ctx);
return ret;
 }
 EXPORT_SYMBOL(__drm_modeset_lock_all);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre/lov: Move target sysfs symlink removal to LOV freeing

2015-06-24 Thread green
From: Oleg Drokin 

This helps to avoid use after free on unmount.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 96c55ac..134b663 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -107,6 +107,10 @@ static void lov_putref(struct obd_device *obd)
/* Disconnect */
__lov_del_obd(obd, tgt);
}
+
+   if (lov->lov_tgts_kobj)
+   kobject_put(lov->lov_tgts_kobj);
+
} else {
mutex_unlock(&lov->lov_lock);
}
@@ -322,9 +326,6 @@ static int lov_disconnect(struct obd_export *exp)
}
}
 
-   if (lov->lov_tgts_kobj)
-   kobject_put(lov->lov_tgts_kobj);
-
obd_putref(obd);
 
 out:
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre: Update header license for lustre_dlm_flags.h

2015-05-29 Thread green
From: Oleg Drokin 

lustre_dlm_flags.h was autogenerated with a wrong script that
mistakenly stated it is GPLv3 when in fact it should be GPLv2.

Also since we are no longer autogenerating this header, drop
all such mentionings.

Reported by: George G. Davis 

Signed-off-by: Oleg Drokin 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6599
Reviewed-on: http://review.whamcloud.com/14797
Reviewed-by: Andreas Dilger 
CC: George G. Davis 
---
 .../staging/lustre/lustre/include/lustre_dlm_flags.h| 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h 
b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
index 16dcdbf..d4cc096 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h
@@ -1,17 +1,10 @@
 /*  -*- buffer-read-only: t -*- vi: set ro:
  *
- * DO NOT EDIT THIS FILE   (lustre_dlm_flags.h)
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
  *
- * It has been AutoGen-ed
- * From the definitionslustre_dlm_flags.def
- * and the template file   lustre_dlm_flags.tpl
- *
- * lustre is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * lustre is distributed in the hope that it will be useful, but
+ * Lustre is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU General Public License for more details.
@@ -22,8 +15,6 @@
 /**
  * \file lustre_dlm_flags.h
  * The flags and collections of flags (masks) for \see struct ldlm_lock.
- * This file is derived from flag definitions in lustre_dlm_flags.def.
- * The format is defined in the lustre_dlm_flags.tpl template file.
  *
  * \addtogroup LDLM Lustre Distributed Lock Manager
  * @{
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6] Final part of lustre procfs removal series

2015-05-30 Thread green
From: Oleg Drokin 

Due to a patch naming error this remainder of patches did not merge.
Fixed the commit message to resolve this.
lustresysctl code still stays in place and would be removed in a
separate patch series.

Additionally resolved a merge conflict with some other patch
that touched lprocfs_exp_setup and made the
lprocfs_exp_setup removal patch unmergeable.

Dmitry Eremin (2):
  staging/lustre/obd: remove unused proc_lustre_root
  staging/lustre/obd: final removal of procfs stuff

Oleg Drokin (4):
  staging/lustre/llite: Move all remaining procfs entries to debugfs
  staging/lustre/obd: Rename lprocfs_add_symlink to ldebugfs_add_symlink
  staging/lustre/obd: remove unused lprocfs_exp_setup() and related
functions
  staging/lustre/obd: Remove nid_stats tracking

 .../lustre/include/linux/libcfs/linux/libcfs.h |   1 -
 drivers/staging/lustre/lustre/fid/Makefile |   3 +-
 drivers/staging/lustre/lustre/fld/Makefile |   3 +-
 drivers/staging/lustre/lustre/include/dt_object.h  |   3 -
 .../lustre/lustre/include/linux/lustre_lite.h  |   1 -
 drivers/staging/lustre/lustre/include/linux/obd.h  |  10 +-
 .../staging/lustre/lustre/include/lprocfs_status.h | 257 +---
 drivers/staging/lustre/lustre/include/lu_object.h  |   2 -
 .../staging/lustre/lustre/include/lustre_export.h  |  29 --
 drivers/staging/lustre/lustre/include/lustre_fid.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_fld.h |   4 -
 drivers/staging/lustre/lustre/include/lustre_net.h |   6 -
 .../staging/lustre/lustre/include/lustre_quota.h   | 241 ---
 drivers/staging/lustre/lustre/include/obd.h|   4 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  33 --
 .../staging/lustre/lustre/include/obd_support.h|  41 --
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |   1 -
 drivers/staging/lustre/lustre/llite/Makefile   |   3 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  26 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  13 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |  48 ++-
 drivers/staging/lustre/lustre/llite/super25.c  |  20 +-
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |  21 +-
 drivers/staging/lustre/lustre/lmv/Makefile |   3 +-
 drivers/staging/lustre/lustre/lmv/lmv_internal.h   |   8 +-
 drivers/staging/lustre/lustre/lov/Makefile |   3 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   7 -
 drivers/staging/lustre/lustre/lov/lov_pool.c   |   2 -
 drivers/staging/lustre/lustre/mdc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   2 +-
 drivers/staging/lustre/lustre/mdc/mdc_internal.h   |   7 -
 drivers/staging/lustre/lustre/mgc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mgc/mgc_internal.h   |  11 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   2 -
 drivers/staging/lustre/lustre/obdclass/Makefile|   4 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  37 +-
 drivers/staging/lustre/lustre/obdclass/dt_object.c |   6 -
 .../lustre/lustre/obdclass/linux/linux-module.c|  19 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 447 +
 drivers/staging/lustre/lustre/obdclass/lu_object.c |   4 -
 .../staging/lustre/lustre/obdclass/obd_config.c|  80 
 drivers/staging/lustre/lustre/osc/Makefile |   3 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_internal.h   |   8 -
 drivers/staging/lustre/lustre/ptlrpc/Makefile  |   3 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|   5 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  12 -
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   |   8 +-
 50 files changed, 121 insertions(+), 1346 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/lustre_quota.h

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] staging/lustre/obd: remove unused lprocfs_exp_setup() and related functions

2015-05-30 Thread green
From: Oleg Drokin 

This code only made sense on servers.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lprocfs_status.h |   2 -
 drivers/staging/lustre/lustre/include/obd.h|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 182 -
 3 files changed, 185 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 328cd07..4b8c265 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -561,8 +561,6 @@ struct obd_export;
 struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
   struct proc_dir_entry *entry);
-extern int lprocfs_exp_setup(struct obd_export *exp,
-lnet_nid_t *peer_nid, int *newnid);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
 extern struct dentry *ldebugfs_add_simple(struct dentry *root,
  char *name,
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index d3df9eb..5268ae5 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -918,7 +918,6 @@ struct obd_device {
struct lprocfs_stats  *md_stats;
 
struct dentry   *obd_debugfs_entry;
-   struct proc_dir_entry  *obd_proc_exports_entry;
struct dentry   *obd_svc_debugfs_entry;
struct lprocfs_stats  *obd_svc_stats;
atomic_t   obd_evict_inprogress;
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 79ff72c..3ef5474 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1096,12 +1096,6 @@ int lprocfs_obd_cleanup(struct obd_device *obd)
if (!obd)
return -EINVAL;
 
-   if (obd->obd_proc_exports_entry) {
-   /* Should be no exports left */
-   lprocfs_remove(&obd->obd_proc_exports_entry);
-   obd->obd_proc_exports_entry = NULL;
-   }
-
if (!IS_ERR_OR_NULL(obd->obd_debugfs_entry))
ldebugfs_remove(&obd->obd_debugfs_entry);
 
@@ -1685,72 +1679,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats 
*ldlm_stats)
 }
 EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
 
-int lprocfs_exp_print_uuid(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-  struct hlist_node *hnode, void *data)
-
-{
-   struct obd_export *exp = cfs_hash_object(hs, hnode);
-   struct seq_file *m = (struct seq_file *)data;
-
-   if (exp->exp_nid_stats)
-   seq_printf(m, "%s\n", obd_uuid2str(&exp->exp_client_uuid));
-
-   return 0;
-}
-
-static int
-lproc_exp_uuid_seq_show(struct seq_file *m, void *unused)
-{
-   struct nid_stat *stats = (struct nid_stat *)m->private;
-   struct obd_device *obd = stats->nid_obd;
-
-   cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
- lprocfs_exp_print_uuid, m);
-   return 0;
-}
-
-LPROC_SEQ_FOPS_RO(lproc_exp_uuid);
-
-struct exp_hash_cb_data {
-   struct seq_file *m;
-   boolfirst;
-};
-
-int lprocfs_exp_print_hash(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-  struct hlist_node *hnode, void *cb_data)
-
-{
-   struct exp_hash_cb_data *data = (struct exp_hash_cb_data *)cb_data;
-   struct obd_export   *exp = cfs_hash_object(hs, hnode);
-
-   if (exp->exp_lock_hash != NULL) {
-   if (data->first) {
-   cfs_hash_debug_header(data->m);
-   data->first = false;
-   }
-   cfs_hash_debug_str(hs, data->m);
-   }
-
-   return 0;
-}
-
-static int
-lproc_exp_hash_seq_show(struct seq_file *m, void *unused)
-{
-   struct nid_stat *stats = (struct nid_stat *)m->private;
-   struct obd_device *obd = stats->nid_obd;
-   struct exp_hash_cb_data cb_data = {
-   .m = m,
-   .first = true
-   };
-
-   cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid,
- lprocfs_exp_print_hash, &cb_data);
-   return 0;
-}
-
-LPROC_SEQ_FOPS_RO(lproc_exp_hash);
-
 int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
 {
seq_printf(m, "%s\n",
@@ -1799,116 +1727,6 @@ int lprocfs_nid_stats_clear_write(struct file *file, 
const char *buffer,
 }
 EXPORT_SYMBOL(lprocfs_nid_stats_clear_write);
 
-int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
-{
-   struct nid_stat *new_stat, *old_stat;
-   struct obd_device *obd = NULL;
-   struct proc_dir_entry *entry;
-   char *buffer = NULL;
-   int rc = 0;
-
-   *newnid = 0;
-
-

[PATCH 2/6] staging/lustre/obd: remove unused proc_lustre_root

2015-05-30 Thread green
From: Dmitry Eremin 

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h |  3 ---
 .../lustre/lustre/obdclass/linux/linux-module.c| 18 --
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 721efd6..19ab9e8 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -349,7 +349,6 @@ enum {
 
 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
 /* class_obd.c */
-extern struct proc_dir_entry *proc_lustre_root;
 extern struct dentry *debugfs_lustre_root;
 extern struct kobject *lustre_kobj;
 
@@ -851,8 +850,6 @@ extern int lprocfs_quota_wr_qs_factor(struct file *file,
 #else
 /* CONFIG_PROC_FS is not defined */
 
-#define proc_lustre_root NULL
-
 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
   int index, long amount)
 { return; }
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 03a982a..50c3d1d 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -322,11 +322,6 @@ static ssize_t jobid_name_store(struct kobject *kobj, 
struct attribute *attr,
 struct dentry *debugfs_lustre_root;
 EXPORT_SYMBOL_GPL(debugfs_lustre_root);
 
-#if defined(CONFIG_PROC_FS)
-/* Root for /proc/fs/lustre */
-struct proc_dir_entry *proc_lustre_root = NULL;
-EXPORT_SYMBOL(proc_lustre_root);
-
 LUSTRE_RO_ATTR(version);
 LUSTRE_RO_ATTR(pinger);
 LUSTRE_RO_ATTR(health);
@@ -459,14 +454,6 @@ int class_procfs_init(void)
kobject_put(lustre_kobj);
goto out;
}
-
-   proc_lustre_root = lprocfs_register("fs/lustre", NULL, NULL, NULL);
-   if (IS_ERR(proc_lustre_root)) {
-   rc = PTR_ERR(proc_lustre_root);
-   proc_lustre_root = NULL;
-   kobject_put(lustre_kobj);
-   goto out;
-   }
 out:
return rc;
 }
@@ -478,12 +465,7 @@ int class_procfs_clean(void)
 
debugfs_lustre_root = NULL;
 
-   if (proc_lustre_root) {
-   lprocfs_remove(&proc_lustre_root);
-   }
-
kobject_put(lustre_kobj);
 
return 0;
 }
-#endif /* CONFIG_PROC_FS */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] staging/lustre/obd: Rename lprocfs_add_symlink to ldebugfs_add_symlink

2015-05-30 Thread green
From: Oleg Drokin 

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h  | 12 ++--
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 16 +---
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 19ab9e8..328cd07 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -572,8 +572,8 @@ extern struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
char *name,
void *data,
struct file_operations *fops);
-extern struct proc_dir_entry *
-lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
+extern struct dentry *
+ldebugfs_add_symlink(const char *name, struct dentry *parent,
const char *format, ...);
 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
 extern int
@@ -905,20 +905,12 @@ static inline void lprocfs_free_md_stats(struct 
obd_device *obddev)
 struct obd_export;
 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
 { return 0; }
-static inline int lprocfs_exp_setup(struct obd_export *exp,
-   lnet_nid_t *peer_nid,
-   int *newnid)
-{ return 0; }
 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
 { return 0; }
 static inline struct proc_dir_entry *
 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
   void *data, struct file_operations *fops)
 {return 0; }
-static inline struct proc_dir_entry *
-lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
-   const char *format, ...)
-{return NULL; }
 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
 { return; }
 static inline
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 51865dd..79ff72c 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -289,10 +289,10 @@ struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
 }
 EXPORT_SYMBOL(lprocfs_add_simple);
 
-struct proc_dir_entry *lprocfs_add_symlink(const char *name,
-   struct proc_dir_entry *parent, const char *format, ...)
+struct dentry *ldebugfs_add_symlink(const char *name, struct dentry *parent,
+   const char *format, ...)
 {
-   struct proc_dir_entry *entry;
+   struct dentry *entry;
char *dest;
va_list ap;
 
@@ -307,15 +307,17 @@ struct proc_dir_entry *lprocfs_add_symlink(const char 
*name,
vsnprintf(dest, MAX_STRING_SIZE, format, ap);
va_end(ap);
 
-   entry = proc_symlink(name, parent, dest);
-   if (entry == NULL)
-   CERROR("LprocFS: Could not create symbolic link from %s to %s",
+   entry = debugfs_create_symlink(name, parent, dest);
+   if (IS_ERR_OR_NULL(entry)) {
+   CERROR("LdebugFS: Could not create symbolic link from %s to %s",
name, dest);
+   entry = NULL;
+   }
 
kfree(dest);
return entry;
 }
-EXPORT_SYMBOL(lprocfs_add_symlink);
+EXPORT_SYMBOL(ldebugfs_add_symlink);
 
 static struct file_operations lprocfs_generic_fops = { };
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] staging/lustre/llite: Move all remaining procfs entries to debugfs

2015-05-30 Thread green
From: Oleg Drokin 

This moves all remaining procfs handling in llite layer to debugfs.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/llite/llite_internal.h   | 27 +++-
 drivers/staging/lustre/lustre/llite/llite_lib.c| 13 +++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 48 --
 drivers/staging/lustre/lustre/llite/super25.c  | 20 -
 drivers/staging/lustre/lustre/llite/vvp_dev.c  | 21 +-
 5 files changed, 68 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index e180912..b30eb85 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -465,7 +465,7 @@ struct ll_sb_info {
struct obd_uuidll_sb_uuid;
struct obd_export   *ll_md_exp;
struct obd_export   *ll_dt_exp;
-   struct proc_dir_entry*ll_proc_root;
+   struct dentry   *ll_debugfs_entry;
struct lu_fidll_root_fid; /* root object fid */
 
intll_flags;
@@ -636,7 +636,7 @@ struct lov_stripe_md;
 
 extern spinlock_t inode_lock;
 
-extern struct proc_dir_entry *proc_lustre_fs_root;
+extern struct dentry *llite_root;
 extern struct kset *llite_kset;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
@@ -664,20 +664,25 @@ struct ll_ra_read *ll_ra_read_get(struct file *f);
 
 /* llite/lproc_llite.c */
 #if defined (CONFIG_PROC_FS)
-int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-   struct super_block *sb, char *osc, char *mdc);
-void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
+int ldebugfs_register_mountpoint(struct dentry *parent,
+struct super_block *sb, char *osc, char *mdc);
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi);
 void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);
 void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
 void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
   struct ll_file_data *file, loff_t pos,
   size_t count, int rw);
-#else
-static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-   struct super_block *sb, char *osc, char *mdc){return 0;}
-static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
+#else /* CONFIG_PROC_FS */
+static inline
+int ldebugfs_register_mountpoint(struct dentry *parent,
+struct super_block *sb, char *osc, char *mdc)
+{ return 0; }
 static inline
-void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi)
+{}
+static inline
+void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
+{}
 static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
 {
memset(lvars, 0, sizeof(*lvars));
@@ -685,7 +690,7 @@ static inline void lprocfs_llite_init_vars(struct 
lprocfs_static_vars *lvars)
 static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
 struct ll_file_data *file, loff_t pos,
 size_t count, int rw) {}
-#endif
+#endif /* CONFIG_PROC_FS */
 
 
 /* llite/dir.c */
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 4c9fd4a..2513988 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -57,7 +57,7 @@
 #include "llite_internal.h"
 
 struct kmem_cache *ll_file_data_slab;
-struct proc_dir_entry *proc_lustre_fs_root;
+struct dentry *llite_root;
 struct kset *llite_kset;
 
 static LIST_HEAD(ll_super_blocks);
@@ -184,11 +184,10 @@ static int client_common_fill_super(struct super_block 
*sb, char *md, char *dt,
return -ENOMEM;
}
 
-   if (proc_lustre_fs_root) {
-   err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
- dt, md);
+   if (llite_root != NULL) {
+   err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
if (err < 0)
-   CERROR("could not register mount in /proc/fs/lustre\n");
+   CERROR("could not register mount in 
/lustre/llite\n");
}
 
/* indicate the features supported by this client */
@@ -601,7 +600,7 @@ out_md:
 out:
kfree(data);
kfree(osfs);
-   lprocfs_unregister_mountpoint(sbi);
+   ldebugfs_unregister_mountpoint(sbi);
return err;
 }
 
@@ -682,7 +681,7 @@ static void client_common_put_super(struct super_block *sb)
 * see LU-2543. */
obd_zombie_barrier();
 
-   lprocfs_unregister_mountpoint(s

[PATCH 5/6] staging/lustre/obd: Remove nid_stats tracking

2015-05-30 Thread green
From: Oleg Drokin 

This nid_stats tracking only makes sense on the server side,
on the client there are no other clients to keep track of anyway.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/dt_object.h  |  1 -
 .../staging/lustre/lustre/include/lprocfs_status.h | 15 
 drivers/staging/lustre/lustre/include/lu_object.h  |  2 -
 .../staging/lustre/lustre/include/lustre_export.h  | 29 ---
 drivers/staging/lustre/lustre/include/obd.h|  3 -
 drivers/staging/lustre/lustre/include/obd_class.h  | 18 
 .../lustre/lustre/obdclass/lprocfs_status.c| 96 --
 .../staging/lustre/lustre/obdclass/obd_config.c| 80 --
 8 files changed, 244 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/dt_object.h 
b/drivers/staging/lustre/lustre/include/dt_object.h
index be4c7d9..866d04b 100644
--- a/drivers/staging/lustre/lustre/include/dt_object.h
+++ b/drivers/staging/lustre/lustre/include/dt_object.h
@@ -58,7 +58,6 @@
 #include "../../include/linux/libcfs/libcfs.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 
 struct thandle;
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 4b8c265..6a77ea8 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -558,7 +558,6 @@ extern void lprocfs_counter_init(struct lprocfs_stats 
*stats, int index,
 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
 extern void lprocfs_free_md_stats(struct obd_device *obddev);
 struct obd_export;
-struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
   struct proc_dir_entry *entry);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
@@ -573,11 +572,6 @@ extern struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
 extern struct dentry *
 ldebugfs_add_symlink(const char *name, struct dentry *parent,
const char *format, ...);
-extern void lprocfs_free_per_client_stats(struct obd_device *obd);
-extern int
-lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
- unsigned long count, void *data);
-extern int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data);
 
 extern int ldebugfs_register_stats(struct dentry *parent,
   const char *name,
@@ -909,15 +903,6 @@ static inline struct proc_dir_entry *
 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
   void *data, struct file_operations *fops)
 {return 0; }
-static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
-{ return; }
-static inline
-int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
- unsigned long count, void *data)
-{return count;}
-static inline
-int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
-{ return 0; }
 
 static inline struct proc_dir_entry *
 lprocfs_register(const char *name, struct proc_dir_entry *parent,
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index c8cc48f..e1d72a7 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -43,7 +43,6 @@
 #include "lu_ref.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 struct lprocfs_stats;
 
@@ -277,7 +276,6 @@ struct lu_device {
 * Stack this device belongs to.
 */
struct lu_site  *ld_site;
-   struct proc_dir_entry*ld_proc_entry;
 
/** \todo XXX: temporary back pointer into obd. */
struct obd_device*ld_obd;
diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h 
b/drivers/staging/lustre/lustre/include/lustre_export.h
index 9c06a49..3b992b4 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -106,34 +106,6 @@ struct mgs_export_data {
spinlock_t  med_lock;   /* protect med_clients */
 };
 
-/**
- * per-NID statistics structure.
- * It tracks access patterns to this export on a per-client-NID basis
- */
-struct nid_stat {
-   lnet_nid_t nid;
-   struct hlist_nodenid_hash;
-   struct list_head   nid_list;
-   struct obd_device   *nid_obd;
-   struct proc_dir_entry   *nid_proc;
-   struct lprocfs_stats*nid_stats;
-   struct lprocfs_stats*nid_ldlm_stats;
-   atomic_t nid_exp_ref_count; /* for obd_nid_stats_hash
-  exp_nid_stats */
-};
-
-#define nidstat_getref(nidstat)
\
-do {  

[PATCH 6/6] staging/lustre/obd: final removal of procfs stuff

2015-05-30 Thread green
From: Dmitry Eremin 

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../lustre/include/linux/libcfs/linux/libcfs.h |   1 -
 drivers/staging/lustre/lustre/fid/Makefile |   3 +-
 drivers/staging/lustre/lustre/fld/Makefile |   3 +-
 drivers/staging/lustre/lustre/include/dt_object.h  |   2 -
 .../lustre/lustre/include/linux/lustre_lite.h  |   1 -
 drivers/staging/lustre/lustre/include/linux/obd.h  |  10 +-
 .../staging/lustre/lustre/include/lprocfs_status.h | 225 +--
 drivers/staging/lustre/lustre/include/lustre_fid.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_fld.h |   4 -
 drivers/staging/lustre/lustre/include/lustre_net.h |   6 -
 .../staging/lustre/lustre/include/lustre_quota.h   | 241 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  15 --
 .../staging/lustre/lustre/include/obd_support.h|  41 
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |   1 -
 drivers/staging/lustre/lustre/llite/Makefile   |   3 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  21 --
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |   2 +-
 drivers/staging/lustre/lustre/lmv/Makefile |   3 +-
 drivers/staging/lustre/lustre/lmv/lmv_internal.h   |   8 +-
 drivers/staging/lustre/lustre/lov/Makefile |   3 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   7 -
 drivers/staging/lustre/lustre/lov/lov_pool.c   |   2 -
 drivers/staging/lustre/lustre/mdc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   2 +-
 drivers/staging/lustre/lustre/mdc/mdc_internal.h   |   7 -
 drivers/staging/lustre/lustre/mgc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mgc/mgc_internal.h   |  11 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   2 -
 drivers/staging/lustre/lustre/obdclass/Makefile|   4 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  37 ++--
 drivers/staging/lustre/lustre/obdclass/dt_object.c |   6 -
 .../lustre/lustre/obdclass/linux/linux-module.c|   1 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 153 +
 drivers/staging/lustre/lustre/obdclass/lu_object.c |   4 -
 drivers/staging/lustre/lustre/osc/Makefile |   3 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_internal.h   |   8 -
 drivers/staging/lustre/lustre/ptlrpc/Makefile  |   3 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|   5 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  12 -
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   |   8 +-
 43 files changed, 54 insertions(+), 830 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/lustre_quota.h

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
index 4fe50841..3e2502a 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
@@ -61,7 +61,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/lustre/lustre/fid/Makefile 
b/drivers/staging/lustre/lustre/fid/Makefile
index 5513ce4..b7ef314 100644
--- a/drivers/staging/lustre/lustre/fid/Makefile
+++ b/drivers/staging/lustre/lustre/fid/Makefile
@@ -1,3 +1,2 @@
 obj-$(CONFIG_LUSTRE_FS) += fid.o
-fid-y := fid_request.o fid_lib.o
-fid-$(CONFIG_PROC_FS) += lproc_fid.o
+fid-y := fid_request.o fid_lib.o lproc_fid.o
diff --git a/drivers/staging/lustre/lustre/fld/Makefile 
b/drivers/staging/lustre/lustre/fld/Makefile
index 2bbf084..646e315 100644
--- a/drivers/staging/lustre/lustre/fld/Makefile
+++ b/drivers/staging/lustre/lustre/fld/Makefile
@@ -1,3 +1,2 @@
 obj-$(CONFIG_LUSTRE_FS) += fld.o
-fld-y := fld_request.o fld_cache.o
-fld-$(CONFIG_PROC_FS) += lproc_fld.o
+fld-y := fld_request.o fld_cache.o lproc_fld.o
diff --git a/drivers/staging/lustre/lustre/include/dt_object.h 
b/drivers/staging/lustre/lustre/include/dt_object.h
index 866d04b..abae31b 100644
--- a/drivers/staging/lustre/lustre/include/dt_object.h
+++ b/drivers/staging/lustre/lustre/include/dt_object.h
@@ -1480,7 +1480,6 @@ static inline struct dt_thread_info *dt_info(const struct 
lu_env *env)
 int dt_global_init(void);
 void dt_global_fini(void);
 
-#if defined (CONFIG_PROC_FS)
 int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
  int count, int *eof, void *data);
 int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
@@ -1493,6 +1492,5 @@ int lprocfs_dt_rd_filestotal(char *page, char **start, 
off_t off,
 int count, int *eof, void *data);
 int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
int count, int *eof, void *data);
-#endif /* CONFIG_PROC_FS */
 

[PATCH] staging/lustre/ldlm: Fix up LDLM_POOL_SYSFS_WRITER*_STORE define

2015-05-30 Thread green
From: Oleg Drokin 

The store method defined by LDLM_POOL_SYSFS_WRITER_STORE and
LDLM_POOL_SYSFS_WRITER_NOLOCK_STORE defines should
use size_t count, not unsigned long.

This produced a warning on i386 (and other 32bit architectures too,
I guess) where unsigned long is not 32 bit.

Reported by kbuild test bot.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h 
b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
index cf81bdb..6601e6b 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h
@@ -265,7 +265,7 @@ typedef enum ldlm_policy_res ldlm_policy_res_t;
static ssize_t var##_store(struct kobject *kobj,\
 struct attribute *attr,\
 const char *buffer,\
-unsigned long count)   \
+size_t count)  \
{   \
struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
pl_kobj);   \
@@ -301,7 +301,7 @@ typedef enum ldlm_policy_res ldlm_policy_res_t;
static ssize_t var##_store(struct kobject *kobj,\
 struct attribute *attr,\
 const char *buffer,\
-unsigned long count)   \
+size_t count)  \
{   \
struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \
pl_kobj);   \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging/lustre/llite: fix ll_getname user buffer copy

2015-06-09 Thread green
From: Oleg Drokin 

strncpy_from_user could return negative values on error,
so need to take those into account.
Since ll_getname is used to get a single component name from userspace
to transfer to server as-is, there's no need to allocate 4k buffer
as done by __getname. Allocate NAME_MAX+1 buffer instead to ensure
we have enough for a null terminated max valid length buffer.

This was discovered by Al Viro in https://lkml.org/lkml/2015/4/11/243

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 87a042c..e0b9043 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1213,29 +1213,31 @@ out:
return rc;
 }
 
-static char *
-ll_getname(const char __user *filename)
+/* This function tries to get a single name component,
+ * to send to the server. No actual path traversal involved,
+ * so we limit to NAME_MAX */
+static char *ll_getname(const char __user *filename)
 {
int ret = 0, len;
-   char *tmp = __getname();
+   char *tmp = kzalloc(NAME_MAX + 1, GFP_KERNEL);
 
if (!tmp)
return ERR_PTR(-ENOMEM);
 
-   len = strncpy_from_user(tmp, filename, PATH_MAX);
-   if (len == 0)
+   len = strncpy_from_user(tmp, filename, NAME_MAX);
+   if (len < 0)
+   ret = len;
+   else if (len == 0)
ret = -ENOENT;
-   else if (len > PATH_MAX)
-   ret = -ENAMETOOLONG;
 
if (ret) {
-   __putname(tmp);
+   kfree(tmp);
tmp =  ERR_PTR(ret);
}
return tmp;
 }
 
-#define ll_putname(filename) __putname(filename)
+#define ll_putname(filename) kfree(filename)
 
 static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging/lustre/llite: remove LL_IOC_REMOVE_ENTRY handler

2015-06-09 Thread green
From: Oleg Drokin 

It uses getname in unsafe manner and since it's to deal with corrupted
or inconsistent filesystem, we are probably better to deal with
it from lfsck anyway.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 29 -
 1 file changed, 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 4b0de8d..87a042c 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1436,35 +1436,6 @@ free_lmv:
kfree(tmp);
return rc;
}
-   case LL_IOC_REMOVE_ENTRY: {
-   char*filename = NULL;
-   int  namelen = 0;
-   int  rc;
-
-   /* Here is a little hack to avoid sending REINT_RMENTRY to
-* unsupported server, which might crash the server(LU-2730),
-* Because both LVB_TYPE and REINT_RMENTRY will be supported
-* on 2.4, we use OBD_CONNECT_LVB_TYPE to detect whether the
-* server will support REINT_RMENTRY XXX*/
-   if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE))
-   return -ENOTSUPP;
-
-   filename = ll_getname((const char *)arg);
-   if (IS_ERR(filename))
-   return PTR_ERR(filename);
-
-   namelen = strlen(filename);
-   if (namelen < 1) {
-   rc = -EINVAL;
-   goto out_rmdir;
-   }
-
-   rc = ll_rmdir_entry(inode, filename, namelen);
-out_rmdir:
-   if (filename)
-   ll_putname(filename);
-   return rc;
-   }
case LL_IOC_LOV_SWAP_LAYOUTS:
return -EPERM;
case LL_IOC_OBD_STATFS:
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] Fixup lusre ll_getname

2015-06-09 Thread green
From: Oleg Drokin 

Some time ago Al Viro noticed that lustre ll_getname is broken.
At the time a patch was submitted to convert lustre to use
exported getname, that was rejected by hch on the grounds that
filesystem code sould not really be reimplementing their own
lookups which kind of made sense back then.

But upon further investigation it seems that ll_getname is
used in a different way, it only gets a single path name
component that is then shiped to the server for some operations.
Going through VFS here to do proper lookups is not really
all that good of an idea since dcache pollution is undesired
at the very least.

So these two patches drop one of the ll_getname users that
could be done in another way and fix up ll_getname to only
allocate a single pathname component buffer and properly check
copy from userspace return value.

Please consider.

Oleg Drokin (2):
  staging/lustre/llite: remove LL_IOC_REMOVE_ENTRY handler
  staging/lustre/llite: fix ll_getname

 drivers/staging/lustre/lustre/llite/dir.c | 49 +++
 1 file changed, 11 insertions(+), 38 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/2] staging/lustre/llite: remove LL_IOC_REMOVE_ENTRY handler

2015-06-10 Thread green
From: Oleg Drokin 

It uses getname in unsafe manner and since it's to deal with corrupted
or inconsistent filesystem, we are probably better to deal with
it from lfsck anyway.

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/lustre/lustre_user.h |  1 -
 drivers/staging/lustre/lustre/llite/dir.c  | 29 --
 2 files changed, 30 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 89794fd..e095ada 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -243,7 +243,6 @@ struct ost_id {
 
 #define LL_IOC_LMV_SETSTRIPE   _IOWR('f', 240, struct lmv_user_md)
 #define LL_IOC_LMV_GETSTRIPE   _IOWR('f', 241, struct lmv_user_md)
-#define LL_IOC_REMOVE_ENTRY_IOWR('f', 242, __u64)
 #define LL_IOC_SET_LEASE   _IOWR('f', 243, long)
 #define LL_IOC_GET_LEASE   _IO('f', 244)
 #define LL_IOC_HSM_IMPORT  _IOWR('f', 245, struct hsm_user_import)
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 4b0de8d..87a042c 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1436,35 +1436,6 @@ free_lmv:
kfree(tmp);
return rc;
}
-   case LL_IOC_REMOVE_ENTRY: {
-   char*filename = NULL;
-   int  namelen = 0;
-   int  rc;
-
-   /* Here is a little hack to avoid sending REINT_RMENTRY to
-* unsupported server, which might crash the server(LU-2730),
-* Because both LVB_TYPE and REINT_RMENTRY will be supported
-* on 2.4, we use OBD_CONNECT_LVB_TYPE to detect whether the
-* server will support REINT_RMENTRY XXX*/
-   if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE))
-   return -ENOTSUPP;
-
-   filename = ll_getname((const char *)arg);
-   if (IS_ERR(filename))
-   return PTR_ERR(filename);
-
-   namelen = strlen(filename);
-   if (namelen < 1) {
-   rc = -EINVAL;
-   goto out_rmdir;
-   }
-
-   rc = ll_rmdir_entry(inode, filename, namelen);
-out_rmdir:
-   if (filename)
-   ll_putname(filename);
-   return rc;
-   }
case LL_IOC_LOV_SWAP_LAYOUTS:
return -EPERM;
case LL_IOC_OBD_STATFS:
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/2] Fixup lustre ll_getname

2015-06-10 Thread green
From: Oleg Drokin 

Some time ago Al Viro noticed that lustre ll_getname is broken.
At the time a patch was submitted to convert lustre to use
exported getname, that was rejected by hch on the grounds that
filesystem code sould not really be reimplementing their own
lookups which kind of made sense back then.

But upon further investigation it seems that ll_getname is
used in a different way, it only gets a single path name
component that is then shiped to the server for some operations.
Going through VFS here to do proper lookups is not really
all that good of an idea since dcache pollution is undesired
at the very least.

So these two patches drop one of the ll_getname users that
could be done in another way and fix up ll_getname to only
allocate a single pathname component buffer and properly check
copy from userspace return value.

Please consider.

Oleg Drokin (2):
  staging/lustre/llite: remove LL_IOC_REMOVE_ENTRY handler
  staging/lustre/llite: fix ll_getname

 .../lustre/lustre/include/lustre/lustre_user.h |  1 -
 drivers/staging/lustre/lustre/llite/dir.c  | 50 ++
 2 files changed, 13 insertions(+), 38 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/2] staging/lustre/llite: fix ll_getname user buffer copy

2015-06-10 Thread green
From: Oleg Drokin 

strncpy_from_user could return negative values on error,
so need to take those into account.
Since ll_getname is used to get a single component name from userspace
to transfer to server as-is, there's no need to allocate 4k buffer
as done by __getname. Allocate NAME_MAX+1 buffer instead to ensure
we have enough for a null terminated max valid length buffer.

This was discovered by Al Viro in https://lkml.org/lkml/2015/4/11/243

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dir.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 87a042c..50d685b 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1213,29 +1213,34 @@ out:
return rc;
 }
 
-static char *
-ll_getname(const char __user *filename)
+/* This function tries to get a single name component,
+ * to send to the server. No actual path traversal involved,
+ * so we limit to NAME_MAX */
+static char *ll_getname(const char __user *filename)
 {
int ret = 0, len;
-   char *tmp = __getname();
+   char *tmp;
 
+   tmp = kzalloc(NAME_MAX + 1, GFP_KERNEL);
if (!tmp)
return ERR_PTR(-ENOMEM);
 
-   len = strncpy_from_user(tmp, filename, PATH_MAX);
-   if (len == 0)
+   len = strncpy_from_user(tmp, filename, NAME_MAX + 1);
+   if (len < 0)
+   ret = len;
+   else if (len == 0)
ret = -ENOENT;
-   else if (len > PATH_MAX)
+   else if (len > NAME_MAX && tmp[NAME_MAX] != 0)
ret = -ENAMETOOLONG;
 
if (ret) {
-   __putname(tmp);
+   kfree(tmp);
tmp =  ERR_PTR(ret);
}
return tmp;
 }
 
-#define ll_putname(filename) __putname(filename)
+#define ll_putname(filename) kfree(filename)
 
 static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] Lustre: remove cfs_daemonize from comments

2015-08-03 Thread green
From: Oleg Drokin 

cfs_daemonize was removed long ago, but I just stumbled upon
a couple of instances where it was still referenced in the comments,
so here are the patches to clean it up and not cause any unnecessary
confusion.

Oleg Drokin (2):
  staging/lustre/ptlrpc: Remove stray daemonize comment
  staging/lustre: Properly reference kthread_run instead of
cfs_daemonize

 drivers/staging/lustre/lustre/include/lustre_net.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/pinger.c  | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging/lustre/ptlrpc: Remove stray cfs_daemonize comment

2015-08-03 Thread green
From: Oleg Drokin 

Ever since daemonize was removed in 3.18, there are no longer
any flags passed to kthread_run.
Most of the comments were deleted, but this one lingered on
until now.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c 
b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
index d05c37c..f8edb79 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
@@ -318,8 +318,6 @@ int ptlrpc_start_pinger(void)
 
strcpy(pinger_thread.t_name, "ll_ping");
 
-   /* CLONE_VM and CLONE_FILES just avoid a needless copy, because we
-* just drop the VM and FILES in cfs_daemonize_ctxt() right away. */
rc = PTR_ERR(kthread_run(ptlrpc_pinger_main, &pinger_thread,
 "%s", pinger_thread.t_name));
if (IS_ERR_VALUE(rc)) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging/lustre: Properly reference kthread_run instead of cfs_daemonize

2015-08-03 Thread green
From: Oleg Drokin 

cfs_daemonize is long gone and replaced by a proper call to kthread_run,
so update the comment to reflect that fact.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_net.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index 77a7de9..3bb2f8b 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -2183,7 +2183,7 @@ struct ptlrpcd_ctl {
 */
struct ptlrpc_request_set  *pc_set;
/**
-* Thread name used in cfs_daemonize()
+* Thread name used in kthread_run()
 */
charpc_name[16];
/**
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre/lloop: Update call to bio_endio() to match new prototype

2015-07-30 Thread green
From: Oleg Drokin 

Also while we are at it, drop all cfs_bio_* wrappers.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 3 ---
 drivers/staging/lustre/lustre/llite/lloop.c   | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 513c81f..c2a4ffd 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -85,9 +85,6 @@
 #define ll_vfs_rename(old, old_dir, mnt, new, new_dir, mnt1) \
vfs_rename(old, old_dir, new, new_dir, NULL, 0)
 
-#define cfs_bio_io_error(a, b)   bio_io_error((a))
-#define cfs_bio_endio(a, b, c)bio_endio((a), (c))
-
 #define cfs_path_put(nd) path_put(&(nd)->path)
 
 
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index cc00fd1..d614234 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -365,7 +365,7 @@ static void loop_make_request(struct request_queue *q, 
struct bio *old_bio)
loop_add_bio(lo, old_bio);
return;
 err:
-   cfs_bio_io_error(old_bio, old_bio->bi_iter.bi_size);
+   bio_io_error(old_bio);
 }
 
 
@@ -376,7 +376,7 @@ static inline void loop_handle_bio(struct lloop_device *lo, 
struct bio *bio)
while (bio) {
struct bio *tmp = bio->bi_next;
bio->bi_next = NULL;
-   cfs_bio_endio(bio, bio->bi_iter.bi_size, ret);
+   bio_endio(bio);
bio = tmp;
}
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/13] staging/lustre: Drop SEEK_* definition checks

2015-07-30 Thread green
From: Oleg Drokin 

SEEK_DATA and SEEK_HOLE are always defined in the kernel,
drop the definition checks

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_compat25.h  | 38 --
 1 file changed, 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index d0e8f3c..7d90999 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,37 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-static inline int
-ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
-{
-   int rc;
-
-   if (sb->s_qcop->quota_on) {
-   struct path path;
-
-   rc = kern_path(name, LOOKUP_FOLLOW, &path);
-   if (!rc)
-   return rc;
-   rc = sb->s_qcop->quota_on(sb, off, ver
-   , &path
-  );
-   path_put(&path);
-   return rc;
-   } else
-   return -ENOSYS;
-}
-
-static inline int ll_quota_off(struct super_block *sb, int off, int remount)
-{
-   if (sb->s_qcop->quota_off) {
-   return sb->s_qcop->quota_off(sb, off
-   );
-   } else
-   return -ENOSYS;
-}
-
-
-
 #define ll_d_hlist_node hlist_node
 #define ll_d_hlist_empty(list) hlist_empty(list)
 #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
@@ -121,13 +90,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 # define NO_QUOTA (-EDQUOT)
 #endif
 
-#ifndef SEEK_DATA
-#define SEEK_DATA  3   /* seek to the next data */
-#endif
-#ifndef SEEK_HOLE
-#define SEEK_HOLE  4   /* seek to the next hole */
-#endif
-
 #ifndef FMODE_UNSIGNED_OFFSET
 #define FMODE_UNSIGNED_OFFSET  ((__force fmode_t)0x2000)
 #endif
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/13] staging/lustre: Use hlist primitives directly

2015-07-30 Thread green
From: Oleg Drokin 

Get rid of ll_d_hlist* compat defines.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h |  9 -
 drivers/staging/lustre/lustre/llite/dcache.c  |  3 +--
 drivers/staging/lustre/lustre/llite/namei.c   | 10 --
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 65493b3..bc4f752 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,15 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#define ll_d_hlist_node hlist_node
-#define ll_d_hlist_empty(list) hlist_empty(list)
-#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
-#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry)
-#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \
-   p = NULL; hlist_for_each_entry(dentry, i_dentry, alias)
-
-
-
 #define ll_pagevec_init(pv, cold)   do {} while (0)
 #define ll_pagevec_add(pv, pg)   (0)
 #define ll_pagevec_lru_add_file(pv) do {} while (0)
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 7b008a6..b866859 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -250,7 +250,6 @@ void ll_intent_release(struct lookup_intent *it)
 void ll_invalidate_aliases(struct inode *inode)
 {
struct dentry *dentry;
-   struct ll_d_hlist_node *p;
 
LASSERT(inode != NULL);
 
@@ -258,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode)
   inode->i_ino, inode->i_generation, inode);
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p 
flags %d\n",
   dentry, dentry, dentry->d_parent,
   d_inode(dentry), dentry->d_flags);
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 2ed1e0a..05e7dc8 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -144,10 +144,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 static void ll_invalidate_negative_children(struct inode *dir)
 {
struct dentry *dentry, *tmp_subdir;
-   struct ll_d_hlist_node *p;
 
ll_lock_dcache(dir);
-   ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(dentry, &dir->i_dentry, d_u.d_alias) {
spin_lock(&dentry->d_lock);
if (!list_empty(&dentry->d_subdirs)) {
struct dentry *child;
@@ -334,15 +333,14 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct 
inode *i2)
 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
 {
struct dentry *alias, *discon_alias, *invalid_alias;
-   struct ll_d_hlist_node *p;
 
-   if (ll_d_hlist_empty(&inode->i_dentry))
+   if (hlist_empty(&inode->i_dentry))
return NULL;
 
discon_alias = invalid_alias = NULL;
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
LASSERT(alias != dentry);
 
spin_lock(&alias->d_lock);
@@ -690,7 +688,7 @@ static struct inode *ll_create_node(struct inode *dir, 
struct lookup_intent *it)
goto out;
}
 
-   LASSERT(ll_d_hlist_empty(&inode->i_dentry));
+   LASSERT(hlist_empty(&inode->i_dentry));
 
/* We asked for a lock on the directory, but were granted a
 * lock on the inode.  Since we finally have an inode pointer,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/13] staging/lustre: get rid of cfs_bio_* compat macroses

2015-07-30 Thread green
From: Oleg Drokin 

This replaces cfs_bio_io_error with direct calls to bio_io_error
and cfs_bio_end_io with bio_end_io

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 
 drivers/staging/lustre/lustre/llite/lloop.c   | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 622bc93..e7d57e8 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -74,10 +74,6 @@
 #define FS_HAS_FIEMAP  (0)
 #endif
 
-#define cfs_bio_io_error(a, b)   bio_io_error((a))
-#define cfs_bio_endio(a, b, c)bio_endio((a), (c))
-
-
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index cc00fd1..56938d2 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -365,7 +365,7 @@ static void loop_make_request(struct request_queue *q, 
struct bio *old_bio)
loop_add_bio(lo, old_bio);
return;
 err:
-   cfs_bio_io_error(old_bio, old_bio->bi_iter.bi_size);
+   bio_io_error(old_bio);
 }
 
 
@@ -376,7 +376,7 @@ static inline void loop_handle_bio(struct lloop_device *lo, 
struct bio *bio)
while (bio) {
struct bio *tmp = bio->bi_next;
bio->bi_next = NULL;
-   cfs_bio_endio(bio, bio->bi_iter.bi_size, ret);
+   bio_endio(bio, ret);
bio = tmp;
}
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/13] staging/lustre: Get rid of inode_dio_write_done and inode_dio_read

2015-07-30 Thread green
From: Oleg Drokin 

These primitives are long deprecated and unused.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 5 +
 drivers/staging/lustre/lustre/llite/vvp_io.c  | 5 ++---
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 157bafb..6b14406 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -64,11 +64,6 @@
 
 #define LTIME_S(time) (time.tv_sec)
 
-/* inode_dio_wait(i) use as-is for write lock */
-# define inode_dio_write_done(i)   do {} while (0) /* for write unlock */
-# define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
-/* inode_dio_done(i) use as-is for read unlock */
-
 #ifndef QUOTA_OK
 # define QUOTA_OK 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 39f0b2a..55e2dc6 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1356,11 +1356,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
if (!op_data)
return -ENOMEM;
 
-   if (!S_ISDIR(inode->i_mode)) {
-   if (attr->ia_valid & ATTR_SIZE)
-   inode_dio_write_done(inode);
+   if (!S_ISDIR(inode->i_mode))
mutex_unlock(&inode->i_mutex);
-   }
 
memcpy(&op_data->op_attr, attr, sizeof(*attr));
 
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c 
b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 91bba79..a659962 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -455,12 +455,11 @@ static void vvp_io_setattr_end(const struct lu_env *env,
struct cl_io *io= ios->cis_io;
struct inode *inode = ccc_object_inode(io->ci_obj);
 
-   if (cl_io_is_trunc(io)) {
+   if (cl_io_is_trunc(io))
/* Truncate in memory pages - they must be clean pages
 * because osc has already notified to destroy osc_extents. */
vvp_do_vmtruncate(inode, io->u.ci_setattr.sa_attr.lvb_size);
-   inode_dio_write_done(inode);
-   }
+
mutex_unlock(&inode->i_mutex);
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/13] staging/lustre: use ATTR_OPEN directly, remove ATTR_RAW

2015-07-30 Thread green
From: Oleg Drokin 

ATTR_RAW is unused.
No point in redefining ATTR_OPEN as ATTR_FROM_OPEN

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_patchless_compat.h| 12 
 drivers/staging/lustre/lustre/mdc/mdc_lib.c  |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git 
a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
index 1456278..ebe8d68 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
@@ -60,18 +60,6 @@ truncate_complete_page(struct address_space *mapping, struct 
page *page)
ll_delete_from_page_cache(page);
 }
 
-#ifdef ATTR_OPEN
-# define ATTR_FROM_OPEN ATTR_OPEN
-#else
-# ifndef ATTR_FROM_OPEN
-#  define ATTR_FROM_OPEN 0
-# endif
-#endif /* ATTR_OPEN */
-
-#ifndef ATTR_RAW
-#define ATTR_RAW 0
-#endif
-
 #ifndef ATTR_CTIME_SET
 /*
  * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c 
b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index d3234cb..1a850ea 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -286,7 +286,7 @@ static inline __u64 attr_pack(unsigned int ia_valid)
sa_valid |= MDS_ATTR_KILL_SGID;
if (ia_valid & ATTR_CTIME_SET)
sa_valid |= MDS_ATTR_CTIME_SET;
-   if (ia_valid & ATTR_FROM_OPEN)
+   if (ia_valid & ATTR_OPEN)
sa_valid |= MDS_ATTR_FROM_OPEN;
if (ia_valid & ATTR_BLOCKS)
sa_valid |= MDS_ATTR_BLOCKS;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/13] staging/lustre: ATTR_TIMES_SET is always defined, so don't check it

2015-07-30 Thread green
From: Oleg Drokin 

Remove ATTR_TIMES_SET check as it's always present, move
the mask of times define close to where it's used.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 2 ++
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index ffcbc78..157bafb 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -84,10 +84,4 @@
 # define ext2_find_next_zero_bit  find_next_zero_bit_le
 #endif
 
-#ifdef ATTR_TIMES_SET
-# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
-#else
-# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET)
-#endif
-
 #endif /* _COMPAT25_H */
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index ab4839c..39f0b2a 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1150,6 +1150,8 @@ void ll_clear_inode(struct inode *inode)
lli->lli_has_smd = false;
 }
 
+#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
+
 static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
  struct md_open_data **mod)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/13] staging/lustre: Get rid of ll_pagevec_ macros

2015-07-30 Thread green
From: Oleg Drokin 

They are noop anyways.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/llite/dir.c | 4 
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index bc4f752..ffcbc78 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,11 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#define ll_pagevec_init(pv, cold)   do {} while (0)
-#define ll_pagevec_add(pv, pg)   (0)
-#define ll_pagevec_lru_add_file(pv) do {} while (0)
-
-
 #ifndef QUOTA_OK
 # define QUOTA_OK 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 3d746a9..769b611 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -203,7 +203,6 @@ static int ll_dir_filler(void *_hash, struct page *page0)
 
CDEBUG(D_VFSTRACE, "read %d/%d pages\n", nrdpgs, npages);
 
-   ll_pagevec_init(&lru_pvec, 0);
for (i = 1; i < npages; i++) {
unsigned long offset;
int ret;
@@ -228,15 +227,12 @@ static int ll_dir_filler(void *_hash, struct page *page0)
GFP_KERNEL);
if (ret == 0) {
unlock_page(page);
-   if (ll_pagevec_add(&lru_pvec, page) == 0)
-   ll_pagevec_lru_add_file(&lru_pvec);
} else {
CDEBUG(D_VFSTRACE, "page %lu add to page cache failed: 
%d\n",
   offset, ret);
}
page_cache_release(page);
}
-   ll_pagevec_lru_add_file(&lru_pvec);
 
if (page_pool != &page0)
kfree(page_pool);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/13] staging/lustre: replace ll_umode_t with umode_t

2015-07-30 Thread green
From: Oleg Drokin 

umode_t is what we need anyway, so replace all users
and drop the define.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 drivers/staging/lustre/lustre/llite/namei.c   | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 754f63f..65493b3 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -104,10 +104,4 @@
 # define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET)
 #endif
 
-
-#include 
-#include 
-
-# define ll_umode_tumode_t
-
 #endif /* _COMPAT25_H */
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 72ce6e7..2ed1e0a 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -1008,7 +1008,7 @@ static int ll_unlink(struct inode *dir, struct dentry 
*dentry)
return rc;
 }
 
-static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode)
+static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
int err;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/13] staging/lustre: remove *hw_segments compat defines

2015-07-30 Thread green
From: Oleg Drokin 

queue_max_phys_segments, queue_max_hw_segments and bio_hw_segments
are not used anywhere in the client code, so remove them

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 38eda23..d0e8f3c 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -100,10 +100,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 
 
 
-#define queue_max_phys_segments(rq)   queue_max_segments(rq)
-#define queue_max_hw_segments(rq)   queue_max_segments(rq)
-
-
 #define ll_d_hlist_node hlist_node
 #define ll_d_hlist_empty(list) hlist_empty(list)
 #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
@@ -112,8 +108,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
p = NULL; hlist_for_each_entry(dentry, i_dentry, alias)
 
 
-#define bio_hw_segments(q, bio) 0
-
 
 #define ll_pagevec_init(pv, cold)   do {} while (0)
 #define ll_pagevec_add(pv, pg)   (0)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/13] staging/lustre: Drop FMODE_UNSIGNED_OFFSET define

2015-07-30 Thread green
From: Oleg Drokin 

It's not really used anywhere.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 7d90999..754f63f 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -90,10 +90,6 @@
 # define NO_QUOTA (-EDQUOT)
 #endif
 
-#ifndef FMODE_UNSIGNED_OFFSET
-#define FMODE_UNSIGNED_OFFSET  ((__force fmode_t)0x2000)
-#endif
-
 #if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit)
 # define ext2_set_bit   __test_and_set_bit_le
 # define ext2_clear_bit   __test_and_clear_bit_le
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/13] staging/lustre: Drop SLAB_DESTROY_BY_RCU redefine, it's always defined

2015-07-30 Thread green
From: Oleg Drokin 

SLAB_DESTROY_BY_RCU is always defined in kernel slab.h, so
no point in checking for it.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 1a6b2fb..38eda23 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,12 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#ifndef SLAB_DESTROY_BY_RCU
-#define SLAB_DESTROY_BY_RCU 0
-#endif
-
-
-
 static inline int
 ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/13] staging/lustre: Drop FS_HAS_FIEMAP compat macro

2015-07-30 Thread green
From: Oleg Drokin 

FS_HAS_FIEMAP was some sort of old RHEL5 construct that's not
really important anymore

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/obdclass/obd_mount.c| 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index e7d57e8..1a6b2fb 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,11 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-
-#ifndef FS_HAS_FIEMAP
-#define FS_HAS_FIEMAP  (0)
-#endif
-
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
 #endif
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 3e0b8a4..40ab7b2 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -1281,7 +1281,7 @@ struct file_system_type lustre_fs_type = {
.mount  = lustre_mount,
.kill_sb  = lustre_kill_super,
.fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
-   FS_HAS_FIEMAP | FS_RENAME_DOES_D_MOVE,
+   FS_RENAME_DOES_D_MOVE,
 };
 MODULE_ALIAS_FS("lustre");
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/13] staging/lustre: Remove unused ll_vfs_* compat defines

2015-07-30 Thread green
From: Oleg Drokin 

Lustre defines quite a bit of those compatibility defines
duplicating kernel vfs api, but they are not actually used
in the client so remove them all and also ll_dirty_inode,
ll_security_inode_unlink and cfs_path_put

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_compat25.h  | 25 --
 1 file changed, 25 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 513c81f..622bc93 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -74,22 +74,9 @@
 #define FS_HAS_FIEMAP  (0)
 #endif
 
-#define ll_vfs_rmdir(dir, entry, mnt)   vfs_rmdir(dir, entry)
-#define ll_vfs_mkdir(inode, dir, mnt, mode)vfs_mkdir(inode, dir, mode)
-#define ll_vfs_link(old, mnt, dir, new, mnt1)   vfs_link(old, dir, new)
-#define ll_vfs_unlink(inode, entry, mnt) vfs_unlink(inode, entry)
-#define ll_vfs_mknod(dir, entry, mnt, mode, dev) \
-vfs_mknod(dir, entry, mode, dev)
-#define ll_security_inode_unlink(dir, entry, mnt) \
-security_inode_unlink(dir, entry)
-#define ll_vfs_rename(old, old_dir, mnt, new, new_dir, mnt1) \
-   vfs_rename(old, old_dir, new, new_dir, NULL, 0)
-
 #define cfs_bio_io_error(a, b)   bio_io_error((a))
 #define cfs_bio_endio(a, b, c)bio_endio((a), (c))
 
-#define cfs_path_put(nd) path_put(&(nd)->path)
-
 
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
@@ -127,14 +114,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 }
 
 
-# define ll_vfs_dq_init dquot_initialize
-# define ll_vfs_dq_drop dquot_drop
-# define ll_vfs_dq_transfer dquot_transfer
-# define ll_vfs_dq_off(sb, remount) dquot_suspend(sb, -1)
-
-
-
-
 
 #define queue_max_phys_segments(rq)   queue_max_segments(rq)
 #define queue_max_hw_segments(rq)   queue_max_segments(rq)
@@ -194,8 +173,4 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 
 # define ll_umode_tumode_t
 
-#include 
-
-# define ll_dirty_inode(inode, flag)   
(inode)->i_sb->s_op->dirty_inode((inode), flag)
-
 #endif /* _COMPAT25_H */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/13] Removal of lustre compat macros

2015-07-30 Thread green
From: Oleg Drokin 

This patchset is a stroll through lustre/include/linux/lustre_compat25.h
that houses a bunch of our "compatibility with old/new kernels"
code and gettign rid of everything that we know for granted is available
because we are part of the tree.

These are the low hanging fruit, the rest are somewhat more tricky and
would need some more research.

a different cfs_bio_* compat removal patch was sent to the linux-block
tree since they changed the prototype, so if there's a conflict with that,
please pick their version.

Oleg Drokin (13):
  staging/lustre: Remove unused ll_vfs_* compat defines
  staging/lustre: get rid of cfs_bio_* compat macroses
  staging/lustre: Drop FS_HAS_FIEMAP compat macro
  staging/lustre: Drop SLAB_DESTROY_BY_RCU redefine, it's always defined
  staging/lustre: remove *hw_segments compat defines
  staging/lustre: Drop SEEK_* definition checks
  staging/lustre: Drop FMODE_UNSIGNED_OFFSET define
  staging/lustre: replace ll_umode_t with umode_t
  staging/lustre: Use hlist primitives directly
  staging/lustre: Get rid of ll_pagevec_ macros
  staging/lustre: ATTR_TIMES_SET is always defined, so don't check it
  staging/lustre: Get rid of inode_dio_write_done and inode_dio_read
  staging/lustre: use ATTR_OPEN directly, remove ATTR_RAW

 .../lustre/lustre/include/linux/lustre_compat25.h  | 119 -
 .../lustre/include/linux/lustre_patchless_compat.h |  12 ---
 drivers/staging/lustre/lustre/llite/dcache.c   |   3 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   4 -
 drivers/staging/lustre/lustre/llite/llite_lib.c|   7 +-
 drivers/staging/lustre/lustre/llite/lloop.c|   4 +-
 drivers/staging/lustre/lustre/llite/namei.c|  12 +--
 drivers/staging/lustre/lustre/llite/vvp_io.c   |   5 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c|   2 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   2 +-
 10 files changed, 15 insertions(+), 155 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre/llite: Don't set page writeback on non-dirty page

2015-07-30 Thread green
From: Oleg Drokin 

New writeback changes in 4.2-RC1 have exposed that we incorrectly
set page_writeback on a page that is being written synchronously,
which aside from this new crash (dereference of NULL inode->i_wb
from set_page_writeback) likely threw off some related page
statistics in the past.

 BUG: unable to handle kernel NULL pointer dereference at 0138
 IP: [] __percpu_counter_add+0x1a/0x80
 PGD 0
 Oops:  [#1] SMP DEBUG_PAGEALLOC
 Modules linked in: osc(C) lmv(C) fld(C) mgc(C) lustre(C) mdc(C) fid(C) lov(C) 
ksocklnd(C) ptlrpc(C) obdclass(C) lnet(C) libcfs(C) loop sha512_generic crc32 
rpcsec_gss_krb5 microcode joydev i2c_piix4 acpi_cpufreq pcspkr nfsd syscopyarea 
sysfillrect sysimgblt drm_kms_helper ttm drm serio_raw virtio_blk [last 
unloaded: libcfs]
 CPU: 0 PID: 13328 Comm: cvs Tainted: G C  4.2.0-rc1-vm-nfs+ #30
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: 8800cc98a400 ti: 8801157e8000 task.ti: 8801157e8000
 RIP: 0010:[]  [] 
__percpu_counter_add+0x1a/0x80
 RSP: 0018:8801157eb698  EFLAGS: 00010086
 RAX: 0003 RBX: ea0002b91cc0 RCX: 001a
 RDX: 0020 RSI: 0001 RDI: 00e8
 RBP: 8801157eb6b8 R08: 0001 R09: 
 R10:  R11:  R12: 00e8
 R13: 0001 R14: 8800673587a8 R15: 8800673589b0
 FS:  7f6718b89800() GS:88011f40() knlGS:
 CS:  0010 DS:  ES:  CR0: 80050033
 CR2: 0138 CR3: 9d51c000 CR4: 07f0
 Stack:
  811919e2 ea0002b91cc0 880067358998 880119419800
  8801157eb718 81191a58 8801157eb788 0282
  8800ce5ce920  8800a525af80 880053f68f10
 Call Trace:
  [] ? __test_set_page_writeback+0x72/0x240
  [] __test_set_page_writeback+0xe8/0x240
  [] vvp_page_prep_write+0x33/0xb0 [lustre]
  [] cl_page_invoke+0x57/0x90 [obdclass]
  [] cl_page_prep+0x2d/0x180 [obdclass]
  [] osc_io_submit+0x134/0x4a0 [osc]
  [] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [] lov_io_submit+0x3a5/0x570 [lov]
  [] ? lockdep_init_map+0x5b/0x6d0
  [] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [] cl_io_submit_sync+0xed/0x1c0 [obdclass]
  [] vvp_page_sync_io.isra.15+0x4d/0x100 [lustre]
  [] ? cl_page_clip+0xff/0x130 [obdclass]
  [] vvp_io_commit_write+0x448/0x500 [lustre]
  [] cl_io_commit_write+0x9a/0x130 [obdclass]
  [] ll_commit_write+0xc2/0x230 [lustre]
  [] ll_write_end+0x2a/0x50 [lustre]
  [] generic_perform_write+0xfa/0x1b0
  [] ? dentry_needs_remove_privs.part.16+0x1e/0x30
  [] __generic_file_write_iter+0x190/0x1f0
  [] generic_file_write_iter+0xea/0x1e0
  [] vvp_io_write_start+0xa0/0x1e0 [lustre]
  [] cl_io_start+0x49/0x80 [obdclass]
  [] cl_io_loop+0x73/0xd0 [obdclass]
  [] ll_file_io_generic+0x45f/0x4b0 [lustre]
  [] ll_file_write_iter+0x6c/0xc0 [lustre]
  [] __vfs_write+0xaa/0xe0
  [] vfs_write+0xa9/0x190
  [] SyS_write+0x49/0xa0
  [] entry_SYSCALL_64_fastpath+0x16/0x7a
 Code: 5b 41 5c 41 5d 41 5e 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 55 41 
54 53 49 89 fc 49 89 f5 48 83 ec 08 65 ff 05 8e d1 bf 7e <48> 8b 47 50 48 63 ca 
65 8b 18 48 63 db 48 01 f3 48 39 cb 7d 0a

Signed-off-by: Jinshan Xiong 
Signed-off-by: Oleg Drokin 
Reviewed-on: http://review.whamcloud.com/15610
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6854
---
 drivers/staging/lustre/lustre/llite/vvp_page.c   | 27 +++-
 drivers/staging/lustre/lustre/obdclass/cl_page.c |  3 ---
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c 
b/drivers/staging/lustre/lustre/llite/vvp_page.c
index 954ed08..a3cf5ad 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_page.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_page.c
@@ -227,11 +227,16 @@ static int vvp_page_prep_write(const struct lu_env *env,
   struct cl_io *unused)
 {
struct page *vmpage = cl2vm_page(slice);
+   struct cl_page *pg = slice->cpl_page;
 
LASSERT(PageLocked(vmpage));
LASSERT(!PageDirty(vmpage));
 
-   set_page_writeback(vmpage);
+   /* ll_writepage path is not a sync write, so need to set page writeback
+* flag */
+   if (!pg->cp_sync_io)
+   set_page_writeback(vmpage);
+
vvp_write_pending(cl2ccc(slice->cpl_obj), cl2ccc_page(slice));
 
return 0;
@@ -298,9 +303,6 @@ static void vvp_page_completion_write(const struct lu_env 
*env,
struct cl_page  *pg = slice->cpl_page;
struct page  *vmpage = cp->cpg_page;
 
-   LASSERT(ergo(pg->cp_sync_io != NULL, PageLocked(vmpage)));
-   LASSERT(PageWriteback(vmpage));
-
CL_PAGE_HEADER(D_PAGE, env, pg, "completing WRITE with %d\n", ioret);
 
/*
@@ -316,14 +318,19 @@ static void vvp_page_completion_write(const struct lu_env 
*env,
cp->cpg_write_queued = 0;
vvp_write

[PATCH] staging/lustre/llite: get rid of unused ll_super_blocks list

2015-08-08 Thread green
From: Oleg Drokin 

ll_super_blocks became unused quite a while ago with switch
to the new CLIO code.
So this patch removes the list, ll_sb_lock spinlock that guards it
and superblock info ll_list linkage.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/llite_internal.h |  1 -
 drivers/staging/lustre/lustre/llite/llite_lib.c  | 14 +-
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index f097d4d..ec27974 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -456,7 +456,6 @@ struct eacl_table {
 };
 
 struct ll_sb_info {
-   struct list_head  ll_list;
/* this protects pglist and ra_info.  It isn't safe to
 * grab from interrupt contexts */
spinlock_tll_lock;
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 55e2dc6..b4ed6c8 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -60,9 +60,6 @@ struct kmem_cache *ll_file_data_slab;
 struct dentry *llite_root;
 struct kset *llite_kset;
 
-static LIST_HEAD(ll_super_blocks);
-static DEFINE_SPINLOCK(ll_sb_lock);
-
 #ifndef log2
 #define log2(n) ffz(~(n))
 #endif
@@ -112,10 +109,6 @@ static struct ll_sb_info *ll_init_sbi(struct super_block 
*sb)
class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
 
-   spin_lock(&ll_sb_lock);
-   list_add_tail(&sbi->ll_list, &ll_super_blocks);
-   spin_unlock(&ll_sb_lock);
-
sbi->ll_flags |= LL_SBI_VERBOSE;
sbi->ll_flags |= LL_SBI_CHECKSUM;
 
@@ -144,12 +137,7 @@ static void ll_free_sbi(struct super_block *sb)
 {
struct ll_sb_info *sbi = ll_s2sbi(sb);
 
-   if (sbi != NULL) {
-   spin_lock(&ll_sb_lock);
-   list_del(&sbi->ll_list);
-   spin_unlock(&ll_sb_lock);
-   kfree(sbi);
-   }
+   kfree(sbi);
 }
 
 static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging/lustre/o2iblnd: remove references to ib_reg_phsy_mr()

2015-08-18 Thread green
From: Oleg Drokin 

Removed references to ib_reg_phsy_mr() and PMR which was added
to deal with some Chelsio specific scenario, but no longer needed
now.

Signed-off-by: Amir Shehata 
Signed-off-by: Oleg Drokin 
---
This fixes a build failure in Lustre due to ib_reg_phys_mr being removed.

 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 251 +
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h|  32 +--
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |  55 +
 .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c  |   6 -
 4 files changed, 19 insertions(+), 325 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 24b2c97..c29d2ce 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -1789,140 +1789,6 @@ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t 
*ps)
goto again;
 }
 
-void kiblnd_pmr_pool_unmap(kib_phys_mr_t *pmr)
-{
-   kib_pmr_pool_t *ppo = pmr->pmr_pool;
-   struct ib_mr *mr = pmr->pmr_mr;
-
-   pmr->pmr_mr = NULL;
-   kiblnd_pool_free_node(&ppo->ppo_pool, &pmr->pmr_list);
-   if (mr != NULL)
-   ib_dereg_mr(mr);
-}
-
-int kiblnd_pmr_pool_map(kib_pmr_poolset_t *pps, kib_hca_dev_t *hdev,
-   kib_rdma_desc_t *rd, __u64 *iova, kib_phys_mr_t **pp_pmr)
-{
-   kib_phys_mr_t *pmr;
-   struct list_head *node;
-   int rc;
-   int i;
-
-   node = kiblnd_pool_alloc_node(&pps->pps_poolset);
-   if (node == NULL) {
-   CERROR("Failed to allocate PMR descriptor\n");
-   return -ENOMEM;
-   }
-
-   pmr = container_of(node, kib_phys_mr_t, pmr_list);
-   if (pmr->pmr_pool->ppo_hdev != hdev) {
-   kiblnd_pool_free_node(&pmr->pmr_pool->ppo_pool, node);
-   return -EAGAIN;
-   }
-
-   for (i = 0; i < rd->rd_nfrags; i++) {
-   pmr->pmr_ipb[i].addr = rd->rd_frags[i].rf_addr;
-   pmr->pmr_ipb[i].size = rd->rd_frags[i].rf_nob;
-   }
-
-   pmr->pmr_mr = ib_reg_phys_mr(hdev->ibh_pd,
-pmr->pmr_ipb, rd->rd_nfrags,
-IB_ACCESS_LOCAL_WRITE |
-IB_ACCESS_REMOTE_WRITE,
-iova);
-   if (!IS_ERR(pmr->pmr_mr)) {
-   pmr->pmr_iova = *iova;
-   *pp_pmr = pmr;
-   return 0;
-   }
-
-   rc = PTR_ERR(pmr->pmr_mr);
-   CERROR("Failed ib_reg_phys_mr: %d\n", rc);
-
-   pmr->pmr_mr = NULL;
-   kiblnd_pool_free_node(&pmr->pmr_pool->ppo_pool, node);
-
-   return rc;
-}
-
-static void kiblnd_destroy_pmr_pool(kib_pool_t *pool)
-{
-   kib_pmr_pool_t *ppo = container_of(pool, kib_pmr_pool_t, ppo_pool);
-   kib_phys_mr_t *pmr;
-   kib_phys_mr_t *tmp;
-
-   LASSERT(pool->po_allocated == 0);
-
-   list_for_each_entry_safe(pmr, tmp, &pool->po_free_list, pmr_list) {
-   LASSERT(pmr->pmr_mr == NULL);
-   list_del(&pmr->pmr_list);
-
-   if (pmr->pmr_ipb != NULL) {
-   LIBCFS_FREE(pmr->pmr_ipb,
-   IBLND_MAX_RDMA_FRAGS *
-   sizeof(struct ib_phys_buf));
-   }
-
-   LIBCFS_FREE(pmr, sizeof(kib_phys_mr_t));
-   }
-
-   kiblnd_fini_pool(pool);
-   if (ppo->ppo_hdev != NULL)
-   kiblnd_hdev_decref(ppo->ppo_hdev);
-
-   LIBCFS_FREE(ppo, sizeof(kib_pmr_pool_t));
-}
-
-static inline int kiblnd_pmr_pool_size(int ncpts)
-{
-   int size = *kiblnd_tunables.kib_pmr_pool_size / ncpts;
-
-   return max(IBLND_PMR_POOL, size);
-}
-
-static int kiblnd_create_pmr_pool(kib_poolset_t *ps, int size,
- kib_pool_t **pp_po)
-{
-   struct kib_pmr_pool *ppo;
-   struct kib_pool *pool;
-   kib_phys_mr_t *pmr;
-   int i;
-
-   LIBCFS_CPT_ALLOC(ppo, lnet_cpt_table(),
-ps->ps_cpt, sizeof(kib_pmr_pool_t));
-   if (ppo == NULL) {
-   CERROR("Failed to allocate PMR pool\n");
-   return -ENOMEM;
-   }
-
-   pool = &ppo->ppo_pool;
-   kiblnd_init_pool(ps, pool, size);
-
-   for (i = 0; i < size; i++) {
-   LIBCFS_CPT_ALLOC(pmr, lnet_cpt_table(),
-ps->ps_cpt, sizeof(kib_phys_mr_t));
-   if (pmr == NULL)
-   break;
-
-   pmr->pmr_pool = ppo;
-   LIBCFS_CPT_ALLOC(pmr->pmr_ipb, lnet_cpt_table(), ps->ps_cpt,
-IBLND_MAX_RDMA_FRAGS * sizeof(*pmr->pmr_ipb));
-   if (pmr->pmr_ipb == NULL)
-   break;
-
-   list_add(&pmr->pmr_list, &pool->po_free_list);
-   }
-
-   if (i < size) {
-   ps->ps_pool_destroy(pool);
-

[PATCH] staging/lustre: remove IOC_LIBCFS_PING_TEST ioctl

2015-12-04 Thread green
From: James Simmons 

The ioctl IOC_LIBCFS_PING_TEST has not been used in
ages. The recent nidstring changes which moved all
the nidstring operations from libcfs to the LNet
layer but this ioctl code was still using an
nidstring operation that was causing a circular
dependency loop between libcfs and LNet.

Signed-off-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
Would be great to have this accepted to fix the ugly
circular dependency error Lustre is still causing in the Linus'
tree when enabled.

 .../staging/lustre/include/linux/libcfs/libcfs_ioctl.h  |  1 -
 drivers/staging/lustre/lustre/libcfs/module.c   | 17 -
 2 files changed, 18 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index f5d741f..485ab26 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -110,7 +110,6 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_CLEAR_DEBUG  _IOWR('e', 31, long)
 #define IOC_LIBCFS_MARK_DEBUG_IOWR('e', 32, long)
 #define IOC_LIBCFS_MEMHOG_IOWR('e', 36, long)
-#define IOC_LIBCFS_PING_TEST  _IOWR('e', 37, long)
 /* lnet ioctls */
 #define IOC_LIBCFS_GET_NI_IOWR('e', 50, long)
 #define IOC_LIBCFS_FAIL_NID_IOWR('e', 51, long)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 07a6859..e7c2b26 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -274,23 +274,6 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, 
unsigned long cmd,
}
break;
 
-   case IOC_LIBCFS_PING_TEST: {
-   extern void (kping_client)(struct libcfs_ioctl_data *);
-   void (*ping)(struct libcfs_ioctl_data *);
-
-   CDEBUG(D_IOCTL, "doing %d pings to nid %s (%s)\n",
-  data->ioc_count, libcfs_nid2str(data->ioc_nid),
-  libcfs_nid2str(data->ioc_nid));
-   ping = symbol_get(kping_client);
-   if (!ping)
-   CERROR("symbol_get failed\n");
-   else {
-   ping(data);
-   symbol_put(kping_client);
-   }
-   return 0;
-   }
-
default: {
struct libcfs_ioctl_handler *hand;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 41/45] staging/lustre/libcfs: Get rid of multiple assignments

2016-02-15 Thread green
From: Oleg Drokin 

They make checkpatch unhappy, and I guess overall might confuse
people too.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/libcfs_mem.c| 7 ---
 drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 6 --
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
index 7396d66..c5a6951 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
@@ -82,9 +82,10 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int 
size)
if (!arr)
return NULL;
 
-   arr->va_size= size = L1_CACHE_ALIGN(size);
-   arr->va_count   = count;
-   arr->va_cptab   = cptab;
+   size = L1_CACHE_ALIGN(size);
+   arr->va_size = size;
+   arr->va_count = count;
+   arr->va_cptab = cptab;
 
for (i = 0; i < count; i++) {
LIBCFS_CPT_ALLOC(arr->va_ptrs[i], cptab, i, size);
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index 4a2c83b..09ab0e4 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -337,8 +337,10 @@ cfs_range_expr_print(char *buffer, int count, struct 
cfs_range_expr *expr,
char s[] = "[";
char e[] = "]";
 
-   if (bracketed)
-   s[0] = e[0] = '\0';
+   if (bracketed) {
+   s[0] = '\0';
+   e[0] = '\0';
+   }
 
if (expr->re_lo == expr->re_hi)
i = scnprintf(buffer, count, "%u", expr->re_lo);
-- 
2.1.0



[PATCH 03/45] staging/lustre/libcfs: Get rid of /proc references in comments

2016-02-15 Thread green
From: Oleg Drokin 

Now that the sysfs conversion is complete, also convert all the
remaining comments

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 4 ++--
 drivers/staging/lustre/lustre/libcfs/module.c| 4 
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 7 ---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
index 59c7bf3..3358c3b 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
@@ -87,7 +87,7 @@ void libcfs_run_debug_log_upcall(char *file)
 
rc = call_usermodehelper(argv[0], argv, envp, 1);
if (rc < 0 && rc != -ENOENT) {
-   CERROR("Error %d invoking LNET debug log upcall %s %s; check 
/proc/sys/lnet/debug_log_upcall\n",
+   CERROR("Error %d invoking LNET debug log upcall %s %s; check 
/sys/kernel/debug/lnet/debug_log_upcall\n",
   rc, argv[0], argv[1]);
} else {
CDEBUG(D_HA, "Invoked LNET debug log upcall %s %s\n",
@@ -113,7 +113,7 @@ void libcfs_run_upcall(char **argv)
 
rc = call_usermodehelper(argv[0], argv, envp, 1);
if (rc < 0 && rc != -ENOENT) {
-   CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; 
check /proc/sys/lnet/upcall\n",
+   CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; 
check /sys/kernel/debug/lnet/upcall\n",
   rc, argv[0], argv[1],
   argc < 3 ? "" : ",", argc < 3 ? "" : argv[2],
   argc < 4 ? "" : ",", argc < 4 ? "" : argv[3],
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 611607a..45838b5 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -368,10 +368,6 @@ static int proc_cpt_table(struct ctl_table *table, int 
write,
 }
 
 static struct ctl_table lnet_table[] = {
-   /*
-* NB No .strategy entries have been provided since sysctl(8) prefers
-* to go via /proc for portability.
-*/
{
.procname = "debug",
.data = &libcfs_debug,
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 65c4f1a..a7d9b78 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -771,9 +771,10 @@ EXPORT_SYMBOL(cfs_trace_copyin_string);
 int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
 const char *knl_buffer, char *append)
 {
-   /* NB if 'append' != NULL, it's a single character to append to the
-* copied out string - usually "\n", for /proc entries and "" (i.e. a
-* terminating zero byte) for sysctl entries */
+   /*
+* NB if 'append' != NULL, it's a single character to append to the
+* copied out string - usually "\n" or "" (i.e. a terminating zero byte)
+*/
int   nob = strlen(knl_buffer);
 
if (nob > usr_buffer_nob)
-- 
2.1.0



[PATCH 12/45] staging/lustre/libcfs: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"
Also removed some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c   |   4 +-
 drivers/staging/lustre/lustre/libcfs/hash.c| 104 ++---
 drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c  |   6 +-
 drivers/staging/lustre/lustre/libcfs/libcfs_lock.c |   2 +-
 drivers/staging/lustre/lustre/libcfs/libcfs_mem.c  |   2 +-
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |  15 ++-
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |  58 ++--
 .../lustre/lustre/libcfs/linux/linux-crypto.c  |  18 ++--
 .../lustre/lustre/libcfs/linux/linux-debug.c   |   4 +-
 .../lustre/lustre/libcfs/linux/linux-module.c  |   6 +-
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   |   6 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |  15 ++-
 drivers/staging/lustre/lustre/libcfs/tracefile.c   |  40 
 drivers/staging/lustre/lustre/libcfs/tracefile.h   |  12 +--
 drivers/staging/lustre/lustre/libcfs/workitem.c|   8 +-
 15 files changed, 143 insertions(+), 157 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 6274558..589b548 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -378,7 +378,7 @@ libcfs_debug_mask2str(char *str, int size, int mask, int 
is_subsys)
continue;
 
token = fn(i);
-   if (token == NULL)/* unused bit */
+   if (!token)   /* unused bit */
continue;
 
if (len > 0) {/* separator? */
@@ -505,7 +505,7 @@ int libcfs_debug_init(unsigned long bufsize)
libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
}
 
-   if (libcfs_debug_file_path != NULL) {
+   if (libcfs_debug_file_path) {
strlcpy(libcfs_debug_file_path_arr,
libcfs_debug_file_path,
sizeof(libcfs_debug_file_path_arr));
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 4d50510..ad831fa 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -355,7 +355,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
 
dh = container_of(cfs_hash_dh_hhead(hs, bd),
  struct cfs_hash_dhead, dh_head);
-   if (dh->dh_tail != NULL) /* not empty */
+   if (dh->dh_tail) /* not empty */
hlist_add_behind(hnode, dh->dh_tail);
else /* empty list */
hlist_add_head(hnode, &dh->dh_head);
@@ -371,7 +371,7 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
 
dh = container_of(cfs_hash_dh_hhead(hs, bd),
  struct cfs_hash_dhead, dh_head);
-   if (hnd->next == NULL) { /* it's the tail */
+   if (!hnd->next) { /* it's the tail */
dh->dh_tail = (hnd->pprev == &dh->dh_head.first) ? NULL :
  container_of(hnd->pprev, struct hlist_node, next);
}
@@ -412,7 +412,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
 
dh = container_of(cfs_hash_dd_hhead(hs, bd),
  struct cfs_hash_dhead_dep, dd_head);
-   if (dh->dd_tail != NULL) /* not empty */
+   if (dh->dd_tail) /* not empty */
hlist_add_behind(hnode, dh->dd_tail);
else /* empty list */
hlist_add_head(hnode, &dh->dd_head);
@@ -428,7 +428,7 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
 
dh = container_of(cfs_hash_dd_hhead(hs, bd),
  struct cfs_hash_dhead_dep, dd_head);
-   if (hnd->next == NULL) { /* it's the tail */
+   if (!hnd->next) { /* it's the tail */
dh->dd_tail = (hnd->pprev == &dh->dd_head.first) ? NULL :
  container_of(hnd->pprev, struct hlist_node, next);
}
@@ -492,7 +492,7 @@ void
 cfs_hash_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bd)
 {
/* NB: caller should hold hs->hs_rwlock if REHASH is set */
-   if (likely(hs->hs_rehash_buckets == NULL)) {
+   if (likely(!hs->hs_rehash_buckets)) {
cfs_hash_bd_from_key(hs, hs->hs_buckets,
 hs->hs_cur_bits, key, bd);
} else {
@@ -641,7 +641,7 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
if (!cfs_hash_keycmp(hs, key, ehnode))
continue;
 
-   if (match != NULL && match != ehnode) /* can't match */
+   if (match && match != ehnode) /* can't match */
  

[PATCH 24/45] staging/lustre/obdecho: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/obdecho/echo_client.c| 61 ++
 1 file changed, 29 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 4ca82af..ca87cc2 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -146,7 +146,7 @@ static inline struct echo_thread_info *echo_env_info(const 
struct lu_env *env)
struct echo_thread_info *info;
 
info = lu_context_key_get(&env->le_ctx, &echo_thread_key);
-   LASSERT(info != NULL);
+   LASSERT(info);
return info;
 }
 
@@ -267,7 +267,7 @@ static void echo_page_completion(const struct lu_env *env,
 const struct cl_page_slice *slice,
 int ioret)
 {
-   LASSERT(slice->cpl_page->cp_sync_io != NULL);
+   LASSERT(slice->cpl_page->cp_sync_io);
 }
 
 static void echo_page_fini(const struct lu_env *env,
@@ -393,13 +393,13 @@ static int echo_lock_init(const struct lu_env *env,
struct echo_lock *el;
 
el = kmem_cache_alloc(echo_lock_kmem, GFP_NOFS | __GFP_ZERO);
-   if (el != NULL) {
+   if (el) {
cl_lock_slice_add(lock, &el->el_cl, obj, &echo_lock_ops);
el->el_object = cl2echo_obj(obj);
INIT_LIST_HEAD(&el->el_chain);
atomic_set(&el->el_refcount, 0);
}
-   return el == NULL ? -ENOMEM : 0;
+   return !el ? -ENOMEM : 0;
 }
 
 static int echo_conf_set(const struct lu_env *env, struct cl_object *obj,
@@ -439,7 +439,7 @@ static int echo_object_init(const struct lu_env *env, 
struct lu_object *obj,
under = ed->ed_next;
below = under->ld_ops->ldo_object_alloc(env, obj->lo_header,
under);
-   if (below == NULL)
+   if (!below)
return -ENOMEM;
lu_object_add(obj, below);
}
@@ -470,12 +470,12 @@ static int echo_alloc_memmd(struct echo_device *ed,
int lsm_size;
 
/* If export is lov/osc then use their obd method */
-   if (ed->ed_next != NULL)
+   if (ed->ed_next)
return obd_alloc_memmd(ed->ed_ec->ec_exp, lsmp);
/* OFD has no unpackmd method, do everything here */
lsm_size = lov_stripe_md_size(1);
 
-   LASSERT(*lsmp == NULL);
+   LASSERT(!*lsmp);
*lsmp = kzalloc(lsm_size, GFP_NOFS);
if (!*lsmp)
return -ENOMEM;
@@ -498,12 +498,11 @@ static int echo_free_memmd(struct echo_device *ed, struct 
lov_stripe_md **lsmp)
int lsm_size;
 
/* If export is lov/osc then use their obd method */
-   if (ed->ed_next != NULL)
+   if (ed->ed_next)
return obd_free_memmd(ed->ed_ec->ec_exp, lsmp);
/* OFD has no unpackmd method, do everything here */
lsm_size = lov_stripe_md_size(1);
 
-   LASSERT(*lsmp != NULL);
kfree((*lsmp)->lsm_oinfo[0]);
kfree(*lsmp);
*lsmp = NULL;
@@ -562,9 +561,9 @@ static struct lu_object *echo_object_alloc(const struct 
lu_env *env,
struct lu_object *obj = NULL;
 
/* we're the top dev. */
-   LASSERT(hdr == NULL);
+   LASSERT(!hdr);
eco = kmem_cache_alloc(echo_object_kmem, GFP_NOFS | __GFP_ZERO);
-   if (eco != NULL) {
+   if (eco) {
struct cl_object_header *hdr = &eco->eo_hdr;
 
obj = &echo_obj2cl(eco)->co_lu;
@@ -627,7 +626,7 @@ static void *echo_thread_key_init(const struct lu_context 
*ctx,
struct echo_thread_info *info;
 
info = kmem_cache_alloc(echo_thread_kmem, GFP_NOFS | __GFP_ZERO);
-   if (info == NULL)
+   if (!info)
info = ERR_PTR(-ENOMEM);
return info;
 }
@@ -658,7 +657,7 @@ static void *echo_session_key_init(const struct lu_context 
*ctx,
struct echo_session_info *session;
 
session = kmem_cache_alloc(echo_session_kmem, GFP_NOFS | __GFP_ZERO);
-   if (session == NULL)
+   if (!session)
session = ERR_PTR(-ENOMEM);
return session;
 }
@@ -715,11 +714,11 @@ static struct lu_device *echo_device_alloc(const struct 
lu_env *env,
 
cleanup = 2;
obd = class_name2obd(lustre_cfg_string(cfg, 0));
-   LASSERT(obd != NULL);
-   LASSERT(env != NULL);
+   LASSERT(obd);
+   LASSERT(env);
 
tgt = class_name2obd(lustre_cfg_string(cfg, 1));
-   if (tgt == NULL) {
+   if (!tgt) {
CERROR("Can not find tgt device %s\n",
lustre_cfg_string(cfg, 1));
rc = -ENODEV;
@@ -748,13 +747,12 @@ static struct lu_device *echo_device_alloc(const struct 
lu_

[PATCH 34/45] staging/lustre/libcfs: Remove unused cfs_tcd_owns_tage() function

2016-02-15 Thread green
From: Oleg Drokin 

Does not appear to be used anywhere.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 10 --
 drivers/staging/lustre/lustre/libcfs/tracefile.h |  3 ---
 2 files changed, 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 5e3c400..6cff79d 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -176,16 +176,6 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, 
int walking)
spin_unlock(&tcd->tcd_lock);
 }
 
-int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,
- struct cfs_trace_page *tage)
-{
-   /*
-* XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT)
-* from here: this will lead to infinite recursion.
-*/
-   return tcd->tcd_cpu == tage->cpu;
-}
-
 void
 cfs_set_ptldebug_header(struct ptldebug_header *header,
struct libcfs_debug_msg_data *msgdata,
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index 2285744..0995da1 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -289,9 +289,6 @@ static inline void cfs_trace_put_tcd(struct 
cfs_trace_cpu_data *tcd)
 int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,
   struct list_head *stock);
 
-int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd,
- struct cfs_trace_page *tage);
-
 void cfs_trace_assertion_failed(const char *str,
struct libcfs_debug_msg_data *m);
 
-- 
2.1.0



[PATCH 44/45] staging/lustre: Convert cfs_trace_daemon_command to use kstrtoul

2016-02-15 Thread green
From: Oleg Drokin 

simple_strtoul is obsolete

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 7df8f0a..510673d 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -878,12 +878,15 @@ int cfs_trace_daemon_command(char *str)
memset(cfs_tracefile, 0, sizeof(cfs_tracefile));
 
} else if (strncmp(str, "size=", 5) == 0) {
-   cfs_tracefile_size = simple_strtoul(str + 5, NULL, 0);
-   if (cfs_tracefile_size < 10 || cfs_tracefile_size > 20480)
-   cfs_tracefile_size = CFS_TRACEFILE_SIZE;
-   else
-   cfs_tracefile_size <<= 20;
-
+   unsigned long tmp;
+
+   rc = kstrtoul(str + 5, 10, &tmp);
+   if (!rc) {
+   if (tmp < 10 || tmp > 20480)
+   cfs_tracefile_size = CFS_TRACEFILE_SIZE;
+   else
+   cfs_tracefile_size = tmp << 20;
+   }
} else if (strlen(str) >= sizeof(cfs_tracefile)) {
rc = -ENAMETOOLONG;
} else if (str[0] != '/') {
-- 
2.1.0



[PATCH 36/45] staging/lustre/libcfs: Update comments style to match kernel

2016-02-15 Thread green
From: Oleg Drokin 

checkpatch complains that the trailing */ on the multiline comments
should be on it's own line.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c   | 18 +-
 drivers/staging/lustre/lustre/libcfs/fail.c|  3 ++-
 drivers/staging/lustre/lustre/libcfs/hash.c| 18 --
 drivers/staging/lustre/lustre/libcfs/libcfs_lock.c |  3 ++-
 drivers/staging/lustre/lustre/libcfs/libcfs_string.c   |  3 ++-
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c |  9 ++---
 .../staging/lustre/lustre/libcfs/linux/linux-crypto.c  |  3 ++-
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   |  3 ++-
 drivers/staging/lustre/lustre/libcfs/prng.c| 13 +++--
 drivers/staging/lustre/lustre/libcfs/tracefile.c   | 14 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.h   |  6 --
 drivers/staging/lustre/lustre/libcfs/workitem.c| 12 
 12 files changed, 65 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index fa81582..c90e510 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -82,7 +82,8 @@ static int libcfs_param_debug_mb_set(const char *val,
 
 /* While debug_mb setting look like unsigned int, in fact
  * it needs quite a bunch of extra processing, so we define special
- * debugmb parameter type with corresponding methods to handle this case */
+ * debugmb parameter type with corresponding methods to handle this case
+ */
 static struct kernel_param_ops param_ops_debugmb = {
.set = libcfs_param_debug_mb_set,
.get = param_get_uint,
@@ -227,8 +228,7 @@ MODULE_PARM_DESC(libcfs_debug_file_path,
 
 int libcfs_panic_in_progress;
 
-/* libcfs_debug_token2mask() expects the returned
- * string in lower-case */
+/* libcfs_debug_token2mask() expects the returned string in lower-case */
 static const char *
 libcfs_debug_subsys2str(int subsys)
 {
@@ -290,8 +290,7 @@ libcfs_debug_subsys2str(int subsys)
}
 }
 
-/* libcfs_debug_token2mask() expects the returned
- * string in lower-case */
+/* libcfs_debug_token2mask() expects the returned string in lower-case */
 static const char *
 libcfs_debug_dbg2str(int debug)
 {
@@ -470,7 +469,8 @@ void libcfs_debug_dumplog(void)
 
/* we're being careful to ensure that the kernel thread is
 * able to set our state to running as it exits before we
-* get to schedule() */
+* get to schedule()
+*/
init_waitqueue_entry(&wait, current);
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&debug_ctlwq, &wait);
@@ -511,7 +511,8 @@ int libcfs_debug_init(unsigned long bufsize)
}
 
/* If libcfs_debug_mb is set to an invalid value or uninitialized
-* then just make the total buffers smp_num_cpus * TCD_MAX_PAGES */
+* then just make the total buffers smp_num_cpus * TCD_MAX_PAGES
+*/
if (max > cfs_trace_max_debug_mb() || max < num_possible_cpus()) {
max = TCD_MAX_PAGES;
} else {
@@ -541,8 +542,7 @@ int libcfs_debug_clear_buffer(void)
return 0;
 }
 
-/* Debug markers, although printed by S_LNET
- * should not be be marked as such. */
+/* Debug markers, although printed by S_LNET should not be be marked as such. 
*/
 #undef DEBUG_SUBSYSTEM
 #define DEBUG_SUBSYSTEM S_UNDEFINED
 int libcfs_debug_mark_buffer(const char *text)
diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c 
b/drivers/staging/lustre/lustre/libcfs/fail.c
index 2783143..dadaf76 100644
--- a/drivers/staging/lustre/lustre/libcfs/fail.c
+++ b/drivers/staging/lustre/lustre/libcfs/fail.c
@@ -97,7 +97,8 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)
/* Lost race to set CFS_FAILED_BIT. */
if (test_and_set_bit(CFS_FAILED_BIT, &cfs_fail_loc)) {
/* If CFS_FAIL_ONCE is valid, only one process can fail,
-* otherwise multi-process can fail at the same time. */
+* otherwise multi-process can fail at the same time.
+*/
if (cfs_fail_loc & CFS_FAIL_ONCE)
return 0;
}
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 414577c..5e2afe4 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -579,7 +579,8 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct 
cfs_hash_bd *bd_old,
return;
 
/* use cfs_hash_bd_hnode_add/del, to avoid atomic & refcount ops
-* in cfs_hash_bd_del/add_locked */
+* in cfs_hash_bd_del/add_locked
+*/
hs->hs_hops->hop_hnode_del(hs, bd_old, hnode);
rc = hs->hs_hops->hop_hnode_add(hs, bd_new, hnode);
cfs_hash_bd_dep_record(hs, bd_new, rc);

[PATCH 10/45] staging/lustre: Remove commented out lock_lock_multi_match

2016-02-15 Thread green
From: Oleg Drokin 

lock_lock_multi_match stayed commented out unused for ages now,
so let's just remove it.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lov/lov_lock.c | 39 
 1 file changed, 39 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c 
b/drivers/staging/lustre/lustre/lov/lov_lock.c
index d866791..36615da 100644
--- a/drivers/staging/lustre/lustre/lov/lov_lock.c
+++ b/drivers/staging/lustre/lustre/lov/lov_lock.c
@@ -852,45 +852,6 @@ static int lov_lock_use(const struct lu_env *env,
return result;
 }
 
-#if 0
-static int lock_lock_multi_match()
-{
-   struct cl_lock*lock= slice->cls_lock;
-   struct cl_lock_descr*subneed = &lov_env_info(env)->lti_ldescr;
-   struct lov_object   *loo = cl2lov(lov->lls_cl.cls_obj);
-   struct lov_layout_raid0 *r0  = lov_r0(loo);
-   struct lov_lock_sub *sub;
-   struct cl_object*subobj;
-   u64  fstart;
-   u64  fend;
-   u64  start;
-   u64  end;
-   int i;
-
-   fstart = cl_offset(need->cld_obj, need->cld_start);
-   fend   = cl_offset(need->cld_obj, need->cld_end + 1) - 1;
-   subneed->cld_mode = need->cld_mode;
-   cl_lock_mutex_get(env, lock);
-   for (i = 0; i < lov->lls_nr; ++i) {
-   sub = &lov->lls_sub[i];
-   if (sub->sub_lock == NULL)
-   continue;
-   subobj = sub->sub_descr.cld_obj;
-   if (!lov_stripe_intersects(loo->lo_lsm, sub->sub_stripe,
-  fstart, fend, &start, &end))
-   continue;
-   subneed->cld_start = cl_index(subobj, start);
-   subneed->cld_end   = cl_index(subobj, end);
-   subneed->cld_obj   = subobj;
-   if (!cl_lock_ext_match(&sub->sub_got, subneed)) {
-   result = 0;
-   break;
-   }
-   }
-   cl_lock_mutex_put(env, lock);
-}
-#endif
-
 /**
  * Check if the extent region \a descr is covered by \a child against the
  * specific \a stripe.
-- 
2.1.0



[PATCH 08/45] staging/lustre: Remove server code from client_obd_setup()

2016-02-15 Thread green
From: Oleg Drokin 

In client_obd_setup references to LUSTRE_OSP_NAME could only
happen on metadata servers, so remove them as never true

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index b52ffc0..774d89c 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -261,22 +261,6 @@ int client_obd_setup(struct obd_device *obddev, struct 
lustre_cfg *lcfg)
cli->cl_sp_me = LUSTRE_SP_CLI;
cli->cl_sp_to = LUSTRE_SP_MDT;
ns_type = LDLM_NS_TYPE_MDC;
-   } else if (!strcmp(name, LUSTRE_OSP_NAME)) {
-   if (strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL) {
-   /* OSP_on_MDT for other MDTs */
-   connect_op = MDS_CONNECT;
-   cli->cl_sp_to = LUSTRE_SP_MDT;
-   ns_type = LDLM_NS_TYPE_MDC;
-   rq_portal = OUT_PORTAL;
-   } else {
-   /* OSP on MDT for OST */
-   connect_op = OST_CONNECT;
-   cli->cl_sp_to = LUSTRE_SP_OST;
-   ns_type = LDLM_NS_TYPE_OSC;
-   rq_portal = OST_REQUEST_PORTAL;
-   }
-   rp_portal = OSC_REPLY_PORTAL;
-   cli->cl_sp_me = LUSTRE_SP_CLI;
} else if (!strcmp(name, LUSTRE_MGC_NAME)) {
rq_portal = MGS_REQUEST_PORTAL;
rp_portal = MGC_REPLY_PORTAL;
-- 
2.1.0



[PATCH 00/45] Lustre cleanups

2016-02-15 Thread green
From: Oleg Drokin 

Majority of this patch is Lustre code style cleanups.
NULL comparison style is adjusted for the whole lustre tree
(but not lnet not to interfere with James patches in flight).

Some server-only code was removed in the process.

lustre/libcfs in addition was processed to remove as many checkpatch
warnings as was possible. Assuming this is the end result we
want I will process the rest of the Lustre tree in the similar way next.

Remaining warnings from checkpatch are either due to bugs/problems
in checkpatch (reported) or otherwise do not make sense.
Amongst these are the long printed strings - I know we could do an
exception for that, but this is pending renaming some of our debug
printing primitives, so I guess they just stay as is.

Please consider.

Here's the full list of remaining warnings in
drivers/staging/lustre/lustre/libcfs for those curious:

WARNING: line over 80 characters
#456: FILE: drivers/staging/lustre/lustre/libcfs/debug.c:427:
+   CWARN("You are trying to use a numerical value for the 
mask - this will be deprecated in a future release.\n");

ERROR: that open brace { should be on the previous line
#2102: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1362:
+cfs_hash_for_each_enter(struct cfs_hash *hs)
+{

ERROR: that open brace { should be on the previous line
#2129: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1389:
+cfs_hash_for_each_exit(struct cfs_hash *hs)
+{

ERROR: that open brace { should be on the previous line
#2160: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1420:
+cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+   void *data, int remove_safe)
+{

ERROR: that open brace { should be on the previous line
#2254: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1514:
+cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+  void *data)
+{

ERROR: that open brace { should be on the previous line
#2304: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1564:
+cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+   void *data)
+{

ERROR: that open brace { should be on the previous line
#2370: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1630:
+cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+void *data)
+{

ERROR: that open brace { should be on the previous line
#2402: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1662:
+cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+   void *data)
+{

ERROR: that open brace { should be on the previous line
#2459: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1719:
+cfs_hash_for_each_key(struct cfs_hash *hs, const void *key,
+ cfs_hash_for_each_cb_t func, void *data)
+{

CHECK: spinlock_t definition without comment
#3125: FILE: drivers/staging/lustre/lustre/libcfs/libcfs_lock.c:55:
+   spinlock_t  *lock;

WARNING: line over 80 characters
#4342: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:317:
+   CDEBUG(D_INFO, "Try to unset cpu %d which is not in 
CPT-table %p\n",

WARNING: line over 80 characters
#4392: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:367:
+   CDEBUG(D_INFO, "No online CPU is found in the CPU mask for CPU 
partition %d\n",

WARNING: line over 80 characters
#4588: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:563:
+   CERROR("No online CPU found in CPU partition %d, did someone do 
CPU hotplug on system? You might need to reload Lustre modules to keep system 
working well.\n",

WARNING: line over 80 characters
#4748: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:723:
+   CWARN("CPU partition number %d is larger than suggested value 
(%d), your system may have performance issue or run out of memory while under 
pressure\n",

WARNING: line over 80 characters
#4753: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:728:
+   CERROR("CPU number %d is not multiple of cpu_npartition %d, 
please try different cpu_npartitions value or set pattern string by 
cpu_pattern=STRING\n",

WARNING: line over 80 characters
#4803: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:778:
+   CERROR("Expect %d(%d) CPU partitions but got %d(%d), CPU 
hotplug/unplug while setting?\n",

WARNING: line over 80 characters
#4814: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:789:
+   CERROR("Failed to setup CPU-partition-table with %d CPU-partitions, 
online HW nodes: %d, HW cpus: %d.\n",

WARNING: char * array declaration might be better as static const
#5734: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:76:
+   char *envp[] = {

WARNING: line over 80 characters
#5748: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:90:
+ 

[PATCH 23/45] staging/lustre/obdclass: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/obdclass/acl.c   | 10 +--
 drivers/staging/lustre/lustre/obdclass/cl_io.c | 83 +-
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   | 47 +--
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 40 +
 drivers/staging/lustre/lustre/obdclass/cl_page.c   | 97 +++---
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  4 +-
 drivers/staging/lustre/lustre/obdclass/genops.c| 29 +++
 .../lustre/lustre/obdclass/linux/linux-module.c|  5 +-
 drivers/staging/lustre/lustre/obdclass/llog.c  | 18 ++--
 drivers/staging/lustre/lustre/obdclass/llog_cat.c  |  2 +-
 drivers/staging/lustre/lustre/obdclass/llog_obd.c  |  7 +-
 .../lustre/lustre/obdclass/lprocfs_counters.c  |  4 +-
 .../lustre/lustre/obdclass/lprocfs_status.c| 56 ++---
 drivers/staging/lustre/lustre/obdclass/lu_object.c | 94 ++---
 .../lustre/lustre/obdclass/lustre_handles.c| 12 +--
 .../staging/lustre/lustre/obdclass/lustre_peer.c   |  4 +-
 .../staging/lustre/lustre/obdclass/obd_config.c| 12 +--
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 37 -
 18 files changed, 267 insertions(+), 294 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c 
b/drivers/staging/lustre/lustre/obdclass/acl.c
index 49ba885..0e02ae9 100644
--- a/drivers/staging/lustre/lustre/obdclass/acl.c
+++ b/drivers/staging/lustre/lustre/obdclass/acl.c
@@ -104,7 +104,7 @@ static int 
lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header,
return old_size;
 
new = kmemdup(*header, new_size, GFP_NOFS);
-   if (unlikely(new == NULL))
+   if (unlikely(!new))
return -ENOMEM;
 
kfree(*header);
@@ -124,7 +124,7 @@ static int 
lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header,
return 0;
 
new = kmemdup(*header, ext_size, GFP_NOFS);
-   if (unlikely(new == NULL))
+   if (unlikely(!new))
return -ENOMEM;
 
kfree(*header);
@@ -149,7 +149,7 @@ lustre_posix_acl_xattr_2ext(posix_acl_xattr_header *header, 
int size)
count = CFS_ACL_XATTR_COUNT(size, posix_acl_xattr);
esize = CFS_ACL_XATTR_SIZE(count, ext_acl_xattr);
new = kzalloc(esize, GFP_NOFS);
-   if (unlikely(new == NULL))
+   if (unlikely(!new))
return ERR_PTR(-ENOMEM);
 
new->a_count = cpu_to_le32(count);
@@ -180,7 +180,7 @@ int lustre_posix_acl_xattr_filter(posix_acl_xattr_header 
*header, size_t size,
return -EINVAL;
 
new = kzalloc(size, GFP_NOFS);
-   if (unlikely(new == NULL))
+   if (unlikely(!new))
return -ENOMEM;
 
new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
@@ -300,7 +300,7 @@ lustre_acl_xattr_merge2ext(posix_acl_xattr_header 
*posix_header, int size,
ext_size = CFS_ACL_XATTR_SIZE(ext_count, ext_acl_xattr);
 
new = kzalloc(ext_size, GFP_NOFS);
-   if (unlikely(new == NULL))
+   if (unlikely(!new))
return ERR_PTR(-ENOMEM);
 
for (i = 0, j = 0; i < posix_count; i++) {
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c 
b/drivers/staging/lustre/lustre/obdclass/cl_io.c
index 63246ba..58b46a7 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_io.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c
@@ -93,7 +93,7 @@ static int cl_io_invariant(const struct cl_io *io)
 * CIS_IO_GOING.
 */
ergo(io->ci_owned_nr > 0, io->ci_state == CIS_IO_GOING ||
-(io->ci_state == CIS_LOCKED && up != NULL));
+(io->ci_state == CIS_LOCKED && up));
 }
 
 /**
@@ -111,7 +111,7 @@ void cl_io_fini(const struct lu_env *env, struct cl_io *io)
slice = container_of(io->ci_layers.prev, struct cl_io_slice,
 cis_linkage);
list_del_init(&slice->cis_linkage);
-   if (slice->cis_iop->op[io->ci_type].cio_fini != NULL)
+   if (slice->cis_iop->op[io->ci_type].cio_fini)
slice->cis_iop->op[io->ci_type].cio_fini(env, slice);
/*
 * Invalidate slice to catch use after free. This assumes that
@@ -164,7 +164,7 @@ static int cl_io_init0(const struct lu_env *env, struct 
cl_io *io,
 
result = 0;
cl_object_for_each(scan, obj) {
-   if (scan->co_ops->coo_io_init != NULL) {
+   if (scan->co_ops->coo_io_init) {
result = scan->co_ops->coo_io_init(env, scan, io);
if (result != 0)
break;
@@ -186,7 +186,7 @@ int cl_io_sub_init(const struct lu_env *env, struct cl_io 
*io,
struct 

[PATCH 35/45] staging/lustre/libcfs: Move private tracefile structs out of header

2016-02-15 Thread green
From: Oleg Drokin 

the struct page_collection, struct cfs_trace_page and
struct tracefiled_ctl are only used by tracefile.c, so move them
there.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 45 +
 drivers/staging/lustre/lustre/libcfs/tracefile.h | 51 
 2 files changed, 45 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 9191f38..298135f 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -56,6 +56,51 @@ static int thread_running;
 
 static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);
 
+struct page_collection {
+   struct list_headpc_pages;
+   /*
+* if this flag is set, collect_pages() will spill both
+* ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise,
+* only ->tcd_pages are spilled.
+*/
+   int pc_want_daemon_pages;
+};
+
+struct tracefiled_ctl {
+   struct completion   tctl_start;
+   struct completion   tctl_stop;
+   wait_queue_head_t   tctl_waitq;
+   pid_t   tctl_pid;
+   atomic_ttctl_shutdown;
+};
+
+/*
+ * small data-structure for each page owned by tracefiled.
+ */
+struct cfs_trace_page {
+   /*
+* page itself
+*/
+   struct page   *page;
+   /*
+* linkage into one of the lists in trace_data_union or
+* page_collection
+*/
+   struct list_head   linkage;
+   /*
+* number of bytes used within this page
+*/
+   unsigned int used;
+   /*
+* cpu that owns this page
+*/
+   unsigned short   cpu;
+   /*
+* type(context) of this page
+*/
+   unsigned short   type;
+};
+
 static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
 struct cfs_trace_cpu_data *tcd);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index 0995da1..2d4dc73 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -195,57 +195,6 @@ extern union cfs_trace_data_union 
(*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
 (tcd = &(*cfs_trace_data[i])[cpu].tcd) &&  \
 cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
 
-/* XXX nikita: this declaration is internal to tracefile.c and should probably
- * be moved there */
-struct page_collection {
-   struct list_headpc_pages;
-   /*
-* if this flag is set, collect_pages() will spill both
-* ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise,
-* only ->tcd_pages are spilled.
-*/
-   int pc_want_daemon_pages;
-};
-
-/* XXX nikita: this declaration is internal to tracefile.c and should probably
- * be moved there */
-struct tracefiled_ctl {
-   struct completion   tctl_start;
-   struct completion   tctl_stop;
-   wait_queue_head_t   tctl_waitq;
-   pid_t   tctl_pid;
-   atomic_ttctl_shutdown;
-};
-
-/*
- * small data-structure for each page owned by tracefiled.
- */
-/* XXX nikita: this declaration is internal to tracefile.c and should probably
- * be moved there */
-struct cfs_trace_page {
-   /*
-* page itself
-*/
-   struct page   *page;
-   /*
-* linkage into one of the lists in trace_data_union or
-* page_collection
-*/
-   struct list_head   linkage;
-   /*
-* number of bytes used within this page
-*/
-   unsigned int used;
-   /*
-* cpu that owns this page
-*/
-   unsigned short   cpu;
-   /*
-* type(context) of this page
-*/
-   unsigned short   type;
-};
-
 void cfs_set_ptldebug_header(struct ptldebug_header *header,
 struct libcfs_debug_msg_data *m,
 unsigned long stack);
-- 
2.1.0



[PATCH 17/45] staging/lustre/fid: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fid/fid_request.c | 14 +++---
 drivers/staging/lustre/lustre/fid/lproc_fid.c   | 14 ++
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index ff8f38d..7ca65df 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -68,7 +68,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
 
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_SEQ_QUERY,
LUSTRE_MDS_VERSION, SEQ_QUERY);
-   if (req == NULL)
+   if (!req)
return -ENOMEM;
 
/* Init operation code */
@@ -226,8 +226,8 @@ int seq_client_alloc_fid(const struct lu_env *env,
wait_queue_t link;
int rc;
 
-   LASSERT(seq != NULL);
-   LASSERT(fid != NULL);
+   LASSERT(seq);
+   LASSERT(fid);
 
init_waitqueue_entry(&link, current);
mutex_lock(&seq->lcs_mutex);
@@ -292,7 +292,7 @@ void seq_client_flush(struct lu_client_seq *seq)
 {
wait_queue_t link;
 
-   LASSERT(seq != NULL);
+   LASSERT(seq);
init_waitqueue_entry(&link, current);
mutex_lock(&seq->lcs_mutex);
 
@@ -375,8 +375,8 @@ static int seq_client_init(struct lu_client_seq *seq,
 {
int rc;
 
-   LASSERT(seq != NULL);
-   LASSERT(prefix != NULL);
+   LASSERT(seq);
+   LASSERT(prefix);
 
seq->lcs_type = type;
 
@@ -438,7 +438,7 @@ int client_fid_fini(struct obd_device *obd)
 {
struct client_obd *cli = &obd->u.cli;
 
-   if (cli->cl_seq != NULL) {
+   if (cli->cl_seq) {
seq_client_fini(cli->cl_seq);
kfree(cli->cl_seq);
cli->cl_seq = NULL;
diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c 
b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index 0320b6e..1f0e786 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -66,7 +66,7 @@ ldebugfs_fid_write_common(const char __user *buffer, size_t 
count,
int rc;
char kernbuf[MAX_FID_RANGE_STRLEN];
 
-   LASSERT(range != NULL);
+   LASSERT(range);
 
if (count >= sizeof(kernbuf))
return -EINVAL;
@@ -104,7 +104,6 @@ ldebugfs_fid_space_seq_write(struct file *file,
int rc;
 
seq = ((struct seq_file *)file->private_data)->private;
-   LASSERT(seq != NULL);
 
mutex_lock(&seq->lcs_mutex);
rc = ldebugfs_fid_write_common(buffer, count, &seq->lcs_space);
@@ -124,8 +123,6 @@ ldebugfs_fid_space_seq_show(struct seq_file *m, void 
*unused)
 {
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
-   LASSERT(seq != NULL);
-
mutex_lock(&seq->lcs_mutex);
seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space));
mutex_unlock(&seq->lcs_mutex);
@@ -143,7 +140,6 @@ ldebugfs_fid_width_seq_write(struct file *file,
int rc, val;
 
seq = ((struct seq_file *)file->private_data)->private;
-   LASSERT(seq != NULL);
 
rc = lprocfs_write_helper(buffer, count, &val);
if (rc)
@@ -172,8 +168,6 @@ ldebugfs_fid_width_seq_show(struct seq_file *m, void 
*unused)
 {
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
-   LASSERT(seq != NULL);
-
mutex_lock(&seq->lcs_mutex);
seq_printf(m, "%llu\n", seq->lcs_width);
mutex_unlock(&seq->lcs_mutex);
@@ -186,8 +180,6 @@ ldebugfs_fid_fid_seq_show(struct seq_file *m, void *unused)
 {
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
 
-   LASSERT(seq != NULL);
-
mutex_lock(&seq->lcs_mutex);
seq_printf(m, DFID "\n", PFID(&seq->lcs_fid));
mutex_unlock(&seq->lcs_mutex);
@@ -201,9 +193,7 @@ ldebugfs_fid_server_seq_show(struct seq_file *m, void 
*unused)
struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
struct client_obd *cli;
 
-   LASSERT(seq != NULL);
-
-   if (seq->lcs_exp != NULL) {
+   if (seq->lcs_exp) {
cli = &seq->lcs_exp->exp_obd->u.cli;
seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
}
-- 
2.1.0



[PATCH 42/45] staging/lustre: Remove space after cast in cfs_crypto_hash_final()

2016-02-15 Thread green
From: Oleg Drokin 

This is against kernel-code style.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
index b0b1244..19a5132 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
@@ -183,7 +183,7 @@ int cfs_crypto_hash_final(struct cfs_crypto_hash_desc 
*hdesc,
*hash_len = size;
return -ENOSPC;
}
-   err = crypto_hash_final((struct hash_desc *) hdesc, hash);
+   err = crypto_hash_final((struct hash_desc *)hdesc, hash);
 
if (err < 0) {
/* May be caller can fix error */
-- 
2.1.0



[PATCH 45/45] staging/lustre: Convert cfs_str2num_check to use kstrtoul

2016-02-15 Thread green
From: Oleg Drokin 

simple_strtoul is obsolete

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index 09ab0e4..9dca666 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -229,18 +229,13 @@ int
 cfs_str2num_check(char *str, int nob, unsigned *num,
  unsigned min, unsigned max)
 {
-   char*endp;
+   int rc;
 
str = cfs_trimwhite(str);
-   *num = simple_strtoul(str, &endp, 0);
-   if (endp == str)
+   rc = kstrtouint(str, 10, num);
+   if (rc)
return 0;
 
-   for (; endp < str + nob; endp++) {
-   if (!isspace(*endp))
-   return 0;
-   }
-
return (*num >= min && *num <= max);
 }
 EXPORT_SYMBOL(cfs_str2num_check);
-- 
2.1.0



[PATCH 39/45] staging/lustre: Update cfs_cpu_notify switch statement with a comment

2016-02-15 Thread green
From: Oleg Drokin 

We do really mean to fall through to that default case statement from
all previous ones, so add a comment to unconfuse verious tools

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index 6c3e448..7318b77 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -939,6 +939,7 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long 
action, void *hcpu)
spin_lock(&cpt_data.cpt_lock);
cpt_data.cpt_version++;
spin_unlock(&cpt_data.cpt_lock);
+   /* Fall through */
default:
if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) {
CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n",
-- 
2.1.0



[PATCH 40/45] staging/lustre: Get rid of cfs_trace_buf_type_t typedef

2016-02-15 Thread green
From: Oleg Drokin 

Replace it with enum cfs_trace_buf_type

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index eccf048..809ea50 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -130,7 +130,7 @@ void cfs_tracefile_write_unlock(void)
up_write(&cfs_tracefile_sem);
 }
 
-cfs_trace_buf_type_t cfs_trace_buf_idx_get(void)
+enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
 {
if (in_irq())
return CFS_TCD_TYPE_IRQ;
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index dffe07f..4c77f90 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -39,12 +39,12 @@
 
 #include "../../include/linux/libcfs/libcfs.h"
 
-typedef enum {
+enum cfs_trace_buf_type {
CFS_TCD_TYPE_PROC = 0,
CFS_TCD_TYPE_SOFTIRQ,
CFS_TCD_TYPE_IRQ,
CFS_TCD_TYPE_MAX
-} cfs_trace_buf_type_t;
+};
 
 /* trace file lock routines */
 
@@ -208,7 +208,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int 
walking);
 void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking);
 
 extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
-cfs_trace_buf_type_t cfs_trace_buf_idx_get(void);
+enum cfs_trace_buf_type cfs_trace_buf_idx_get(void);
 
 static inline char *
 cfs_trace_get_console_buffer(void)
-- 
2.1.0



[PATCH 37/45] staging/lustre/libcfs: Remove useless returns in void functions

2016-02-15 Thread green
From: Oleg Drokin 

Return at the end of a void function does not serve any particular
purpose and makes checkpatch unhappy, so eliminate them.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c   | 2 --
 drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c| 2 --
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 --
 drivers/staging/lustre/lustre/libcfs/workitem.c  | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index 8d6a4ee..6c3e448 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -354,8 +354,6 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int 
cpu)
 
if (i >= nr_cpu_ids)
node_clear(node, *cptab->ctb_nodemask);
-
-   return;
 }
 EXPORT_SYMBOL(cfs_cpt_unset_cpu);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
index 44d1ad6..140134d 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
@@ -286,6 +286,4 @@ void cfs_crypto_unregister(void)
 {
if (adler32 == 0)
cfs_crypto_adler32_unregister();
-
-   return;
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index c50e24f..f0880a0 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -198,7 +198,6 @@ cfs_set_ptldebug_header(struct ptldebug_header *header,
header->ph_pid = current->pid;
header->ph_line_num = msgdata->msg_line;
header->ph_extern_pid = 0;
-   return;
 }
 
 static char *
@@ -252,7 +251,6 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int 
mask,
   hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num,
   fn, len, buf);
}
-   return;
 }
 
 int cfs_trace_max_debug_mb(void)
diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c 
b/drivers/staging/lustre/lustre/libcfs/workitem.c
index 08c5b19..136bc13 100644
--- a/drivers/staging/lustre/lustre/libcfs/workitem.c
+++ b/drivers/staging/lustre/lustre/libcfs/workitem.c
@@ -131,8 +131,6 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi)
 
wi->wi_scheduled = 1; /* LBUG future schedule attempts */
spin_unlock(&sched->ws_lock);
-
-   return;
 }
 EXPORT_SYMBOL(cfs_wi_exit);
 
@@ -203,7 +201,6 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t 
*wi)
 
LASSERT(!list_empty(&wi->wi_list));
spin_unlock(&sched->ws_lock);
-   return;
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
 
-- 
2.1.0



[PATCH 43/45] staging/lustre/libcfs: Replace use of printk with pr_

2016-02-15 Thread green
From: Oleg Drokin 

This pacifies checkpatch amongst other things, also is shorter to write
and avoiding calls to printk_ratelimit() is also good.

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   | 10 ++--
 drivers/staging/lustre/lustre/libcfs/tracefile.c   | 53 +-
 2 files changed, 27 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 809ea50..5aba132 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -89,7 +89,7 @@ int cfs_tracefile_init_arch(void)
 
 out:
cfs_tracefile_fini_arch();
-   printk(KERN_ERR "lnet: Not enough memory\n");
+   pr_err("lnet: Not enough memory\n");
return -ENOMEM;
 }
 
@@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, 
int mask,
}
 
if ((mask & D_CONSOLE) != 0) {
-   printk("%s%s: %.*s", ptype, prefix, len, buf);
+   pr_err("%s%s: %.*s", ptype, prefix, len, buf);
} else {
-   printk("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix,
-  hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num,
-  fn, len, buf);
+   pr_warn("%s%s: %d:%d:(%s:%d:%s()) %.*s", ptype, prefix,
+   hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num,
+   fn, len, buf);
}
 }
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 53c1dd6..7df8f0a 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -194,11 +194,9 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, 
unsigned long len)
} else {
tage = cfs_tage_alloc(GFP_ATOMIC);
if (unlikely(!tage)) {
-   if ((!memory_pressure_get() ||
-in_interrupt()) && printk_ratelimit())
-   printk(KERN_WARNING
-  "cannot allocate a tage (%ld)\n",
-  tcd->tcd_cur_pages);
+   if ((!memory_pressure_get() || in_interrupt()))
+   pr_warn_ratelimited("cannot allocate a 
tage (%ld)\n",
+   tcd->tcd_cur_pages);
return NULL;
}
}
@@ -233,9 +231,8 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
 * from here: this will lead to infinite recursion.
 */
 
-   if (printk_ratelimit())
-   printk(KERN_WARNING "debug daemon buffer overflowed; discarding 
10%% of pages (%d of %ld)\n",
-  pgcount + 1, tcd->tcd_cur_pages);
+   pr_warn_ratelimited("debug daemon buffer overflowed; discarding 10%% of 
pages (%d of %ld)\n",
+   pgcount + 1, tcd->tcd_cur_pages);
 
INIT_LIST_HEAD(&pc.pc_pages);
 
@@ -362,8 +359,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data 
*msgdata,
 
max_nob = PAGE_CACHE_SIZE - tage->used - known_size;
if (max_nob <= 0) {
-   printk(KERN_EMERG "negative max_nob: %d\n",
-  max_nob);
+   pr_emerg("negative max_nob: %d\n", max_nob);
mask |= D_ERROR;
cfs_trace_put_tcd(tcd);
tcd = NULL;
@@ -393,8 +389,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data 
*msgdata,
}
 
if (*(string_buf + needed - 1) != '\n')
-   printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
-  file, msgdata->msg_line, msgdata->msg_fn);
+   pr_info("format at %s:%d:%s doesn't end in newline\n",
+   file, msgdata->msg_line, msgdata->msg_fn);
 
header.ph_len = known_size + needed;
debug_buf = (char *)page_address(tage->page) + tage->used;
@@ -743,8 +739,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
kunmap(tage->page);
 
if (rc != (int)tage->used) {
-   printk(KERN_WARNING "wanted to write %u but wrote %d\n",
-  tage->used, rc);
+   pr_warn("wanted to write %u but wrote %d\n",
+   tage->used, rc);
put_pages_back(&pc);
__LASSERT(list_empty(&pc.pc_pages));
break;
@@ -895,10 +891,8 @@ int cfs_trace_daemon_command(char *str)
} else {
strcpy(cfs_tracefile, s

[PATCH 38/45] staging/lustre/libcfs: Remove empty lines after/before braces

2016-02-15 Thread green
From: Oleg Drokin 

No need for an empty line after opening curvy brace and no need
for an empty line before the closing one too.
Remove them.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c| 2 --
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 1 -
 drivers/staging/lustre/lustre/libcfs/module.c| 1 -
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 4 
 4 files changed, 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
index 140134d..b0b1244 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
@@ -125,7 +125,6 @@ struct cfs_crypto_hash_desc *
cfs_crypto_hash_init(unsigned char alg_id,
 unsigned char *key, unsigned int key_len)
 {
-
struct  hash_desc   *hdesc;
int  err;
const struct cfs_crypto_hash_type   *type;
@@ -212,7 +211,6 @@ static void cfs_crypto_performance_test(unsigned char 
alg_id,
 hash, &hash_len);
if (err)
break;
-
}
end = jiffies;
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index f0880a0..eccf048 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -65,7 +65,6 @@ int cfs_tracefile_init_arch(void)
num_possible_cpus(), GFP_KERNEL);
if (!cfs_trace_data[i])
goto out;
-
}
 
/* arch related info initialized */
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index b8b69bb..ea3dc9b 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -549,7 +549,6 @@ void lustre_insert_debugfs(struct ctl_table *table,
for (; symlinks && symlinks->name; symlinks++)
debugfs_create_symlink(symlinks->name, lnet_debugfs_root,
   symlinks->target);
-
 }
 EXPORT_SYMBOL_GPL(lustre_insert_debugfs);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index b3abec6..53c1dd6 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -598,7 +598,6 @@ static void put_pages_back_on_all_cpus(struct 
page_collection *pc)
 
list_for_each_entry_safe(tage, tmp, &pc->pc_pages,
 linkage) {
-
__LASSERT_TAGE_INVARIANT(tage);
 
if (tage->cpu != cpu || tage->type != i)
@@ -629,7 +628,6 @@ static void put_pages_on_tcd_daemon_list(struct 
page_collection *pc,
struct cfs_trace_page *tmp;
 
list_for_each_entry_safe(tage, tmp, &pc->pc_pages, linkage) {
-
__LASSERT_TAGE_INVARIANT(tage);
 
if (tage->cpu != tcd->tcd_cpu || tage->type != tcd->tcd_type)
@@ -737,7 +735,6 @@ int cfs_tracefile_dump_all_pages(char *filename)
 */
MMSPACE_OPEN;
list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
-
__LASSERT_TAGE_INVARIANT(tage);
 
buf = kmap(tage->page);
@@ -775,7 +772,6 @@ void cfs_trace_flush_pages(void)
pc.pc_want_daemon_pages = 1;
collect_pages(&pc);
list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
-
__LASSERT_TAGE_INVARIANT(tage);
 
list_del(&tage->linkage);
-- 
2.1.0



[PATCH 28/45] staging/lustre/libcfs: Cleanup: parenthesis alignment adjustments

2016-02-15 Thread green
From: Oleg Drokin 

Adjust alignment of argments that were pushed to next lines
to conform to kernel code style.
Found with checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c|  3 +--
 drivers/staging/lustre/lustre/libcfs/hash.c | 18 +-
 .../staging/lustre/lustre/libcfs/libcfs_string.c| 19 +++
 .../lustre/lustre/libcfs/linux/linux-debug.c|  2 +-
 .../lustre/lustre/libcfs/linux/linux-module.c   |  4 ++--
 drivers/staging/lustre/lustre/libcfs/module.c   |  8 
 drivers/staging/lustre/lustre/libcfs/tracefile.c| 21 +
 drivers/staging/lustre/lustre/libcfs/workitem.c |  6 +++---
 8 files changed, 36 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 589b548..9cb8f04 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -448,8 +448,7 @@ void libcfs_debug_dumplog_internal(void *arg)
snprintf(debug_file_name, sizeof(debug_file_name) - 1,
 "%s.%lld.%ld", libcfs_debug_file_path_arr,
 (s64)ktime_get_real_seconds(), (long_ptr_t)arg);
-   pr_alert("LustreError: dumping log to %s\n",
-  debug_file_name);
+   pr_alert("LustreError: dumping log to %s\n", debug_file_name);
cfs_tracefile_dump_all_pages(debug_file_name);
libcfs_run_debug_log_upcall(debug_file_name);
}
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index ad831fa..51d72f0 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -2040,15 +2040,15 @@ void cfs_hash_debug_str(struct cfs_hash *hs, struct 
seq_file *m)
theta = __cfs_hash_theta(hs);
 
seq_printf(m, "%-*s %5d %5d %5d %d.%03d %d.%03d %d.%03d  0x%02x %6d ",
- CFS_HASH_BIGNAME_LEN, hs->hs_name,
- 1 << hs->hs_cur_bits, 1 << hs->hs_min_bits,
- 1 << hs->hs_max_bits,
- __cfs_hash_theta_int(theta), __cfs_hash_theta_frac(theta),
- __cfs_hash_theta_int(hs->hs_min_theta),
- __cfs_hash_theta_frac(hs->hs_min_theta),
- __cfs_hash_theta_int(hs->hs_max_theta),
- __cfs_hash_theta_frac(hs->hs_max_theta),
- hs->hs_flags, hs->hs_rehash_count);
+  CFS_HASH_BIGNAME_LEN, hs->hs_name,
+  1 << hs->hs_cur_bits, 1 << hs->hs_min_bits,
+  1 << hs->hs_max_bits,
+  __cfs_hash_theta_int(theta), __cfs_hash_theta_frac(theta),
+  __cfs_hash_theta_int(hs->hs_min_theta),
+  __cfs_hash_theta_frac(hs->hs_min_theta),
+  __cfs_hash_theta_int(hs->hs_max_theta),
+  __cfs_hash_theta_frac(hs->hs_max_theta),
+  hs->hs_flags, hs->hs_rehash_count);
 
/*
 * The distribution is a summary of the chained hash depth in
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index f3bcf20..f7cda59 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -343,11 +343,10 @@ cfs_range_expr_print(char *buffer, int count, struct 
cfs_range_expr *expr,
i = scnprintf(buffer, count, "%u", expr->re_lo);
else if (expr->re_stride == 1)
i = scnprintf(buffer, count, "%s%u-%u%s",
-   s, expr->re_lo, expr->re_hi, e);
+ s, expr->re_lo, expr->re_hi, e);
else
i = scnprintf(buffer, count, "%s%u-%u/%u%s",
-   s, expr->re_lo, expr->re_hi,
-   expr->re_stride, e);
+ s, expr->re_lo, expr->re_hi, expr->re_stride, e);
return i;
 }
 
@@ -469,7 +468,7 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list)
struct cfs_range_expr *expr;
 
expr = list_entry(expr_list->el_exprs.next,
- struct cfs_range_expr, re_link);
+ struct cfs_range_expr, re_link);
list_del(&expr->re_link);
LIBCFS_FREE(expr, sizeof(*expr));
}
@@ -520,15 +519,12 @@ cfs_expr_list_parse(char *str, int len, unsigned min, 
unsigned max,
if (rc != 0)
break;
 
-   list_add_tail(&expr->re_link,
- &expr_list->el_exprs);
+   list_add_tail(&expr->re_link, &expr_list->el_exprs);
}
} else {

[PATCH 33/45] staging/lustre/libcfs: Shortened too long lines

2016-02-15 Thread green
From: Oleg Drokin 

Lines that were too long for not good reason were shortened in this patch.
Found with checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 6 --
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 6 +++---
 drivers/staging/lustre/lustre/libcfs/workitem.c  | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
index 3f3c2d9..638e4b3 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
@@ -189,10 +189,12 @@ static struct notifier_block libcfs_panic_notifier = {
 
 void libcfs_register_panic_notifier(void)
 {
-   atomic_notifier_chain_register(&panic_notifier_list, 
&libcfs_panic_notifier);
+   atomic_notifier_chain_register(&panic_notifier_list,
+  &libcfs_panic_notifier);
 }
 
 void libcfs_unregister_panic_notifier(void)
 {
-   atomic_notifier_chain_unregister(&panic_notifier_list, 
&libcfs_panic_notifier);
+   atomic_notifier_chain_unregister(&panic_notifier_list,
+&libcfs_panic_notifier);
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index d9bb2b5..9191f38 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -399,9 +399,9 @@ console:
return 1;
}
 
-   if (cfs_time_after(cfs_time_current(), cdls->cdls_next +
-  libcfs_console_max_delay
-  + cfs_time_seconds(10))) 
{
+   if (cfs_time_after(cfs_time_current(),
+  cdls->cdls_next + libcfs_console_max_delay +
+  cfs_time_seconds(10))) {
/* last timeout was a long time ago */
cdls->cdls_delay /= libcfs_console_backoff * 4;
} else {
diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c 
b/drivers/staging/lustre/lustre/libcfs/workitem.c
index 9d80cfb..e234dfe 100644
--- a/drivers/staging/lustre/lustre/libcfs/workitem.c
+++ b/drivers/staging/lustre/lustre/libcfs/workitem.c
@@ -46,7 +46,8 @@
 #define CFS_WS_NAME_LEN 16
 
 struct cfs_wi_sched {
-   struct list_headws_list;/* chain on global list 
*/
+   /* chain on global list */
+   struct list_headws_list;
/** serialised workitems */
spinlock_t  ws_lock;
/** where schedulers sleep */
-- 
2.1.0



[PATCH 29/45] staging/lustre/libcfs: Move EXPORT_SYMBOLs under function/variable

2016-02-15 Thread green
From: Oleg Drokin 

Found with checkpatch

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c   | 4 ++--
 drivers/staging/lustre/lustre/libcfs/hash.c| 1 -
 drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c | 7 +++
 drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c   | 5 ++---
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 9cb8f04..9bb31f9 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -47,15 +47,15 @@
 static char debug_file_name[1024];
 
 unsigned int libcfs_subsystem_debug = ~0;
+EXPORT_SYMBOL(libcfs_subsystem_debug);
 module_param(libcfs_subsystem_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_subsystem_debug, "Lustre kernel debug subsystem mask");
-EXPORT_SYMBOL(libcfs_subsystem_debug);
 
 unsigned int libcfs_debug = (D_CANTMASK |
 D_NETERROR | D_HA | D_CONFIG | D_IOCTL);
+EXPORT_SYMBOL(libcfs_debug);
 module_param(libcfs_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_debug, "Lustre kernel debug mask");
-EXPORT_SYMBOL(libcfs_debug);
 
 static int libcfs_param_debug_mb_set(const char *val,
 const struct kernel_param *kp)
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 51d72f0..414577c 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -1702,7 +1702,6 @@ out:
cfs_hash_unlock(hs, 0);
cfs_hash_for_each_exit(hs);
 }
-
 EXPORT_SYMBOL(cfs_hash_hlist_for_each);
 
 /*
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index 68515d9..13d31e8 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -65,6 +65,7 @@ void cfs_cap_raise(cfs_cap_t cap)
commit_creds(cred);
}
 }
+EXPORT_SYMBOL(cfs_cap_raise);
 
 void cfs_cap_lower(cfs_cap_t cap)
 {
@@ -76,11 +77,13 @@ void cfs_cap_lower(cfs_cap_t cap)
commit_creds(cred);
}
 }
+EXPORT_SYMBOL(cfs_cap_lower);
 
 int cfs_cap_raised(cfs_cap_t cap)
 {
return cap_raised(current_cap(), cap);
 }
+EXPORT_SYMBOL(cfs_cap_raised);
 
 static void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
 {
@@ -95,10 +98,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
cfs_kernel_cap_pack(current_cap(), &cap);
return cap;
 }
-
-EXPORT_SYMBOL(cfs_cap_raise);
-EXPORT_SYMBOL(cfs_cap_lower);
-EXPORT_SYMBOL(cfs_cap_raised);
 EXPORT_SYMBOL(cfs_curproc_cap_pack);
 
 /*
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
index 565f990..04203b3 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
@@ -144,6 +144,7 @@ void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data 
*msgdata)
 
libcfs_run_upcall (argv);
 }
+EXPORT_SYMBOL(libcfs_run_lbug_upcall);
 
 /* coverity[+kill] */
 void __noreturn lbug_with_loc(struct libcfs_debug_msg_data *msgdata)
@@ -166,6 +167,7 @@ void __noreturn lbug_with_loc(struct libcfs_debug_msg_data 
*msgdata)
while (1)
schedule();
 }
+EXPORT_SYMBOL(lbug_with_loc);
 
 static int panic_notifier(struct notifier_block *self, unsigned long unused1,
  void *unused2)
@@ -194,6 +196,3 @@ void libcfs_unregister_panic_notifier(void)
 {
atomic_notifier_chain_unregister(&panic_notifier_list, 
&libcfs_panic_notifier);
 }
-
-EXPORT_SYMBOL(libcfs_run_lbug_upcall);
-EXPORT_SYMBOL(lbug_with_loc);
-- 
2.1.0



[PATCH 26/45] staging/lustre/ptlrpc: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c  | 75 +--
 drivers/staging/lustre/lustre/ptlrpc/connection.c  |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/events.c  |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c  |  9 ++-
 drivers/staging/lustre/lustre/ptlrpc/layout.c  | 26 +++
 drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 20 +++---
 drivers/staging/lustre/lustre/ptlrpc/llog_net.c|  2 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c| 31 
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  | 30 
 drivers/staging/lustre/lustre/ptlrpc/nrs.c | 84 +++---
 drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c|  6 +-
 .../staging/lustre/lustre/ptlrpc/pack_generic.c| 14 ++--
 drivers/staging/lustre/lustre/ptlrpc/pinger.c  |  5 +-
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 16 ++---
 drivers/staging/lustre/lustre/ptlrpc/recover.c |  6 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 54 +++---
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c| 12 ++--
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  | 24 +++
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   |  6 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c|  4 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   | 16 ++---
 drivers/staging/lustre/lustre/ptlrpc/service.c | 76 ++--
 22 files changed, 244 insertions(+), 276 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 1cc3c69..9b89068 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -145,7 +145,7 @@ struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct 
ptlrpc_request *req,
 
LASSERT(type == BULK_PUT_SINK || type == BULK_GET_SOURCE);
desc = ptlrpc_new_bulk(npages, max_brw, type, portal);
-   if (desc == NULL)
+   if (!desc)
return NULL;
 
desc->bd_import_generation = req->rq_import_generation;
@@ -171,7 +171,7 @@ void __ptlrpc_prep_bulk_page(struct ptlrpc_bulk_desc *desc,
 struct page *page, int pageoffset, int len, int 
pin)
 {
LASSERT(desc->bd_iov_count < desc->bd_max_iov);
-   LASSERT(page != NULL);
+   LASSERT(page);
LASSERT(pageoffset >= 0);
LASSERT(len > 0);
LASSERT(pageoffset + len <= PAGE_CACHE_SIZE);
@@ -193,7 +193,6 @@ void __ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc, int 
unpin)
 {
int i;
 
-   LASSERT(desc != NULL);
LASSERT(desc->bd_iov_count != LI_POISON); /* not freed already */
LASSERT(desc->bd_md_count == 0); /* network hands off */
LASSERT((desc->bd_export != NULL) ^ (desc->bd_import != NULL));
@@ -412,7 +411,7 @@ int ptlrpc_request_cache_init(void)
request_cache = kmem_cache_create("ptlrpc_cache",
  sizeof(struct ptlrpc_request),
  0, SLAB_HWCACHE_ALIGN, NULL);
-   return request_cache == NULL ? -ENOMEM : 0;
+   return !request_cache ? -ENOMEM : 0;
 }
 
 void ptlrpc_request_cache_fini(void)
@@ -442,8 +441,6 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool)
struct list_head *l, *tmp;
struct ptlrpc_request *req;
 
-   LASSERT(pool != NULL);
-
spin_lock(&pool->prp_lock);
list_for_each_safe(l, tmp, &pool->prp_req_list) {
req = list_entry(l, struct ptlrpc_request, rq_list);
@@ -753,7 +750,7 @@ ptlrpc_request_alloc_internal(struct obd_import *imp,
struct ptlrpc_request *request;
 
request = __ptlrpc_request_alloc(imp, pool);
-   if (request == NULL)
+   if (!request)
return NULL;
 
req_capsule_init(&request->rq_pill, request, RCL_CLIENT);
@@ -952,10 +949,10 @@ void ptlrpc_set_add_req(struct ptlrpc_request_set *set,
atomic_inc(&set->set_remaining);
req->rq_queued_time = cfs_time_current();
 
-   if (req->rq_reqmsg != NULL)
+   if (req->rq_reqmsg)
lustre_msg_set_jobid(req->rq_reqmsg, NULL);
 
-   if (set->set_producer != NULL)
+   if (set->set_producer)
/*
 * If the request set has a producer callback, the RPC must be
 * sent straight away
@@ -975,7 +972,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,
struct ptlrpc_request_set *set = pc->pc_set;
int count, i;
 
-   LASSERT(req->rq_set == NULL);
+   LASSERT(!req->rq_set);
LASSERT(test_bit(LIOD_STOP, &pc->pc_flags) == 0);
 
spin_lock(&set->set_new_req_lock);
@@ -1016,7 +1013,6 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
 {
int delay = 0;
 
-

[PATCH 32/45] staging/lustre/libcfs: Remove stray spaces after function name

2016-02-15 Thread green
From: Oleg Drokin 

Problem highlighted by checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.h | 3 +--
 drivers/staging/lustre/lustre/libcfs/workitem.c  | 9 -
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
index 04203b3..3f3c2d9 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c
@@ -142,7 +142,7 @@ void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data 
*msgdata)
argv[4] = buf;
argv[5] = NULL;
 
-   libcfs_run_upcall (argv);
+   libcfs_run_upcall(argv);
 }
 EXPORT_SYMBOL(libcfs_run_lbug_upcall);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 967f8d7..d9bb2b5 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -378,7 +378,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data 
*msgdata,
__LASSERT(debug_buf == string_buf);
 
tage->used += needed;
-   __LASSERT (tage->used <= PAGE_CACHE_SIZE);
+   __LASSERT(tage->used <= PAGE_CACHE_SIZE);
 
 console:
if ((mask & libcfs_printk) == 0) {
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index 92a00ed..2285744 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -279,8 +279,7 @@ cfs_trace_get_tcd(void)
return tcd;
 }
 
-static inline void
-cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd)
+static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)
 {
cfs_trace_unlock_tcd(tcd, 0);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c 
b/drivers/staging/lustre/lustre/libcfs/workitem.c
index 24400df..9d80cfb 100644
--- a/drivers/staging/lustre/lustre/libcfs/workitem.c
+++ b/drivers/staging/lustre/lustre/libcfs/workitem.c
@@ -163,7 +163,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, 
cfs_workitem_t *wi)
wi->wi_scheduled = 0;
}
 
-   LASSERT (list_empty(&wi->wi_list));
+   LASSERT(list_empty(&wi->wi_list));
 
spin_unlock(&sched->ws_lock);
return rc;
@@ -186,7 +186,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t 
*wi)
spin_lock(&sched->ws_lock);
 
if (!wi->wi_scheduled) {
-   LASSERT (list_empty(&wi->wi_list));
+   LASSERT(list_empty(&wi->wi_list));
 
wi->wi_scheduled = 1;
sched->ws_nscheduled++;
@@ -198,14 +198,13 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, 
cfs_workitem_t *wi)
}
}
 
-   LASSERT (!list_empty(&wi->wi_list));
+   LASSERT(!list_empty(&wi->wi_list));
spin_unlock(&sched->ws_lock);
return;
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
 
-static int
-cfs_wi_scheduler (void *arg)
+static int cfs_wi_scheduler(void *arg)
 {
struct cfs_wi_sched *sched = (struct cfs_wi_sched *)arg;
 
-- 
2.1.0



[PATCH 30/45] staging/lustre/libcfs: style change to add missing spaces for operations

2016-02-15 Thread green
From: Oleg Drokin 

This fixes checkpatch messages about
"spaces preferred around that '-' (ctx:VxV)"

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/debug.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c   | 2 +-
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 7 ---
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 9bb31f9..fa81582 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -418,7 +418,7 @@ libcfs_debug_str2mask(int *mask, const char *str, int 
is_subsys)
/* Allow a number for backwards compatibility */
 
for (n = strlen(str); n > 0; n--)
-   if (!isspace(str[n-1]))
+   if (!isspace(str[n - 1]))
break;
matched = n;
t = sscanf(str, "%i%n", &m, &matched);
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c
index 025e2f0..86f32ff 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c
@@ -50,7 +50,7 @@ void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int 
cpt, size_t size,
ret = kzalloc_node(size, flags | __GFP_NOWARN,
   cfs_cpt_spread_node(cptab, cpt));
if (!ret) {
-   WARN_ON(!(flags & (__GFP_FS|__GFP_HIGH)));
+   WARN_ON(!(flags & (__GFP_FS | __GFP_HIGH)));
ret = vmalloc_node(size, cfs_cpt_spread_node(cptab, cpt));
}
 
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 89944c0..5e3c400 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -268,5 +268,5 @@ int cfs_trace_max_debug_mb(void)
 {
int  total_mb = (totalram_pages >> (20 - PAGE_SHIFT));
 
-   return max(512, (total_mb * 80)/100);
+   return max(512, (total_mb * 80) / 100);
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 28a11b5..967f8d7 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -346,7 +346,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data 
*msgdata,
break;
}
 
-   if (*(string_buf+needed-1) != '\n')
+   if (*(string_buf + needed - 1) != '\n')
printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
   file, msgdata->msg_line, msgdata->msg_fn);
 
@@ -436,7 +436,7 @@ console:
remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;
if (remain > 0) {
va_start(ap, format2);
-   needed += vsnprintf(string_buf+needed, remain,
+   needed += vsnprintf(string_buf + needed, remain,
format2, ap);
va_end(ap);
}
@@ -667,7 +667,8 @@ int cfs_tracefile_dump_all_pages(char *filename)
 
cfs_tracefile_write_lock();
 
-   filp = filp_open(filename, O_CREAT|O_EXCL|O_WRONLY|O_LARGEFILE, 0600);
+   filp = filp_open(filename, O_CREAT | O_EXCL | O_WRONLY | O_LARGEFILE,
+0600);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
filp = NULL;
-- 
2.1.0



[PATCH 31/45] staging/lustre/libcfs: reformat cfs_tcd_for_each_type_lock define

2016-02-15 Thread green
From: Oleg Drokin 

Avoid using leading spaces that make checkpatch unhappy.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h 
b/drivers/staging/lustre/lustre/libcfs/tracefile.h
index 67a701f..92a00ed 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.h
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h
@@ -191,9 +191,9 @@ extern union cfs_trace_data_union 
(*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
 j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
 
 #define cfs_tcd_for_each_type_lock(tcd, i, cpu)   \
-for (i = 0; cfs_trace_data[i] && \
-(tcd = &(*cfs_trace_data[i])[cpu].tcd) &&  \
-cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
+   for (i = 0; cfs_trace_data[i] &&\
+(tcd = &(*cfs_trace_data[i])[cpu].tcd) &&  \
+cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
 
 /* XXX nikita: this declaration is internal to tracefile.c and should probably
  * be moved there */
-- 
2.1.0



[PATCH 25/45] staging/lustre/osc: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c  | 120 ++-
 .../staging/lustre/lustre/osc/osc_cl_internal.h|   4 +-
 drivers/staging/lustre/lustre/osc/osc_dev.c|   6 +-
 drivers/staging/lustre/lustre/osc/osc_io.c |  19 ++-
 drivers/staging/lustre/lustre/osc/osc_lock.c   |  61 +-
 drivers/staging/lustre/lustre/osc/osc_object.c |   4 +-
 drivers/staging/lustre/lustre/osc/osc_page.c   |  22 ++--
 drivers/staging/lustre/lustre/osc/osc_quota.c  |  16 +--
 drivers/staging/lustre/lustre/osc/osc_request.c| 130 ++---
 10 files changed, 189 insertions(+), 197 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c 
b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index b69ec0f..cb9edaf 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -381,7 +381,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, 
void *v)
 
DECLARE_CKSUM_NAME;
 
-   if (obd == NULL)
+   if (!obd)
return 0;
 
for (i = 0; i < ARRAY_SIZE(cksum_name); i++) {
@@ -406,7 +406,7 @@ static ssize_t osc_checksum_type_seq_write(struct file 
*file,
DECLARE_CKSUM_NAME;
char kernbuf[10];
 
-   if (obd == NULL)
+   if (!obd)
return 0;
 
if (count > sizeof(kernbuf) - 1)
diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c 
b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 6b5f8d0..4704231 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -140,7 +140,7 @@ static const char *oes_strings[] = {
 
 static inline struct osc_extent *rb_extent(struct rb_node *n)
 {
-   if (n == NULL)
+   if (!n)
return NULL;
 
return container_of(n, struct osc_extent, oe_node);
@@ -148,7 +148,7 @@ static inline struct osc_extent *rb_extent(struct rb_node 
*n)
 
 static inline struct osc_extent *next_extent(struct osc_extent *ext)
 {
-   if (ext == NULL)
+   if (!ext)
return NULL;
 
LASSERT(ext->oe_intree);
@@ -157,7 +157,7 @@ static inline struct osc_extent *next_extent(struct 
osc_extent *ext)
 
 static inline struct osc_extent *prev_extent(struct osc_extent *ext)
 {
-   if (ext == NULL)
+   if (!ext)
return NULL;
 
LASSERT(ext->oe_intree);
@@ -240,7 +240,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
goto out;
}
 
-   if (ext->oe_osclock == NULL && ext->oe_grants > 0) {
+   if (!ext->oe_osclock && ext->oe_grants > 0) {
rc = 90;
goto out;
}
@@ -319,7 +319,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj,
if (!extent_debug)
return 0;
 
-   for (tmp = first_extent(obj); tmp != NULL; tmp = next_extent(tmp)) {
+   for (tmp = first_extent(obj); tmp; tmp = next_extent(tmp)) {
if (tmp == ext)
continue;
if (tmp->oe_end >= ext->oe_start &&
@@ -347,7 +347,7 @@ static struct osc_extent *osc_extent_alloc(struct 
osc_object *obj)
struct osc_extent *ext;
 
ext = kmem_cache_alloc(osc_extent_kmem, GFP_NOFS | __GFP_ZERO);
-   if (ext == NULL)
+   if (!ext)
return NULL;
 
RB_CLEAR_NODE(&ext->oe_node);
@@ -415,7 +415,7 @@ static struct osc_extent *osc_extent_search(struct 
osc_object *obj,
struct osc_extent *tmp, *p = NULL;
 
LASSERT(osc_object_is_locked(obj));
-   while (n != NULL) {
+   while (n) {
tmp = rb_extent(n);
if (index < tmp->oe_start) {
n = n->rb_left;
@@ -439,7 +439,7 @@ static struct osc_extent *osc_extent_lookup(struct 
osc_object *obj,
struct osc_extent *ext;
 
ext = osc_extent_search(obj, index);
-   if (ext != NULL && ext->oe_start <= index && index <= ext->oe_end)
+   if (ext && ext->oe_start <= index && index <= ext->oe_end)
return osc_extent_get(ext);
return NULL;
 }
@@ -454,7 +454,7 @@ static void osc_extent_insert(struct osc_object *obj, 
struct osc_extent *ext)
LASSERT(ext->oe_intree == 0);
LASSERT(ext->oe_obj == obj);
LASSERT(osc_object_is_locked(obj));
-   while (*n != NULL) {
+   while (*n) {
tmp = rb_extent(*n);
parent = *n;
 
@@ -533,7 +533,7 @@ static int osc_extent_merge(const struct lu_env *env, 
struct osc_extent *cur,
 
LASSERT(cur->oe_state == OES_CACHE);
LASSERT(osc_object_is_locked(obj));
-   if (victim == NULL)
+   if (!victim)
return -EINVAL;
 
if (vi

[PATCH 27/45] staging/lustre: Remove the "write to FSF to get a copy of GPL" wording

2016-02-15 Thread green
From: Oleg Drokin 

Checkpatch highlighted that some of our Lustre files carry this
extra paragraph and indeed it does seem somewhat redundant, so remove it.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/lnet/lnetctl.h   | 4 
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h   | 4 
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c| 3 ---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c | 3 ---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c | 3 ---
 drivers/staging/lustre/lnet/lnet/router.c | 4 
 drivers/staging/lustre/lnet/lnet/router_proc.c| 4 
 drivers/staging/lustre/lustre/include/lu_ref.h| 4 
 drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 5 -
 drivers/staging/lustre/lustre/libcfs/libcfs_lock.c| 5 -
 drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 5 -
 drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c| 5 -
 drivers/staging/lustre/lustre/ptlrpc/nrs.c| 4 
 drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c   | 4 
 14 files changed, 57 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h 
b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
index bdd69b2..4b64f62 100644
--- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h
+++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
@@ -10,10 +10,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  * header for lnet ioctl
  */
 #ifndef _LNETCTL_H_
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index a4117ad..a176544 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -19,10 +19,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 
 #ifndef _SOCKLND_SOCKLND_H_
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 02da02d..efb7169 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -19,9 +19,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "socklnd.h"
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
index 77ce597..6329cbe 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c
@@ -14,9 +14,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "socklnd.h"
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
index 70910ed..976a072 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
@@ -19,9 +19,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 #include "socklnd.h"
diff --git a/drivers/staging/lustre/lnet/lnet/router.c 
b/drivers/staging/lustre/lnet/lnet/router.c
index 735a8f2..83ed123 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -15,10 +15,6 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- *   You should have received a copy of the GNU General Public License
- *   along with Portals; if not, write to

[PATCH 22/45] staging/lustre/mgc: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 41 -
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index ab4800c..bd34ab3 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -162,7 +162,7 @@ struct config_llog_data *config_log_find(char *logname,
struct config_llog_data *found = NULL;
void *instance;
 
-   LASSERT(logname != NULL);
+   LASSERT(logname);
 
instance = cfg ? cfg->cfg_instance : NULL;
spin_lock(&config_list_lock);
@@ -300,7 +300,7 @@ static int config_log_add(struct obd_device *obd, char 
*logname,
 * -sptlrpc. multiple regular logs may share one sptlrpc log.
 */
ptr = strrchr(logname, '-');
-   if (ptr == NULL || ptr - logname > 8) {
+   if (!ptr || ptr - logname > 8) {
CERROR("logname %s is too long\n", logname);
return -EINVAL;
}
@@ -309,7 +309,7 @@ static int config_log_add(struct obd_device *obd, char 
*logname,
strcpy(seclogname + (ptr - logname), "-sptlrpc");
 
sptlrpc_cld = config_log_find(seclogname, NULL);
-   if (sptlrpc_cld == NULL) {
+   if (!sptlrpc_cld) {
sptlrpc_cld = do_config_log_add(obd, seclogname,
CONFIG_T_SPTLRPC, NULL, NULL);
if (IS_ERR(sptlrpc_cld)) {
@@ -376,7 +376,7 @@ static int config_log_end(char *logname, struct 
config_llog_instance *cfg)
int rc = 0;
 
cld = config_log_find(logname, cfg);
-   if (cld == NULL)
+   if (!cld)
return -ENOENT;
 
mutex_lock(&cld->cld_lock);
@@ -455,7 +455,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)
 
spin_lock(&config_list_lock);
list_for_each_entry(cld, &config_llog_list, cld_list_chain) {
-   if (cld->cld_recover == NULL)
+   if (!cld->cld_recover)
continue;
seq_printf(m,  "- { client: %s, nidtbl_version: %u }\n",
   cld->cld_logname,
@@ -883,7 +883,7 @@ static int mgc_enqueue(struct obd_export *exp, struct 
lov_stripe_md *lsm,
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
&RQF_LDLM_ENQUEUE, LUSTRE_DLM_VERSION,
LDLM_ENQUEUE);
-   if (req == NULL)
+   if (!req)
return -ENOMEM;
 
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, 0);
@@ -921,7 +921,7 @@ static int mgc_target_register(struct obd_export *exp,
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
&RQF_MGS_TARGET_REG, LUSTRE_MGS_VERSION,
MGS_TARGET_REG);
-   if (req == NULL)
+   if (!req)
return -ENOMEM;
 
req_mti = req_capsule_client_get(&req->rq_pill, &RMF_MGS_TARGET_INFO);
@@ -1109,7 +1109,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
int   rc  = 0;
int   off = 0;
 
-   LASSERT(cfg->cfg_instance != NULL);
+   LASSERT(cfg->cfg_instance);
LASSERT(cfg->cfg_sb == cfg->cfg_instance);
 
inst = kzalloc(PAGE_CACHE_SIZE, GFP_KERNEL);
@@ -1195,7 +1195,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
/* lustre-OST0001-osc- */
strcpy(obdname, cld->cld_logname);
cname = strrchr(obdname, '-');
-   if (cname == NULL) {
+   if (!cname) {
CERROR("mgc %s: invalid logname %s\n",
   mgc->obd_name, obdname);
break;
@@ -1212,7 +1212,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 
/* find the obd by obdname */
obd = class_name2obd(obdname);
-   if (obd == NULL) {
+   if (!obd) {
CDEBUG(D_INFO, "mgc %s: cannot find obdname %s\n",
   mgc->obd_name, obdname);
rc = 0;
@@ -1227,7 +1227,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
uuid = buf + pos;
 
down_read(&obd->u.cli.cl_sem);
-   if (obd->u.cli.cl_import == NULL) {
+   if (!obd->u.cli.cl_import) {
/* client does not connect to the OST yet */
up_read(&obd->u.cli.cl_sem);
rc = 0;
@@ -1257,7 +1257,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 
rc = -ENOMEM;
lcfg = lustre_cfg_new(

[PATCH 21/45] staging/lustre/mdc: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c |  12 +--
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   |  47 +-
 drivers/staging/lustre/lustre/mdc/mdc_reint.c   |  24 ++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 116 
 4 files changed, 90 insertions(+), 109 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c 
b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index 7218532..ea2ab23 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -41,8 +41,6 @@
 
 static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 {
-   LASSERT(b != NULL);
-
b->suppgid = suppgid;
b->uid = from_kuid(&init_user_ns, current_uid());
b->gid = from_kgid(&init_user_ns, current_gid());
@@ -83,7 +81,6 @@ void mdc_pack_body(struct ptlrpc_request *req, const struct 
lu_fid *fid,
 {
struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
&RMF_MDT_BODY);
-   LASSERT(b != NULL);
b->valid = valid;
b->eadatasize = ea_size;
b->flags = flags;
@@ -323,7 +320,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct 
md_op_data *op_data,
return;
 
lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
-   if (ea == NULL) { /* Remove LOV EA */
+   if (!ea) { /* Remove LOV EA */
lum->lmm_magic = LOV_USER_MAGIC_V1;
lum->lmm_stripe_size = 0;
lum->lmm_stripe_count = 0;
@@ -346,7 +343,6 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct 
md_op_data *op_data)
 
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_unlink));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
-   LASSERT(rec != NULL);
 
rec->ul_opcode   = op_data->op_cli_flags & CLI_RM_ENTRY ?
REINT_RMENTRY : REINT_UNLINK;
@@ -362,7 +358,7 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct 
md_op_data *op_data)
rec->ul_bias = op_data->op_bias;
 
tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
-   LASSERT(tmp != NULL);
+   LASSERT(tmp);
LOGL0(op_data->op_name, op_data->op_namelen, tmp);
 }
 
@@ -373,7 +369,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct 
md_op_data *op_data)
 
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
-   LASSERT(rec != NULL);
 
rec->lk_opcode   = REINT_LINK;
rec->lk_fsuid= op_data->op_fsuid; /* current->fsuid; */
@@ -456,10 +451,9 @@ static void mdc_hsm_release_pack(struct ptlrpc_request 
*req,
struct ldlm_lock *lock;
 
data = req_capsule_client_get(&req->rq_pill, &RMF_CLOSE_DATA);
-   LASSERT(data != NULL);
 
lock = ldlm_handle2lock(&op_data->op_lease_handle);
-   if (lock != NULL) {
+   if (lock) {
data->cd_handle = lock->l_remote_handle;
ldlm_lock_put(lock);
}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index ef9a1e1..09dd2b3 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -129,7 +129,7 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, 
void *data,
 
lock = ldlm_handle2lock((struct lustre_handle *)lockh);
 
-   LASSERT(lock != NULL);
+   LASSERT(lock);
lock_res_and_lock(lock);
if (lock->l_resource->lr_lvb_inode &&
lock->l_resource->lr_lvb_inode != data) {
@@ -191,12 +191,12 @@ int mdc_null_inode(struct obd_export *exp,
struct ldlm_resource *res;
struct ldlm_namespace *ns = class_exp2obd(exp)->obd_namespace;
 
-   LASSERTF(ns != NULL, "no namespace passed\n");
+   LASSERTF(ns, "no namespace passed\n");
 
fid_build_reg_res_name(fid, &res_id);
 
res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
-   if (res == NULL)
+   if (!res)
return 0;
 
lock_res(res);
@@ -317,7 +317,7 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct 
obd_export *exp,
 
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
   &RQF_LDLM_INTENT_OPEN);
-   if (req == NULL) {
+   if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
return ERR_PTR(-ENOMEM);
}
@@ -365,7 +365,7 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
 
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT

[PATCH 20/45] staging/lustre/include: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/cl_object.h  |  6 +--
 drivers/staging/lustre/lustre/include/lclient.h|  4 +-
 drivers/staging/lustre/lustre/include/linux/obd.h  |  6 +--
 .../staging/lustre/lustre/include/lprocfs_status.h |  6 +--
 drivers/staging/lustre/lustre/include/lu_object.h  |  6 +--
 .../lustre/lustre/include/lustre/lustre_idl.h  |  6 +--
 drivers/staging/lustre/lustre/include/lustre_cfg.h |  5 +--
 drivers/staging/lustre/lustre/include/lustre_dlm.h | 16 +++
 .../staging/lustre/lustre/include/lustre_export.h  | 11 -
 drivers/staging/lustre/lustre/include/lustre_lib.h |  8 ++--
 drivers/staging/lustre/lustre/include/lustre_log.h | 12 +++---
 drivers/staging/lustre/lustre/include/lustre_mdc.h | 10 ++---
 drivers/staging/lustre/lustre/include/lustre_net.h | 13 +++---
 drivers/staging/lustre/lustre/include/obd.h|  7 ++--
 drivers/staging/lustre/lustre/include/obd_class.h  | 49 +++---
 .../staging/lustre/lustre/include/obd_support.h|  1 -
 16 files changed, 72 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index c8f4569..373e772 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2653,7 +2653,7 @@ static inline int lu_device_is_cl(const struct lu_device 
*d)
 
 static inline struct cl_device *lu2cl_dev(const struct lu_device *d)
 {
-   LASSERT(d == NULL || IS_ERR(d) || lu_device_is_cl(d));
+   LASSERT(!d || IS_ERR(d) || lu_device_is_cl(d));
return container_of0(d, struct cl_device, cd_lu_dev);
 }
 
@@ -2664,7 +2664,7 @@ static inline struct lu_device *cl2lu_dev(struct 
cl_device *d)
 
 static inline struct cl_object *lu2cl(const struct lu_object *o)
 {
-   LASSERT(o == NULL || IS_ERR(o) || lu_device_is_cl(o->lo_dev));
+   LASSERT(!o || IS_ERR(o) || lu_device_is_cl(o->lo_dev));
return container_of0(o, struct cl_object, co_lu);
 }
 
@@ -2681,7 +2681,7 @@ static inline struct cl_object *cl_object_next(const 
struct cl_object *obj)
 
 static inline struct cl_device *cl_object_device(const struct cl_object *o)
 {
-   LASSERT(o == NULL || IS_ERR(o) || lu_device_is_cl(o->co_lu.lo_dev));
+   LASSERT(!o || IS_ERR(o) || lu_device_is_cl(o->co_lu.lo_dev));
return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev);
 }
 
diff --git a/drivers/staging/lustre/lustre/include/lclient.h 
b/drivers/staging/lustre/lustre/include/lclient.h
index 36e7a67..7f0a045 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -127,7 +127,7 @@ static inline struct ccc_thread_info *ccc_env_info(const 
struct lu_env *env)
struct ccc_thread_info  *info;
 
info = lu_context_key_get(&env->le_ctx, &ccc_key);
-   LASSERT(info != NULL);
+   LASSERT(info);
return info;
 }
 
@@ -156,7 +156,7 @@ static inline struct ccc_session *ccc_env_session(const 
struct lu_env *env)
struct ccc_session *ses;
 
ses = lu_context_key_get(env->le_ses, &ccc_session_key);
-   LASSERT(ses != NULL);
+   LASSERT(ses);
return ses;
 }
 
diff --git a/drivers/staging/lustre/lustre/include/linux/obd.h 
b/drivers/staging/lustre/lustre/include/linux/obd.h
index 468bc28..240947b 100644
--- a/drivers/staging/lustre/lustre/include/linux/obd.h
+++ b/drivers/staging/lustre/lustre/include/linux/obd.h
@@ -73,7 +73,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t 
*lock,
 
while (1) {
if (spin_trylock(&lock->lock)) {
-   LASSERT(lock->task == NULL);
+   LASSERT(!lock->task);
lock->task = current;
lock->func = func;
lock->line = line;
@@ -85,7 +85,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t 
*lock,
time_before(lock->time + 5 * HZ, jiffies)) {
struct task_struct *task = lock->task;
 
-   if (task == NULL)
+   if (!task)
continue;
 
LCONSOLE_WARN("%s:%d: lock %p was acquired by 
<%s:%d:%s:%d> for %lu seconds.\n",
@@ -108,7 +108,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t 
*lock,
 
 static inline void client_obd_list_unlock(client_obd_lock_t *lock)
 {
-   LASSERT(lock->task != NULL);
+   LASSERT(lock->task);
lock->task = NULL;
lock->time = jiffies;
spin_unlock(&lock->lock);
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 97c2d7e..88f754e 100644
--- a/drivers/staging/lustre/lustre/

[PATCH 14/45] staging/lustre/llite: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

The only exception is ll_update_inode where dropping != NULL
in the construction below would break the logic.
I guess we could change lsm != NULL to !!lsm, but that's uglier.
(lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)

Also removed some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/dcache.c   |  10 +-
 drivers/staging/lustre/lustre/llite/dir.c  |  23 ++---
 drivers/staging/lustre/lustre/llite/file.c | 115 ++---
 drivers/staging/lustre/lustre/llite/llite_close.c  |  14 +--
 .../staging/lustre/lustre/llite/llite_internal.h   |  25 +++--
 drivers/staging/lustre/lustre/llite/llite_lib.c|  61 ++-
 drivers/staging/lustre/lustre/llite/llite_mmap.c   |  14 ++-
 drivers/staging/lustre/lustre/llite/llite_rmtacl.c |  10 +-
 drivers/staging/lustre/lustre/llite/lloop.c|  17 ++-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |  12 +--
 drivers/staging/lustre/lustre/llite/namei.c|  53 +++---
 drivers/staging/lustre/lustre/llite/rw.c   |  23 ++---
 drivers/staging/lustre/lustre/llite/rw26.c |  16 +--
 drivers/staging/lustre/lustre/llite/statahead.c|  40 ---
 drivers/staging/lustre/lustre/llite/super25.c  |  10 +-
 drivers/staging/lustre/lustre/llite/symlink.c  |   3 +-
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |  16 +--
 drivers/staging/lustre/lustre/llite/vvp_io.c   |  12 +--
 drivers/staging/lustre/lustre/llite/vvp_object.c   |   5 +-
 drivers/staging/lustre/lustre/llite/vvp_page.c |  22 ++--
 drivers/staging/lustre/lustre/llite/xattr.c|  21 ++--
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |  16 ++-
 22 files changed, 241 insertions(+), 297 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index bc179e5..34eb17c 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -60,7 +60,7 @@ static void ll_release(struct dentry *de)
 {
struct ll_dentry_data *lld;
 
-   LASSERT(de != NULL);
+   LASSERT(de);
lld = ll_d2d(de);
if (!lld) /* NFS copies the de->d_op methods (bug 4655) */
return;
@@ -178,8 +178,6 @@ static int ll_ddelete(const struct dentry *de)
 
 int ll_d_init(struct dentry *de)
 {
-   LASSERT(de != NULL);
-
CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n",
de, de, de->d_parent, d_inode(de),
d_count(de));
@@ -251,8 +249,6 @@ void ll_invalidate_aliases(struct inode *inode)
 {
struct dentry *dentry;
 
-   LASSERT(inode != NULL);
-
CDEBUG(D_INODE, "marking dentries for ino %lu/%u(%p) invalid\n",
   inode->i_ino, inode->i_generation, inode);
 
@@ -286,9 +282,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
 
 void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode)
 {
-   LASSERT(it != NULL);
-
-   if (it->d.lustre.it_lock_mode && inode != NULL) {
+   if (it->d.lustre.it_lock_mode && inode) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
 
CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 36b1055..d7dc264 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -190,8 +190,6 @@ static int ll_dir_filler(void *_hash, struct page *page0)
} else if (rc == 0) {
body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
/* Checked by mdc_readpage() */
-   LASSERT(body != NULL);
-
if (body->valid & OBD_MD_FLSIZE)
cl_isize_write(inode, body->size);
 
@@ -245,7 +243,7 @@ void ll_release_page(struct page *page, int remove)
kunmap(page);
if (remove) {
lock_page(page);
-   if (likely(page->mapping != NULL))
+   if (likely(page->mapping))
truncate_complete_page(page->mapping, page);
unlock_page(page);
}
@@ -393,7 +391,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
CERROR("dir page locate: "DFID" at %llu: rc %ld\n",
   PFID(ll_inode2fid(dir)), lhash, PTR_ERR(page));
goto out_unlock;
-   } else if (page != NULL) {
+   } else if (page) {
/*
 * XXX nikita: not entirely correct handling of a corner case:
 * suppose hash chain of entries with hash value HASH crosses
@@ -499,7 +497,7 @@ int ll_dir_read(struct inode *inode, struct dir_context 
*ctx)
__u64 next;
 
dp = page_address(page);

[PATCH 19/45] staging/lustre/lclient: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 32 +++---
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 4dfeb4e..efa6e2e 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -117,7 +117,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct 
lu_context_key *key)
struct ccc_thread_info *info;
 
info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO);
-   if (info == NULL)
+   if (!info)
info = ERR_PTR(-ENOMEM);
return info;
 }
@@ -136,7 +136,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
struct ccc_session *session;
 
session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO);
-   if (session == NULL)
+   if (!session)
session = ERR_PTR(-ENOMEM);
return session;
 }
@@ -173,7 +173,7 @@ int ccc_device_init(const struct lu_env *env, struct 
lu_device *d,
vdv = lu2ccc_dev(d);
vdv->cdv_next = lu2cl_dev(next);
 
-   LASSERT(d->ld_site != NULL && next->ld_type != NULL);
+   LASSERT(d->ld_site && next->ld_type);
next->ld_site = d->ld_site;
rc = next->ld_type->ldt_ops->ldto_device_init(
env, next, next->ld_type->ldt_name, NULL);
@@ -211,12 +211,12 @@ struct lu_device *ccc_device_alloc(const struct lu_env 
*env,
vdv->cdv_cl.cd_ops = clops;
 
site = kzalloc(sizeof(*site), GFP_NOFS);
-   if (site != NULL) {
+   if (site) {
rc = cl_site_init(site, &vdv->cdv_cl);
if (rc == 0)
rc = lu_site_init_finish(&site->cs_lu);
else {
-   LASSERT(lud->ld_site == NULL);
+   LASSERT(!lud->ld_site);
CERROR("Cannot init lu_site, rc %d.\n", rc);
kfree(site);
}
@@ -236,7 +236,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env,
struct cl_site*site = lu2cl_site(d->ld_site);
struct lu_device  *next = cl2lu_dev(vdv->cdv_next);
 
-   if (d->ld_site != NULL) {
+   if (d->ld_site) {
cl_site_fini(site);
kfree(site);
}
@@ -252,7 +252,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device 
*dev,
int result;
 
vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO);
-   if (vrq != NULL) {
+   if (vrq) {
cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
result = 0;
} else
@@ -304,7 +304,7 @@ out_kmem:
 
 void ccc_global_fini(struct lu_device_type *device_type)
 {
-   if (ccc_inode_fini_env != NULL) {
+   if (ccc_inode_fini_env) {
cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
ccc_inode_fini_env = NULL;
}
@@ -328,7 +328,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
struct lu_object  *obj;
 
vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO);
-   if (vob != NULL) {
+   if (vob) {
struct cl_object_header *hdr;
 
obj = ccc2lu(vob);
@@ -365,7 +365,7 @@ int ccc_object_init(const struct lu_env *env, struct 
lu_object *obj,
 
under = &dev->cdv_next->cd_lu_dev;
below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, under);
-   if (below != NULL) {
+   if (below) {
const struct cl_object_conf *cconf;
 
cconf = lu2cl_conf(conf);
@@ -397,7 +397,7 @@ int ccc_lock_init(const struct lu_env *env,
CLOBINVRNT(env, obj, ccc_object_invariant(obj));
 
clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO);
-   if (clk != NULL) {
+   if (clk) {
cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
result = 0;
} else
@@ -660,7 +660,7 @@ void ccc_io_update_iov(const struct lu_env *env,
 {
size_t size = io->u.ci_rw.crw_count;
 
-   if (!cl_is_normalio(env, io) || cio->cui_iter == NULL)
+   if (!cl_is_normalio(env, io) || !cio->cui_iter)
return;
 
iov_iter_truncate(cio->cui_iter, size);
@@ -749,7 +749,7 @@ int ccc_prep_size(const struct lu_env *env, struct 
cl_object *obj,
 */
ccc_object_size_unlock(obj);
result = cl_glimpse_lock(env, io, inode, obj, 0);
-   if (result == 0 && exceed != NULL) {
+   if (result == 0 && exceed) {
/* If objective page index exceed end-of-file
 * page index, return directly. Do not

[PATCH 16/45] staging/lustre/lmv: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c   |  11 +--
 drivers/staging/lustre/lustre/lmv/lmv_internal.h |   6 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c  | 115 ++-
 drivers/staging/lustre/lustre/lmv/lproc_lmv.c|   4 +-
 4 files changed, 61 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c 
b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
index 66de27f..cb1ed42 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
@@ -69,7 +69,7 @@ static int lmv_intent_remote(struct obd_export *exp, void 
*lmm,
int rc = 0;
 
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
-   if (body == NULL)
+   if (!body)
return -EPROTO;
 
LASSERT((body->valid & OBD_MD_MDS));
@@ -107,7 +107,7 @@ static int lmv_intent_remote(struct obd_export *exp, void 
*lmm,
 
op_data->op_fid1 = body->fid1;
/* Sent the parent FID to the remote MDT */
-   if (parent_fid != NULL) {
+   if (parent_fid) {
/* The parent fid is only for remote open to
 * check whether the open is from OBF,
 * see mdt_cross_open */
@@ -204,7 +204,7 @@ static int lmv_intent_open(struct obd_export *exp, struct 
md_op_data *op_data,
return rc;
 
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
-   if (body == NULL)
+   if (!body)
return -EPROTO;
/*
 * Not cross-ref case, just get out of here.
@@ -270,7 +270,7 @@ static int lmv_intent_lookup(struct obd_export *exp,
rc = md_intent_lock(tgt->ltd_exp, op_data, lmm, lmmsize, it,
 flags, reqp, cb_blocking, extra_lock_flags);
 
-   if (rc < 0 || *reqp == NULL)
+   if (rc < 0 || !*reqp)
return rc;
 
/*
@@ -278,7 +278,7 @@ static int lmv_intent_lookup(struct obd_export *exp,
 * remote inode. Let's check this.
 */
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
-   if (body == NULL)
+   if (!body)
return -EPROTO;
/* Not cross-ref case, just get out of here. */
if (likely(!(body->valid & OBD_MD_MDS)))
@@ -299,7 +299,6 @@ int lmv_intent_lock(struct obd_export *exp, struct 
md_op_data *op_data,
struct obd_device *obd = exp->exp_obd;
int rc;
 
-   LASSERT(it != NULL);
LASSERT(fid_is_sane(&op_data->op_fid1));
 
CDEBUG(D_INODE, "INTENT LOCK '%s' for '%*s' on "DFID"\n",
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h 
b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
index eb8e673..041d30f33 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h
+++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
@@ -66,7 +66,7 @@ static inline struct lmv_stripe_md *lmv_get_mea(struct 
ptlrpc_request *req)
struct mdt_body  *body;
struct lmv_stripe_md*mea;
 
-   LASSERT(req != NULL);
+   LASSERT(req);
 
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
 
@@ -75,8 +75,6 @@ static inline struct lmv_stripe_md *lmv_get_mea(struct 
ptlrpc_request *req)
 
mea = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD,
   body->eadatasize);
-   LASSERT(mea != NULL);
-
if (mea->mea_count == 0)
return NULL;
if (mea->mea_magic != MEA_MAGIC_LAST_CHAR &&
@@ -101,7 +99,7 @@ lmv_get_target(struct lmv_obd *lmv, u32 mds)
int i;
 
for (i = 0; i < count; i++) {
-   if (lmv->tgts[i] == NULL)
+   if (!lmv->tgts[i])
continue;
 
if (lmv->tgts[i]->ltd_idx == mds)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 733222c..2df369a 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -88,7 +88,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct 
obd_uuid *uuid,
spin_lock(&lmv->lmv_lock);
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
tgt = lmv->tgts[i];
-   if (tgt == NULL || tgt->ltd_exp == NULL)
+   if (!tgt || !tgt->ltd_exp)
continue;
 
CDEBUG(D_INFO, "Target idx %d is %s conn %#llx\n", i,
@@ -104,7 +104,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct 
obd_uuid *uuid,
}
 
obd = class_exp2obd(tgt->ltd_exp);
-   if (obd == NULL) {
+   if (!obd) {
rc = -ENOTCONN;
goto out_lmv_lock;
}
@@ -262,7 +262,7 @@ static void lmv_set_timeouts(stru

[PATCH 15/45] staging/lustre/ldlm: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/ldlm/interval_tree.c |  2 -
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |  9 ++-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c| 13 ++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  | 16 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 65 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c| 45 ---
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 17 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  | 65 +++---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 25 -
 9 files changed, 123 insertions(+), 134 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c 
b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
index a2ea8e5..fd70f65 100644
--- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c
+++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
@@ -49,13 +49,11 @@ enum {
 
 static inline int node_is_left_child(struct interval_node *node)
 {
-   LASSERT(node->in_parent != NULL);
return node == node->in_parent->in_left;
 }
 
 static inline int node_is_right_child(struct interval_node *node)
 {
-   LASSERT(node->in_parent != NULL);
return node == node->in_parent->in_right;
 }
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index 9c70f31..aa92682 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -113,7 +113,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock 
*lock)
 
LASSERT(lock->l_resource->lr_type == LDLM_EXTENT);
node = kmem_cache_alloc(ldlm_interval_slab, GFP_NOFS | __GFP_ZERO);
-   if (node == NULL)
+   if (!node)
return NULL;
 
INIT_LIST_HEAD(&node->li_group);
@@ -134,7 +134,7 @@ struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock 
*l)
 {
struct ldlm_interval *n = l->l_tree_node;
 
-   if (n == NULL)
+   if (!n)
return NULL;
 
LASSERT(!list_empty(&n->li_group));
@@ -168,7 +168,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res,
LASSERT(lock->l_granted_mode == lock->l_req_mode);
 
node = lock->l_tree_node;
-   LASSERT(node != NULL);
+   LASSERT(node);
LASSERT(!interval_is_intree(&node->li_node));
 
idx = lock_mode_to_index(lock->l_granted_mode);
@@ -185,7 +185,6 @@ void ldlm_extent_add_lock(struct ldlm_resource *res,
struct ldlm_interval *tmp;
 
tmp = ldlm_interval_detach(lock);
-   LASSERT(tmp != NULL);
ldlm_interval_free(tmp);
ldlm_interval_attach(to_ldlm_interval(found), lock);
}
@@ -211,7 +210,7 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock)
LASSERT(lock->l_granted_mode == 1 << idx);
tree = &res->lr_itree[idx];
 
-   LASSERT(tree->lit_root != NULL); /* assure the tree is not null */
+   LASSERT(tree->lit_root); /* assure the tree is not null */
 
tree->lit_size--;
node = ldlm_interval_detach(lock);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index 4310154..7c671e3 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -361,7 +361,7 @@ reprocess:
lock->l_policy_data.l_flock.start =
new->l_policy_data.l_flock.end + 1;
new2->l_conn_export = lock->l_conn_export;
-   if (lock->l_export != NULL) {
+   if (lock->l_export) {
new2->l_export = class_export_lock_get(lock->l_export,
   new2);
if (new2->l_export->exp_lock_hash &&
@@ -381,7 +381,7 @@ reprocess:
}
 
/* if new2 is created but never used, destroy it*/
-   if (splitted == 0 && new2 != NULL)
+   if (splitted == 0 && new2)
ldlm_lock_destroy_nolock(new2);
 
/* At this point we're granting the lock request. */
@@ -462,8 +462,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 
flags, void *data)
if ((lock->l_flags & (LDLM_FL_FAILED|LDLM_FL_LOCAL_ONLY)) ==
(LDLM_FL_FAILED|LDLM_FL_LOCAL_ONLY)) {
if (lock->l_req_mode == lock->l_granted_mode &&
-   lock->l_granted_mode != LCK_NL &&
-   data == NULL)
+   lock->l_granted_mode != LCK_NL && !data)
ldlm_lock_decref_internal(lock, lock->l_req_mode);
 
/* Need to wake up the waiter if we were evicted */
@@ -475,7 +474,7 @@ ldlm_flock_completion_ast(stru

[PATCH 18/45] staging/lustre/fld: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fld/fld_cache.c| 10 +++-
 drivers/staging/lustre/lustre/fld/fld_internal.h |  2 +-
 drivers/staging/lustre/lustre/fld/fld_request.c  | 32 +++-
 drivers/staging/lustre/lustre/fld/lproc_fld.c| 11 ++--
 4 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c 
b/drivers/staging/lustre/lustre/fld/fld_cache.c
index d9459e5..a7026a9 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -65,7 +65,7 @@ struct fld_cache *fld_cache_init(const char *name,
 {
struct fld_cache *cache;
 
-   LASSERT(name != NULL);
+   LASSERT(name);
LASSERT(cache_threshold < cache_size);
 
cache = kzalloc(sizeof(*cache), GFP_NOFS);
@@ -100,7 +100,7 @@ void fld_cache_fini(struct fld_cache *cache)
 {
__u64 pct;
 
-   LASSERT(cache != NULL);
+   LASSERT(cache);
fld_cache_flush(cache);
 
if (cache->fci_stat.fst_count > 0) {
@@ -218,8 +218,6 @@ static int fld_cache_shrink(struct fld_cache *cache)
struct list_head *curr;
int num = 0;
 
-   LASSERT(cache != NULL);
-
if (cache->fci_cache_count < cache->fci_cache_size)
return 0;
 
@@ -414,7 +412,7 @@ static int fld_cache_insert_nolock(struct fld_cache *cache,
}
}
 
-   if (prev == NULL)
+   if (!prev)
prev = head;
 
CDEBUG(D_INFO, "insert range "DRANGE"\n", PRANGE(&f_new->fce_range));
@@ -499,7 +497,7 @@ int fld_cache_lookup(struct fld_cache *cache,
cache->fci_stat.fst_count++;
list_for_each_entry(flde, head, fce_list) {
if (flde->fce_range.lsr_start > seq) {
-   if (prev != NULL)
+   if (prev)
*range = prev->fce_range;
break;
}
diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h 
b/drivers/staging/lustre/lustre/fld/fld_internal.h
index 12eb164..59eabda 100644
--- a/drivers/staging/lustre/lustre/fld/fld_internal.h
+++ b/drivers/staging/lustre/lustre/fld/fld_internal.h
@@ -169,7 +169,7 @@ struct fld_cache_entry
 static inline const char *
 fld_target_name(struct lu_fld_target *tar)
 {
-   if (tar->ft_srv != NULL)
+   if (tar->ft_srv)
return tar->ft_srv->lsf_name;
 
return (const char *)tar->ft_exp->exp_obd->obd_name;
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c 
b/drivers/staging/lustre/lustre/fld/fld_request.c
index d92c01b..222d18d 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -148,9 +148,9 @@ again:
fld->lcf_name, hash, seq, fld->lcf_count);
 
list_for_each_entry(target, &fld->lcf_targets, ft_chain) {
-   const char *srv_name = target->ft_srv != NULL  ?
+   const char *srv_name = target->ft_srv ?
target->ft_srv->lsf_name : "";
-   const char *exp_name = target->ft_exp != NULL ?
+   const char *exp_name = target->ft_exp ?
(char *)target->ft_exp->exp_obd->obd_uuid.uuid :
"";
 
@@ -183,13 +183,13 @@ fld_client_get_target(struct lu_client_fld *fld, u64 seq)
 {
struct lu_fld_target *target;
 
-   LASSERT(fld->lcf_hash != NULL);
+   LASSERT(fld->lcf_hash);
 
spin_lock(&fld->lcf_lock);
target = fld->lcf_hash->fh_scan_func(fld, seq);
spin_unlock(&fld->lcf_lock);
 
-   if (target != NULL) {
+   if (target) {
CDEBUG(D_INFO, "%s: Found target (idx %llu) by seq %#llx\n",
   fld->lcf_name, target->ft_idx, seq);
}
@@ -207,10 +207,10 @@ int fld_client_add_target(struct lu_client_fld *fld,
const char *name;
struct lu_fld_target *target, *tmp;
 
-   LASSERT(tar != NULL);
+   LASSERT(tar);
name = fld_target_name(tar);
-   LASSERT(name != NULL);
-   LASSERT(tar->ft_srv != NULL || tar->ft_exp != NULL);
+   LASSERT(name);
+   LASSERT(tar->ft_srv || tar->ft_exp);
 
if (fld->lcf_flags != LUSTRE_FLD_INIT) {
CERROR("%s: Attempt to add target %s (idx %llu) on fly - skip 
it\n",
@@ -236,7 +236,7 @@ int fld_client_add_target(struct lu_client_fld *fld,
}
 
target->ft_exp = tar->ft_exp;
-   if (target->ft_exp != NULL)
+   if (target->ft_exp)
class_export_get(target->ft_exp);
target->ft_srv = tar->ft_srv;
target->ft_idx = tar->ft_idx;
@@ -264,7 +264,7 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 
idx)
list_del(&target->ft_chain);
spin_unlock(&fld->lcf_lock);
 
-

[PATCH 13/45] staging/lustre/lov: Adjust NULL comparison codestyle

2016-02-15 Thread green
From: Oleg Drokin 

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"
Also removed some redundant assertions.

Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/lov/lov_cl_internal.h|  6 +--
 drivers/staging/lustre/lustre/lov/lov_dev.c| 40 -
 drivers/staging/lustre/lustre/lov/lov_ea.c |  4 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |  1 -
 drivers/staging/lustre/lustre/lov/lov_io.c | 30 ++---
 drivers/staging/lustre/lustre/lov/lov_lock.c   | 49 ++---
 drivers/staging/lustre/lustre/lov/lov_obd.c| 44 +--
 drivers/staging/lustre/lustre/lov/lov_object.c | 51 +++---
 drivers/staging/lustre/lustre/lov/lov_offset.c |  5 ---
 drivers/staging/lustre/lustre/lov/lov_pack.c   |  8 ++--
 drivers/staging/lustre/lustre/lov/lov_page.c   |  6 +--
 drivers/staging/lustre/lustre/lov/lov_pool.c   | 20 -
 drivers/staging/lustre/lustre/lov/lov_request.c| 30 ++---
 drivers/staging/lustre/lustre/lov/lovsub_dev.c |  5 +--
 drivers/staging/lustre/lustre/lov/lovsub_lock.c|  4 +-
 drivers/staging/lustre/lustre/lov/lovsub_object.c  |  4 +-
 drivers/staging/lustre/lustre/lov/lproc_lov.c  | 18 
 17 files changed, 152 insertions(+), 173 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h 
b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
index 66a2492..b5fc159 100644
--- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
@@ -651,7 +651,7 @@ static inline struct lov_session *lov_env_session(const 
struct lu_env *env)
struct lov_session *ses;
 
ses = lu_context_key_get(env->le_ses, &lov_session_key);
-   LASSERT(ses != NULL);
+   LASSERT(ses);
return ses;
 }
 
@@ -759,7 +759,7 @@ static inline struct lovsub_lock *cl2sub_lock(const struct 
cl_lock *lock)
const struct cl_lock_slice *slice;
 
slice = cl_lock_at(lock, &lovsub_device_type);
-   LASSERT(slice != NULL);
+   LASSERT(slice);
return cl2lovsub_lock(slice);
 }
 
@@ -817,7 +817,7 @@ static inline struct lov_thread_info *lov_env_info(const 
struct lu_env *env)
struct lov_thread_info *info;
 
info = lu_context_key_get(&env->le_ctx, &lov_key);
-   LASSERT(info != NULL);
+   LASSERT(info);
return info;
 }
 
diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c 
b/drivers/staging/lustre/lustre/lov/lov_dev.c
index 2c33cbc..ee093e0 100644
--- a/drivers/staging/lustre/lustre/lov/lov_dev.c
+++ b/drivers/staging/lustre/lustre/lov/lov_dev.c
@@ -143,7 +143,7 @@ static void *lov_key_init(const struct lu_context *ctx,
struct lov_thread_info *info;
 
info = kmem_cache_alloc(lov_thread_kmem, GFP_NOFS | __GFP_ZERO);
-   if (info != NULL)
+   if (info)
INIT_LIST_HEAD(&info->lti_closure.clc_list);
else
info = ERR_PTR(-ENOMEM);
@@ -171,7 +171,7 @@ static void *lov_session_key_init(const struct lu_context 
*ctx,
struct lov_session *info;
 
info = kmem_cache_alloc(lov_session_kmem, GFP_NOFS | __GFP_ZERO);
-   if (info == NULL)
+   if (!info)
info = ERR_PTR(-ENOMEM);
return info;
 }
@@ -199,15 +199,15 @@ static struct lu_device *lov_device_fini(const struct 
lu_env *env,
int i;
struct lov_device *ld = lu2lov_dev(d);
 
-   LASSERT(ld->ld_lov != NULL);
-   if (ld->ld_target == NULL)
+   LASSERT(ld->ld_lov);
+   if (!ld->ld_target)
return NULL;
 
lov_foreach_target(ld, i) {
struct lovsub_device *lsd;
 
lsd = ld->ld_target[i];
-   if (lsd != NULL) {
+   if (lsd) {
cl_stack_fini(env, lovsub2cl_dev(lsd));
ld->ld_target[i] = NULL;
}
@@ -222,8 +222,8 @@ static int lov_device_init(const struct lu_env *env, struct 
lu_device *d,
int i;
int rc = 0;
 
-   LASSERT(d->ld_site != NULL);
-   if (ld->ld_target == NULL)
+   LASSERT(d->ld_site);
+   if (!ld->ld_target)
return rc;
 
lov_foreach_target(ld, i) {
@@ -232,7 +232,7 @@ static int lov_device_init(const struct lu_env *env, struct 
lu_device *d,
struct lov_tgt_desc  *desc;
 
desc = ld->ld_lov->lov_tgts[i];
-   if (desc == NULL)
+   if (!desc)
continue;
 
cl = cl_type_setup(env, d->ld_site, &lovsub_device_type,
@@ -262,7 +262,7 @@ static int lov_req_init(const struct lu_env *env, struct 
cl_device *dev,
int result;
 
lr = kmem_cache_alloc(lov_req_kmem, GFP_NOFS | __GFP_ZERO);
-   if (lr != NULL) {
+   if (lr) {
cl_req_slice_add(req, &lr->lr_cl, dev, &lov_req_ops);
result = 0;
} 

[PATCH 09/45] staging/lustre: Remove server code from class_get_type()

2016-02-15 Thread green
From: Oleg Drokin 

class_get_type has some references to various server modules
that could not exist on the server, so get rid of them.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/obdclass/genops.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c 
b/drivers/staging/lustre/lustre/obdclass/genops.c
index 5665655..1cb68df 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -113,15 +113,6 @@ static struct obd_type *class_get_type(const char *name)
if (!type) {
const char *modname = name;
 
-   if (strcmp(modname, "obdfilter") == 0)
-   modname = "ofd";
-
-   if (strcmp(modname, LUSTRE_LWP_NAME) == 0)
-   modname = LUSTRE_OSP_NAME;
-
-   if (!strncmp(modname, LUSTRE_MDS_NAME, strlen(LUSTRE_MDS_NAME)))
-   modname = LUSTRE_MDT_NAME;
-
if (!request_module("%s", modname)) {
CDEBUG(D_INFO, "Loaded module '%s'\n", modname);
type = class_search_type(name);
-- 
2.1.0



[PATCH 04/45] staging/lustre/llite: Get rid of /proc references in comments

2016-02-15 Thread green
From: Oleg Drokin 

Now that the sysfs conversion is complete, also convert all the
remaining comments

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/lproc_llite.c | 2 +-
 drivers/staging/lustre/lustre/llite/vvp_io.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c 
b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index f134ad9..8d3c788 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -43,7 +43,7 @@
 #include "llite_internal.h"
 #include "vvp_internal.h"
 
-/* /proc/lustre/llite mount point registration */
+/* debugfs llite mount point registration */
 static struct file_operations ll_rw_extents_stats_fops;
 static struct file_operations ll_rw_extents_stats_pp_fops;
 static struct file_operations ll_rw_offset_stats_fops;
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c 
b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 0920ac6..573ab15 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -1003,7 +1003,7 @@ static int vvp_io_commit_write(const struct lu_env *env,
 *
 * (3) IO is batched up to the RPC size and is async until the
 * client max cache is hit
-* (/proc/fs/lustre/osc/OSC.../max_dirty_mb)
+* (/sys/fs/lustre/osc/OSC.../max_dirty_mb)
 *
 */
if (!PageDirty(vmpage)) {
-- 
2.1.0



[PATCH 11/45] staging/lustre/osc: Remove commented out osc_page_protected()

2016-02-15 Thread green
From: Oleg Drokin 

The complicated version of osc_page_protected and osc_page_is_dlocked
are unsafe and were commented out for ages, so probably no point in
carrying them on.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/osc/osc_page.c | 99 
 1 file changed, 99 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c 
b/drivers/staging/lustre/lustre/osc/osc_page.c
index 8943f0a..99d5b56 100644
--- a/drivers/staging/lustre/lustre/osc/osc_page.c
+++ b/drivers/staging/lustre/lustre/osc/osc_page.c
@@ -51,111 +51,12 @@ static int osc_lru_reserve(const struct lu_env *env, 
struct osc_object *obj,
  *  @{
  */
 
-/*
- * Comment out osc_page_protected because it may sleep inside the
- * the client_obd_list_lock.
- * client_obd_list_lock -> osc_ap_completion -> osc_completion ->
- *   -> osc_page_protected -> osc_page_is_dlocked -> osc_match_base
- *   -> ldlm_lock_match -> sptlrpc_import_check_ctx -> sleep.
- */
-#if 0
-static int osc_page_is_dlocked(const struct lu_env *env,
-  const struct osc_page *opg,
-  enum cl_lock_mode mode, int pending, int unref)
-{
-   struct cl_page   *page;
-   struct osc_object  *obj;
-   struct osc_thread_info *info;
-   struct ldlm_res_id *resname;
-   struct lustre_handle   *lockh;
-   ldlm_policy_data_t *policy;
-   ldlm_mode_t  dlmmode;
-   __u64   flags;
-
-   might_sleep();
-
-   info = osc_env_info(env);
-   resname = &info->oti_resname;
-   policy = &info->oti_policy;
-   lockh = &info->oti_handle;
-   page = opg->ops_cl.cpl_page;
-   obj = cl2osc(opg->ops_cl.cpl_obj);
-
-   flags = LDLM_FL_TEST_LOCK | LDLM_FL_BLOCK_GRANTED;
-   if (pending)
-   flags |= LDLM_FL_CBPENDING;
-
-   dlmmode = osc_cl_lock2ldlm(mode) | LCK_PW;
-   osc_lock_build_res(env, obj, resname);
-   osc_index2policy(policy, page->cp_obj, page->cp_index, page->cp_index);
-   return osc_match_base(osc_export(obj), resname, LDLM_EXTENT, policy,
- dlmmode, &flags, NULL, lockh, unref);
-}
-
-/**
- * Checks an invariant that a page in the cache is covered by a lock, as
- * needed.
- */
-static int osc_page_protected(const struct lu_env *env,
- const struct osc_page *opg,
- enum cl_lock_mode mode, int unref)
-{
-   struct cl_object_header *hdr;
-   struct cl_lock*scan;
-   struct cl_page*page;
-   struct cl_lock_descr*descr;
-   int result;
-
-   LINVRNT(!opg->ops_temp);
-
-   page = opg->ops_cl.cpl_page;
-   if (page->cp_owner != NULL &&
-   cl_io_top(page->cp_owner)->ci_lockreq == CILR_NEVER)
-   /*
-* If IO is done without locks (liblustre, or lloop), lock is
-* not required.
-*/
-   result = 1;
-   else
-   /* otherwise check for a DLM lock */
-   result = osc_page_is_dlocked(env, opg, mode, 1, unref);
-   if (result == 0) {
-   /* maybe this page is a part of a lockless io? */
-   hdr = cl_object_header(opg->ops_cl.cpl_obj);
-   descr = &osc_env_info(env)->oti_descr;
-   descr->cld_mode = mode;
-   descr->cld_start = page->cp_index;
-   descr->cld_end   = page->cp_index;
-   spin_lock(&hdr->coh_lock_guard);
-   list_for_each_entry(scan, &hdr->coh_locks, cll_linkage) {
-   /*
-* Lock-less sub-lock has to be either in HELD state
-* (when io is actively going on), or in CACHED state,
-* when top-lock is being unlocked:
-* cl_io_unlock()->cl_unuse()->...->lov_lock_unuse().
-*/
-   if ((scan->cll_state == CLS_HELD ||
-scan->cll_state == CLS_CACHED) &&
-   cl_lock_ext_match(&scan->cll_descr, descr)) {
-   struct osc_lock *olck;
-
-   olck = osc_lock_at(scan);
-   result = osc_lock_is_lockless(olck);
-   break;
-   }
-   }
-   spin_unlock(&hdr->coh_lock_guard);
-   }
-   return result;
-}
-#else
 static int osc_page_protected(const struct lu_env *env,
  const struct osc_page *opg,
  enum cl_lock_mode mode, int unref)
 {
return 1;
 }
-#endif
 
 /*
  *
-- 
2.1.0



[PATCH 06/45] staging/lustre: Remove unused function oti_init

2016-02-15 Thread green
From: Oleg Drokin 

All the users seems to have disappeared.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h | 28 
 1 file changed, 28 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index 514e12b..991d2c6 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -595,34 +595,6 @@ struct obd_trans_info {
struct obd_uuid  *oti_ost_uuid;
 };
 
-static inline void oti_init(struct obd_trans_info *oti,
-   struct ptlrpc_request *req)
-{
-   if (oti == NULL)
-   return;
-   memset(oti, 0, sizeof(*oti));
-
-   if (req == NULL)
-   return;
-
-   oti->oti_xid = req->rq_xid;
-   /** VBR: take versions from request */
-   if (req->rq_reqmsg != NULL &&
-   lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
-   __u64 *pre_version = lustre_msg_get_versions(req->rq_reqmsg);
-
-   oti->oti_pre_version = pre_version ? pre_version[0] : 0;
-   oti->oti_transno = lustre_msg_get_transno(req->rq_reqmsg);
-   }
-
-   /** called from mds_create_objects */
-   if (req->rq_repmsg != NULL)
-   oti->oti_transno = lustre_msg_get_transno(req->rq_repmsg);
-   oti->oti_thread = req->rq_svc_thread;
-   if (req->rq_reqmsg != NULL)
-   oti->oti_conn_cnt = lustre_msg_get_conn_cnt(req->rq_reqmsg);
-}
-
 static inline void oti_alloc_cookies(struct obd_trans_info *oti,
 int num_cookies)
 {
-- 
2.1.0



[PATCH 07/45] staging/lustre: Remove unused osc_on_mdt function

2016-02-15 Thread green
From: Oleg Drokin 

This only makes sense on metadata server, so get rid of it.

Also remove now unused MDS_OSC_MAX_RIF_DEFAULT define

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/obd.h   |  1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 28 +--
 2 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index 991d2c6..c64a499 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -216,7 +216,6 @@ struct timeout_item {
 };
 
 #define OSC_MAX_RIF_DEFAULT   8
-#define MDS_OSC_MAX_RIF_DEFAULT   50
 #define OSC_MAX_RIF_MAX 256
 #define OSC_MAX_DIRTY_DEFAULT  (OSC_MAX_RIF_DEFAULT * 4)
 #define OSC_MAX_DIRTY_MB_MAX   2048 /* arbitrary, but < MAX_LONG bytes */
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 3c8d441..b52ffc0 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -227,29 +227,6 @@ void client_destroy_import(struct obd_import *imp)
 }
 EXPORT_SYMBOL(client_destroy_import);
 
-/**
- * Check whether or not the OSC is on MDT.
- * In the config log,
- * osc on MDT
- * setup 0:{fsname}-OST-osc[-MDT] 1:lustre-OST_UUID 2:NID
- * osc on client
- * setup 0:{fsname}-OST-osc 1:lustre-OST_UUID 2:NID
- *
- **/
-static int osc_on_mdt(char *obdname)
-{
-   char *ptr;
-
-   ptr = strrchr(obdname, '-');
-   if (ptr == NULL)
-   return 0;
-
-   if (strncmp(ptr + 1, "MDT", 3) == 0)
-   return 1;
-
-   return 0;
-}
-
 /* Configure an RPC client OBD device.
  *
  * lcfg parameters:
@@ -400,10 +377,7 @@ int client_obd_setup(struct obd_device *obddev, struct 
lustre_cfg *lcfg)
} else if (totalram_pages >> (20 - PAGE_CACHE_SHIFT) <= 512 /* MB */) {
cli->cl_max_rpcs_in_flight = 4;
} else {
-   if (osc_on_mdt(obddev->obd_name))
-   cli->cl_max_rpcs_in_flight = MDS_OSC_MAX_RIF_DEFAULT;
-   else
-   cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT;
+   cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT;
}
rc = ldlm_get_ref();
if (rc) {
-- 
2.1.0



[PATCH 05/45] staging/lustre/lov: Get rid of /proc references in comments

2016-02-15 Thread green
From: Oleg Drokin 

Now that the sysfs conversion is complete, also convert all the
remaining comments

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lov/lov_pool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c 
b/drivers/staging/lustre/lustre/lov/lov_pool.c
index 3ee1d40..470708c 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pool.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pool.c
@@ -154,7 +154,7 @@ struct cfs_hash_ops pool_hash_operations = {
 
 /* ifdef needed for liblustre support */
 /*
- * pool /proc seq_file methods
+ * pool debugfs seq_file methods
  */
 /*
  * iterator is used to go through the target pool entries
@@ -429,7 +429,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
INIT_HLIST_NODE(&new_pool->pool_hash);
 
/* we need this assert seq_file is not implemented for liblustre */
-   /* get ref for /proc file */
+   /* get ref for debugfs file */
lov_pool_getref(new_pool);
new_pool->pool_debugfs_entry = ldebugfs_add_simple(
lov->lov_pool_debugfs_entry,
-- 
2.1.0



[PATCH 01/45] staging/lustre/ptlrpc: Get rid of /proc references in comments

2016-02-15 Thread green
From: Oleg Drokin 

Now that the sysfs conversion is complete, also convert all the
remaining comments

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +-
 drivers/staging/lustre/lustre/include/lustre_net.h | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/recover.c | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h 
b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index 9b319f1..11a841a 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -373,7 +373,7 @@ struct ldlm_namespace {
 
/**
 * Namespace connect flags supported by server (may be changed via
-* /proc, LRU resize may be disabled/enabled).
+* sysfs, LRU resize may be disabled/enabled).
 */
__u64   ns_connect_flags;
 
diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h 
b/drivers/staging/lustre/lustre/include/lustre_net.h
index d834ddd..d9c7267 100644
--- a/drivers/staging/lustre/lustre/include/lustre_net.h
+++ b/drivers/staging/lustre/lustre/include/lustre_net.h
@@ -1947,7 +1947,7 @@ struct ptlrpc_service_ops {
  * or general metadata service for MDS.
  */
 struct ptlrpc_service {
-   /** serialize /proc operations */
+   /** serialize sysfs operations */
spinlock_t  srv_lock;
/** most often accessed fields */
/** chain thru all services */
diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c 
b/drivers/staging/lustre/lustre/ptlrpc/recover.c
index db6626c..4359cac 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/recover.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c
@@ -260,7 +260,7 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request 
*failed_req)
  * Administratively active/deactive a client.
  * This should only be called by the ioctl interface, currently
  *  - the lctl deactivate and activate commands
- *  - echo 0/1 >> /proc/osc/XXX/active
+ *  - echo 0/1 >> /sys/fs/lustre/osc/XXX/active
  *  - client umount -f (ll_umount_begin)
  */
 int ptlrpc_set_import_active(struct obd_import *imp, int active)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 22621c7..52a6c51 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -120,7 +120,7 @@ static struct ptlrpc_enc_page_pool {
 } page_pools;
 
 /*
- * /proc/fs/lustre/sptlrpc/encrypt_page_pools
+ * /sys/kernel/debug/lustre/sptlrpc/encrypt_page_pools
  */
 int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v)
 {
-- 
2.1.0



[PATCH 02/45] staging/lustre/obdclass: Get rid of /proc references in comments.

2016-02-15 Thread green
From: Oleg Drokin 

Now that the sysfs conversion is complete, also convert all the
remaining comments

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/cl_object.h   | 2 +-
 drivers/staging/lustre/lustre/include/lprocfs_status.h  | 2 +-
 drivers/staging/lustre/lustre/include/obd.h | 7 ---
 drivers/staging/lustre/lustre/obdclass/class_obd.c  | 4 ++--
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 8 
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index bd7acc2..c8f4569 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2613,7 +2613,7 @@ struct cl_site {
 * Statistical counters. Atomics do not scale, something better like
 * per-cpu counters is needed.
 *
-* These are exported as /proc/fs/lustre/llite/.../site
+* These are exported as /sys/kernel/debug/lustre/llite/.../site
 *
 * When interpreting keep in mind that both sub-locks (and sub-pages)
 * and top-locks (and top-pages) are accounted here.
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index fb13094..97c2d7e 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -54,7 +54,7 @@ struct lprocfs_vars {
struct file_operations  *fops;
void*data;
/**
-* /proc file mode.
+* sysfs file mode.
 */
umode_t proc_mode;
 };
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index f00d9a2..514e12b 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -302,7 +302,7 @@ struct client_obd {
struct list_head   cl_loi_read_list;
int   cl_r_in_flight;
int   cl_w_in_flight;
-   /* just a sum of the loi/lop pending numbers to be exported by /proc */
+   /* just a sum of the loi/lop pending numbers to be exported by sysfs */
atomic_t cl_pending_w_pages;
atomic_t cl_pending_r_pages;
__u32cl_max_pages_per_rpc;
@@ -449,7 +449,7 @@ struct pool_desc {
struct lov_qos_rr pool_rr;  /* round robin qos */
struct hlist_node  pool_hash; /* access by poolname */
struct list_headpool_list;/* serial access */
-   struct dentry   *pool_debugfs_entry;/* file in /proc */
+   struct dentry   *pool_debugfs_entry;/* file in debugfs */
struct obd_device*pool_lobd;/* obd of the lov/lod to which
*  this pool belongs */
 };
@@ -737,7 +737,8 @@ struct obd_device {
  obd_async_recov:1,   /* allow asynchronous orphan cleanup 
*/
  obd_no_conn:1,   /* deny new connections */
  obd_inactive:1,  /* device active/inactive
-  * (for /proc/status only!!) */
+   * (for sysfs status only!!)
+   */
  obd_no_ir:1,   /* no imperative recovery. */
  obd_process_conf:1;  /* device is processing mgs config */
/* use separate field as it is set in interrupt to don't mess with
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c 
b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 65cf46c..84f6880 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(obd_devs);
 struct list_head obd_types;
 DEFINE_RWLOCK(obd_dev_lock);
 
-/* The following are visible and mutable through /proc/sys/lustre/. */
+/* The following are visible and mutable through /sys/fs/lustre. */
 unsigned int obd_debug_peer_on_timeout;
 EXPORT_SYMBOL(obd_debug_peer_on_timeout);
 unsigned int obd_dump_on_timeout;
@@ -67,7 +67,7 @@ unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT;   /* seconds 
*/
 EXPORT_SYMBOL(obd_timeout);
 unsigned int obd_timeout_set;
 EXPORT_SYMBOL(obd_timeout_set);
-/* Adaptive timeout defs here instead of ptlrpc module for /proc/sys/ access */
+/* Adaptive timeout defs here instead of ptlrpc module for /sys/fs/ access */
 unsigned int at_min;
 EXPORT_SYMBOL(at_min);
 unsigned int at_max = 600;
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index eda44d8..a7e22e0 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status

[PATCH 49/56] staging/lustre/lov: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lov/lov_ea.c   |  3 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h |  6 +-
 drivers/staging/lustre/lustre/lov/lov_lock.c | 32 ++
 drivers/staging/lustre/lustre/lov/lov_obd.c  | 78 
 drivers/staging/lustre/lustre/lov/lov_object.c   | 24 +---
 drivers/staging/lustre/lustre/lov/lov_offset.c   | 12 ++--
 drivers/staging/lustre/lustre/lov/lov_pack.c | 12 ++--
 drivers/staging/lustre/lustre/lov/lov_pool.c | 12 ++--
 drivers/staging/lustre/lustre/lov/lov_request.c  | 18 --
 drivers/staging/lustre/lustre/lov/lovsub_lock.c  |  6 +-
 10 files changed, 134 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c 
b/drivers/staging/lustre/lustre/lov/lov_ea.c
index 6c8381a..c27b884 100644
--- a/drivers/staging/lustre/lustre/lov/lov_ea.c
+++ b/drivers/staging/lustre/lustre/lov/lov_ea.c
@@ -162,7 +162,8 @@ static int lsm_destroy_plain(struct lov_stripe_md *lsm, 
struct obdo *oa,
 }
 
 /* Find minimum stripe maxbytes value.  For inactive or
- * reconnecting targets use LUSTRE_STRIPE_MAXBYTES. */
+ * reconnecting targets use LUSTRE_STRIPE_MAXBYTES.
+ */
 static void lov_tgt_maxbytes(struct lov_tgt_desc *tgt, __u64 *stripe_maxbytes)
 {
struct obd_import *imp = tgt->ltd_obd->u.cli.cl_import;
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h 
b/drivers/staging/lustre/lustre/lov/lov_internal.h
index d4522ba..725ebf9 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -43,7 +43,8 @@
 /* lov_do_div64(a, b) returns a % b, and a = a / b.
  * The 32-bit code is LOV-specific due to knowing about stripe limits in
  * order to reduce the divisor to a 32-bit number.  If the divisor is
- * already a 32-bit value the compiler handles this directly. */
+ * already a 32-bit value the compiler handles this directly.
+ */
 #if BITS_PER_LONG == 64
 # define lov_do_div64(n, base) ({  \
uint64_t __base = (base);   \
@@ -92,7 +93,8 @@ struct lov_request_set {
atomic_tset_refcount;
struct obd_export   *set_exp;
/* XXX: There is @set_exp already, however obd_statfs gets obd_device
-  only. */
+* only.
+*/
struct obd_device   *set_obd;
int set_count;
atomic_tset_completes;
diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c 
b/drivers/staging/lustre/lustre/lov/lov_lock.c
index e6b0437..e0a6438 100644
--- a/drivers/staging/lustre/lustre/lov/lov_lock.c
+++ b/drivers/staging/lustre/lustre/lov/lov_lock.c
@@ -160,7 +160,8 @@ static struct cl_lock *lov_sublock_alloc(const struct 
lu_env *env,
 * to remember the subio. This is because lock is able
 * to be cached, but this is not true for IO. This
 * further means a sublock might be referenced in
-* different io context. -jay */
+* different io context. -jay
+*/
 
sublock = cl_lock_hold(subenv->lse_env, subenv->lse_io,
   descr, "lov-parent", parent);
@@ -477,7 +478,8 @@ static int lov_lock_enqueue_one(const struct lu_env *env, 
struct lov_lock *lck,
result = cl_enqueue_try(env, sublock, io, enqflags);
if ((sublock->cll_state == CLS_ENQUEUED) && !(enqflags & CEF_AGL)) {
/* if it is enqueued, try to `wait' on it---maybe it's already
-* granted */
+* granted
+*/
result = cl_wait_try(env, sublock);
if (result == CLO_REENQUEUED)
result = CLO_WAIT;
@@ -518,7 +520,8 @@ static int lov_sublock_fill(const struct lu_env *env, 
struct cl_lock *parent,
} else {
kmem_cache_free(lov_lock_link_kmem, link);
/* other thread allocated sub-lock, or enqueue is no
-* longer going on */
+* longer going on
+*/
cl_lock_mutex_put(env, parent);
cl_lock_unhold(env, sublock, "lov-parent", parent);
cl_lock_mutex_get(env, parent);
@@ -575,7 +578,8 @@ static int lov_lock_enqueue(const struct lu_env *env,
if (!sub) {
result = lov_sublock_fill(env, lock, io, lck, i);
/* lov_sublock_fill() released @lock mutex,
-* restart. */
+* restart.
+*/
  

[PATCH 50/56] staging/lustre/mdc: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/mdc/mdc_lib.c |  3 +-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   | 87 -
 drivers/staging/lustre/lustre/mdc/mdc_reint.c   | 12 ++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 27 +---
 4 files changed, 84 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c 
b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index ea2ab23..b3bfdcb 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -489,7 +489,8 @@ static int mdc_req_avail(struct client_obd *cli, struct 
mdc_cache_waiter *mcw)
 
 /* We record requests in flight in cli->cl_r_in_flight here.
  * There is only one write rpc possible in mdc anyway. If this to change
- * in the future - the code may need to be revisited. */
+ * in the future - the code may need to be revisited.
+ */
 int mdc_enter_request(struct client_obd *cli)
 {
int rc = 0;
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index ae648d0..6dae574 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -210,7 +210,8 @@ int mdc_null_inode(struct obd_export *exp,
 /* find any ldlm lock of the inode in mdc
  * return 0not find
  * 1find one
- *  < 0error */
+ *  < 0error
+ */
 int mdc_find_cbdata(struct obd_export *exp,
const struct lu_fid *fid,
ldlm_iterator_t it, void *data)
@@ -252,7 +253,8 @@ static inline void mdc_clear_replay_flag(struct 
ptlrpc_request *req, int rc)
  * OOM here may cause recovery failure if lmm is needed (only for the
  * original open if the MDS crashed just when this client also OOM'd)
  * but this is incredibly unlikely, and questionable whether the client
- * could do MDS recovery under OOM anyways... */
+ * could do MDS recovery under OOM anyways...
+ */
 static void mdc_realloc_openmsg(struct ptlrpc_request *req,
struct mdt_body *body)
 {
@@ -514,7 +516,8 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct 
obd_export *exp,
/* pack the layout intent request */
layout = req_capsule_client_get(&req->rq_pill, &RMF_LAYOUT_INTENT);
/* LAYOUT_INTENT_ACCESS is generic, specific operation will be
-* set for replication */
+* set for replication
+*/
layout->li_opc = LAYOUT_INTENT_ACCESS;
 
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER,
@@ -561,7 +564,8 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 
LASSERT(rc >= 0);
/* Similarly, if we're going to replay this request, we don't want to
-* actually get a lock, just perform the intent. */
+* actually get a lock, just perform the intent.
+*/
if (req->rq_transno || req->rq_replay) {
lockreq = req_capsule_client_get(pill, &RMF_DLM_REQ);
lockreq->lock_flags |= ldlm_flags_to_wire(LDLM_FL_INTENT_ONLY);
@@ -575,7 +579,8 @@ static int mdc_finish_enqueue(struct obd_export *exp,
lock = ldlm_handle2lock(lockh);
 
/* If the server gave us back a different lock mode, we should
-* fix up our variables. */
+* fix up our variables.
+*/
if (lock->l_req_mode != einfo->ei_mode) {
ldlm_lock_addref(lockh, lock->l_req_mode);
ldlm_lock_decref(lockh, einfo->ei_mode);
@@ -593,7 +598,8 @@ static int mdc_finish_enqueue(struct obd_export *exp,
intent->it_data = req;
 
/* Technically speaking rq_transno must already be zero if
-* it_status is in error, so the check is a bit redundant */
+* it_status is in error, so the check is a bit redundant
+*/
if ((!req->rq_transno || intent->it_status < 0) && req->rq_replay)
mdc_clear_replay_flag(req, intent->it_status);
 
@@ -603,7 +609,8 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 *
 * It's important that we do this first!  Otherwise we might exit the
 * function without doing so, and try to replay a failed create
-* (bug 3440) */
+* (bug 3440)
+*/
if (it->it_op & IT_OPEN && req->rq_replay &&
(!it_disposition(it, DISP_OPEN_OPEN) || intent->it_status != 0))
mdc_clear_replay_flag(req, intent->it_status);
@@ -647,7 +654,8 @@ static int mdc_finish_enqueue(struct obd_export *exp,
return -EPROTO;
 
/* save lvb data and length in case this is for layout
-* lock */
+* lock
+*/

[PATCH 48/56] staging/lustre/lmv: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lmv/lmv_fld.c|  3 ++-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c |  9 ---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c| 37 +-
 3 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_fld.c 
b/drivers/staging/lustre/lustre/lmv/lmv_fld.c
index ee23592..378691b 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_fld.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_fld.c
@@ -58,7 +58,8 @@ int lmv_fld_lookup(struct lmv_obd *lmv,
int rc;
 
/* FIXME: Currently ZFS still use local seq for ROOT unfortunately, and
-* this fid_is_local check should be removed once LU-2240 is fixed */
+* this fid_is_local check should be removed once LU-2240 is fixed
+*/
LASSERTF((fid_seq_in_fldb(fid_seq(fid)) ||
  fid_seq_is_local_file(fid_seq(fid))) &&
 fid_is_sane(fid), DFID" is insane!\n", PFID(fid));
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c 
b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
index cb1ed42..259b211 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
@@ -110,11 +110,13 @@ static int lmv_intent_remote(struct obd_export *exp, void 
*lmm,
if (parent_fid) {
/* The parent fid is only for remote open to
 * check whether the open is from OBF,
-* see mdt_cross_open */
+* see mdt_cross_open
+*/
LASSERT(it->it_op & IT_OPEN);
op_data->op_fid2 = *parent_fid;
/* Add object FID to op_fid3, in case it needs to check stale
-* (M_CHECK_STALE), see mdc_finish_intent_lock */
+* (M_CHECK_STALE), see mdc_finish_intent_lock
+*/
op_data->op_fid3 = body->fid1;
}
 
@@ -173,7 +175,8 @@ static int lmv_intent_open(struct obd_export *exp, struct 
md_op_data *op_data,
return PTR_ERR(tgt);
 
/* If it is ready to open the file by FID, do not need
-* allocate FID at all, otherwise it will confuse MDT */
+* allocate FID at all, otherwise it will confuse MDT
+*/
if ((it->it_op & IT_CREAT) &&
!(it->it_flags & MDS_OPEN_BY_FID)) {
/*
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index eb1c85f..67746c9 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -679,7 +679,8 @@ repeat_fid2path:
goto out_fid2path;
 
/* If remote_gf != NULL, it means just building the
-* path on the remote MDT, copy this path segment to gf */
+* path on the remote MDT, copy this path segment to gf
+*/
if (remote_gf) {
struct getinfo_fid2path *ori_gf;
char *ptr;
@@ -797,7 +798,8 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, 
unsigned int cmd, int len,
/* unregister request (call from llapi_hsm_copytool_fini) */
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
/* best effort: try to clean as much as possible
-* (continue on error) */
+* (continue on error)
+*/
obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp, len, lk, uarg);
}
 
@@ -821,7 +823,8 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, 
unsigned int cmd, int len,
 
/* All or nothing: try to register to all MDS.
 * In case of failure, unregister from previous MDS,
-* except if it because of inactive target. */
+* except if it because of inactive target.
+*/
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
err = obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp,
   len, lk, uarg);
@@ -841,8 +844,8 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, 
unsigned int cmd, int len,
return rc;
}
/* else: transient error.
-* kuc will register to the missing MDT
-* when it is back */
+* kuc will register to the missing MDT when it is back
+*/
} else {
any_set = true;
}
@@ -1028,7 +1031,8 @@ static int lmv_iocontrol(unsigned int cmd, struct 
obd_export *exp,
 
/* if the request is about a single fid
 * or if there is a single MDS, no need to split
-* the request. */
+* the request.
+*/
if (reqcount == 1 || count == 1)

[PATCH 51/56] staging/lustre/mgc: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 71 -
 1 file changed, 46 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 9764e57..6fc8225 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -90,7 +90,8 @@ static int mgc_name2resid(char *name, int len, struct 
ldlm_res_id *res_id,
 int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type)
 {
/* fsname is at most 8 chars long, maybe contain "-".
-* e.g. "lustre", "SUN-000" */
+* e.g. "lustre", "SUN-000"
+*/
return mgc_name2resid(fsname, strlen(fsname), res_id, type);
 }
 EXPORT_SYMBOL(mgc_fsname2resid);
@@ -102,7 +103,8 @@ static int mgc_logname2resid(char *logname, struct 
ldlm_res_id *res_id, int type
 
/* logname consists of "fsname-nodetype".
 * e.g. "lustre-MDT0001", "SUN-000-client"
-* there is an exception: llog "params" */
+* there is an exception: llog "params"
+*/
name_end = strrchr(logname, '-');
if (!name_end)
len = strlen(logname);
@@ -125,7 +127,8 @@ static int config_log_get(struct config_llog_data *cld)
 }
 
 /* Drop a reference to a config log.  When no longer referenced,
-   we can free the config log data */
+ * we can free the config log data
+ */
 static void config_log_put(struct config_llog_data *cld)
 {
CDEBUG(D_INFO, "log %s refs %d\n", cld->cld_logname,
@@ -252,7 +255,8 @@ static struct config_llog_data 
*config_recover_log_add(struct obd_device *obd,
char logname[32];
 
/* we have to use different llog for clients and mdts for cmd
-* where only clients are notified if one of cmd server restarts */
+* where only clients are notified if one of cmd server restarts
+*/
LASSERT(strlen(fsname) < sizeof(logname) / 2);
strcpy(logname, fsname);
LASSERT(lcfg.cfg_instance);
@@ -483,8 +487,9 @@ static void do_requeue(struct config_llog_data *cld)
LASSERT(atomic_read(&cld->cld_refcount) > 0);
 
/* Do not run mgc_process_log on a disconnected export or an
-  export which is being disconnected. Take the client
-  semaphore to make the check non-racy. */
+* export which is being disconnected. Take the client
+* semaphore to make the check non-racy.
+*/
down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname);
@@ -529,8 +534,9 @@ static int mgc_requeue_thread(void *data)
}
 
/* Always wait a few seconds to allow the server who
-  caused the lock revocation to finish its setup, plus some
-  random so everyone doesn't try to reconnect at once. */
+* caused the lock revocation to finish its setup, plus some
+* random so everyone doesn't try to reconnect at once.
+*/
to = MGC_TIMEOUT_MIN_SECONDS * HZ;
to += rand * HZ / 100; /* rand is centi-seconds */
lwi = LWI_TIMEOUT(to, NULL, NULL);
@@ -559,7 +565,8 @@ static int mgc_requeue_thread(void *data)
LASSERT(atomic_read(&cld->cld_refcount) > 0);
 
/* Whether we enqueued again or not in mgc_process_log,
-* we're done with the ref from the old enqueue */
+* we're done with the ref from the old enqueue
+*/
if (cld_prev)
config_log_put(cld_prev);
cld_prev = cld;
@@ -575,7 +582,8 @@ static int mgc_requeue_thread(void *data)
config_log_put(cld_prev);
 
/* break after scanning the list so that we can drop
-* refcount to losing lock clds */
+* refcount to losing lock clds
+*/
if (unlikely(stopped)) {
spin_lock(&config_list_lock);
break;
@@ -598,7 +606,8 @@ static int mgc_requeue_thread(void *data)
 }
 
 /* Add a cld to the list to requeue.  Start the requeue thread if needed.
-   We are responsible for dropping the config log reference from here on out. 
*/
+ * We are responsible for dropping the config log reference from here on out.
+ */
 static void mgc_requeue_add(struct config_llog_data *cld)
 {
CDEBUG(D_INFO, "log %s: requeue (r=%d sp=%d st=%x)\n",
@@ -635,7 +644,8 @@ static int mgc_llog_init(const struct lu_env *env, struct 
obd_device *obd)
int  

[PATCH 45/56] staging/lustre/lclient: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/lclient/glimpse.c|  3 ++-
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 24 ++
 .../staging/lustre/lustre/lclient/lcommon_misc.c   |  6 --
 3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/glimpse.c 
b/drivers/staging/lustre/lustre/lclient/glimpse.c
index 8533a1e..c4e8a08 100644
--- a/drivers/staging/lustre/lustre/lclient/glimpse.c
+++ b/drivers/staging/lustre/lustre/lclient/glimpse.c
@@ -109,7 +109,8 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io 
*io,
 *   if there were no conflicting locks. If there
 *   were conflicting locks, enqueuing or waiting
 *   fails with -ENAVAIL, but valid inode
-*   attributes are returned anyway. */
+*   attributes are returned anyway.
+*/
*descr = whole_file;
descr->cld_obj   = clob;
descr->cld_mode  = CLM_PHANTOM;
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index efa6e2e..30651f2 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -613,7 +613,8 @@ void ccc_lock_state(const struct lu_env *env,
 * stale i_size when doing appending writes and effectively
 * cancel the result of the truncate.  Getting the
 * ll_inode_size_lock() after the enqueue maintains the DLM
-* -> ll_inode_size_lock() acquiring order. */
+* -> ll_inode_size_lock() acquiring order.
+*/
if (lock->cll_descr.cld_start == 0 &&
lock->cll_descr.cld_end == CL_PAGE_EOF)
cl_merge_lvb(env, inode);
@@ -754,7 +755,8 @@ int ccc_prep_size(const struct lu_env *env, struct 
cl_object *obj,
 * page index, return directly. Do not expect
 * kernel will check such case correctly.
 * linux-2.6.18-128.1.1 miss to do that.
-* --bug 17336 */
+* --bug 17336
+*/
loff_t size = cl_isize_read(inode);
loff_t cur_index = start >> PAGE_CACHE_SHIFT;
loff_t size_index = (size - 1) >>
@@ -884,7 +886,8 @@ again:
 
if (attr->ia_valid & ATTR_FILE)
/* populate the file descriptor for ftruncate to honor
-* group lock - see LU-787 */
+* group lock - see LU-787
+*/
cio->cui_fd = cl_iattr2fd(inode, attr);
 
result = cl_io_loop(env, io);
@@ -896,7 +899,8 @@ again:
goto again;
/* HSM import case: file is released, cannot be restored
 * no need to fail except if restore registration failed
-* with -ENODATA */
+* with -ENODATA
+*/
if (result == -ENODATA && io->ci_restore_needed &&
io->ci_result != -ENODATA)
result = 0;
@@ -1026,7 +1030,8 @@ int cl_file_inode_init(struct inode *inode, struct 
lustre_md *md)
/* clob is slave of inode, empty lli_clob means for new inode,
 * there is no clob in cache with the given fid, so it is
 * unnecessary to perform lookup-alloc-lookup-insert, just
-* alloc and insert directly. */
+* alloc and insert directly.
+*/
LASSERT(inode->i_state & I_NEW);
conf.coc_lu.loc_flags = LOC_F_NEW;
clob = cl_object_find(env, lu2cl_dev(site->ls_top_dev),
@@ -1151,7 +1156,8 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent)
 }
 
 /**
- * build inode number from passed @fid */
+ * build inode number from passed @fid
+ */
 __u64 cl_fid_build_ino(const struct lu_fid *fid, int api32)
 {
if (BITS_PER_LONG == 32 || api32)
@@ -1162,7 +1168,8 @@ __u64 cl_fid_build_ino(const struct lu_fid *fid, int 
api32)
 
 /**
  * build inode generation from passed @fid.  If our FID overflows the 32-bit
- * inode number then return a non-zero generation to distinguish them. */
+ * inode number then return a non-zero generation to distinguish them.
+ */
 __u32 cl_fid_build_gen(const struct lu_fid *fid)
 {
__u32 gen;
@@ -1183,7 +1190,8 @@ __u32 cl_fid_build_gen(const struct lu_fid *fid)
  * have to wait for the refcount to become zero to destroy the older layout.
  *
  * Not

[PATCH 44/56] staging/lustre/fid: Adjust comments to better conform to coding style

2016-02-22 Thread green
From: Oleg Drokin 

This patch fixes "Block comments use a trailing */ on a separate line"
warnings from checkpatch.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fid/fid_request.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index 7ca65df..70400aa 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -95,7 +95,8 @@ static int seq_client_rpc(struct lu_client_seq *seq,
 * precreating objects on this OST), and it will send the
 * request to MDT0 here, so we can not keep resending the
 * request here, otherwise if MDT0 is failed(umounted),
-* it can not release the export of MDT0 */
+* it can not release the export of MDT0
+*/
if (seq->lcs_type == LUSTRE_SEQ_DATA)
req->rq_no_delay = req->rq_no_resend = 1;
debug_mask = D_CONSOLE;
@@ -152,7 +153,8 @@ static int seq_client_alloc_meta(const struct lu_env *env,
/* If meta server return -EINPROGRESS or EAGAIN,
 * it means meta server might not be ready to
 * allocate super sequence from sequence controller
-* (MDT0)yet */
+* (MDT0)yet
+*/
rc = seq_client_rpc(seq, &seq->lcs_space,
SEQ_ALLOC_META, "meta");
} while (rc == -EINPROGRESS || rc == -EAGAIN);
-- 
2.1.0



[PATCH 41/56] staging/lustre: Reformat comments and structures in lustre_idl.h

2016-02-22 Thread green
From: Oleg Drokin 

This file mostly contains various on the wire data and got
significantly mangled in transition.
This patch rectifies the situation somewhat. Also fixes the
comment style for block comments.

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/lustre/lustre_idl.h  | 286 -
 1 file changed, 165 insertions(+), 121 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index c272c18..e32163b 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -146,7 +146,9 @@
 #define SEQ_CONTROLLER_PORTAL32
 #define MGS_BULK_PORTAL33
 
-/* Portal 63 is reserved for the Cray Inc DVS - n...@cray.com, r...@cray.com, 
n8...@cray.com */
+/* Portal 63 is reserved for the Cray Inc DVS - n...@cray.com, r...@cray.com,
+ * n8...@cray.com
+ */
 
 /* packet types */
 #define PTL_RPC_MSG_REQUEST 4711
@@ -295,7 +297,8 @@ static inline int range_compare_loc(const struct 
lu_seq_range *r1,
fld_range_is_mdt(range) ? "mdt" : "ost"
 
 /** \defgroup lu_fid lu_fid
- * @{ */
+ * @{
+ */
 
 /**
  * Flags for lustre_mdt_attrs::lma_compat and lustre_mdt_attrs::lma_incompat.
@@ -307,7 +310,8 @@ enum lma_compat {
LMAC_SOM= 0x0002,
LMAC_NOT_IN_OI  = 0x0004, /* the object does NOT need OI mapping */
LMAC_FID_ON_OST = 0x0008, /* For OST-object, its OI mapping is
-  * under /O//d. */
+  * under /O//d.
+  */
 };
 
 /**
@@ -319,7 +323,8 @@ enum lma_incompat {
LMAI_RELEASED   = 0x0001, /* file is released */
LMAI_AGENT  = 0x0002, /* agent inode */
LMAI_REMOTE_PARENT  = 0x0004, /* the parent of the object
-is on the remote MDT */
+  * is on the remote MDT
+  */
 };
 
 #define LMA_INCOMPAT_SUPP  (LMAI_AGENT | LMAI_REMOTE_PARENT)
@@ -395,12 +400,14 @@ enum fid_seq {
FID_SEQ_LOCAL_FILE  = 0x20001ULL,
FID_SEQ_DOT_LUSTRE  = 0x20002ULL,
/* sequence is used for local named objects FIDs generated
-* by local_object_storage library */
+* by local_object_storage library
+*/
FID_SEQ_LOCAL_NAME  = 0x20003ULL,
/* Because current FLD will only cache the fid sequence, instead
 * of oid on the client side, if the FID needs to be exposed to
 * clients sides, it needs to make sure all of fids under one
-* sequence will be located in one MDT. */
+* sequence will be located in one MDT.
+*/
FID_SEQ_SPECIAL = 0x20004ULL,
FID_SEQ_QUOTA   = 0x20005ULL,
FID_SEQ_QUOTA_GLB   = 0x20006ULL,
@@ -601,7 +608,8 @@ static inline void ostid_set_seq(struct ost_id *oi, __u64 
seq)
oi->oi_fid.f_seq = seq;
/* Note: if f_oid + f_ver is zero, we need init it
 * to be 1, otherwise, ostid_seq will treat this
-* as old ostid (oi_seq == 0) */
+* as old ostid (oi_seq == 0)
+*/
if (oi->oi_fid.f_oid == 0 && oi->oi_fid.f_ver == 0)
oi->oi_fid.f_oid = LUSTRE_FID_INIT_OID;
}
@@ -689,7 +697,8 @@ static inline int ostid_to_fid(struct lu_fid *fid, struct 
ost_id *ostid,
 * that we map into the IDIF namespace.  It allows up to 2^48
 * objects per OST, as this is the object namespace that has
 * been in production for years.  This can handle create rates
-* of 1M objects/s/OST for 9 years, or combinations thereof. */
+* of 1M objects/s/OST for 9 years, or combinations thereof.
+*/
if (ostid_id(ostid) >= IDIF_MAX_OID) {
 CERROR("bad MDT0 id, "DOSTID" ost_idx:%u\n",
POSTID(ostid), ost_idx);
@@ -704,7 +713,8 @@ static inline int ostid_to_fid(struct lu_fid *fid, struct 
ost_id *ostid,
   /* This is either an IDIF object, which identifies objects across
* all OSTs, or a regular FID.  The IDIF namespace maps legacy
* OST objects into the FID namespace.  In both cases, we just
-   * pass the FID through, no conversion needed. */
+   * pass the FID through, no conversion needed.
+   */
if (ostid->oi_fid.f_ver != 0) {
CERROR("bad MDT0 id, "DOSTID" ost_idx:%u\n",
POSTID(ostid), ost_idx);
@@ -868,7 +878,8 @@ static inline void ostid_le_to_cpu(const stru

  1   2   3   4   5   6   7   8   9   10   >