LU-2733 osd: osd-zfs to initialize existing sequence

osd_find_or_add_seq() to use osd_oi_find_or_create() so that
existing sequence is loaded if exists

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Change-Id: I9f173615ef047dd4696d8ed51687c7c268b32dbf
Reviewed-on: http://review.whamcloud.com/5247
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-1866 lfsck: ancillary work for namespace LFSCK

1) Share related linkEA functions with LFSCK.

2) Multiple linked objects are rare, and the objects with
   a lot of linkea entries are more rare. It is unnecessary
   to worry about performance under such cases. So drop the
   linkea entries count limitation: LINKEA_MAX_COUNT.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I75f90c9619c56f2f62063435aea26ed01337d6dd
Reviewed-on: http://review.whamcloud.com/4907
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-1866 lfsck: general framework for LFSCK 1.5

LFSCK 1.5 main data structure definations, LFSCK
component APIs, setup/cleanup/start/stop interfaces.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I4507b9432289ca8d54cbf686893b706052d0eeb3
Reviewed-on: http://review.whamcloud.com/4908
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-1866 lfsck: LFSCK main engine

There are two engines for LFSCK 1.5:

1) One is low layer object table based iteration, which can
   guarantee that all the objects can be scanned at least once.

2) The other is namespace based directory traversal. All the
   namespace based components, such as FID-in-dirent and linkEA,
   can be handled during that.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ic5a404cde35fdb20c24f6522faa8b21117cf4254
Reviewed-on: http://review.whamcloud.com/4909
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1866 lfsck: LFSCK for namespace consistency (1)

It is the first part of LFSCK 1.5 for namespace consistency
check and repair. It mainly implements the LFSCK namespace
component internal framework and external APIs.

The functionality parts for the LFSCK namespace component,
such as lfsck_operations::lfsck_{exec_dir,dump,double_scan},
are not included. They will be implemented in other patches.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I011e06c991577e632eadf364b87be74f1f5535c6
Reviewed-on: http://review.whamcloud.com/4910
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1866 lfsck: LFSCK 1.5 user space control

Include the user space command to start/stop the LFSCK for
namespace consistency check and repair. And proc interface
to query the LFSCK status, statistical informtion, and ect.

Test-Parameters: envdefinitions=ENABLE_QUOTA=yes testlist=sanity-lfsck

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Icf4046b313dc1653b5b8b1a3add7fa0329ca7ad0
Reviewed-on: http://review.whamcloud.com/4911
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1866 lfsck: FID-in-{dirent,LMA} check and repair

As part of LFSCK 1.5, it implementes the following functionalities:

1) Verify and rebuild FID-in-dirent, mainly for MDT file-level
   backup/restore.

2) (Partly) verify and rebuild FID-in-LMA: if the FID-in-dirent
   is valid but FID-in-LMA is missed, then the later one will be
   repaired; but if both are missed, then it is OI scrub's duty
   to repair the inconsistency.

3) (Partly) handle IGIF objects upgrading: build IGIF-in-dirent
   for IGIF objects. The other two parts work for IGIF objects
   upgrading are:

3.1) Generate IGIF-in-LMA, which has been done by OI scrub in
     former patch(es).

3.2) Generate linkEA, which will be done by up layer LFSCK in
     other patch(es).

Test-Parameters: envdefinitions=ENABLE_QUOTA=yes testlist=sanity-lfsck

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ibb317f0f3f3e9cf6db56bfa25f55d2017b0e1937
Reviewed-on: http://review.whamcloud.com/4912
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1866 lfsck: LFSCK for namespace consistency (2)

It is the second part of LFSCK 1.5 for namespace consistency
check and repair. It mainly implements the LFSCK namespace
component functionality lfsck_operations::lfsck_exec_dir:
for linkEA verification and repair.

The basic functionality is to find out missed linkEA entries
and add them to the object. It is also part of handling IGIF
objects upgrading.

Test-Parameters: envdefinitions=ENABLE_QUOTA=yes testlist=sanity-lfsck

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I9df2a1fddfa4b15838ecbdfb6279c240d01d0f95
Reviewed-on: http://review.whamcloud.com/4913
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-2017 mdc: add layout swap between 2 objects

This patch adds the client and MDT code to swap layouts
between 2 files:
- a lfs command
- a llapi call, based on a new ioctl
- the mdc/mdt codes for the ioctl (with layout locking)

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I7e710a1ab3ca38e8b26582e49d08e9943aa445cd
Reviewed-on: http://review.whamcloud.com/4507
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>