Commit Graph

49018 Commits

Author SHA1 Message Date
Matt Benjamin
603f245ea3 librgw: split nfsns bucket and object create blocks
Helps to see the respective timings.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:29 -05:00
Matt Benjamin
82aababc46 librgw_file_nfsns: bugfix MARKER1_SETUP
Successfully creates 5*1024 objects at /nfsroot/nfs_marker/, verifies
externally.

Follow-up rgw_readdir shows 999 results, apparently the initial readdir
segment works correctly, but restart from offset fails.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:28 -05:00
Matt Benjamin
e6b3be3cbf librgw: consolidate dup'd librgw, rgwlib
There can be only one.  Fixes crash on shutdown.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:27 -05:00
Matt Benjamin
103b9dde9e librgw: remove search_prefix()
Since it turns out this is a synonym for relative_object_name().

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:26 -05:00
Matt Benjamin
5b6af8a1af incremental marker
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:25 -05:00
Matt Benjamin
80d5201ae2 librgw: omit always-false depth test.
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:24 -05:00
Matt Benjamin
bd4b984472 librgw: rework full_object_name() and friends
Flex RGWFileHandle::full_object_name() to build either a search
prefix (omits leading "/" and bucket name) or else the full path
to the root (e.g., for pretty-printing), depending on the value
of a boolean omit_bucket argument.

New convenience methods search_prefix() and relative_object_name()
select these, respectively.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:23 -05:00
Matt Benjamin
4158721036 librgw: add continued readdir test
Verify that files created in a single, large directory are correctly
enumerated through a sequence of rgw_readdir() calls, at successive
offsets checking cookie/marker and bounds invariants.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:22 -05:00
Matt Benjamin
1097ed4cf3 marker
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:20 -05:00
Matt Benjamin
a557c898c0 Fix copyright statements on new test driver files (Red Hat, Inc.)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:19 -05:00
Matt Benjamin
597f69d953 librgw: dir traversal state GC added
To minimize overhead, traversal events are modeled as a linear
sequence of fh_key, timestamp tuples.  GC operates out-of-line in
LIFO order, and includes a ref cycle.  If the matching directory
object can't be found by handle, it's already gone, and nothing
happens.

To avoid lock contention, scanning of the event sequence is done
in groups of 24 by default, but in groups of sequence/4 if the
event sequence grows larger than 500 events.

Push READDIR events on successful component readdir (bucket or
object listing partial result, as appropriate).

Revise locking, timestamp and update link count in all cases.  Link
counts are approximate (metadata to represent it is not stored).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:18 -05:00
Matt Benjamin
b970fd005e librgw: restore readdir prints (move to dout)
They are useful for checking the exact strings being produced,
and in which sequence (object or common prefix).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:17 -05:00
Matt Benjamin
7acb20d877 librgw: move readdir operations into RGWFileHandle::readdir
The motivation here is to localize state updates to the class,
e.g., to hide consistency logic.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:16 -05:00
Matt Benjamin
453219cb12 librgw: implement small-directory name cache
Augment the existing marker cache with cache of name->type
mappings for up to 128 dirents (appx. 4x the common upper-bound
of 32).

The motivation here is to use the name and type information from
readdir, rather than discarding it.  Boosts perf. at least 60%
on unit test corpus.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:15 -05:00
Matt Benjamin
e8fc2b757e librgw: remote redundnat prints in RGWReaddirRequest
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:14 -05:00
Matt Benjamin
49a034afea librgw: don't increment offset at rcb (it is no longer a counter)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:13 -05:00
Matt Benjamin
bd06808907 librgw: fill in dirent cache
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:12 -05:00
Matt Benjamin
33856c191b librgw: implement framework for fs periodic work
This can be used for, e.g., gc of stale handles and directory
traversals.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:11 -05:00
Matt Benjamin
3237f0b96a librgw: add intrusive refcnt to RGWLibFS
Ensures that file system instances cannot be disposed while (e.g.)
background processing is ongoing.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:10 -05:00
Matt Benjamin
baffb146bf librgw: header and namespace reorganization
Move RGWLibProcess and RGWLibFrontend into new rgw_lib_frontend.h
header, which can include rgw_lib.h and rgw_file.h.

This allows the already-defined RGWLibProcess to call methods on
RGWLibFS objects (e.g., to perform GC, which follows in a separate
commit).

