[PATCH] Staging: wlan-ng: improved code in p80211req.c file

2016-08-20 Thread Claudiu Beznea
This patch improves code from p80211req.c file by removing
duplicate code, by keeping count of returning code of
the called functions and also aesthetically.

Signed-off-by: Claudiu Beznea 
---
 drivers/staging/wlan-ng/p80211req.c | 163 +++-
 1 file changed, 84 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211req.c 
b/drivers/staging/wlan-ng/p80211req.c
index 4b84b56..900635e 100644
--- a/drivers/staging/wlan-ng/p80211req.c
+++ b/drivers/staging/wlan-ng/p80211req.c
@@ -72,10 +72,12 @@
 #include "p80211metastruct.h"
 #include "p80211req.h"
 
-static void p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg);
-static void p80211req_mibset_mibget(wlandevice_t *wlandev,
+static int p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg);
+static int p80211req_mibset_mibget(wlandevice_t *wlandev,
   struct p80211msg_dot11req_mibget *mib_msg,
   int isget);
+static void p80211req_handle_action(struct wlandevice *wlandev, u32 *data,
+   int isget, u32 flag);
 
 /*
 * p80211req_dorequest
@@ -96,6 +98,7 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
 int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
 {
struct p80211msg *msg = (struct p80211msg *) msgbuf;
+   int rc = 0;
 
/* Check to make sure the MSD is running */
if (!((wlandev->msdstate == WLAN_MSD_HWPRESENT &&
@@ -107,7 +110,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
 
/* Check Permissions */
if (!capable(CAP_NET_ADMIN) &&
-   (msg->msgcode != DIDmsg_dot11req_mibget)) {
+   (msg->msgcode != DIDmsg_dot11req_mibget)) {
netdev_err(wlandev->netdev,
   "%s: only dot11req_mibget allowed for non-root.\n",
   wlandev->name);
@@ -115,20 +118,23 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
}
 
/* Check for busy status */
-   if (test_and_set_bit(1, &(wlandev->request_pending)))
+   if (test_and_set_bit(1, &wlandev->request_pending))
return -EBUSY;
 
/* Allow p80211 to look at msg and handle if desired. */
/* So far, all p80211 msgs are immediate, no waitq/timer necessary */
/* This may change. */
-   p80211req_handlemsg(wlandev, msg);
+   rc = p80211req_handlemsg(wlandev, msg);
+   if (rc != 0)
+   goto exit;
 
/* Pass it down to wlandev via wlandev->mlmerequest */
if (wlandev->mlmerequest != NULL)
-   wlandev->mlmerequest(wlandev, msg);
+   rc = wlandev->mlmerequest(wlandev, msg);
 
-   clear_bit(1, &(wlandev->request_pending));
-   return 0;   /* if result==0, msg->status still may contain an err */
+exit:
+   clear_bit(1, &wlandev->request_pending);
+   return rc;  /* if result==0, msg->status still may contain an err */
 }
 
 /*
@@ -149,64 +155,63 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
 * Call context:
 *  Process thread
 */
-static void p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg)
+static int p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg)
 {
-   switch (msg->msgcode) {
+   struct p80211msg_lnxreq_hostwep *req;
+   struct p80211msg_dot11req_mibget *mib_msg;
+   int isget;
+   int rc = 0;
 
-   case DIDmsg_lnxreq_hostwep:{
-   struct p80211msg_lnxreq_hostwep *req =
-   (struct p80211msg_lnxreq_hostwep *) msg;
-   wlandev->hostwep &=
-   ~(HOSTWEP_DECRYPT | HOSTWEP_ENCRYPT);
+   switch (msg->msgcode) {
+   case DIDmsg_lnxreq_hostwep:
+   req = (struct p80211msg_lnxreq_hostwep *)msg;
+   wlandev->hostwep &= ~(HOSTWEP_DECRYPT | HOSTWEP_ENCRYPT);
if (req->decrypt.data == P80211ENUM_truth_true)
wlandev->hostwep |= HOSTWEP_DECRYPT;
if (req->encrypt.data == P80211ENUM_truth_true)
wlandev->hostwep |= HOSTWEP_ENCRYPT;
 
-   break;
-   }
+   break;
+
case DIDmsg_dot11req_mibget:
-   case DIDmsg_dot11req_mibset:{
-   int isget = (msg->msgcode == DIDmsg_dot11req_mibget);
-   struct p80211msg_dot11req_mibget *mib_msg =
-   (struct p80211msg_dot11req_mibget *) msg;
-   p80211req_mibset_mibget(wlandev, mib_msg, isget);
-   break;
+   case DIDmsg_dot11req_mibset:
+   isget = (msg->msgcode == DIDmsg_dot11req_mibget);
+   mib_msg = (struct p80211msg_dot11req_mibget *)msg;
+   rc = p80211req_mibset_

[PATCH 00/13] Lustre patches

2016-08-20 Thread Oleg Drokin
This is rebase of the previous set that got merged only half-way with
added signed-offs as requested.

I also added a patch to include James Simmons as a Lustre maintainer too
since he is performing a lot of work in the area.

Al Viro (7):
  ksocknal_lib_recv_iov(): recvmsg doesn't bugger iovec anymore...
  ksocknal_lib_send_iov(): sendmsg doesn't bugger iovec...
  ksocknal_lib_send_kiov(): sendmsg doesn't bugger iovec...
  lustre: ->kss_scratch... are unused now
  lustre: constify lib-move.c stuff
  lustre: pass iov_iter to ->lnd_recv()
  lustre: introduce lnet_copy_{k,}iov2iter(), kill
lnet_copy_{k,}iov2{k,}iov()

Emoly Liu (3):
  staging/lustre: Add spaces preferred around that '{+,-,*,/,|,<<,>>,&}'
  staging/lustre: Fix unnecessary parentheses around variables
  staging/lustre: Make alignment match open parenthesis

Oleg Drokin (3):
  staging/lustre: Always return EEXIST on mkdir for existing names
  staging/lustre: Remove unused cp_error from struct cl_page
  Add James Simmons as another Lustre maintainer

 MAINTAINERS|   1 +
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   6 +-
 .../lustre/include/linux/libcfs/libcfs_debug.h |  10 +-
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |  65 +---
 .../staging/lustre/include/linux/lnet/lib-types.h  |   5 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|   2 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h|   3 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |  64 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h|  10 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |  21 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib.c|  89 ++
 .../lustre/lnet/libcfs/linux/linux-crypto.c|   4 +-
 drivers/staging/lustre/lnet/lnet/lib-move.c| 329 +
 drivers/staging/lustre/lnet/lnet/lo.c  |  39 +--
 drivers/staging/lustre/lustre/include/cl_object.h  |   4 +-
 drivers/staging/lustre/lustre/include/lu_object.h  |   3 +-
 .../lustre/lustre/include/lustre/lustre_idl.h  |  42 +--
 .../lustre/lustre/include/lustre/lustre_user.h |   4 +-
 drivers/staging/lustre/lustre/include/lustre_fid.h |   2 +-
 .../staging/lustre/lustre/include/lustre_lite.h|   2 +-
 .../staging/lustre/lustre/include/obd_support.h|  13 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |   4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c|   8 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  17 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |   8 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  26 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|  21 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c |   4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |  14 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   5 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   5 +-
 drivers/staging/lustre/lustre/llite/file.c |   4 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  25 +-
 drivers/staging/lustre/lustre/llite/llite_mmap.c   |   4 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |  14 +-
 drivers/staging/lustre/lustre/llite/namei.c|  12 +-
 drivers/staging/lustre/lustre/llite/rw.c   |   9 +-
 drivers/staging/lustre/lustre/llite/rw26.c |   2 +-
 drivers/staging/lustre/lustre/llite/statahead.c|   3 +-
 drivers/staging/lustre/lustre/llite/super25.c  |   4 +-
 drivers/staging/lustre/lustre/llite/vvp_object.c   |   2 +-
 drivers/staging/lustre/lustre/llite/vvp_page.c |   4 +-
 drivers/staging/lustre/lustre/lov/lov_ea.c |   3 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|  22 +-
 drivers/staging/lustre/lustre/lov/lov_pool.c   |  18 +-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |   5 +-
 drivers/staging/lustre/lustre/mdc/mdc_reint.c  |   5 +-
 drivers/staging/lustre/lustre/obdclass/cl_page.c   |   4 +-
 drivers/staging/lustre/lustre/obdclass/debug.c |   4 +-
 drivers/staging/lustre/lustre/obdclass/genops.c|   6 +-
 drivers/staging/lustre/lustre/obdclass/llog.c  |   2 +-
 .../lustre/lustre/obdclass/lustre_handles.c|   2 +-
 .../staging/lustre/lustre/obdclass/obd_config.c|  14 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  10 +-
 drivers/staging/lustre/lustre/obdclass/obdo.c  |   6 +-
 .../staging/lustre/lustre/obdecho/echo_internal.h  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c  |   6 +-
 .../staging/lustre/lustre/osc/osc_cl_internal.h|   2 +-
 drivers/staging/lustre/lustre/osc/osc_io.c |   2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|  14 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c  |   6 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|   2 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |   3 +-
 .../staging/lustre/lustre/ptlrpc/pack_generic.c|  11 +-
 drivers/staging/lustre/lustre/ptlrp

[PATCH 02/13] ksocknal_lib_send_iov(): sendmsg doesn't bugger iovec...

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lnet/klnds/socklnd/socklnd_lib.c| 38 ++
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 77bb29ff..8eb4a68 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -73,9 +73,9 @@ ksocknal_lib_zc_capable(struct ksock_conn *conn)
 int
 ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx)
 {
+   struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
struct socket *sock = conn->ksnc_sock;
-   int nob;
-   int rc;
+   int nob, i;
 
if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */
conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection  */
@@ -83,34 +83,16 @@ ksocknal_lib_send_iov(struct ksock_conn *conn, struct 
ksock_tx *tx)
!tx->tx_msg.ksm_csum)/* not checksummed  */
ksocknal_lib_csum_tx(tx);
 
-   /*
-* NB we can't trust socket ops to either consume our iovs
-* or leave them alone.
-*/
-   {
-#if SOCKNAL_SINGLE_FRAG_TX
-   struct kvec scratch;
-   struct kvec *scratchiov = &scratch;
-   unsigned int niov = 1;
-#else
-   struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
-   unsigned int niov = tx->tx_niov;
-#endif
-   struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
-   int i;
-
-   for (nob = i = 0; i < niov; i++) {
-   scratchiov[i] = tx->tx_iov[i];
-   nob += scratchiov[i].iov_len;
-   }
+   for (nob = i = 0; i < tx->tx_niov; i++)
+   nob += tx->tx_iov[i].iov_len;
 
-   if (!list_empty(&conn->ksnc_tx_queue) ||
-   nob < tx->tx_resid)
-   msg.msg_flags |= MSG_MORE;
+   if (!list_empty(&conn->ksnc_tx_queue) ||
+   nob < tx->tx_resid)
+   msg.msg_flags |= MSG_MORE;
 
-   rc = kernel_sendmsg(sock, &msg, scratchiov, niov, nob);
-   }
-   return rc;
+   iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC,
+ tx->tx_iov, tx->tx_niov, nob);
+   return sock_sendmsg(sock, &msg);
 }
 
 int
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/13] staging/lustre: Always return EEXIST on mkdir for existing names

