Author: stefan2
Date: Fri Aug 2 20:17:24 2013
New Revision: 1509843
URL: http://svn.apache.org/r1509843
Log:
On the log-addressing branch: Add FSFS config file option to set
the block size in which we access rev / pack files. For now, we
use it with aligned_seek only but it will soon also determine the
size of the blocks we parse.
* subversion/libsvn_fs_fs/fs.h
(CONFIG_SECTION_IO,
CONFIG_OPTION_BLOCK_SIZE): declare new config file elements
(fs_fs_data_t): add block size
* subversion/libsvn_fs_fs/fs_fs.c
(read_config): read the new option
(write_config): extend config file template
* subversion/libsvn_fs_fs/cached_data.c
(aligned_seek): take FS as parameter to select block size
(open_and_seek_revision,
open_and_seek_transaction,
get_fs_id_at_offset,
get_root_changes_offset,
auto_read_diff_version,
create_rep_state_body,
read_delta_window,
read_plain_window,
get_contents,
svn_fs_fs__get_changes): update callers
Modified:
subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs.h
subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c
Modified:
subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c?rev=1509843&r1=1509842&r2=1509843&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
Fri Aug 2 20:17:24 2013
@@ -144,13 +144,17 @@ dbg_log_access(svn_fs_t *fs,
return SVN_NO_ERROR;
}
-/* Convenience wrapper around svn_io_file_aligned_seek. */
+/* Convenience wrapper around svn_io_file_aligned_seek, taking filesystem
+ FS instead of a block size. */
static svn_error_t *
-aligned_seek(apr_file_t *file,
+aligned_seek(svn_fs_t *fs,
+ apr_file_t *file,
apr_off_t offset,
apr_pool_t *pool)
{
- return svn_error_trace(svn_io_file_aligned_seek(file, 0, NULL, offset,
+ fs_fs_data_t *ffd = fs->fsap_data;
+ return svn_error_trace(svn_io_file_aligned_seek(file, ffd->block_size,
+ NULL, offset,
pool));
}
@@ -171,7 +175,7 @@ open_and_seek_revision(apr_file_t **file
SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, rev, pool));
SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rev, NULL, item, pool));
- SVN_ERR(aligned_seek(rev_file, offset, pool));
+ SVN_ERR(aligned_seek(fs, rev_file, offset, pool));
*file = rev_file;
@@ -197,7 +201,7 @@ open_and_seek_transaction(apr_file_t **f
SVN_ERR(svn_fs_fs__item_offset(&offset, fs, SVN_INVALID_REVNUM,
&rep->txn_id, rep->item_index, pool));
- SVN_ERR(aligned_seek(rev_file, offset, pool));
+ SVN_ERR(aligned_seek(fs, rev_file, offset, pool));
*file = rev_file;
@@ -358,7 +362,7 @@ get_fs_id_at_offset(svn_fs_id_t **id_p,
{
node_revision_t *noderev;
- SVN_ERR(aligned_seek(rev_file, offset, pool));
+ SVN_ERR(aligned_seek(fs, rev_file, offset, pool));
SVN_ERR(svn_fs_fs__read_noderev(&noderev,
svn_stream_from_aprfile2(rev_file, TRUE,
pool),
@@ -438,7 +442,7 @@ get_root_changes_offset(apr_off_t *root_
SVN_ERR(svn_io_file_seek(rev_file, seek_relative, &offset, pool));
trailer->len = trailer->blocksize-1;
- SVN_ERR(aligned_seek(rev_file, offset - trailer->len, pool));
+ SVN_ERR(aligned_seek(fs, rev_file, offset - trailer->len, pool));
/* Read in this last block, from which we will identify the last line. */
SVN_ERR(svn_io_file_read(rev_file, trailer->data, &trailer->len, pool));
@@ -583,7 +587,8 @@ auto_read_diff_version(rep_state_t *rs,
if (rs->ver == -1)
{
char buf[4];
- SVN_ERR(aligned_seek(rs->file->file, rs->start, pool));
+ SVN_ERR(aligned_seek(rs->file->fs, rs->file->file, rs->start,
+ pool));
SVN_ERR(svn_io_file_read_full2(rs->file->file, buf, sizeof(buf),
NULL, NULL, pool));
@@ -684,7 +689,7 @@ create_rep_state_body(rep_state_t **rep_
fs, rep->revision, NULL,
rep->item_index, pool));
SVN_ERR(auto_open_shared_file(rs->file));
- SVN_ERR(aligned_seek((*shared_file)->file, offset, pool));
+ SVN_ERR(aligned_seek(fs, (*shared_file)->file, offset, pool));
}
else
{
@@ -1197,7 +1202,8 @@ read_delta_window(svn_txdelta_window_t *
/* RS->FILE may be shared between RS instances -> make sure we point
* to the right data. */
start_offset = rs->start + rs->current;
- SVN_ERR(aligned_seek(rs->file->file, start_offset, pool));
+ SVN_ERR(aligned_seek(rs->file->fs, rs->file->file, start_offset,
+ pool));
/* Skip windows to reach the current chunk if we aren't there yet. */
while (rs->chunk_index < this_chunk)
@@ -1246,7 +1252,7 @@ read_plain_window(svn_stringbuf_t **nwin
SVN_ERR(auto_set_start_offset(rs, pool));
offset = rs->start + rs->current;
- SVN_ERR(aligned_seek(rs->file->file, offset, pool));
+ SVN_ERR(aligned_seek(rs->file->fs, rs->file->file, offset, pool));
/* Read the plain data. */
*nwin = svn_stringbuf_create_ensure(size, pool);
@@ -1407,7 +1413,8 @@ get_contents(struct rep_read_baton *rb,
SVN_ERR(auto_set_start_offset(rs, rb->pool));
offset = rs->start + rs->current;
- SVN_ERR(aligned_seek(rs->file->file, offset, rb->pool));
+ SVN_ERR(aligned_seek(rs->file->fs, rs->file->file, offset,
+ rb->pool));
SVN_ERR(svn_io_file_read_full2(rs->file->file, cur, copy_len,
NULL, NULL, rb->pool));
}
@@ -2050,7 +2057,7 @@ svn_fs_fs__get_changes(apr_array_header_
SVN_ERR(get_root_changes_offset(NULL, &changes_offset, revision_file, fs,
rev, pool));
- SVN_ERR(aligned_seek(revision_file, changes_offset, pool));
+ SVN_ERR(aligned_seek(fs, revision_file, changes_offset, pool));
SVN_ERR(svn_fs_fs__read_changes(changes,
svn_stream_from_aprfile2(revision_file, TRUE, pool),
pool));
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs.h
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs.h?rev=1509843&r1=1509842&r2=1509843&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs.h Fri Aug 2
20:17:24 2013
@@ -101,6 +101,8 @@ extern "C" {
#define CONFIG_SECTION_PACKED_REVPROPS "packed-revprops"
#define CONFIG_OPTION_REVPROP_PACK_SIZE "revprop-pack-size"
#define CONFIG_OPTION_COMPRESS_PACKED_REVPROPS "compress-packed-revprops"
+#define CONFIG_SECTION_IO "io"
+#define CONFIG_OPTION_BLOCK_SIZE "block-size"
/* The format number of this filesystem.
This is independent of the repository format number, and
@@ -282,6 +284,9 @@ typedef struct fs_fs_data_t
and is not complete, yet. */
svn_revnum_t min_log_addressing_rev;
+ /* Rev / pack file read granularity. */
+ apr_int64_t block_size;
+
/* The revision that was youngest, last time we checked. */
svn_revnum_t youngest_rev_cache;
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c?rev=1509843&r1=1509842&r2=1509843&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/fs_fs.c Fri Aug
2 20:17:24 2013
@@ -526,6 +526,21 @@ read_config(fs_fs_data_t *ffd,
ffd->compress_packed_revprops = FALSE;
}
+ if (ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT)
+ {
+ SVN_ERR(svn_config_get_int64(ffd->config, &ffd->block_size,
+ CONFIG_SECTION_IO,
+ CONFIG_OPTION_BLOCK_SIZE,
+ 64));
+
+ ffd->block_size *= 0x400;
+ }
+ else
+ {
+ /* should be irrelevant but we initialize it anyway */
+ ffd->block_size = 0x1000;
+ }
+
return SVN_NO_ERROR;
}
@@ -660,6 +675,24 @@ write_config(svn_fs_t *fs,
"### unless you often modify revprops after packing." NL
"### Compressing packed revprops is disabled by default." NL
"# " CONFIG_OPTION_COMPRESS_PACKED_REVPROPS " = false" NL
+"" NL
+"[" CONFIG_SECTION_IO "]" NL
+"### Parameters in this section control the data access granularity in" NL
+"### format 7 repositories and later. The defaults should translate into" NL
+"### decent performance over a wide range of setups." NL
+"###" NL
+"### When a specific piece of information needs to be read from disk, a" NL
+"### data block is being read at once and its contents are being cached." NL
+"### If the repository is being stored on a RAID, the block size should" NL
+"### be either 50% or 100% of RAID block size / granularity. Also, your" NL
+"### file system (clusters) should be properly aligned and sized. In that" NL
+"### setup, each access will hit only one disk (minimizes I/O load) but" NL
+"### uses all the data provided by the disk in a single access." NL
+"### For SSD-based storage systems, slightly lower values around 16 kB" NL
+"### may improve latency while still maximizing throughput." NL
+"### Can be changed at any time but must be a power of 2." NL
+"### block-size is 64 kBytes by default." NL
+"# " CONFIG_OPTION_BLOCK_SIZE " = 64" NL
;
#undef NL
return svn_io_file_create(svn_dirent_join(fs->path, PATH_CONFIG, pool),