Author: stefan2
Date: Fri Aug 2 16:31:18 2013
New Revision: 1509766
URL: http://svn.apache.org/r1509766
Log:
On the log-addressing branch: Introduce the notion of "item_index" as a
generalized replacement for "offset" that works in both adressing modes.
This requires 3 sets of changes
- rename "offset" to "item_index" in structs and some local variables
- hange the FSFS ID API to say "item" instead of "offset"
- translate the item_index into actual file offsets before accessing
the respective file
For the latter, we extend the existing svn_fs_fs__item_offset function
to take an optional TXN_ID parameter to make it suitable for general
offset translation. The current implementation remains simple because
we don't really have logical addresses, yet. Use that mapping API also
in those few places where we don't do so already.
* subversion/libsvn_fs_fs/id.h
(svn_fs_fs__id_part_t): update commentary
(svn_fs_fs__id_rev_offset,
svn_fs_fs__id_offset): rename these to ...
(svn_fs_fs__id_rev_item,
svn_fs_fs__id_item): ... these, respectively
(svn_fs_fs__id_rev_create): rename parameter
* subversion/libsvn_fs_fs/id.c
(fs_fs__id_t): rename rev_offset member to rev_item
(svn_fs_fs__id_rev_offset,
svn_fs_fs__id_offset): rename these to ...
(svn_fs_fs__id_rev_item,
svn_fs_fs__id_item): ... these, respectively; update struct user
(svn_fs_fs__id_rev,
svn_fs_fs__id_unparse,
svn_fs_fs__id_txn_create_root,
svn_fs_fs__id_txn_create,
svn_fs_fs__id_parse): update struct user
(svn_fs_fs__id_rev_create): ditto; update signature
* subversion/libsvn_fs_fs/util.h
(svn_fs_fs__item_offset): update signature; add TXN_ID parameter
* subversion/libsvn_fs_fs/util.c
(svn_fs_fs__item_offset): update
* subversion/libsvn_fs_fs/fs.h
(representation_cache_key_t,
window_cache_key_t,
fs_fs_data_t,
representation_t): replace offsets with 64 bit item_index
* subversion/libsvn_fs_fs/low_level.h
(svn_fs_fs__rep_header_t): rename base_offset to base_item_index
* subversion/libsvn_fs_fs/low_level.c
(svn_fs_fs__parse_representation,
svn_fs_fs__unparse_representation,
svn_fs_fs__read_rep_header,
svn_fs_fs__write_rep_header): update struct users
* subversion/libsvn_fs_fs/cached_data.c
(dbg_log_access,
open_and_seek_revision): update signature; struct usage and offset
translation
(open_and_seek_transaction): translate offset before accessing the file
(open_and_seek_representation): update struct usage
(get_node_revision_body,
svn_fs_fs__get_node_revision): update API caller
(rep_state_t): rename offset to item_index
(auto_set_start_offset): update API caller
(create_rep_state_body): update struct usage and offset translation
(svn_fs_fs__rep_chain_length,
get_window_key,
build_rep_list,
read_delta_window,
svn_fs_fs__get_contents,
svn_fs_fs__try_process_file_contents,
svn_fs_fs__get_file_delta_stream,
locate_dir_cache,
svn_fs_fs__get_proplist): update struct usage
* subversion/libsvn_fs_fs/fs_fs.c
(svn_fs_fs__noderev_same_rep_key): ditto
* subversion/libsvn_fs_fs/pack.c
(compare_dir_entries_format6): update API caller
* subversion/libsvn_fs_fs/recovery.c
(recover_find_max_ids,
svn_fs_fs__find_max_ids): translate offsets before usage
* subversion/libsvn_fs_fs/rep-cache.c
(svn_fs_fs__walk_rep_reference,
svn_fs_fs__get_rep_reference,
svn_fs_fs__set_rep_reference): update struct users
* subversion/libsvn_fs_fs/transaction.c
(rep_write_get_baton,
rep_write_contents_close,
write_hash_rep,
write_hash_delta_rep,
write_final_rev,
commit_body): ditto
* tools/server-side/svn-rep-sharing-stats.c
(record): ditto
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
subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.h
subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.h
subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/rep-cache.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c
subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h
subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.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=1509766&r1=1509765&r2=1509766&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 16:31:18 2013
@@ -60,7 +60,7 @@
static svn_error_t *
dbg_log_access(svn_fs_t *fs,
svn_revnum_t revision,
- apr_off_t offset,
+ apr_uint64_t item_index,
void *item,
int item_type,
apr_pool_t *scratch_pool)
@@ -72,11 +72,11 @@ dbg_log_access(svn_fs_t *fs,
const char *description = "";
const char *type = types[item_type];
const char *pack = "";
- apr_off_t offset_in_rev = offset;
+ apr_off_t offset_in_rev;
/* determine rev / pack file offset */
- SVN_ERR(svn_fs_fs__item_offset(&offset, fs, revision, offset,
- scratch_pool));
+ SVN_ERR(svn_fs_fs__item_offset(&offset_in_rev, fs, revision, NULL,
+ item_index, scratch_pool));
/* constructing the pack file description */
if (revision < ffd->min_unpacked_rev)
@@ -91,13 +91,13 @@ dbg_log_access(svn_fs_t *fs,
= node->data_rep
? apr_psprintf(scratch_pool, " d=%ld/%" APR_UINT64_T_FMT,
node->data_rep->revision,
- node->data_rep->offset)
+ node->data_rep->item_index)
: "";
const char *prop_rep
= node->prop_rep
? apr_psprintf(scratch_pool, " p=%ld/%" APR_UINT64_T_FMT,
node->prop_rep->revision,
- node->prop_rep->offset)
+ node->prop_rep->item_index)
: "";
description = apr_psprintf(scratch_pool, "%s (pc=%d%s%s)",
node->created_path,
@@ -118,7 +118,7 @@ dbg_log_access(svn_fs_t *fs,
description = apr_psprintf(scratch_pool,
" DELTA against %ld/%" APR_UINT64_T_FMT,
header->base_revision,
- header->base_offset);
+ header->base_item_index);
}
else if (item_type == SVN_FS_FS__ITEM_TYPE_CHANGES && item != NULL)
{
@@ -136,7 +136,7 @@ dbg_log_access(svn_fs_t *fs,
printf("%5s%10" APR_UINT64_T_HEX_FMT " %s %7ld %7" APR_UINT64_T_FMT \
" %s\n",
- pack, (apr_uint64_t)(offset), type, revision, offset_in_rev,
+ pack, (apr_uint64_t)(offset), type, revision, item_index,
description);
#endif
@@ -161,15 +161,16 @@ static svn_error_t *
open_and_seek_revision(apr_file_t **file,
svn_fs_t *fs,
svn_revnum_t rev,
- apr_off_t offset,
+ apr_uint64_t item,
apr_pool_t *pool)
{
apr_file_t *rev_file;
+ apr_off_t offset = -1;
SVN_ERR(svn_fs_fs__ensure_revision_exists(rev, fs, pool));
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, offset, pool));
+ SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rev, NULL, item, pool));
SVN_ERR(aligned_seek(rev_file, offset, pool));
*file = rev_file;
@@ -187,13 +188,16 @@ open_and_seek_transaction(apr_file_t **f
apr_pool_t *pool)
{
apr_file_t *rev_file;
+ apr_off_t offset;
SVN_ERR(svn_io_file_open(&rev_file,
svn_fs_fs__path_txn_proto_rev(fs, &rep->txn_id,
pool),
APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
- SVN_ERR(aligned_seek(rev_file, rep->offset, pool));
+ 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));
*file = rev_file;
@@ -210,7 +214,7 @@ open_and_seek_representation(apr_file_t
apr_pool_t *pool)
{
if (! svn_fs_fs__id_txn_used(&rep->txn_id))
- return open_and_seek_revision(file_p, fs, rep->revision, rep->offset,
+ return open_and_seek_revision(file_p, fs, rep->revision, rep->item_index,
pool);
else
return open_and_seek_transaction(file_p, fs, rep, pool);
@@ -270,7 +274,7 @@ get_node_revision_body(node_revision_t *
else
{
/* noderevs in rev / pack files can be cached */
- const svn_fs_fs__id_part_t *rev_item = svn_fs_fs__id_rev_offset(id);
+ const svn_fs_fs__id_part_t *rev_item = svn_fs_fs__id_rev_item(id);
pair_cache_key_t key;
key.revision = rev_item->revision;
key.second = rev_item->number;
@@ -319,7 +323,7 @@ svn_fs_fs__get_node_revision(node_revisi
const svn_fs_id_t *id,
apr_pool_t *pool)
{
- const svn_fs_fs__id_part_t *rev_offset = svn_fs_fs__id_rev_offset(id);
+ const svn_fs_fs__id_part_t *rev_item = svn_fs_fs__id_rev_item(id);
svn_error_t *err = get_node_revision_body(noderev_p, fs, id, pool);
if (err && err->apr_err == SVN_ERR_FS_CORRUPT)
@@ -331,8 +335,8 @@ svn_fs_fs__get_node_revision(node_revisi
}
SVN_ERR(dbg_log_access(fs,
- rev_offset->revision,
- rev_offset->number,
+ rev_item->revision,
+ rev_item->number,
*noderev_p,
SVN_FS_FS__ITEM_TYPE_NODEREV,
pool));
@@ -525,8 +529,8 @@ typedef struct rep_state_t
svn_cache__t *combined_cache;
/* revision containing the representation */
svn_revnum_t revision;
- /* representation's offset in REVISION */
- apr_uint64_t offset;
+ /* representation's item index in REVISION */
+ apr_uint64_t item_index;
/* length of the header at the start of the rep.
0 iff this is rep is stored in a container
(i.e. does not have a header) */
@@ -563,7 +567,7 @@ auto_set_start_offset(rep_state_t *rs, a
if (rs->start == -1)
{
SVN_ERR(svn_fs_fs__item_offset(&rs->start, rs->file->fs, rs->revision,
- rs->offset, pool));
+ NULL, rs->item_index, pool));
rs->start += rs->header_size;
}
@@ -630,12 +634,12 @@ create_rep_state_body(rep_state_t **rep_
representation_cache_key_t key;
key.revision = rep->revision;
key.is_packed = rep->revision < ffd->min_unpacked_rev;
- key.offset = rep->offset;
+ key.item_index = rep->item_index;
/* continue constructing RS and RA */
rs->size = rep->size;
rs->revision = rep->revision;
- rs->offset = rep->offset;
+ rs->item_index = rep->item_index;
rs->window_cache = ffd->txdelta_window_cache;
rs->combined_cache = ffd->combined_window_cache;
rs->ver = -1;
@@ -676,11 +680,11 @@ create_rep_state_body(rep_state_t **rep_
* This implies that we don't read from a txn.
*/
rs->file = *shared_file;
+ SVN_ERR(svn_fs_fs__item_offset(&offset,
+ fs, rep->revision, NULL,
+ rep->item_index, pool));
SVN_ERR(auto_open_shared_file(rs->file));
- SVN_ERR(svn_fs_fs__get_packed_offset(&offset, fs, rep->revision,
- pool));
- SVN_ERR(aligned_seek((*shared_file)->file, offset + rep->offset,
- pool));
+ SVN_ERR(aligned_seek((*shared_file)->file, offset, pool));
}
else
{
@@ -703,7 +707,7 @@ create_rep_state_body(rep_state_t **rep_
}
/* finalize */
- SVN_ERR(dbg_log_access(fs, rep->revision, rep->offset, rh,
+ SVN_ERR(dbg_log_access(fs, rep->revision, rep->item_index, rh,
SVN_FS_FS__ITEM_TYPE_ANY_REP, pool));
rs->header_size = rh->header_size;
@@ -812,7 +816,7 @@ svn_fs_fs__rep_chain_length(int *chain_l
sub_pool));
base_rep.revision = header->base_revision;
- base_rep.offset = header->base_offset;
+ base_rep.item_index = header->base_item_index;
base_rep.size = header->base_length;
svn_fs_fs__id_txn_reset(&base_rep.txn_id);
is_delta = header->type == svn_fs_fs__rep_delta;
@@ -891,7 +895,7 @@ get_window_key(window_cache_key_t *key,
{
assert(rs->revision <= APR_UINT32_MAX);
key->revision = (apr_uint32_t)rs->revision;
- key->offset = rs->offset;
+ key->item_index = rs->item_index;
key->chunk_index = rs->chunk_index;
return key;
@@ -1111,7 +1115,7 @@ build_rep_list(apr_array_header_t **list
}
rep.revision = rep_header->base_revision;
- rep.offset = rep_header->base_offset;
+ rep.item_index = rep_header->base_item_index;
rep.size = rep_header->base_length;
svn_fs_fs__id_txn_reset(&rep.txn_id);
@@ -1177,7 +1181,7 @@ read_delta_window(svn_txdelta_window_t *
apr_off_t end_offset;
SVN_ERR_ASSERT(rs->chunk_index <= this_chunk);
- SVN_ERR(dbg_log_access(rs->file->fs, rs->revision, rs->offset,
+ SVN_ERR(dbg_log_access(rs->file->fs, rs->revision, rs->item_index,
NULL, SVN_FS_FS__ITEM_TYPE_ANY_REP, pool));
/* Read the next window. But first, try to find it in the cache. */
@@ -1532,7 +1536,7 @@ svn_fs_fs__get_contents(svn_stream_t **c
struct rep_read_baton *rb;
fulltext_cache_key.revision = rep->revision;
- fulltext_cache_key.second = rep->offset;
+ fulltext_cache_key.second = rep->item_index;
if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
&& fulltext_size_is_cachable(ffd, len))
{
@@ -1607,7 +1611,7 @@ svn_fs_fs__try_process_file_contents(svn
pair_cache_key_t fulltext_cache_key = { 0 };
fulltext_cache_key.revision = rep->revision;
- fulltext_cache_key.second = rep->offset;
+ fulltext_cache_key.second = rep->item_index;
if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
&& fulltext_size_is_cachable(ffd, rep->expanded_size))
{
@@ -1685,7 +1689,7 @@ svn_fs_fs__get_file_delta_stream(svn_txd
if (rep_header->type == svn_fs_fs__rep_self_delta
|| (rep_header->type == svn_fs_fs__rep_delta
&& rep_header->base_revision == source->data_rep->revision
- && rep_header->base_offset == source->data_rep->offset))
+ && rep_header->base_item_index == source->data_rep->item_index))
{
/* Create the delta read baton. */
struct delta_read_baton *drb = apr_pcalloc(pool, sizeof(*drb));
@@ -1855,7 +1859,7 @@ locate_dir_cache(svn_fs_t *fs,
if (noderev->data_rep)
{
pair_key->revision = noderev->data_rep->revision;
- pair_key->second = noderev->data_rep->offset;
+ pair_key->second = noderev->data_rep->item_index;
*key = pair_key;
}
else
@@ -1985,7 +1989,7 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
pair_cache_key_t key = { 0 };
key.revision = rep->revision;
- key.second = rep->offset;
+ key.second = rep->item_index;
if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
{
svn_boolean_t is_cached;
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=1509766&r1=1509765&r2=1509766&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
16:31:18 2013
@@ -248,8 +248,8 @@ typedef struct representation_cache_key_
/* Packed or non-packed representation? */
svn_boolean_t is_packed;
- /* Item offset of the representation */
- apr_uint64_t offset;
+ /* Item index of the representation */
+ apr_uint64_t item_index;
} representation_cache_key_t;
/* Key type that identifies a txdelta window. */
@@ -261,8 +261,8 @@ typedef struct window_cache_key_t
/* Window number within that representation */
apr_int32_t chunk_index;
- /* Offset of the representation within REVISION */
- apr_uint64_t offset;
+ /* Item index of the representation */
+ apr_uint64_t item_index;
} window_cache_key_t;
/* Private (non-shared) FSFS-specific data for each svn_fs_t object.
@@ -343,7 +343,7 @@ typedef struct fs_fs_data_t
the key is window_cache_key_t */
svn_cache__t *combined_window_cache;
- /* Cache for node_revision_t objects; the key is (revision, id offset) */
+ /* Cache for node_revision_t objects; the key is (revision, item_index) */
svn_cache__t *node_revision_cache;
/* Cache for change lists as APR arrays of change_t * objects; the key
@@ -351,7 +351,7 @@ typedef struct fs_fs_data_t
svn_cache__t *changes_cache;
/* Cache for svn_fs_fs__rep_header_t objects; the key is a
- (revision, is_packed, offset) set */
+ (revision, item index) pair */
svn_cache__t *rep_header_cache;
/* Cache for svn_mergeinfo_t objects; the key is a combination of
@@ -460,8 +460,8 @@ typedef struct representation_t
/* Revision where this representation is located. */
svn_revnum_t revision;
- /* Offset into the revision file where it is located. */
- svn_filesize_t offset;
+ /* Item index with the the revision. */
+ apr_uint64_t item_index;
/* The size of the representation in bytes as seen in the revision
file. */
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=1509766&r1=1509765&r2=1509766&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 16:31:18 2013
@@ -952,7 +952,7 @@ svn_fs_fs__noderev_same_rep_key(represen
if (a == NULL || b == NULL)
return FALSE;
- if (a->offset != b->offset)
+ if (a->item_index != b->item_index)
return FALSE;
if (a->revision != b->revision)
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.c Fri Aug 2
16:31:18 2013
@@ -41,7 +41,7 @@ typedef struct fs_fs__id_t
svn_fs_fs__id_part_t node_id;
svn_fs_fs__id_part_t copy_id;
svn_fs_fs__id_part_t txn_id;
- svn_fs_fs__id_part_t rev_offset;
+ svn_fs_fs__id_part_t rev_item;
} private_id;
} fs_fs__id_t;
@@ -214,11 +214,11 @@ svn_fs_fs__id_txn_id(const svn_fs_id_t *
const svn_fs_fs__id_part_t *
-svn_fs_fs__id_rev_offset(const svn_fs_id_t *fs_id)
+svn_fs_fs__id_rev_item(const svn_fs_id_t *fs_id)
{
fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
- return &id->private_id.rev_offset;
+ return &id->private_id.rev_item;
}
svn_revnum_t
@@ -226,15 +226,15 @@ svn_fs_fs__id_rev(const svn_fs_id_t *fs_
{
fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
- return id->private_id.rev_offset.revision;
+ return id->private_id.rev_item.revision;
}
apr_uint64_t
-svn_fs_fs__id_offset(const svn_fs_id_t *fs_id)
+svn_fs_fs__id_item(const svn_fs_id_t *fs_id)
{
fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
- return id->private_id.rev_offset.number;
+ return id->private_id.rev_item.number;
}
svn_boolean_t
@@ -265,9 +265,9 @@ svn_fs_fs__id_unparse(const svn_fs_id_t
else
{
*(p++) = 'r';
- p += svn__i64toa(p, id->private_id.rev_offset.revision);
+ p += svn__i64toa(p, id->private_id.rev_item.revision);
*(p++) = '/';
- p += svn__i64toa(p, id->private_id.rev_offset.number);
+ p += svn__i64toa(p, id->private_id.rev_item.number);
}
return svn_string_ncreate(string, p - string, pool);
@@ -355,7 +355,7 @@ svn_fs_fs__id_txn_create_root(const svn_
/* node ID and copy ID are "0" */
id->private_id.txn_id = *txn_id;
- id->private_id.rev_offset.revision = SVN_INVALID_REVNUM;
+ id->private_id.rev_item.revision = SVN_INVALID_REVNUM;
id->generic_id.vtable = &id_vtable;
id->generic_id.fsap_data = &id;
@@ -374,7 +374,7 @@ svn_fs_fs__id_txn_create(const svn_fs_fs
id->private_id.node_id = *node_id;
id->private_id.copy_id = *copy_id;
id->private_id.txn_id = *txn_id;
- id->private_id.rev_offset.revision = SVN_INVALID_REVNUM;
+ id->private_id.rev_item.revision = SVN_INVALID_REVNUM;
id->generic_id.vtable = &id_vtable;
id->generic_id.fsap_data = &id;
@@ -386,7 +386,7 @@ svn_fs_fs__id_txn_create(const svn_fs_fs
svn_fs_id_t *
svn_fs_fs__id_rev_create(const svn_fs_fs__id_part_t *node_id,
const svn_fs_fs__id_part_t *copy_id,
- const svn_fs_fs__id_part_t *rev_offset,
+ const svn_fs_fs__id_part_t *rev_item,
apr_pool_t *pool)
{
fs_fs__id_t *id = apr_pcalloc(pool, sizeof(*id));
@@ -394,7 +394,7 @@ svn_fs_fs__id_rev_create(const svn_fs_fs
id->private_id.node_id = *node_id;
id->private_id.copy_id = *copy_id;
id->private_id.txn_id.revision = SVN_INVALID_REVNUM;
- id->private_id.rev_offset = *rev_offset;
+ id->private_id.rev_item = *rev_item;
id->generic_id.vtable = &id_vtable;
id->generic_id.fsap_data = &id;
@@ -471,7 +471,7 @@ svn_fs_fs__id_parse(const char *data,
str = svn_cstring_tokenize("/", &data_copy);
if (str == NULL)
return NULL;
- id->private_id.rev_offset.revision = SVN_STR_TO_REV(str);
+ id->private_id.rev_item.revision = SVN_STR_TO_REV(str);
err = svn_cstring_atoi64(&val, data_copy);
if (err)
@@ -479,13 +479,13 @@ svn_fs_fs__id_parse(const char *data,
svn_error_clear(err);
return NULL;
}
- id->private_id.rev_offset.number = (apr_uint64_t)val;
+ id->private_id.rev_item.number = (apr_uint64_t)val;
}
else if (str[0] == 't')
{
/* This is a transaction type ID */
- id->private_id.rev_offset.revision = SVN_INVALID_REVNUM;
- id->private_id.rev_offset.number = 0;
+ id->private_id.rev_item.revision = SVN_INVALID_REVNUM;
+ id->private_id.rev_item.number = 0;
if (! txn_id_parse(&id->private_id.txn_id, str + 1))
return NULL;
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.h
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.h?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.h (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/id.h Fri Aug 2
16:31:18 2013
@@ -41,7 +41,7 @@ typedef struct svn_fs_fs__id_part_t
svn_revnum_t revision;
/* sub-id value relative to REVISION. Its interpretation depends on
- the part itself. In rev_offset, it is the offset value, in others
+ the part itself. In rev_item, it is the index_index value, in others
it represents a unique counter value. */
apr_uint64_t number;
} svn_fs_fs__id_part_t;
@@ -84,16 +84,16 @@ const svn_fs_fs__id_part_t *svn_fs_fs__i
/* Get the "txn id" portion of ID, or NULL if it is a permanent ID. */
const svn_fs_fs__id_part_t *svn_fs_fs__id_txn_id(const svn_fs_id_t *id);
-/* Get the "rev,offset" portion of ID. */
-const svn_fs_fs__id_part_t *svn_fs_fs__id_rev_offset(const svn_fs_id_t *id);
+/* Get the "rev,item" portion of ID. */
+const svn_fs_fs__id_part_t *svn_fs_fs__id_rev_item(const svn_fs_id_t *id);
/* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a
transaction ID. */
svn_revnum_t svn_fs_fs__id_rev(const svn_fs_id_t *id);
-/* Access the "offset" portion of the ID, or 0 if it is a transaction
+/* Access the "item" portion of the ID, or 0 if it is a transaction
ID. */
-apr_uint64_t svn_fs_fs__id_offset(const svn_fs_id_t *id);
+apr_uint64_t svn_fs_fs__id_item(const svn_fs_id_t *id);
/* Return TRUE, if this is a transaction ID. */
svn_boolean_t svn_fs_fs__id_is_txn(const svn_fs_id_t *id);
@@ -129,11 +129,11 @@ svn_fs_id_t *svn_fs_fs__id_txn_create(co
const svn_fs_fs__id_part_t *txn_id,
apr_pool_t *pool);
-/* Create a permanent ID based on NODE_ID, COPY_ID and REV_OFFSET,
+/* Create a permanent ID based on NODE_ID, COPY_ID and REV_ITEM,
allocated in POOL. */
svn_fs_id_t *svn_fs_fs__id_rev_create(const svn_fs_fs__id_part_t *node_id,
const svn_fs_fs__id_part_t *copy_id,
- const svn_fs_fs__id_part_t *rev_offset,
+ const svn_fs_fs__id_part_t *rev_item,
apr_pool_t *pool);
/* Return a copy of ID, allocated from POOL. */
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.c Fri
Aug 2 16:31:18 2013
@@ -551,7 +551,7 @@ svn_fs_fs__parse_representation(represen
}
SVN_ERR(svn_cstring_atoi64(&val, str));
- rep->offset = (apr_off_t)val;
+ rep->item_index = (apr_uint64_t)val;
str = svn_cstring_tokenize(" ", &string);
if (str == NULL)
@@ -831,17 +831,17 @@ svn_fs_fs__unparse_representation(repres
if (format < SVN_FS_FS__MIN_REP_SHARING_FORMAT || !rep->has_sha1)
return svn_stringbuf_createf
- (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
+ (pool, "%ld %" APR_UINT64_T_FMT " %" SVN_FILESIZE_T_FMT
" %" SVN_FILESIZE_T_FMT " %s",
- rep->revision, rep->offset, rep->size,
+ rep->revision, rep->item_index, rep->size,
rep->expanded_size,
format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool));
svn__ui64tobase36(buffer, rep->uniquifier.number);
return svn_stringbuf_createf
- (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
+ (pool, "%ld %" APR_UINT64_T_FMT " %" SVN_FILESIZE_T_FMT
" %" SVN_FILESIZE_T_FMT " %s %s %s/_%s",
- rep->revision, rep->offset, rep->size,
+ rep->revision, rep->item_index, rep->size,
rep->expanded_size,
format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool),
format_digest(rep->sha1_digest, svn_checksum_sha1,
@@ -968,7 +968,7 @@ svn_fs_fs__read_rep_header(svn_fs_fs__re
if (! str)
goto error;
SVN_ERR(svn_cstring_atoi64(&val, str));
- (*header)->base_offset = (apr_off_t)val;
+ (*header)->base_item_index = (apr_off_t)val;
str = svn_cstring_tokenize(" ", &last_str);
if (! str)
@@ -1003,7 +1003,7 @@ svn_fs_fs__write_rep_header(svn_fs_fs__r
default:
text = apr_psprintf(pool, REP_DELTA " %ld %" APR_OFF_T_FMT " %"
SVN_FILESIZE_T_FMT "\n",
- header->base_revision, header->base_offset,
+ header->base_revision, header->base_item_index,
header->base_length);
}
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.h
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.h?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.h
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/low_level.h Fri
Aug 2 16:31:18 2013
@@ -142,9 +142,9 @@ typedef struct svn_fs_fs__rep_header_t
svn_revnum_t base_revision;
/* if this rep is a delta against some other rep, that base rep can
- * be found at this offset within the base rep's revision. Should
+ * be found at this item index within the base rep's revision. Should
* be 0 if there is no base rep. */
- apr_off_t base_offset;
+ apr_off_t base_item_index;
/* if this rep is a delta against some other rep, this is the (deltified)
* size of that base rep. Should be 0 if there is no base rep. */
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c Fri Aug
2 16:31:18 2013
@@ -52,9 +52,9 @@ compare_dir_entries_format6(const svn_so
const svn_fs_dirent_t *rhs = (const svn_fs_dirent_t *) b->value;
const svn_fs_fs__id_part_t *lhs_rev_item
- = svn_fs_fs__id_rev_offset(lhs->id);
+ = svn_fs_fs__id_rev_item(lhs->id);
const svn_fs_fs__id_part_t *rhs_rev_item
- = svn_fs_fs__id_rev_offset(rhs->id);
+ = svn_fs_fs__id_rev_item(rhs->id);
/* decreasing ("reverse") order on revs */
if (lhs_rev_item->revision != rhs_rev_item->revision)
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c Fri
Aug 2 16:31:18 2013
@@ -182,7 +182,8 @@ recover_find_max_ids(svn_fs_t *fs,
/* We could use get_dir_contents(), but this is much cheaper. It does
rely on directory entries being stored as PLAIN reps, though. */
- offset = noderev->data_rep->offset;
+ SVN_ERR(svn_fs_fs__item_offset(&offset, fs, rev, NULL,
+ noderev->data_rep->item_index, pool));
SVN_ERR(svn_io_file_seek(rev_file, APR_SET, &offset, pool));
SVN_ERR(svn_fs_fs__read_rep_header(&header, baton.stream, pool));
if (header->type != svn_fs_fs__rep_plain)
@@ -211,7 +212,7 @@ recover_find_max_ids(svn_fs_t *fs,
char *str;
svn_node_kind_t kind;
svn_fs_id_t *id;
- const svn_fs_fs__id_part_t *rev_offset;
+ const svn_fs_fs__id_part_t *rev_item;
apr_uint64_t node_id, copy_id;
apr_off_t child_dir_offset;
const svn_string_t *path = svn__apr_hash_index_val(hi);
@@ -242,8 +243,8 @@ recover_find_max_ids(svn_fs_t *fs,
id = svn_fs_fs__id_parse(str, strlen(str), iterpool);
- rev_offset = svn_fs_fs__id_rev_offset(id);
- if (rev_offset->revision != rev)
+ rev_item = svn_fs_fs__id_rev_item(id);
+ if (rev_item->revision != rev)
{
/* If the node wasn't modified in this revision, we've already
checked the node and copy id. */
@@ -261,7 +262,12 @@ recover_find_max_ids(svn_fs_t *fs,
if (kind == svn_node_file)
continue;
- child_dir_offset = rev_offset->number;
+ SVN_ERR(svn_fs_fs__item_offset(&child_dir_offset,
+ fs,
+ rev_item->revision,
+ NULL,
+ rev_item->number,
+ iterpool));
SVN_ERR(recover_find_max_ids(fs, rev, rev_file, child_dir_offset,
max_node_id, max_copy_id, iterpool));
}
@@ -286,7 +292,11 @@ svn_fs_fs__find_max_ids(svn_fs_t *fs,
SVN_ERR_ASSERT(ffd->format < SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT);
SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, youngest, pool));
- root_offset = svn_fs_fs__id_offset(root_id);
+ SVN_ERR(svn_fs_fs__item_offset(&root_offset, fs,
+ svn_fs_fs__id_rev(root_id),
+ NULL,
+ svn_fs_fs__id_item(root_id),
+ pool));
SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, youngest, pool));
SVN_ERR(recover_find_max_ids(fs, youngest, rev_file, root_offset,
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/rep-cache.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/rep-cache.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/rep-cache.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/rep-cache.c Fri
Aug 2 16:31:18 2013
@@ -204,7 +204,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
rep->has_sha1 = TRUE;
memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
rep->revision = svn_sqlite__column_revnum(stmt, 1);
- rep->offset = svn_sqlite__column_int64(stmt, 2);
+ rep->item_index = svn_sqlite__column_int64(stmt, 2);
rep->size = svn_sqlite__column_int64(stmt, 3);
rep->expanded_size = svn_sqlite__column_int64(stmt, 4);
@@ -259,7 +259,7 @@ svn_fs_fs__get_rep_reference(representat
sizeof((*rep)->sha1_digest));
(*rep)->has_sha1 = TRUE;
(*rep)->revision = svn_sqlite__column_revnum(stmt, 0);
- (*rep)->offset = svn_sqlite__column_int64(stmt, 1);
+ (*rep)->item_index = svn_sqlite__column_int64(stmt, 1);
(*rep)->size = svn_sqlite__column_int64(stmt, 2);
(*rep)->expanded_size = svn_sqlite__column_int64(stmt, 3);
}
@@ -301,7 +301,7 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
SVN_ERR(svn_sqlite__bindf(stmt, "siiii",
svn_checksum_to_cstring(&checksum, pool),
(apr_int64_t) rep->revision,
- (apr_int64_t) rep->offset,
+ (apr_int64_t) rep->item_index,
(apr_int64_t) rep->size,
(apr_int64_t) rep->expanded_size));
@@ -324,7 +324,7 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
if (old_rep)
{
if (reject_dup && ((old_rep->revision != rep->revision)
- || (old_rep->offset != rep->offset)
+ || (old_rep->item_index != rep->item_index)
|| (old_rep->size != rep->size)
|| (old_rep->expanded_size !=
rep->expanded_size)))
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -337,9 +337,9 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
SVN_FILESIZE_T_FMT, APR_OFF_T_FMT,
SVN_FILESIZE_T_FMT, SVN_FILESIZE_T_FMT),
svn_checksum_to_cstring_display(&checksum, pool),
- fs->path, old_rep->revision, old_rep->offset,
+ fs->path, old_rep->revision, old_rep->item_index,
old_rep->size, old_rep->expanded_size, rep->revision,
- rep->offset, rep->size, rep->expanded_size);
+ rep->item_index, rep->size, rep->expanded_size);
else
return SVN_NO_ERROR;
}
Modified:
subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
(original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/transaction.c
Fri Aug 2 16:31:18 2013
@@ -1790,7 +1790,7 @@ rep_write_get_baton(struct rep_write_bat
if (base_rep)
{
header.base_revision = base_rep->revision;
- header.base_offset = base_rep->offset;
+ header.base_item_index = base_rep->item_index;
header.base_length = base_rep->size;
header.type = svn_fs_fs__rep_delta;
}
@@ -1956,7 +1956,7 @@ rep_write_contents_close(void *baton)
apr_off_t offset;
rep = apr_pcalloc(b->parent_pool, sizeof(*rep));
- rep->offset = b->rep_offset;
+ rep->item_index = b->rep_offset;
/* Close our delta stream so the last bits of svndiff are written
out. */
@@ -2243,7 +2243,7 @@ write_hash_rep(representation_t *rep,
/* Write out our cosmetic end marker. */
SVN_ERR(svn_stream_puts(whb->stream, "ENDREP\n"));
- rep->offset = offset;
+ rep->item_index = offset;
/* update the representation */
rep->size = whb->size;
@@ -2299,7 +2299,7 @@ write_hash_delta_rep(representation_t *r
if (base_rep)
{
header.base_revision = base_rep->revision;
- header.base_offset = base_rep->offset;
+ header.base_item_index = base_rep->item_index;
header.base_length = base_rep->size;
header.type = svn_fs_fs__rep_delta;
}
@@ -2354,7 +2354,7 @@ write_hash_delta_rep(representation_t *r
SVN_ERR(svn_fs_fs__get_file_offset(&rep_end, file, pool));
SVN_ERR(svn_stream_puts(file_stream, "ENDREP\n"));
- rep->offset = offset;
+ rep->item_index = offset;
/* update the representation */
rep->expanded_size = whb->size;
@@ -2493,7 +2493,7 @@ write_final_rev(const svn_fs_id_t **new_
node_revision_t *noderev;
apr_off_t my_offset;
const svn_fs_id_t *new_id;
- svn_fs_fs__id_part_t node_id, copy_id, rev_offset;
+ svn_fs_fs__id_part_t node_id, copy_id, rev_item;
fs_fs_data_t *ffd = fs->fsap_data;
*new_id_p = NULL;
@@ -2566,7 +2566,7 @@ write_final_rev(const svn_fs_id_t **new_
/* See issue 3845. Some unknown mechanism caused the
protorev file to get truncated, so check for that
here. */
- if (noderev->data_rep->offset + noderev->data_rep->size
+ if (noderev->data_rep->item_index + noderev->data_rep->size
> initial_offset)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Truncated protorev file detected"));
@@ -2601,10 +2601,10 @@ write_final_rev(const svn_fs_id_t **new_
noderev->copyroot_rev = rev;
SVN_ERR(svn_fs_fs__get_file_offset(&my_offset, file, pool));
- rev_offset.number = my_offset;
+ rev_item.number = my_offset;
- rev_offset.revision = rev;
- new_id = svn_fs_fs__id_rev_create(&node_id, ©_id, &rev_offset, pool);
+ rev_item.revision = rev;
+ new_id = svn_fs_fs__id_rev_create(&node_id, ©_id, &rev_item, pool);
noderev->id = new_id;
@@ -2911,7 +2911,7 @@ commit_body(void *baton, apr_pool_t *poo
/* Write the final line. */
trailer = svn_fs_fs__unparse_revision_trailer
- (svn_fs_fs__id_offset(new_root_id),
+ (svn_fs_fs__id_item(new_root_id),
changed_path_offset,
pool);
SVN_ERR(svn_io_file_write_full(proto_file, trailer->data, trailer->len,
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.c Fri Aug
2 16:31:18 2013
@@ -632,18 +632,22 @@ svn_error_t *
svn_fs_fs__item_offset(apr_off_t *absolute_position,
svn_fs_t *fs,
svn_revnum_t rev,
- apr_off_t offset,
+ const svn_fs_fs__id_part_t *txn_id,
+ apr_uint64_t item_index,
apr_pool_t *pool)
{
- if (svn_fs_fs__is_packed_rev(fs, rev))
+ /* for now, we only implement physical addressing */
+
+ if (txn_id == NULL && svn_fs_fs__is_packed_rev(fs, rev))
{
apr_off_t rev_offset;
SVN_ERR(svn_fs_fs__get_packed_offset(&rev_offset, fs, rev, pool));
- *absolute_position = rev_offset + offset;
+ *absolute_position = rev_offset + item_index;
}
else
{
- *absolute_position = offset;
+ /* for TXNs and non-packed revs, item_index *is* the offset */
+ *absolute_position = item_index;
}
return SVN_NO_ERROR;
Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/util.h Fri Aug
2 16:31:18 2013
@@ -359,13 +359,16 @@ svn_boolean_t
svn_fs_fs__use_log_addressing(svn_fs_t *fs,
svn_revnum_t rev);
-/* For OFFSET within REV in FS, return the position in the respective rev
- or pack file in *ABSOLUTE_POSITION. Use POOL for allocations. */
+/* For ITEM_INDEX within REV in FS, return the position in the respective
+ rev or pack file in *ABSOLUTE_POSITION. If TXN_ID is not NULL, return
+ the file offset within that transaction and REV should be given as
+ SVN_INVALID_REVNUM in that case. Use POOL for allocations. */
svn_error_t *
svn_fs_fs__item_offset(apr_off_t *absolute_position,
svn_fs_t *fs,
svn_revnum_t rev,
- apr_off_t offset,
+ const svn_fs_fs__id_part_t *txn_id,
+ apr_uint64_t item_index,
apr_pool_t *pool);
#endif
\ No newline at end of file
Modified:
subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c
URL:
http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c?rev=1509766&r1=1509765&r2=1509766&view=diff
==============================================================================
---
subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c
(original)
+++
subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c
Fri Aug 2 16:31:18 2013
@@ -211,7 +211,7 @@ static svn_error_t *record(apr_hash_t *r
*/
key = apr_pcalloc(result_pool, sizeof(*key));
key->revision = rep->revision;
- key->offset = rep->offset;
+ key->offset = rep->item_index;
/* Update or create the value. */
if ((value = apr_hash_get(records, key, sizeof(*key))))