2016-08-20 Thread Oleg Drokin
if the name already exists, but we don't have write permissions
in the parent, force talking to the MDS to determine what
more sensical error code to return.
This also happens to fix matlab and other such programs that
assume that EEXIST is the only valid error code for mkdir of
an existing directory.

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

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 09e1801..8350943 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -541,8 +541,12 @@ static struct dentry *ll_lookup_nd(struct inode *parent, 
struct dentry *dentry,
CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),flags=%u\n",
   dentry, PFID(ll_inode2fid(parent)), parent, flags);
 
-   /* Optimize away (CREATE && !OPEN). Let .create handle the race. */
-   if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN))
+   /* Optimize away (CREATE && !OPEN). Let .create handle the race.
+* but only if we have write permissions there, otherwise we need
+* to proceed with lookup. LU-4185
+*/
+   if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN) &&
+   (inode_permission(parent, MAY_WRITE | MAY_EXEC) == 0))
return NULL;
 
if (flags & (LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE))
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/13] lustre: constify lib-move.c stuff

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/include/linux/lnet/lib-lnet.h   | 28 +++---
 drivers/staging/lustre/lnet/lnet/lib-move.c| 20 
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h 
b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 513a822..1c5418e 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -605,34 +605,34 @@ void lnet_counters_reset(void);
 
 unsigned int lnet_iov_nob(unsigned int niov, struct kvec *iov);
 int lnet_extract_iov(int dst_niov, struct kvec *dst,
-int src_niov, struct kvec *src,
+int src_niov, const struct kvec *src,
  unsigned int offset, unsigned int len);
 
 unsigned int lnet_kiov_nob(unsigned int niov, lnet_kiov_t *iov);
 int lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
