You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/12/16 16:25:25 UTC
svn commit: r1645974 - in
/subversion/branches/fsx-id/subversion/libsvn_fs_x: cached_data.c dag.c
fs_x.c low_level.c pack.c transaction.c
Author: stefan2
Date: Tue Dec 16 15:25:24 2014
New Revision: 1645974
URL: http://svn.apache.org/r1645974
Log:
On the fsx-id branch: Where immediately possible, replace access to the
noderev's full ID with access to the respective ID part.
* subversion/libsvn_fs_x/cached_data.c
(get_dir_contents,
locate_dir_cache,
svn_fs_x__get_proplist): Access the noderev_id part directly.
* subversion/libsvn_fs_x/dag.c
(svn_fs_x__dag_get_node_id,
svn_fs_x__dag_get_copy_id): Access the ID parts directly instead of
contructing a temp. svn_fs_t instance.
* subversion/libsvn_fs_x/fs_x.c
(svn_fs_x__prop_rep_equal): Checking the noderev IDs is the correct
identity check for noderevs. Duh!
* subversion/libsvn_fs_x/low_level.c
(svn_fs_x__read_noderev,
svn_fs_x__write_noderev): No detour via the full ID required anymore.
* subversion/libsvn_fs_x/pack.c
(copy_node_to_temp): The wanted ID parts are now readily available.
* subversion/libsvn_fs_x/transaction.c
(create_new_txn_noderev_from_rev,
svn_fs_x__set_entry,
shards_spanned): Same.
(rep_write_cleanup,
rep_write_get_baton,
rep_write_contents_close): Extract the txn ID directly from the
noderev_id.
(set_representation): The noderev_id is enough to check for txns.
Store the correct ID (part) in an error message.
(svn_fs_x__create_successor): The revision can now be read directly
from the noderev_id.
(svn_fs_x__set_proplist): The noderev_id is now readily available.
(write_final_rev): Remove redundant copying.
Modified:
subversion/branches/fsx-id/subversion/libsvn_fs_x/cached_data.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/dag.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_x.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/pack.c
subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/cached_data.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/cached_data.c Tue Dec 16 15:25:24 2014
@@ -2542,7 +2542,7 @@ get_dir_contents(apr_array_header_t **en
apr_pool_t *scratch_pool)
{
svn_stream_t *contents;
- const svn_fs_x__noderev_id_t *id = svn_fs_x__id_noderev_id(noderev->id);
+ const svn_fs_x__noderev_id_t *id = &noderev->noderev_id;
*entries = apr_array_make(result_pool, 16, sizeof(svn_fs_dirent_t *));
if (noderev->data_rep
@@ -2594,11 +2594,11 @@ locate_dir_cache(svn_fs_t *fs,
apr_pool_t *pool)
{
fs_x_data_t *ffd = fs->fsap_data;
- if (svn_fs_x__id_is_txn(noderev->id))
+ if (svn_fs_x__is_txn(noderev->noderev_id.change_set))
{
/* data in txns must be addressed by ID since the representation has
not been created, yet. */
- *key = *svn_fs_x__id_noderev_id(noderev->id);
+ *key = noderev->noderev_id;
}
else
{
@@ -2722,8 +2722,7 @@ svn_fs_x__get_proplist(apr_hash_t **prop
{
apr_hash_t *proplist;
svn_stream_t *stream;
- const svn_fs_x__noderev_id_t *noderev_id
- = svn_fs_x__id_noderev_id(noderev->id);
+ const svn_fs_x__noderev_id_t *noderev_id = &noderev->noderev_id;
if (noderev->prop_rep
&& !svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/dag.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/dag.c Tue Dec 16 15:25:24 2014
@@ -86,35 +86,6 @@ svn_node_kind_t svn_fs_x__dag_node_kind(
return node->kind;
}
-/* Return the node revision ID of NODE. The value returned is shared
- with NODE, and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_node_id(svn_fs_x__id_part_t *node_id,
- dag_node_t *node)
-{
- const svn_fs_id_t *id;
-
- SVN_ERR(svn_fs_x__dag_get_fs_id(&id, node, node->node_pool));
- *node_id = *svn_fs_x__id_node_id(id);
-
- return SVN_NO_ERROR;
-}
-
-/* Return the node revision ID of NODE. The value returned is shared
- with NODE, and will be deallocated when NODE is. */
-svn_error_t *
-svn_fs_x__dag_get_copy_id(svn_fs_x__id_part_t *copy_id,
- dag_node_t *node)
-{
- const svn_fs_id_t *id;
-
- SVN_ERR(svn_fs_x__dag_get_fs_id(&id, node, node->node_pool));
- *copy_id = *svn_fs_x__id_copy_id(id);
-
- return SVN_NO_ERROR;
-}
-
-
const svn_fs_x__noderev_id_t *
svn_fs_x__dag_get_id(const dag_node_t *node)
{
@@ -199,6 +170,31 @@ get_node_revision(node_revision_t **node
return SVN_NO_ERROR;
}
+/* Return the node revision ID of NODE. The value returned is shared
+ with NODE, and will be deallocated when NODE is. */
+svn_error_t *
+svn_fs_x__dag_get_node_id(svn_fs_x__id_part_t *node_id,
+ dag_node_t *node)
+{
+ node_revision_t *noderev;
+ SVN_ERR(get_node_revision(&noderev, node));
+
+ *node_id = noderev->node_id;
+ return SVN_NO_ERROR;
+}
+
+/* Return the node revision ID of NODE. The value returned is shared
+ with NODE, and will be deallocated when NODE is. */
+svn_error_t *
+svn_fs_x__dag_get_copy_id(svn_fs_x__id_part_t *copy_id,
+ dag_node_t *node)
+{
+ node_revision_t *noderev;
+ SVN_ERR(get_node_revision(&noderev, node));
+
+ *copy_id = noderev->copy_id;
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_fs_x__dag_get_fs_id(const svn_fs_id_t **id,
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_x.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/fs_x.c Tue Dec 16 15:25:24 2014
@@ -750,7 +750,7 @@ svn_fs_x__prop_rep_equal(svn_boolean_t *
}
/* Same path in same txn? */
- if (svn_fs_x__id_eq(a->id, b->id))
+ if (svn_fs_x__id_part_eq(&a->noderev_id, &b->noderev_id))
{
*equal = TRUE;
return SVN_NO_ERROR;
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/low_level.c Tue Dec 16 15:25:24 2014
@@ -518,7 +518,8 @@ svn_fs_x__read_noderev(node_revision_t *
if (value == NULL)
{
noderev->copyroot_path = noderev->created_path;
- noderev->copyroot_rev = svn_fs_x__id_rev(noderev->id);
+ noderev->copyroot_rev
+ = svn_fs_x__get_revnum(noderev->noderev_id.change_set);
}
else
{
@@ -629,16 +630,13 @@ svn_fs_x__write_noderev(svn_stream_t *ou
{
svn_string_t *str_id;
- str_id = svn_fs_x__id_part_unparse(svn_fs_x__id_noderev_id(noderev->id),
- scratch_pool);
+ str_id = svn_fs_x__id_part_unparse(&noderev->noderev_id, scratch_pool);
SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_ID ": %s\n",
str_id->data));
- str_id = svn_fs_x__id_part_unparse(svn_fs_x__id_node_id(noderev->id),
- scratch_pool);
+ str_id = svn_fs_x__id_part_unparse(&noderev->node_id, scratch_pool);
SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_NODE ": %s\n",
str_id->data));
- str_id = svn_fs_x__id_part_unparse(svn_fs_x__id_copy_id(noderev->id),
- scratch_pool);
+ str_id = svn_fs_x__id_part_unparse(&noderev->copy_id, scratch_pool);
SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_COPY ": %s\n",
str_id->data));
@@ -678,8 +676,9 @@ svn_fs_x__write_noderev(svn_stream_t *ou
auto_escape_path(noderev->copyfrom_path,
scratch_pool)));
- if ((noderev->copyroot_rev != svn_fs_x__id_rev(noderev->id)) ||
- (strcmp(noderev->copyroot_path, noderev->created_path) != 0))
+ if ( ( noderev->copyroot_rev
+ != svn_fs_x__get_revnum(noderev->noderev_id.change_set))
+ || (strcmp(noderev->copyroot_path, noderev->created_path) != 0))
SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_COPYROOT ": %ld"
" %s\n",
noderev->copyroot_rev,
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/pack.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/pack.c Tue Dec 16 15:25:24 2014
@@ -717,10 +717,10 @@ copy_node_to_temp(pack_context_t *contex
* It will not be stored in the final pack file. */
sort_path = tweak_path_for_ordering(noderev->created_path, pool);
path_order->path = svn_prefix_string__create(context->paths, sort_path);
- path_order->node_id = *svn_fs_x__id_node_id(noderev->id);
- path_order->revision = svn_fs_x__id_rev(noderev->id);
+ path_order->node_id = noderev->node_id;
+ path_order->revision = svn_fs_x__get_revnum(noderev->noderev_id.change_set);
path_order->is_dir = noderev->kind == svn_node_dir;
- path_order->noderev_id = *svn_fs_x__id_noderev_id(noderev->id);
+ path_order->noderev_id = noderev->noderev_id;
APR_ARRAY_PUSH(context->path_order, path_order_t *) = path_order;
return SVN_NO_ERROR;
Modified: subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c?rev=1645974&r1=1645973&r2=1645974&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/fsx-id/subversion/libsvn_fs_x/transaction.c Tue Dec 16 15:25:24 2014
@@ -1161,10 +1161,10 @@ create_new_txn_noderev_from_rev(svn_fs_t
SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, src, pool, pool));
/* This must be a root node. */
- SVN_ERR_ASSERT( svn_fs_x__id_node_id(noderev->id)->number == 0
- && svn_fs_x__id_copy_id(noderev->id)->number == 0);
+ SVN_ERR_ASSERT( noderev->node_id.number == 0
+ && noderev->copy_id.number == 0);
- if (svn_fs_x__id_is_txn(noderev->id))
+ if (svn_fs_x__is_txn(noderev->noderev_id.change_set))
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Copying from transactions not allowed"));
@@ -1708,10 +1708,8 @@ svn_fs_x__set_entry(svn_fs_t *fs,
apr_pool_t *pool)
{
representation_t *rep = parent_noderev->data_rep;
- const svn_fs_x__noderev_id_t *parent_id
- = svn_fs_x__id_noderev_id(parent_noderev->id);
const char *filename
- = svn_fs_x__path_txn_node_children(fs, parent_id, pool);
+ = svn_fs_x__path_txn_node_children(fs, &parent_noderev->noderev_id, pool);
apr_file_t *file;
svn_stream_t *out;
fs_x_data_t *ffd = fs->fsap_data;
@@ -1752,8 +1750,7 @@ svn_fs_x__set_entry(svn_fs_t *fs,
/* update directory cache */
{
/* build parameters: (name, new entry) pair */
- const svn_fs_x__id_part_t *key
- = svn_fs_x__id_noderev_id(parent_noderev->id);
+ const svn_fs_x__id_part_t *key = &(parent_noderev->noderev_id);
replace_baton_t baton;
baton.name = name;
@@ -1942,7 +1939,7 @@ shards_spanned(int *spanned,
svn_pool_clear(iterpool);
SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, predecessor_id,
pool, iterpool));
- shard = svn_fs_x__id_rev(noderev->id) / shard_size;
+ shard = svn_fs_x__get_revnum(predecessor_id->change_set) / shard_size;
if (shard != last_shard)
{
++count;
@@ -2089,6 +2086,8 @@ rep_write_cleanup(void *data)
{
svn_error_t *err;
struct rep_write_baton *b = data;
+ svn_fs_x__txn_id_t txn_id
+ = svn_fs_x__get_txn_id(b->noderev->noderev_id.change_set);
/* Truncate and close the protorevfile. */
err = svn_io_file_trunc(b->file, b->rep_offset, b->scratch_pool);
@@ -2100,9 +2099,9 @@ rep_write_cleanup(void *data)
file lock which will be removed no matter what since the pool is
going away. */
err = svn_error_compose_create(err,
- unlock_proto_rev(b->fs,
- svn_fs_x__id_txn_id(b->noderev->id),
- b->lockcookie, b->scratch_pool));
+ unlock_proto_rev(b->fs, txn_id,
+ b->lockcookie,
+ b->scratch_pool));
if (err)
{
apr_status_t rc = err->apr_err;
@@ -2132,6 +2131,8 @@ rep_write_get_baton(struct rep_write_bat
void *whb;
int diff_version = 1;
svn_fs_x__rep_header_t header = { 0 };
+ svn_fs_x__txn_id_t txn_id
+ = svn_fs_x__get_txn_id(noderev->noderev_id.change_set);
b = apr_pcalloc(pool, sizeof(*b));
@@ -2145,8 +2146,7 @@ rep_write_get_baton(struct rep_write_bat
b->noderev = noderev;
/* Open the prototype rev file and seek to its end. */
- SVN_ERR(get_writable_proto_rev(&file, &b->lockcookie,
- fs, svn_fs_x__id_txn_id(noderev->id),
+ SVN_ERR(get_writable_proto_rev(&file, &b->lockcookie, fs, txn_id,
b->scratch_pool));
b->file = file;
@@ -2352,7 +2352,7 @@ rep_write_contents_close(void *baton)
/* Fill in the rest of the representation field. */
rep->expanded_size = b->rep_size;
- txn_id = svn_fs_x__id_txn_id(b->noderev->id);
+ txn_id = svn_fs_x__get_txn_id(b->noderev->noderev_id.change_set);
rep->id.change_set = svn_fs_x__change_set_by_txn(txn_id);
/* Finalize the checksum. */
@@ -2431,10 +2431,11 @@ set_representation(svn_stream_t **conten
{
struct rep_write_baton *wb;
- if (! svn_fs_x__id_is_txn(noderev->id))
+ if (! svn_fs_x__is_txn(noderev->noderev_id.change_set))
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
_("Attempted to write to non-transaction '%s'"),
- svn_fs_x__id_unparse(noderev->id, pool)->data);
+ svn_fs_x__id_part_unparse(&noderev->noderev_id,
+ pool)->data);
SVN_ERR(rep_write_get_baton(&wb, fs, noderev, pool));
@@ -2484,9 +2485,10 @@ svn_fs_x__create_successor(const svn_fs_
if (! new_noderev->copyroot_path)
{
- new_noderev->copyroot_path = apr_pstrdup(pool,
- new_noderev->created_path);
- new_noderev->copyroot_rev = svn_fs_x__id_rev(new_noderev->id);
+ new_noderev->copyroot_path
+ = apr_pstrdup(pool, new_noderev->created_path);
+ new_noderev->copyroot_rev
+ = svn_fs_x__get_revnum(new_noderev->noderev_id.change_set);
}
SVN_ERR(svn_fs_x__put_node_revision(fs, new_noderev->id, new_noderev, FALSE,
@@ -2503,7 +2505,7 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
apr_hash_t *proplist,
apr_pool_t *pool)
{
- const svn_fs_x__noderev_id_t *id = svn_fs_x__id_noderev_id(noderev->id);
+ const svn_fs_x__noderev_id_t *id = &noderev->noderev_id;
const char *filename = svn_fs_x__path_txn_node_props(fs, id, pool);
apr_file_t *file;
svn_stream_t *out;
@@ -2520,10 +2522,12 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
if (!noderev->prop_rep
|| svn_fs_x__is_revision(noderev->prop_rep->id.change_set))
{
+ svn_fs_x__txn_id_t txn_id
+ = svn_fs_x__get_txn_id(noderev->noderev_id.change_set);
noderev->prop_rep = apr_pcalloc(pool, sizeof(*noderev->prop_rep));
noderev->prop_rep->id.change_set = id->change_set;
SVN_ERR(allocate_item_index(&noderev->prop_rep->id.number, fs,
- svn_fs_x__id_txn_id(noderev->id), pool));
+ txn_id, pool));
SVN_ERR(svn_fs_x__put_node_revision(fs, noderev->id, noderev, FALSE,
pool));
}
@@ -2945,11 +2949,8 @@ write_final_rev(const svn_fs_id_t **new_
}
/* Convert our temporary ID into a permanent revision one. */
- noderev->node_id = *svn_fs_x__id_node_id(noderev->id);
get_final_id(&noderev->node_id, rev);
- noderev->copy_id = *svn_fs_x__id_copy_id(noderev->id);
get_final_id(&noderev->copy_id, rev);
- noderev->noderev_id = *svn_fs_x__id_noderev_id(noderev->id);
get_final_id(&noderev->noderev_id, rev);
if (noderev->copyroot_rev == SVN_INVALID_REVNUM)