Commit Graph

23 Commits

Author SHA1 Message Date
Jim Harris
d465a21a30 reduce: allocate scratch buffer space for requests
Each request will need a scratch buffer of size
chunk_size.  This is needed for read/modify/write
operations when only part of a chunk is written.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ided33f1e9ae18dd9a5de45f53f0a994a6f260b17

Reviewed-on: https://review.gerrithub.io/434111
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-12-03 20:34:11 +00:00
Jim Harris
b0281115b5 reduce: clean up a few items found during code review
1) Add #define with comment for the 2-element iov array
2) Account for user passing trailing slash in pm file path

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id5b620ae9d17dd3534e4cc78ddf1ba176f9c7fcd

Reviewed-on: https://review.gerrithub.io/433903
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-11-20 14:50:27 +00:00
Jim Harris
202bb34fcc reduce: add struct spdk_reduce_vol_request
These structures will be used as contexts for every
I/O request.  Allocate a bunch of these requests
when a volume is initialized or loaded.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibf4da3081b03dd3950550e4ca1c5a3a50f72fd52

Reviewed-on: https://review.gerrithub.io/433516
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
8489937b2e reduce: add bit_arrays for free chunk maps and backing blocks
This patch only creates and frees the bit arrays.  Later
patches will initialize the bit arrays during load based
on information in the pm file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id3ba2b27fa7988778df440b3221ce12c80306c66

Reviewed-on: https://review.gerrithub.io/433515
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
ee26b22b4c reduce: simplify init/load cleanup code
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7a724a3c7c78485c292ebcc65c32e84a5a852b86

Reviewed-on: https://review.gerrithub.io/433514
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
922258a6a7 reduce: initialize vol pm pointer members at load
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id3865c873be1ae80c3e27473ef369b1eeeac7a18

Reviewed-on: https://review.gerrithub.io/433513
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
80ba4fa879 reduce: store a params struct in spdk_reduce_vol
These parameters will be needed for a number of reasons
after init/load.

The params struct contains the uuid, so the explicit uuid
member in spdk_reduce_vol is no longer needed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ide12a7816e4a236be5c73a5733e76919ad9af103

Reviewed-on: https://review.gerrithub.io/433512
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
a03515de80 reduce: define and initialize pm file regions
A pm file consists of:
* volume metadata
* logical map
* chunk maps

Define all three of these in struct spdk_reduce_vol.
Also define -1ULL to denote an empty entry in the logical
map or a chunk map - and initialize the logical map
and chunk maps entirely with this value when initializing
a new compressed volume.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9aae23c73d2fbbdc72050ab103fe9e686907eb40

Reviewed-on: https://review.gerrithub.io/433490
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
eebdab6137 reduce: add spdk_reduce_vol_load()
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7923d461af8ec8835fc258fc537230eff52f787e

Reviewed-on: https://review.gerrithub.io/433088
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
b8745a8403 reduce: allocate 2 iovs for reduce_init_load_ctx
We will need the extra iov in the upcoming load path,
so we can load the superblock and pmem file path into
separate buffers.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I99cce0172bd772ca93813a002dcce6943e661f35

Reviewed-on: https://review.gerrithub.io/433087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
d31f2be55f reduce: have library create pmem file
Currently the API requires the caller to open the
pmem file and pass the mapped buffer pointer, length
and pmem flag to libreduce using the spdk_reduce_pm_file
structure.

Let's have the library just do the pmem_map_file() instead.
Users then just pass the path to create the pmem file.  The
library will still use the spdk_reduce_pm_file structure
internally - so move its definition out of the public header
and into reduce.c.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I81fcbfdfbb3211dca016d6aa422cf2e1ab16d84d

Reviewed-on: https://review.gerrithub.io/432593
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 14:50:27 +00:00
Jim Harris
38259b9982 reduce: generate uuid if user doesn't pass one
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I29a68cac0c2ace3db65e684c36d1512ce72078ac