- int src_niov, lnet_kiov_t *src,
+ int src_niov, const lnet_kiov_t *src,
  unsigned int offset, unsigned int len);
 
-void lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov,
+void lnet_copy_iov2iov(unsigned int ndiov, const struct kvec *diov,
   unsigned int doffset,
-   unsigned int nsiov, struct kvec *siov,
+   unsigned int nsiov, const struct kvec *siov,
unsigned int soffset, unsigned int nob);
-void lnet_copy_kiov2iov(unsigned int niov, struct kvec *iov,
+void lnet_copy_kiov2iov(unsigned int niov, const struct kvec *iov,
unsigned int iovoffset,
-unsigned int nkiov, lnet_kiov_t *kiov,
+unsigned int nkiov, const lnet_kiov_t *kiov,
 unsigned int kiovoffset, unsigned int nob);
-void lnet_copy_iov2kiov(unsigned int nkiov, lnet_kiov_t *kiov,
+void lnet_copy_iov2kiov(unsigned int nkiov, const lnet_kiov_t *kiov,
unsigned int kiovoffset,
-unsigned int niov, struct kvec *iov,
+unsigned int niov, const struct kvec *iov,
 unsigned int iovoffset, unsigned int nob);
-void lnet_copy_kiov2kiov(unsigned int ndkiov, lnet_kiov_t *dkiov,
+void lnet_copy_kiov2kiov(unsigned int ndkiov, const lnet_kiov_t *dkiov,
 unsigned int doffset,
- unsigned int nskiov, lnet_kiov_t *skiov,
+ unsigned int nskiov, const lnet_kiov_t *skiov,
  unsigned int soffset, unsigned int nob);
 
 static inline void
 lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
-  unsigned int nsiov, struct kvec *siov, unsigned int soffset,
+  unsigned int nsiov, const struct kvec *siov, unsigned int 
soffset,
   unsigned int nob)
 {
struct kvec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
@@ -643,7 +643,7 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int 
doffset,
 
 static inline void
 lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset,
-   unsigned int nsiov, lnet_kiov_t *skiov,
+   unsigned int nsiov, const lnet_kiov_t *skiov,
unsigned int soffset, unsigned int nob)
 {
struct kvec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen};
@@ -653,7 +653,7 @@ lnet_copy_kiov2flat(int dlen, void *dest, unsigned int 
doffset,
 }
 
 static inline void
-lnet_copy_flat2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
+lnet_copy_flat2iov(unsigned int ndiov, const struct kvec *diov, unsigned int 
doffset,
   int slen, void *src, unsigned int soffset, unsigned int nob)
 {
struct kvec siov = {/*.iov_base = */ src, /*.iov_len = */slen};
@@ -663,7 +663,7 @@ lnet_copy_flat2iov(unsigned int ndiov, struct kvec *diov, 
unsigned int doffset,
 }
 
 static inline void
-lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov,
+lnet_copy_flat2kiov(unsigned int ndiov, const lnet_kiov_t *dkiov,
unsigned int doffset, int slen, void *src,
unsigned int soffset, unsigned int nob)
 {
diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c 
b/drivers/staging/lustre/lnet/lnet/lib-move.c
index 6a3f2e1..7d8d2d6 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-move.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-move.c
@@ -166,8 +166,8 @@ lnet_iov_nob(unsigned int niov, struct kvec *iov)
 EXPORT_SYMBOL(lnet_iov_nob);
 
 void
-lnet_copy_iov2iov(unsigned int ndiov, struct kvec *diov, unsigned int doffset,
- unsigned int nsiov, struct kvec *siov, unsigned int soffset,
+lnet_copy_iov2iov(unsigned int ndiov, const struct kvec *diov, unsigned int 
doffset,
+ unsigned int nsiov, const struct kvec *siov, un

[PATCH 07/13] lustre: introduce lnet_copy_{k, }iov2iter(), kill lnet_copy_{k, }iov2{k, }iov()

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: James Simmons 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |  57 +---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |  37 ++-
 drivers/staging/lustre/lnet/lnet/lib-move.c| 314 -
 drivers/staging/lustre/lnet/lnet/lo.c  |  35 +--
 4 files changed, 86 insertions(+), 357 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h 
b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 1c5418e..a59c5e99c 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -613,65 +613,12 @@ int lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst,
  int src_niov, const lnet_kiov_t *src,
  unsigned int offset, unsigned int len);
 
-void lnet_copy_iov2iov(unsigned int ndiov, const struct kvec *diov,
-  unsigned int doffset,
+void lnet_copy_iov2iter(struct iov_iter *to,
unsigned int nsiov, const struct kvec *siov,
unsigned int soffset, unsigned int nob);
-void lnet_copy_kiov2iov(unsigned int niov, const struct kvec *iov,
-   unsigned int iovoffset,
+void lnet_copy_kiov2iter(struct iov_iter *to,
 unsigned int nkiov, const lnet_kiov_t *kiov,
 unsigned int kiovoffset, unsigned int nob);
-void lnet_copy_iov2kiov(unsigned int nkiov, const lnet_kiov_t *kiov,
-   unsigned int kiovoffset,
-unsigned int niov, const struct kvec *iov,
-unsigned int iovoffset, unsigned int nob);
-void lnet_copy_kiov2kiov(unsigned int ndkiov, const lnet_kiov_t *dkiov,
-unsigned int doffset,
- unsigned int nskiov, const lnet_kiov_t *skiov,
- unsigned int soffset, unsigned int nob);
-
-static inline void
-lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
-  unsigned int nsiov, const struct kvec *siov, unsigned int 
soffset,
-  unsigned int nob)
-{
-   struct kvec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
-
-   lnet_copy_iov2iov(1, &diov, doffset,
- nsiov, siov, soffset, nob);
-}
-
-static inline void
-lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset,
-   unsigned int nsiov, const lnet_kiov_t *skiov,
-   unsigned int soffset, unsigned int nob)
-{
-   struct kvec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen};
-
-   lnet_copy_kiov2iov(1, &diov, doffset,
-  nsiov, skiov, soffset, nob);
-}
-
-static inline void
-lnet_copy_flat2iov(unsigned int ndiov, const struct kvec *diov, unsigned int 
doffset,
-  int slen, void *src, unsigned int soffset, unsigned int nob)
-{
-   struct kvec siov = {/*.iov_base = */ src, /*.iov_len = */slen};
-
-   lnet_copy_iov2iov(ndiov, diov, doffset,
- 1, &siov, soffset, nob);
-}
-
-static inline void
-lnet_copy_flat2kiov(unsigned int ndiov, const lnet_kiov_t *dkiov,
-   unsigned int doffset, int slen, void *src,
-   unsigned int soffset, unsigned int nob)
-{
-   struct kvec siov = {/* .iov_base = */ src, /* .iov_len = */ slen};
-
-   lnet_copy_iov2kiov(ndiov, dkiov, doffset,
-  1, &siov, soffset, nob);
-}
 
 void lnet_me_unlink(lnet_me_t *me);
 
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 1b20ae8..2581744 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1499,6 +1499,7 @@ kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t 
*lntmsg)
lnet_kiov_t *payload_kiov = lntmsg->msg_kiov;
unsigned int payload_offset = lntmsg->msg_offset;
unsigned int payload_nob = lntmsg->msg_len;
+   struct iov_iter from;
struct kib_msg *ibmsg;
struct kib_rdma_desc  *rd;
struct kib_tx *tx;
@@ -1518,6 +1519,17 @@ kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t 
*lntmsg)
/* payload is either all vaddrs or all pages */
LASSERT(!(payload_kiov && payload_iov));
 
+   if (payload_kiov)
+   iov_iter_bvec(&from, ITER_BVEC | WRITE,
+ payload_kiov, payload_niov,
+ payload_nob + payload_offset);
+   else
+   iov_iter_kvec(&from, ITER_KVEC | WRITE,
+ payload_iov, payload_niov,
+ payload_nob + payload_offset);
+
+   iov_iter_advance(&from, payload_offset);
+
switch (type) {
default:
LBUG();
@@ -1637,17 +1649,8 @@ kiblnd_send(lnet_ni_t *n

[PATCH 01/13] ksocknal_lib_recv_iov(): recvmsg doesn't bugger iovec anymore...

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lnet/klnds/socklnd/socklnd_lib.c| 22 +-
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index fe7b9f9..77bb29ff 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -201,14 +201,7 @@ ksocknal_lib_eager_ack(struct ksock_conn *conn)
 int
 ksocknal_lib_recv_iov(struct ksock_conn *conn)
 {
-#if SOCKNAL_SINGLE_FRAG_RX
-   struct kvec scratch;
-   struct kvec *scratchiov = &scratch;
-   unsigned int niov = 1;
-#else
-   struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = conn->ksnc_rx_niov;
-#endif
struct kvec *iov = conn->ksnc_rx_iov;
struct msghdr msg = {
.msg_flags = 0
@@ -220,20 +213,15 @@ ksocknal_lib_recv_iov(struct ksock_conn *conn)
int sum;
__u32 saved_csum;
 
-   /*
-* NB we can't trust socket ops to either consume our iovs
-* or leave them alone.
-*/
LASSERT(niov > 0);
 
-   for (nob = i = 0; i < niov; i++) {
-   scratchiov[i] = iov[i];
-   nob += scratchiov[i].iov_len;
-   }
+   for (nob = i = 0; i < niov; i++)
+   nob += iov[i].iov_len;
+
LASSERT(nob <= conn->ksnc_rx_nob_wanted);
 
-   rc = kernel_recvmsg(conn->ksnc_sock, &msg, scratchiov, niov, nob,
-   MSG_DONTWAIT);
+   iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, iov, niov, nob);
+   rc = sock_recvmsg(conn->ksnc_sock, &msg, MSG_DONTWAIT);
 
saved_csum = 0;
if (conn->ksnc_proto == &ksocknal_protocol_v2x) {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/13] ksocknal_lib_send_kiov(): sendmsg doesn't bugger iovec...

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 .../lustre/lnet/klnds/socklnd/socklnd_lib.c| 29 --
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8eb4a68..6c95e98 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -106,10 +106,6 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct 
ksock_tx *tx)
/* Not NOOP message */
LASSERT(tx->tx_lnetmsg);
 
-   /*
-* NB we can't trust socket ops to either consume our iovs
-* or leave them alone.
-*/
if (tx->tx_msg.ksm_zc_cookies[0]) {
/* Zero copy is enabled */
struct sock *sk = sock->sk;
@@ -132,34 +128,19 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct 
ksock_tx *tx)
rc = tcp_sendpage(sk, page, offset, fragsize, msgflg);
}
} else {
-#if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK
-   struct kvec scratch;
-   struct kvec *scratchiov = &scratch;
-   unsigned int niov = 1;
-#else
-#ifdef CONFIG_HIGHMEM
-#warning "XXX risk of kmap deadlock on multiple frags..."
-#endif
-   struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
-   unsigned int niov = tx->tx_nkiov;
-#endif
struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i;
 
-   for (nob = i = 0; i < niov; i++) {
-   scratchiov[i].iov_base = kmap(kiov[i].bv_page) +
-kiov[i].bv_offset;
-   nob += scratchiov[i].iov_len = kiov[i].bv_len;
-   }
+   for (nob = i = 0; i < tx->tx_nkiov; i++)
+   nob += kiov[i].bv_len;
 
if (!list_empty(&conn->ksnc_tx_queue) ||
nob < tx->tx_resid)
msg.msg_flags |= MSG_MORE;
 
-   rc = kernel_sendmsg(sock, &msg, (struct kvec *)scratchiov, 
niov, nob);
-
-   for (i = 0; i < niov; i++)
-   kunmap(kiov[i].bv_page);
+   iov_iter_bvec(&msg.msg_iter, WRITE | ITER_BVEC,
+ kiov, tx->tx_nkiov, nob);
+   rc = sock_sendmsg(sock, &msg);
}
return rc;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/13] lustre: ->kss_scratch... are unused now

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index d5efb42..84a915c 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -86,10 +86,6 @@ struct ksock_sched { /* per 
scheduler state */
int kss_nconns; /* # connections assigned to
 * this scheduler */
struct ksock_sched_info *kss_info;  /* owner of it */
-   union {
-   struct bio_vec  kss_scratch_bvec[LNET_MAX_IOV];
-   struct kvec kss_scratch_iov[LNET_MAX_IOV];
-   };
 };
 
 struct ksock_sched_info {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/13] lustre: pass iov_iter to ->lnd_recv()

2016-08-20 Thread Oleg Drokin
From: Al Viro 

Signed-off-by: Al Viro 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/include/linux/lnet/lib-types.h  |  5 +---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h|  3 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 32 --
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h|  4 +--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 21 ++
 drivers/staging/lustre/lnet/lnet/lib-move.c| 11 ++--
 drivers/staging/lustre/lnet/lnet/lo.c  | 24 
 7 files changed, 49 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h 
b/drivers/staging/lustre/include/linux/lnet/lib-types.h
index 7967b01..640ff72 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-types.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h
@@ -220,10 +220,7 @@ typedef struct lnet_lnd {
 * credit if the LND does flow control.
 */
int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg,
-   int delayed, unsigned int niov,
-   struct kvec *iov, lnet_kiov_t *kiov,
-   unsigned int offset, unsigned int mlen,
-   unsigned int rlen);
+   int delayed, struct iov_iter *to, unsigned int rlen);
 
