LU-2590 obdclass: correct swab lov_mds_md

For caller's convenience, the 2nd parameter of obd_free_diskmd()
could be host endianness, it needs swab to LE if necessary, while just
lov_mds_md header needs it for figuring out how much memory needs to
be freed.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: I537e83b56b4be6e08a7431bfda1de71efefa33ee
Reviewed-on: http://review.whamcloud.com/5145
Tested-by: Hudson
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-2302 scripts: make lfs_migrate compatible with 1.8

Earlier versions of lfs setstripe/getstripe use option -s instead
of -S. Make sure lfs_migrate can be used with any version.

Signed-off-by: Daniel Kobras <d.kobras@science-computing.de>
Signed-off-by: Keith Mannthey <keith.mannthey@intel.com>
Change-Id: Ic3caaeaf3d6c764afbd75cd7a8a7279462d21d47
Reviewed-on: http://review.whamcloud.com/4702
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2444 build: fix 'error handling' issues

Fix 'error handling issues' defects found by Coverity version
6.0.3:
Unchecked return value (CHECKED_RETURN)
Value returned from a function is not checked for errors before
being used.
Argument cannot be negative (NEGATIVE_RETURNS)
Negative value used as argument to a function expecting a
positive value.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: I44022a7d7227ee46345b77701b4c5199a74c386d
Reviewed-on: http://review.whamcloud.com/4772
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-642 lov: make up obd_connect for inactive OSC

When OSC is inactivated before lov tries to connect it, lov_connect()
miss the chance to connect it to OST devices even when it is
activated later.

We need make up the connection for the initially inactive OSC when it
is activated.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: I4aca442bc4a77baa2bc14adaf2b0f8f5c7bfa7df
Reviewed-on: http://review.whamcloud.com/4691
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2710 build: avoid function resolution mistakes by Coverity

Remove function resolution mistakes made by Coverity version
6.0.3.
The .hs_keycmp function is incorrectly resolved by Coverity,
making the variable passed as its first 'key' parameter to
be considered of the wrong type. Data structures being of
different sizes, it ends up with this Coverity defect:
Out-of-bounds access (OVERRUN_STATIC)
Overrunning static array by passing it as an argument to a
function which indexes it at a higher byte position.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Ie062b05a73db16d63c63db89dc4d0e264f3b1f8a
Reviewed-on: http://review.whamcloud.com/5211
Tested-by: Hudson
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1431 ptlrpc: Support for over 1MB bulk I/O RPC

Increase the maximum size of BRW RPCs between OSCs and OSTs to 4MB
by increasing the number of LNet Memory Descriptors assosiated with
a bulk.  Each bulk transfer is still limited to LNET_MTU_SIZE, so
that it can be passed through routers and does not break RDMA limits.

The client and server negotiate the maximum BRW RPC size at connect
time via ocd_brw_size, with the client sending the maximum size it
supports, and the server returning min(client_max, server_max) back
to the client.

For each RPC, the number of bulk MDs that are registered depends on
the actual RPC size at sending time.  The (max_brw_count - 1) is sent
to the OST in the high 16 bits of obd_ioobj.ioo_max_brw and forms a
mask for the bulk RPC XIDs.  The actual number of bulk transfers
is encoded in the BRW RPC XID.  The masked value of the request XID
determines the starting bulk transfer match bits, and the last bulk
match is the RPC XID.

For older clients this means that the starting and ending bulk match
bits are the RPC XID itself (as it always was) and the old ioo_type
(now ioo_max_brw) field being set to zero would result in a mask of
"1", which just keeps the same RPC XID as it was before.

It is important to note that the client and server do NOT share the
value of PTLRPC_BULK_OPS_MASK, or this would incorrectly mask the
RPC XID if the PTLRPC_BULK_OPS_BITS was ever increased on the server.

The actual BRW RPC size can be controlled for each client separately
by changing the client's max_pages_per_rpc.  For example, this will
set it to 4MB:

        lctl set_param osc.*.max_pages_per_rpc=1024

It is also possible to specify a units suffix, so that the RPC size
can be set independently of the client PAGE_SIZE:

        lctl set_param osc.*.max_pages_per_rpc=4M

By default, the size is 1MB for for OST BRW RPCs until more testing
is done. All other bulk I/O (e.g. MDC<->MDS) is left at 1MB.

With PTLRPC_MAX_BRW_SIZE growing larger, it doesn't make sense for
the readahead to increase the window size so dramatically at one time
Instead, limit readahead growth by the current inode i_blkbits value,
which currently defaults to 4MB.

If we want to tune the readahead growth so that it matches the actual
cl_max_pages_per_rpc value, then this can be done much more easily by
changing the per-inode i_blkbits value, since this is tied to specific
OSTs with specific RPC settings (which may be different for e.g. local
and remote OSTs), and only needs to be checked once.

Change the ras_*() functions to take the inode as an argument, and
always put it first in the argument list for consistency.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Sergii Glushchenko <sergii_glushchenko@xyratex.com>
Reviewed-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Reviewed-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Change-Id: I757b14a04e5d4cc053576e41e47864c743c35b8b
Xyratex-bug-id: MRP-319
Reviewed-on: http://review.whamcloud.com/4993
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
LU-1199 ldiskfs: Remove HAVE_{EXT4,JBD2}_JOURNAL_CALLBACK_{SET,ADD}

Lustre servers now only support kernels/ldiskfs with
{ext4,ldiskfs}_journal_callback_add().  Additionally, the
HAVE_EXT4_JOURNAL_CALLBACK_ADD define is not in the upstream
3.3 kernel where the ext4_journal_callback_add() patch landed.

Therefore we remove the HAVE_{LDISKFS,EXT4}_JOURNAL_CALLBACK_{SET,ADD}
checks and just assume that it is set.

Change-Id: I10cc79fcf07dd05a10ae83014f188c613ab1620c
Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-on: http://review.whamcloud.com/5055
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-2642 osd-ldiskfs: use struct fs_disk_quota for quotas

Commit b9b2dd36 modified ->get_dqblk to use struct fs_disk_quota.
(v2.6.34)

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Change-Id: Ifb8a79db37e3f88046c00eb906b8e7264005481b
Reviewed-on: http://review.whamcloud.com/5118
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
LU-2642 quota: update quota APIs

Commit 871a2931 renamed vfs_dq_init to dquot_initialize. (v2.6.34)
Commit 9f754758 renamed vfs_dq_drop to dquot_drop. (v2.6.34)
Commit b43fa828 renamed vfs_dq_transfer to dquot_transfer. (v2.6.34)
Commit 0f0dd62f killed vfs_dq_off and vfs_dq_quota_on_remount and
replaced them with dquot_suspend and dquot_resume. (v2.6.34)

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Change-Id: I61e5a4d6c4a519457146b4a65ce78bfddebe2899
Reviewed-on: http://review.whamcloud.com/5119
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>