Commit Graph

36 Commits

Author SHA1 Message Date
Maciej Szwed
eb8b1e20a9 blobstore: add bstype to blobstore super block
Introducing bstype as a way to identify and verify
 blobstore type.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I50267b5408625be10fe0c146ae329016d5509b4a
Reviewed-on: https://review.gerrithub.io/380476
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-17 13:36:03 -04:00
Cunyin Chang
2d18887fbd blobfs: Make the behaviour of "delete file" as unlink.
Mark the file as deleted in the function spdk_fs_delete_file()
when the referance is not 0, and delete the file when it is closed,
make the behaviour as "unlink".

Change-Id: Ia934bb73c82c48fdbab79dbe4b56296a73abc01e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/374944
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-15 17:13:14 -04:00
Daniel Verkamp
d92f0f75ca log: rename SPDK_TRACELOG to SPDK_DEBUGLOG
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.

Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-29 13:25:58 -04:00
Ben Walker
053d5733e6 env: Add a default value for mempool cache size
This is just a convenience and replaces the common practice
of passing -1.

Change-Id: Id96734307ebf52ef0ee7dba0e7ac89602b2b5b1a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/374520
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-17 16:55:55 -04:00
Ziye Yang
59379d4f06 blobfs: Remove next pointer in cache_buffer
Change-Id: I4797e3900eb425f8cddec1543a4612d4d98e07a6
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372990
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 16:38:43 -04:00
Ziye Yang
9ea96234d8 blobfs, tree: fix a bug in spdk_tree_insert_buffer
From the exising code, the comparison should + 1.
Suppose offset = 2^19, we still can be fit into
tree with level =0, since there will be 64 buffer,
each with size 2^18, so we do not need to
increse the tree level.

Also a unit test is added to demonstrate this.

Change-Id: I95d3542b0881aa7bb661bc57bc789cc4ef4e7509
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372396
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 16:36:41 -04:00
Ziye Yang
95399c118e blobfs: remove duplicated tailq operation statement.
The code can be merged into cache_free_buffers

Change-Id: I5da59ae5c5ea2b91d4aecd15a611ad6731bd4c56
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372993
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-15 15:28:36 -04:00
Ziye Yang
b4511e39fd blobfs: Remove unnecessary if statement.
Change-Id: I9134ffcb9713e0613de61d3178940390291dc287
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372621
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-07 17:39:27 -04:00
Ziye Yang
402288ac68 blobfs: check file->tree in file_alloc
Change-Id: I0705e9f203e3cb905bf2e6a7bfc72bbb424a6180
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372644
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-07 14:03:09 -04:00
Ziye Yang
f352e6ab03 blobfs, cache: Change some definition of macros
Some macros depend on others, so we change to
change it and it will avoid potential wrong change
only one value

Change-Id: I2490064a19adc5cbd03a2c231d5f14fbf5b95792
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/372217
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-04 20:06:43 -04:00
Cunyin Chang
b89199cffd blobfs: remove the unnecessary assert.
we will retry the alloc_cache_memory_buffer outside the function if
it fail to allocate one cache buffer.

Change-Id: I276173e449e700ceb7703f68828153f566249ae2
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/371140
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-08-01 16:53:20 -04:00
Dariusz Stojaczyk
73358c99e1 util/nvme: added io_device unregister callback
Patch afe860ae deferred freeing the io_device. However, for nvme, the
io_device context (spdk_nvme_ctrlr) is still being destructed before
io_channels are destroyed, causing segfaults on hotremove.

This patch defers io_device context destruction and fixes nvme
hotremove.

Fixes: afe860aeb1 ("channel: Correctly defer unregisters if channels exist")
Fixes: 5533c3d208 ("util: defer put_io_channel")

Change-Id: I7af699174cac0c6c6a6faa2cc65418c47347eb9a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/370459
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-20 16:07:02 -04:00
Ben Walker
5177ed40c4 blobfs: Handle request alloc failure during init/load
If the spdk_filesystem object is created but the initial
request allocation fails, correctly clean up. This
addresses a static analysis failure.