/*
 * lnet_parse() has had to delay processing of this message
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index 078a0c3..f49483e 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -1034,5 +1034,4 @@ int  kiblnd_post_rx(struct kib_rx *rx, int credit);
 
 int  kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg);
 int  kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
-unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov,
-unsigned int offset, unsigned int mlen, unsigned int rlen);
+struct iov_iter *to, unsigned int rlen);
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 9eb1db6..1b20ae8 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -648,7 +648,7 @@ static int kiblnd_map_tx(lnet_ni_t *ni, struct kib_tx *tx, 
struct kib_rdma_desc
 
 static int
 kiblnd_setup_rd_iov(lnet_ni_t *ni, struct kib_tx *tx, struct kib_rdma_desc *rd,
-   unsigned int niov, struct kvec *iov, int offset, int nob)
+   unsigned int niov, const struct kvec *iov, int offset, int 
nob)
 {
struct kib_net *net = ni->ni_data;
struct page *page;
@@ -705,7 +705,7 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, struct kib_tx *tx, 
struct kib_rdma_desc *rd,
 
 static int
 kiblnd_setup_rd_kiov(lnet_ni_t *ni, struct kib_tx *tx, struct kib_rdma_desc 
*rd,
-int nkiov, lnet_kiov_t *kiov, int offset, int nob)
+int nkiov, const lnet_kiov_t *kiov, int offset, int nob)
 {
struct kib_net *net = ni->ni_data;
struct scatterlist *sg;
@@ -1719,8 +1719,7 @@ kiblnd_reply(lnet_ni_t *ni, struct kib_rx *rx, lnet_msg_t 
*lntmsg)
 
 int
 kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
-   unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov,
-   unsigned int offset, unsigned int mlen, unsigned int rlen)
+   struct iov_iter *to, unsigned int rlen)
 {
struct kib_rx *rx = private;
struct kib_msg *rxmsg = rx->rx_msg;
@@ -1730,10 +1729,9 @@ kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t 
*lntmsg, int delayed,
int post_credit = IBLND_POSTRX_PEER_CREDIT;
int rc = 0;
 
-   LASSERT(mlen <= rlen);
+   LASSERT(iov_iter_count(to) <= rlen);
LASSERT(!in_interrupt());
/* Either all pages or all vaddrs */
-   LASSERT(!(kiov && iov));
 