In addition, move all of the library and file interface into
namespace rgw.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:09 -05:00
Matt Benjamin
e448c4eb7f librgw: use string_ref remove_prefix
Save a few cycles over re-assigning a string_ref suffix substring
to itself.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:07 -05:00
Matt Benjamin
8db2c6a969 librgw: fix initialization of string_ref from temporary
Found by valgrind.  The good news:  amounts to proof that the
sref notation works.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:06 -05:00
Matt Benjamin
b19912c9b2 cohort_lru: use correct new/delete operator pair
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:05 -05:00
Matt Benjamin
eaf156397a librgw: move ObjUnref trace print ahead of...unref
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:04 -05:00
Matt Benjamin
1f2ec092f7 librgw: cleanup add_marker and handlers
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:03 -05:00
Matt Benjamin
e6eee9fa53 librgw: rename RGWGetObjRequest, RGWListBucketRequest
The behavior of these requests is basically specific to the
needs of NFS READDIR and READ.  (RGWWriteRequest already updated.)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:02 -05:00
Matt Benjamin
ef6367fc35 common: add (tweaked) sstring.h
Add sstring.h from Seastar, slightly adapted for c++2011 and
boost::string_ref.

An sstring resembles std::string, but the size of its small-string
optimization (static allocation) is controlled by a template
argument (cf. small_vector).

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:01 -05:00
Matt Benjamin
6147c3e526 librgw: fix RGWLibFS::stat_leaf ex-ref
Found verifying refcounts at RGWLibFS::close.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:07:00 -05:00
Matt Benjamin
9cf66708d9 lirgw: call RGWLibFS::close in rgw_umount
Also remove an unused warning in currently-disabled rgw_readv.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:59 -05:00
Matt Benjamin
562ebcbe38 librgw: implement LRU lifecycle for handles
This re-uses intrusive lane LRU and co-resident intrusive b-tree
for lookups (formerly, we were using just the dictionary).

Machinery for cache drain on unmount/release of an active filesystem
instance has been added.  Currently, this code won't be reached.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:58 -05:00
Matt Benjamin
066c2e8d00 librgw: remove dead code (rgw_readdir)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:57 -05:00
Matt Benjamin
00571a51e2 librgw: use correct finish path for RGWWriteRequest (logging and stats)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:56 -05:00
Matt Benjamin
e4b0c2be44 librgw: update posix-style read path
Update RGWGetObj to take ulp buffer rather than transferring the
elements of a buffer::list and re-traversing it.

This breaks the readv variant, but that was not final.  What it
fixes is offset handling.

Also, skip CREATE_BUCKET if not requested, in librgw_file_aw.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:55 -05:00
Matt Benjamin
49a47d1d69 librgw: set iov->iov_len to nread (get)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:53 -05:00
Matt Benjamin
ea51474ab0 librgw: sequential rgw_write works
This commit finishes hooking up RGWWriteRequest, and its supporting
RGWLibContinuedRequest.

The rgw_read call now fails--trivially, because it never handled
starting offset correctly.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:52 -05:00
Matt Benjamin
5d9e395cb0 librgw: update mtime on write finish
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:51 -05:00
Matt Benjamin
e08b8d67f7 librgw: -EISDIR
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:50 -05:00
Matt Benjamin
0090da6d49 librgw: check variant type, fix reversed check for write trans
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:49 -05:00
Matt Benjamin
3b795c1c09 librgw: finish write transactions in rgw_close path
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:48 -05:00
Matt Benjamin
a8f8c1a624 librgw: block in RGWWriteRequest::exec_continue
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:47 -05:00
Matt Benjamin
6e630d6924 librgw: block in RGWWriteRequest::exec_start
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:46 -05:00
Matt Benjamin
1c722bbcac librgw: wire up more of continuation
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:45 -05:00
Matt Benjamin
80bac65738 librgw: dont forget to call exec_start
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:44 -05:00
Matt Benjamin
6b798deb60 librgw: partial implementation of continued request framework
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:43 -05:00
Matt Benjamin
e3be0743f1 librgw_file_aw: re-enable write sequence
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:42 -05:00
Matt Benjamin
a27a4070b4 librgw: fix some incorrect uses of string temporary
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:40 -05:00
Matt Benjamin
5fe01703e7 librgw: add initial atomic write unit test
Tests are focused on open-write-close, open-read-close sequences.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:39 -05:00
Matt Benjamin
4e5aef61f3 librgw: don't allow open on directories (externally)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:38 -05:00
Matt Benjamin
eb99b448b1 librgw: restrict objects to single-open
this is the simplest consistent model for an open-write-close
transaction (and it reads stable)

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:37 -05:00
Matt Benjamin
57938d8c7d librgw: fix last enumeration bug, move tracing to debug
The last issue with enumeration was caused by inserting objects
into handle cache with their key-ified full_object_name()--this
should be the base name.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
2016-02-12 12:06:36 -05:00