Whamcloud - gitweb
LU-6698 kernel: kernel update RHEL 6.6 [2.6.32-504.23.4.el6]
[fs/lustre-release.git] / lustre / mgs / mgs_nids.c
index 895ad98..e945585 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -43,9 +43,8 @@
 #define DEBUG_SUBSYSTEM S_MGS
 #define D_MGS D_CONFIG
 
-#ifdef __KERNEL__
+#include <linux/kthread.h>
 #include <linux/pagemap.h>
-#endif
 
 #include <obd.h>
 #include <obd_class.h>
@@ -136,23 +135,14 @@ static int mgs_nidtbl_read(struct obd_export *exp, struct mgs_nidtbl *tbl,
                                 break;
                         }
 
-                        /* check if we need to consume remaining bytes. */
-                        if (last_in_unit != NULL && bytes_in_unit) {
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
-                               /* May need to swab back to update the length.*/
-                               if (exp->exp_need_mne_swab)
-                                       lustre_swab_mgs_nidtbl_entry(last_in_unit);
-#endif
+                       /* check if we need to consume remaining bytes. */
+                       if (last_in_unit != NULL && bytes_in_unit) {
                                last_in_unit->mne_length += bytes_in_unit;
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
-                               if (exp->exp_need_mne_swab)
-                                       lustre_swab_mgs_nidtbl_entry(last_in_unit);
-#endif
-                                rc  += bytes_in_unit;
-                                buf += bytes_in_unit;
-                                last_in_unit = NULL;
-                        }
-                        LASSERT((rc & (unit_size - 1)) == 0);
+                               rc  += bytes_in_unit;
+                               buf += bytes_in_unit;
+                               last_in_unit = NULL;
+                       }
+                       LASSERT((rc & (unit_size - 1)) == 0);
 
                        if (units_in_page == 0) {
                                /* allocate a new page */
@@ -190,19 +180,13 @@ static int mgs_nidtbl_read(struct obd_export *exp, struct mgs_nidtbl *tbl,
                 entry->mne_type      = tgt->mnt_type;
                 entry->mne_nid_type  = 0;
                 entry->mne_nid_size  = sizeof(lnet_nid_t);
-                entry->mne_nid_count = mti->mti_nid_count;
-                memcpy(entry->u.nids, mti->mti_nids,
-                       mti->mti_nid_count * sizeof(lnet_nid_t));
+               entry->mne_nid_count = mti->mti_nid_count;
+               memcpy(entry->u.nids, mti->mti_nids,
+                      mti->mti_nid_count * sizeof(lnet_nid_t));
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 6, 50, 0)
-               /* For LU-1644, swab entry for 2.2 clients. */
-               if (exp->exp_need_mne_swab)
-                       lustre_swab_mgs_nidtbl_entry(entry);
-#endif
-
-                version = tgt->mnt_version;
-                rc     += entry_len;
-                buf    += entry_len;
+               version = tgt->mnt_version;
+               rc     += entry_len;
+               buf    += entry_len;
 
                 bytes_in_unit -= entry_len;
                 last_in_unit   = entry;
@@ -674,18 +658,22 @@ int mgs_get_ir_logs(struct ptlrpc_request *req)
        page_count = (bytes + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
        LASSERT(page_count <= nrpages);
        desc = ptlrpc_prep_bulk_exp(req, page_count, 1,
-                                   BULK_PUT_SOURCE, MGS_BULK_PORTAL);
+                                   PTLRPC_BULK_PUT_SOURCE |
+                                       PTLRPC_BULK_BUF_KIOV,
+                                   MGS_BULK_PORTAL,
+                                   &ptlrpc_bulk_kiov_pin_ops);
        if (desc == NULL)
                GOTO(out, rc = -ENOMEM);
 
        for (i = 0; i < page_count && bytes > 0; i++) {
-               ptlrpc_prep_bulk_page_pin(desc, pages[i], 0,
-                                         min_t(int, bytes, PAGE_CACHE_SIZE));
+               desc->bd_frag_ops->add_kiov_frag(desc, pages[i], 0,
+                                                min_t(int, bytes,
+                                                     PAGE_CACHE_SIZE));
                bytes -= PAGE_CACHE_SIZE;
         }
 
         rc = target_bulk_io(req->rq_export, desc, &lwi);
-       ptlrpc_free_bulk_pin(desc);
+       ptlrpc_free_bulk(desc);
 
 out:
        for (i = 0; i < nrpages; i++) {