Change-Id: If47a380d8804a279ec92d2aee3de7d86bb5c67fa
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/369901
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-17 18:56:37 -04:00
Jim Harris
a6014eb2ad blobfs: process one set_xattr at a time
During RocksDB testing with MySQL, we found cases
where blobfs would try to update and sync the length
xattr on the underlying blob while an existing update
was already in progress.  This was primarily driven
by RocksDB performing appends and syncs on the log
file from multiple writer threads.

The simplest way to fix this is to just process one
sync_request at a time.  There could be a tiny bit
of inefficiency here if multiple threads are appending
and syncing a file in parallel - we can look at some
additional optimizations if we find a case where that
is noticeable.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reported-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: Changpeng Liu <changpeng.liu@intel.com>
Change-Id: I7ab7814494d365bae8716efd0b828337286cc7b7

Reviewed-on: https://review.gerrithub.io/369490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-07-13 19:53:25 -04:00
Ben Walker
45f7571a08 blobfs: Fix bug when reading unwritten region after truncate
If a file is extended and then the new region is immediately
read without being written, there as a math error in the
buffer cache.

Change-Id: Ibd2bbe98c734f98df43eada799ed62de4081964b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/367265
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-27 13:24:39 -04:00
Daniel Verkamp
8037bc0df3 blobfs/tree: assert that array index is in bounds
The math works out so that index is always in range here, but add an
assert anyway to catch potential mistakes in the future and to placate
scan-build.

Change-Id: I09ad37dde56bc315543b3c142d91ca9a49e9b32c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/364530
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-09 15:46:49 -04:00
Jim Harris
59ed2aa9f6 blobfs: lock accesses to sync fs_request list
Synchronous blobfs channels may allocate requests from
the synchronous thread, but free the request from the
async thread - especially for code that is shared between
sync and async modes.  So add a lock to the request list
for sync channels only.

Note this only affects metadata path (i.e. sync, delete, open)
and not I/O path.

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

Reviewed-on: https://review.gerrithub.io/362964
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 13:18:26 -04:00
Jim Harris
1285f823e4 blobfs: relax locking for __rw_send_from_file calls
The file's lock does not need to be held across
calls to this function as the file is not dereferenced
at all.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idf0a52f2528521f12e45963bb0ab1f414b37380f
Reviewed-on: https://review.gerrithub.io/363138
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-05-31 17:49:46 -04:00
John Meneghini
8a44220b1a env: Rename spdk_malloc/zmalloc/realloc/free to spdk_dma_(func)
- rename spdk_malloc_socket to spdk_dma_malloc_socket
  - rename spdk_malloc to spdk_dma_malloc
  - rename spdk_zmalloc to spdk_dma_zmalloc
  - rename spdk_realloc to spdk_dma_realloc
  - rename spdk_free to spdk_dma_free

Change-Id: I52a11b7a4243281f9c56f503e826fd7c4a1fd883
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/362604
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-05-31 15:30:27 -04:00
Ben Walker
d969ac445a io_channel: Remove per-channel priority
This wasn't used anywhere and we currently believe there
are superior software-only techniques for controlling
quality of service.

Change-Id: Icdadd5870ed0629b338c307d2619bbc242c3e7a3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362065
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-26 13:42:19 -04:00
Jim Harris
e045a02ca0 blobfs: cleanup cache pool
Keep a global counter of the number of opened
blobfs instances.  Allocate the cache pool when the
first instance is opened, and free the cache pool
when the last instance closes.

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

Reviewed-on: https://review.gerrithub.io/362606
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-05-25 16:55:03 -04:00
Ben Walker
305cb239d2 io_channel: Remove unique flag
This is no longer used anywhere. For the places where we previously
used it, we've since found alternate solutions that do not
require it.

Change-Id: I738a80b95ef50348ce1c14969a3812b0a625b3fd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362064
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Ben Walker
267a4e1ebd blobfs: Add separate I/O target for md
This isn't strictly necessary, but follow the
pattern for sync and I/O devices.

Change-Id: I34b1bd6f9da06008e419f55ee9810022f5fed3d5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/361674
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Ben Walker
a3ab7610f6 blobfs: Use a separate io_device for sync channels
This allows us to no longer use the unique=true flag as well
as assign sync channels different queue depths.