Reviewed-on: https://review.gerrithub.io/433086
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-11-15 01:03:26 +00:00
Jim Harris
0c6b87b7db reduce: add spdk_reduce_vol_get_uuid
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ied2ec966f470e135adbe29244a954c8a30672210

Reviewed-on: https://review.gerrithub.io/433085
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2018-11-15 01:03:07 +00:00
Jim Harris
cfc372c2ec reduce: write path of pm file to backing dev
Write pm filepath first to offset 4K.  Then write
the super block to offset 0.  This ensures the backing
device isn't really valid until both are written
(avoiding the case where the super block got written
but not the path.)

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I55508aa67b4179e658827c982cd955d009a3f321

Reviewed-on: https://review.gerrithub.io/432505
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <spdk-ci.pdl@broadcom.com>
2018-11-12 22:23:44 +00:00
Jim Harris
b4f9dd1a17 reduce: write metadata to backing_dev
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaccb9f37d4c08aeb44719ed9bfeecfc394207d25

Reviewed-on: https://review.gerrithub.io/432504
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-12 22:23:44 +00:00
Jim Harris
b7623dd483 reduce: check that all backing_dev function ptrs are specified
While here, add basic implementations for these function ptrs
in the unit tests.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I54e18a3b331777602fed29382b95b449005efcce

Reviewed-on: https://review.gerrithub.io/432503
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-12 22:23:44 +00:00
Jim Harris
d912dba2cb reduce: close backing dev during unload
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id94095d2b7069a811ac63123ddd8c5d94f4b53a7

Reviewed-on: https://review.gerrithub.io/432502
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-09 17:51:02 +00:00
Jim Harris
c6323a8d52 reduce: close pm_file during unload
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibd0026a95cbda1577155a0d9520a93e2e4ba921b

Reviewed-on: https://review.gerrithub.io/430649
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-11-08 03:55:50 +00:00
Jim Harris
dfd44de7de reduce: pass details of pm file to init
Add the following to struct spdk_reduce_pm_file:
* path of the pm file
* pointer to the mmapped pm region
* whether the mmaped address is pmem or not

Now use pmem_persist or pmem_msync to persist volume
parameters.  Note that we do *not* persist the pm filename
to the pm file - the pm filename will be written to the
backing disk in a later patch.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1d873ae086dc20600798a49b98e1bf490ac750f3

Reviewed-on: https://review.gerrithub.io/430648
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-08 00:01:47 +00:00
Jim Harris
970228038f reduce: add configure option
--with-reduce required to build reduce.  This depends on
libpmem being installed.

We still need to work out details in pkgdep.sh and
vm_setup.sh.  Some distributions like Ubuntu still
require configuring extra package repositories to
get libpmem packages.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4e056ce1da9a1fecb4458f8f5e7ff5d61c422533

Reviewed-on: https://review.gerrithub.io/430646
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-08 00:01:47 +00:00
Jim Harris
f28f81333f reduce: add spdk_reduce_vol_init() and _unload()
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I07b78d476aca2dd5c1d64f0100f35f431f699623

Reviewed-on: https://review.gerrithub.io/430645
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-08 00:01:47 +00:00
Jim Harris
dd42c80857 lib/reduce: add functions to get pm and backing sizes
A compressed volume will require both a persistent
memory region/file for per-chunk metadata and a
backing device to store the compressed blocks.
Add functions here to calculate the sizes of these
based on the desired size of the compressed volume,
its chunk size and the size of each backing block.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9203479e2a268c3ab0e2b0e06e348285e9d1cd13

Reviewed-on: https://review.gerrithub.io/430387
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-11-08 00:01:47 +00:00
Jim Harris
6bf35070c6 lib/reduce: add empty library, include, unit tests
reduce will be a block compression algorithm designed
specifically for SPDK.  It is called "reduce" because
it reduces the data size on disk.

This patch just adds the shell of a library, include
files and unit tests.  This will be fleshed out in
the rest of the patches in this series.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I88e238af64142a7c0e50ab7b447280026b55581f

Reviewed-on: https://review.gerrithub.io/430386
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2018-11-07 18:11:49 +00:00