switch (rxmsg->ibm_type) {
default:
@@ -1749,16 +1747,16 @@ kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t 
*lntmsg, int delayed,
break;
}
 
-   if (kiov)
-   lnet_copy_flat2kiov(niov, kiov, offset,
+   if (to->type & ITER_BVEC)
+   lnet_copy_flat2kiov(to->nr_segs, to->bvec, 
to->iov_offset,
IBLND_MSG_SIZE, rxmsg,
offsetof(struct kib_msg, 
ibm_u.immediate.ibim_payload),
-   mlen);
+   iov_iter_count(to));
else
-   lnet_copy_flat2iov(niov, iov, offset,
+   lnet_copy_flat2iov(to->nr_segs, to->kvec, 
to->iov_offset,
  

[PATCH 10/13] staging/lustre: Fix unnecessary parentheses around variables

2016-08-20 Thread Oleg Drokin
From: Emoly Liu 

This patch fixes all checkpatch occurences of
"CHECK: Unnecessary parentheses around xxx"
in Lustre code.

Signed-off-by: Emoly Liu 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lustre/lustre_user.h   |  2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c  |  4 ++--
 drivers/staging/lustre/lustre/lov/lov_pool.c | 16 
 drivers/staging/lustre/lustre/obdclass/genops.c  |  4 ++--
 drivers/staging/lustre/lustre/obdclass/llog.c|  2 +-
 drivers/staging/lustre/lustre/obdclass/lustre_handles.c  |  2 +-
 drivers/staging/lustre/lustre/obdclass/obd_config.c  |  2 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c   |  2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c  |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c  |  6 +++---
 10 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 5fc0c5c..e077687 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -978,7 +978,7 @@ struct hsm_user_request {
 /** Return pointer to data field in a hsm user request */
 static inline void *hur_data(struct hsm_user_request *hur)
 {
-   return &(hur->hur_user_item[hur->hur_request.hr_itemcount]);
+   return &hur->hur_user_item[hur->hur_request.hr_itemcount];
 }
 
 /**
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index bc71e4f..52651c4 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -940,7 +940,7 @@ int lov_process_config_base(struct obd_device *obd, struct 
lustre_cfg *lcfg,
}
case LCFG_PARAM: {
struct lprocfs_static_vars lvars = { NULL };
-   struct lov_desc *desc = &(obd->u.lov.desc);
+   struct lov_desc *desc = &obd->u.lov.desc;
 
if (!desc) {
rc = -EINVAL;
@@ -1460,7 +1460,7 @@ static int lov_iocontrol(unsigned int cmd, struct 
obd_export *exp, int len,
}
 
desc = (struct lov_desc *)data->ioc_inlbuf1;
-   memcpy(desc, &(lov->desc), sizeof(*desc));
+   memcpy(desc, &lov->desc, sizeof(*desc));
 
uuidp = (struct obd_uuid *)data->ioc_inlbuf2;
genp = (__u32 *)data->ioc_inlbuf3;
diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c 
b/drivers/staging/lustre/lustre/lov/lov_pool.c
index 639e086..f8c8a36 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pool.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pool.c
@@ -61,7 +61,7 @@ void lov_pool_putref(struct pool_desc *pool)
LASSERT(hlist_unhashed(&pool->pool_hash));
LASSERT(list_empty(&pool->pool_list));
LASSERT(!pool->pool_debugfs_entry);
-   lov_ost_pool_free(&(pool->pool_obds));
+   lov_ost_pool_free(&pool->pool_obds);
kfree(pool);
}
 }
@@ -260,7 +260,7 @@ static int pool_proc_show(struct seq_file *s, void *v)
tgt = pool_tgt(iter->pool, iter->idx);
up_read(&pool_tgt_rw_sem(iter->pool));
if (tgt)
-   seq_printf(s, "%s\n", obd_uuid2str(&(tgt->ltd_uuid)));
+   seq_printf(s, "%s\n", obd_uuid2str(&tgt->ltd_uuid));
 
return 0;
 }
@@ -400,7 +400,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
struct pool_desc *new_pool;
int rc;
 
-   lov = &(obd->u.lov);
+   lov = &obd->u.lov;
 
if (strlen(poolname) > LOV_MAXPOOLNAME)
return -ENAMETOOLONG;
@@ -471,7 +471,7 @@ int lov_pool_del(struct obd_device *obd, char *poolname)
struct lov_obd *lov;
struct pool_desc *pool;
 
-   lov = &(obd->u.lov);
+   lov = &obd->u.lov;
 
/* lookup and kill hash reference */
pool = cfs_hash_del_key(lov->lov_pools_hash_body, poolname);
@@ -503,7 +503,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, 
char *ostname)
unsigned int lov_idx;
int rc;
 
-   lov = &(obd->u.lov);
+   lov = &obd->u.lov;
 
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
if (!pool)
@@ -517,7 +517,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, 
char *ostname)
if (!lov->lov_tgts[lov_idx])
continue;
if (obd_uuid_equals(&ost_uuid,
-   &(lov->lov_tgts[lov_idx]->ltd_uuid)))
+   &lov->lov_tgts[lov_idx]->ltd_uuid))
break;
}
/* test if ost found in lov */
@@ -547,7 +547,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, 
char *ostname)
unsigned int lov_idx;
int rc = 0;
 