Change-Id: I0b3129a3139bf39d745c2a4dc1d9f402c0a8faa8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/361673
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Ben Walker
3b683c188e blobfs: Use a separate io_device for io channels
This allows us to have a different queue depth
on I/O channels than on metadata/sync channels

Change-Id: I30dfc95af550082efffec4b12ed6c4cd4b8c11cf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/361672
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Ben Walker
345f3d7ddb blobfs: No longer use unique_ctx when creating channels
This temporarily increases the size of the sync channel
to 512 (like all of the other channels). This will be
fixed in a later patch.

Change-Id: I679f1cb7c9f7afdad0acf9a3a26f9632f60cc510
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/361670
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Ben Walker
4eda4fd245 Fix incorrect free in blob/blobfs
The channel memory isn't allocated by these
libraries, so they can't free it.

Change-Id: I30909fa4e77bc5a41b45230f04ba5fe75b172dbf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-18 14:36:11 -07:00
Ben Walker
bea2e2308f blob: Remove per-channel queue size configuration
This will need to be configured globally for all channels.

Change-Id: I773252f220373617f8d09d1f24243db8095cf8a4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-18 14:36:11 -07:00
Ziye Yang
644678258f blobfs: move the location of next buffer check.
This patch address the issue:
https://github.com/spdk/spdk/issues/151.

For cache_append_no_cache in cache_ut testcase,
there is resource contention for buffer among two
threads in the following two functions.
Thread 0: cache_free_buffers
Thread1: __file_flush_done

When the thread1 execuctes __file_flush_done,
it calls the call back: __sem_post defined in
following statement in spdk_file_sync

_file_sync(file, channel, __sem_post, &channel->sem);

Thus Thread 0 will execute next function
cache_buffers, and it frees the buffer.

Then Thread 1 continues executing the remaining statements
in __file_flush_done with the assert function, and touches
the space already freed.

So it will be safe to move ahead the next buffer check.

Change-Id: Ic007b3481f4e3a17d47eeca5c9c802001949a5ab
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-05-16 10:51:26 +08:00
Ben Walker
b961d9cc12 include: Move the remainder of the code base to stdinc.h
Change-Id: I6a142feeaad3117bd3c75e7c5cb7231a1cfa78ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-08 13:20:36 -07:00
Ziye Yang
08e6f94226 blobfs: separate cache tree related definitions into tree.h
The code will locks clear to put those definitions into tree.h header

Change-Id: Ib1a34f19d9849acd7ea979eb0a6e153b0e8e39de
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-05-04 09:11:28 -07:00
GangCao
57986fb884 blob: check memory allocation in check_readahead
Change-Id: I80a1b19570aab8145e8d8d2c544ed46576a89e60
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-28 10:38:26 -07:00
Jim Harris
38f91be52b blobfs: cache_insert_buffer() - check count before allocating buffer
This avoids corner case where a buffer gets allocated on the 100th
try.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If65053d539d458d9a53c8850bbb4cbe4ee84f604
2017-03-24 16:06:37 -07:00
Jim Harris
7079a18f21 blobfs: add assert in fs_open_blob_create_cb to satisfy static checker
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia67d8a42825f7287c48729ec4d88d94a9efe430e
2017-03-24 16:06:37 -07:00
Jim Harris
f2e4d641a5 blobfs: fix use after free in init failure path
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7709c08abc103023363bede99e06bf07984c04ca
2017-03-24 16:06:37 -07:00
Jim Harris
1edd9bf3e4 blobfs: Add a lightweight filesystem built on the blobstore
This is the initial commit for "blobfs", a lightweight
filesystem built on top of the SPDK blobstore.

Also included in this patch:

1) a shim for using SPDK bdevs as the backing store for
   SPDK blobstore/blobfs
2) documentation for using blobfs as the storage engine
   with RocksDB
3) scripts for running a set of workloads and collecting
   profiling data with RocksDB and blobfs

See doc/blobfs/getting_started.md included in this commit
for more details on blobfs, including some of the current
limitations.


Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2a6d3d4b87236730051228ed62c0c04e04c42c73
2017-03-24 14:15:45 -07:00