-   lov 

[PATCH 09/13] staging/lustre: Add spaces preferred around that '{+, -, *, /, |, <<

2016-08-20 Thread Oleg Drokin
From: Emoly Liu 

This patch fixes all checkpatch occurences of
"CHECK: spaces preferred around that '{+,-,*,/,|,<<,>>,&}' (ctx:VxV)"
in Lustre code.

Signed-off-by: Emoly Liu 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/lu_object.h  |  3 +-
 .../lustre/lustre/include/lustre/lustre_idl.h  | 42 +++---
 .../lustre/lustre/include/lustre/lustre_user.h |  2 +-
 drivers/staging/lustre/lustre/include/lustre_fid.h |  2 +-
 .../staging/lustre/lustre/include/lustre_lite.h|  2 +-
 .../staging/lustre/lustre/include/obd_support.h| 13 +++
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c|  4 +--
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |  4 +--
 drivers/staging/lustre/lustre/llite/dir.c  |  2 +-
 drivers/staging/lustre/lustre/llite/file.c |  4 +--
 drivers/staging/lustre/lustre/llite/llite_lib.c| 21 ++-
 drivers/staging/lustre/lustre/llite/llite_mmap.c   |  4 +--
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 14 
 drivers/staging/lustre/lustre/llite/namei.c|  4 +--
 drivers/staging/lustre/lustre/llite/rw.c   |  5 +--
 drivers/staging/lustre/lustre/llite/rw26.c |  2 +-
 drivers/staging/lustre/lustre/llite/super25.c  |  4 +--
 drivers/staging/lustre/lustre/llite/vvp_object.c   |  2 +-
 drivers/staging/lustre/lustre/lov/lov_ea.c |  3 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c| 14 
 drivers/staging/lustre/lustre/lov/lov_pool.c   |  2 +-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |  2 +-
 drivers/staging/lustre/lustre/mdc/mdc_reint.c  |  5 +--
 drivers/staging/lustre/lustre/obdclass/debug.c |  4 +--
 drivers/staging/lustre/lustre/obdclass/genops.c|  2 +-
 .../staging/lustre/lustre/obdclass/obd_config.c| 12 +++
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |  6 ++--
 drivers/staging/lustre/lustre/obdclass/obdo.c  |  6 ++--
 .../staging/lustre/lustre/obdecho/echo_internal.h  |  4 +--
 drivers/staging/lustre/lustre/osc/osc_cache.c  |  2 +-
 .../staging/lustre/lustre/osc/osc_cl_internal.h|  2 +-
 drivers/staging/lustre/lustre/osc/osc_io.c |  2 +-
 drivers/staging/lustre/lustre/osc/osc_request.c| 12 ---
 drivers/staging/lustre/lustre/ptlrpc/import.c  |  6 ++--
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|  2 +-
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c |  4 +--
 drivers/staging/lustre/lustre/ptlrpc/service.c |  2 +-
 37 files changed, 121 insertions(+), 105 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index 6e25c1b..1e8421c 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -1025,7 +1025,8 @@ enum lu_context_tag {
/**
 * Contexts usable in cache shrinker thread.
 */
-   LCT_SHRINKER  = LCT_MD_THREAD|LCT_DT_THREAD|LCT_CL_THREAD|LCT_NOREF
+   LCT_SHRINKER  = LCT_MD_THREAD | LCT_DT_THREAD | LCT_CL_THREAD |
+   LCT_NOREF
 };
 
 /**
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 32471a6..7410a8a 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -1318,13 +1318,13 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
 #define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_IBITS | OBD_CONNECT_FID | \
 OBD_CONNECT_FULL20)
 
-#define OBD_OCD_VERSION(major, minor, patch, fix) (((major)<<24) + \
- ((minor)<<16) + \
- ((patch)<<8) + (fix))
-#define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
-#define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255)
-#define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255)
-#define OBD_OCD_VERSION_FIX(version)   ((int)(version)&255)
+#define OBD_OCD_VERSION(major, minor, patch, fix) (((major) << 24) + \
+  ((minor) << 16) + \
+  ((patch) << 8) + (fix))
+#define OBD_OCD_VERSION_MAJOR(version) ((int)((version) >> 24) & 255)
+#define OBD_OCD_VERSION_MINOR(version) ((int)((version) >> 16) & 255)
+#define OBD_OCD_VERSION_PATCH(version) ((int)((version) >> 8) & 255)
+#define OBD_OCD_VERSION_FIX(version)   ((int)(version) & 255)
 
 /* This structure is used for both request and reply.
  *
@@ -2028,7 +2028,7 @@ void lustre_swab_generic_32s(__u32 *val);
 
 #define MDS_INODELOCK_MAXSHIFT 5
 /* This FULL lock is useful to take on unlink sort of operations */
-#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
+#define MDS_INODELOCK_FULL ((1 << (MDS_INODELOCK_MAXSHIFT + 1)) - 1)
 
 /* NOTE: until Lustre 1.8.7/2.1.1 the fid

[PATCH 13/13] Add James Simmons as another Lustre maintainer

2016-08-20 Thread Oleg Drokin
James Simmons is also spendign a lot of efforts on
cleaning up staging tree Lustre code and also
helps to sync up all the missing changes from the other tree.

Signed-off-by: Oleg Drokin 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a306795..f277cfd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11154,6 +11154,7 @@ F:  drivers/staging/media/lirc/
 STAGING - LUSTRE PARALLEL FILESYSTEM
 M: Oleg Drokin 
 M: Andreas Dilger 
+M: James Simmons 
 L: lustre-de...@lists.lustre.org (moderated for non-subscribers)
 W: http://wiki.lustre.org/
 S: Maintained
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/13] staging/lustre: Remove unused cp_error from struct cl_page

2016-08-20 Thread Oleg Drokin
cp_error member is not really set anywhere, so kill
it and the only printing user of it too.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/cl_object.h | 2 --
 drivers/staging/lustre/lustre/obdclass/cl_page.c  | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index 78613a9..6d8f956 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -726,8 +726,6 @@ struct cl_page {
struct mutexcp_mutex;
/** Linkage of pages within cl_req. */
struct list_head   cp_flight;
-   /** Transfer error. */
-   int   cp_error;
 
/**
 * Page type. Only CPT_TRANSIENT is used so far. Immutable after
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index db2dc6b..d903f71 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -989,9 +989,9 @@ void cl_page_header_print(const struct lu_env *env, void 
*cookie,
  lu_printer_t printer, const struct cl_page *pg)
 {
(*printer)(env, cookie,
-  "page@%p[%d %p %d %d %d %p %p %#x]\n",
+  "page@%p[%d %p %d %d %p %p %#x]\n",
   pg, atomic_read(&pg->cp_ref), pg->cp_obj,
-  pg->cp_state, pg->cp_error, pg->cp_type,
+  pg->cp_state, pg->cp_type,
   pg->cp_owner, pg->cp_req, pg->cp_flags);
 }
 EXPORT_SYMBOL(cl_page_header_print);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/13] staging/lustre: Make alignment match open parenthesis

2016-08-20 Thread Oleg Drokin
From: Emoly Liu 

This patch fixes most of checkpatch occurences of
"CHECK: Alignment should match open parenthesis"
in Lustre code.

Signed-off-by: Emoly Liu 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   6 +-
 .../lustre/include/linux/libcfs/libcfs_debug.h |  10 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|   2 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |   5 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h|   2 +-
 .../lustre/lnet/libcfs/linux/linux-crypto.c|   4 +-
 drivers/staging/lustre/lustre/include/cl_object.h  |   2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |   4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c|   4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_internal.h |  17 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |   8 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  26 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|  21 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c |   4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c  |  10 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   5 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   3 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|   4 +-
 drivers/staging/lustre/lustre/llite/rw.c   |   4 +-
 drivers/staging/lustre/lustre/llite/statahead.c|   3 +-
 drivers/staging/lustre/lustre/llite/vvp_page.c |   4 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|   4 +-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |   3 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   2 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c  |   4 +-
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c  |   3 +-
 .../staging/lustre/lustre/ptlrpc/pack_generic.c|   5 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c|   5 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_plain.c   |  18 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c |  22 +-
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c| 288 ++---
 31 files changed, 257 insertions(+), 245 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 3f6447c..3b92d38 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -138,8 +138,8 @@ struct lnet_debugfs_symlink_def {
 void lustre_insert_debugfs(struct ctl_table *table,
   const struct lnet_debugfs_symlink_def *symlinks);
 int lprocfs_call_handler(void *data, int write, loff_t *ppos,
- void __user *buffer, size_t *lenp,
- int (*handler)(void *data, int write,
- loff_t pos, void __user *buffer, int len));
+void __user *buffer, size_t *lenp,
+int (*handler)(void *data, int write, loff_t pos,
+   void __user *buffer, int len));
 
 #endif /* _LIBCFS_H */
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 25adab1..b7bd6e8 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -247,19 +247,19 @@ do {  
\
 #define LCONSOLE_EMERG(format, ...) CDEBUG(D_CONSOLE | D_EMERG, format, ## 
__VA_ARGS__)
 
 int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
-   const char *format1, ...)
+const char *format1, ...)
__printf(2, 3);
 
 int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
- const char *format1,
- va_list args, const char *format2, ...)
+  const char *format1,
+  va_list args, const char *format2, ...)
__printf(4, 5);
 
 /* other external symbols that tracefile provides: */
 int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
-   const char __user *usr_buffer, int usr_buffer_nob);
+   const char __user *usr_buffer, int usr_buffer_nob);
 int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
-   const char *knl_buffer, char *append);
+const char *knl_buffer, char *append);
 
 #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
 
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 4f5978b..e93dbeb 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -618,7 +618,7 @@ static int kiblnd_get_completion_vector(struct kib_conn 
*conn, int cpt)
 }
 
 struct kib_

[PATCH] staging: lustre: llite: don't clean in_data again

2016-08-20 Thread Shawn Lin
We have got a zero buffer for in_data as we use
kzalloc here. So let's remove it anyway.

Signed-off-by: Shawn Lin 
---

 drivers/staging/lustre/lustre/llite/file.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 50938bd..ec6b7ce 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3251,7 +3251,6 @@ void *ll_iocontrol_register(llioc_callback_t cb, int 
count, unsigned int *cmd)
if (!in_data)
return NULL;
 
-   memset(in_data, 0, sizeof(*in_data));
in_data->iocd_size = size;
in_data->iocd_cb = cb;
in_data->iocd_count = count;
-- 
2.3.7


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: llite: don't clean in_data again

2016-08-20 Thread Oleg Drokin
Acked-by: Oleg Drokin 

On Aug 20, 2016, at 10:44 PM, Shawn Lin wrote:

> We have got a zero buffer for in_data as we use
> kzalloc here. So let's remove it anyway.
> 
> Signed-off-by: Shawn Lin 
> ---
> 
> drivers/staging/lustre/lustre/llite/file.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index 50938bd..ec6b7ce 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -3251,7 +3251,6 @@ void *ll_iocontrol_register(llioc_callback_t cb, int 
> count, unsigned int *cmd)
>   if (!in_data)
>   return NULL;
> 
> - memset(in_data, 0, sizeof(*in_data));
>   in_data->iocd_size = size;
>   in_data->iocd_cb = cb;
>   in_data->iocd_count = count;
> -- 
> 2.3.7
> 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel