Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/rev_file.h URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/rev_file.h?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/rev_file.h (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/rev_file.h Wed Aug 19 02:35:12 2015 @@ -26,11 +26,14 @@ #include "svn_fs.h" #include "id.h" -/* In format 7, index files must be read in sync with the respective - * revision / pack file. I.e. we must use packed index files for packed - * rev files and unpacked ones for non-packed rev files. So, the whole - * point is to open them with matching "is packed" setting in case some - * background pack process was run. +/* In FSX, index data must be read in sync with the respective revision / + * pack file. I.e. we must use packed index files for packed rev files and + * unpacked ones for non-packed rev files. So, the whole point is to open + * them with matching "is packed" setting in case some background pack + * process was run. + * + * Another thing that this allows us is to lazily open the file, i.e. open + * it upon first access. */ /* Opaque index stream type. @@ -38,11 +41,22 @@ typedef struct svn_fs_x__packed_number_stream_t svn_fs_x__packed_number_stream_t; -/* Data file, including indexes data, and associated properties for - * START_REVISION. As the FILE is kept open, background pack operations - * will not cause access to this file to fail. - */ -typedef struct svn_fs_x__revision_file_t +/* Location and content meta data for an index. */ +typedef struct svn_fs_x__index_info_t +{ + /* Offset within the pack / rev file at which the index data starts. */ + apr_off_t start; + + /* First offset behind the index data. */ + apr_off_t end; + + /* MD5 checksum on the whole on-disk representation of the index. */ + svn_checksum_t *checksum; + +} svn_fs_x__index_info_t; + +/* Location and content meta data for a revision / pack file. */ +typedef struct svn_fs_x__rev_file_info_t { /* first (potentially only) revision in the rev / pack file. * SVN_INVALID_REVNUM for txn proto-rev files. */ @@ -51,60 +65,24 @@ typedef struct svn_fs_x__revision_file_t /* the revision was packed when the first file / stream got opened */ svn_boolean_t is_packed; - /* rev / pack file */ - apr_file_t *file; +} svn_fs_x__rev_file_info_t; - /* stream based on FILE and not NULL exactly when FILE is not NULL */ - svn_stream_t *stream; - - /* the opened P2L index stream or NULL. Always NULL for txns. */ - svn_fs_x__packed_number_stream_t *p2l_stream; +/* Data file, including indexes data, and associated properties for + * START_REVISION. As the FILE is kept open, background pack operations + * will not cause access to this file to fail. + */ +typedef struct svn_fs_x__revision_file_t svn_fs_x__revision_file_t; - /* the opened L2P index stream or NULL. Always NULL for txns. */ - svn_fs_x__packed_number_stream_t *l2p_stream; - - /* Copied from FS->FFD->BLOCK_SIZE upon creation. It allows us to - * use aligned seek() without having the FS handy. */ - apr_off_t block_size; - - /* Offset within FILE at which the rev data ends and the L2P index - * data starts. Less than P2L_OFFSET. -1 if svn_fs_fs__auto_read_footer - * has not been called, yet. */ - apr_off_t l2p_offset; - - /* MD5 checksum on the whole on-disk representation of the L2P index. - * NULL if svn_fs_fs__auto_read_footer has not been called, yet. */ - svn_checksum_t *l2p_checksum; - - /* Offset within FILE at which the L2P index ends and the P2L index - * data starts. Greater than L2P_OFFSET. -1 if svn_fs_fs__auto_read_footer - * has not been called, yet. */ - apr_off_t p2l_offset; - - /* MD5 checksum on the whole on-disk representation of the P2L index. - * NULL if svn_fs_fs__auto_read_footer has not been called, yet. */ - svn_checksum_t *p2l_checksum; - - /* Offset within FILE at which the P2L index ends and the footer starts. - * Greater than P2L_OFFSET. -1 if svn_fs_fs__auto_read_footer has not - * been called, yet. */ - apr_off_t footer_offset; - - /* pool containing this object */ - apr_pool_t *pool; -} svn_fs_x__revision_file_t; - -/* Open the correct revision file for REV. If the filesystem FS has - * been packed, *FILE will be set to the packed file; otherwise, set *FILE - * to the revision file for REV. Return SVN_ERR_FS_NO_SUCH_REVISION if the - * file doesn't exist. Allocate *FILE in RESULT_POOL and use SCRATCH_POOL - * for temporaries. */ -svn_error_t * -svn_fs_x__open_pack_or_rev_file(svn_fs_x__revision_file_t **file, - svn_fs_t *fs, - svn_revnum_t rev, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); +/* Initialize the revision / pack file access structure in *FILE for reading + * revision REV from filesystem FS. The file will not be opened until the + * first call to any of the access functions. + * + * Allocate *FILE in RESULT_POOL. */ +svn_error_t * +svn_fs_x__rev_file_init(svn_fs_x__revision_file_t **file, + svn_fs_t *fs, + svn_revnum_t rev, + apr_pool_t *result_pool); /* Open the correct revision file for REV with read and write access. * If necessary, temporarily reset the file's read-only state. If the @@ -114,39 +92,101 @@ svn_fs_x__open_pack_or_rev_file(svn_fs_x * Return SVN_ERR_FS_NO_SUCH_REVISION if the file doesn't exist. * Allocate *FILE in RESULT_POOL and use SCRATCH_POOLfor temporaries. */ svn_error_t * -svn_fs_x__open_pack_or_rev_file_writable(svn_fs_x__revision_file_t **file, - svn_fs_t *fs, - svn_revnum_t rev, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); - -/* If the footer data in FILE has not been read, yet, do so now. - * Index locations will only be read upon request as we assume they get - * cached and the FILE is usually used for REP data access only. - * Hence, the separate step. - */ -svn_error_t * -svn_fs_x__auto_read_footer(svn_fs_x__revision_file_t *file); +svn_fs_x__rev_file_open_writable(svn_fs_x__revision_file_t **file, + svn_fs_t *fs, + svn_revnum_t rev, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* Open the proto-rev file of transaction TXN_ID in FS and return it in *FILE. * Allocate *FILE in RESULT_POOL use and SCRATCH_POOL for temporaries.. */ svn_error_t * -svn_fs_x__open_proto_rev_file(svn_fs_x__revision_file_t **file, - svn_fs_t *fs, - svn_fs_x__txn_id_t txn_id, - apr_pool_t* result_pool, - apr_pool_t *scratch_pool); +svn_fs_x__rev_file_open_proto_rev(svn_fs_x__revision_file_t **file, + svn_fs_t *fs, + svn_fs_x__txn_id_t txn_id, + apr_pool_t* result_pool, + apr_pool_t *scratch_pool); /* Wrap the TEMP_FILE, used in the context of FS, into a revision file * struct, allocated in RESULT_POOL, and return it in *FILE. */ svn_error_t * -svn_fs_x__wrap_temp_rev_file(svn_fs_x__revision_file_t **file, +svn_fs_x__rev_file_wrap_temp(svn_fs_x__revision_file_t **file, svn_fs_t *fs, apr_file_t *temp_file, apr_pool_t *result_pool); -/* Close all files and streams in FILE. +/* Access functions */ + +/* Copy the L2P index info for FILE into *INFO. + */ +svn_error_t * +svn_fs_x__rev_file_info(svn_fs_x__rev_file_info_t *info, + svn_fs_x__revision_file_t *file); + +/* Convenience wrapper around svn_io_file_name_get. */ +svn_error_t * +svn_fs_x__rev_file_name(const char **filename, + svn_fs_x__revision_file_t *file, + apr_pool_t *result_pool); + +/* Set *STREAM to the shared stream object of FILE. + */ +svn_error_t * +svn_fs_x__rev_file_stream(svn_stream_t **stream, + svn_fs_x__revision_file_t *file); + +/* Set *APR_FILE to the shared file object of FILE. + */ +svn_error_t * +svn_fs_x__rev_file_get(apr_file_t **apr_file, + svn_fs_x__revision_file_t *file); + +/* Set *STREAM to the shared L2P data stream of FILE. + */ +svn_error_t * +svn_fs_x__rev_file_l2p_index(svn_fs_x__packed_number_stream_t **stream, + svn_fs_x__revision_file_t *file); + +/* Set *STREAM to the shared P2L data stream of FILE. + */ +svn_error_t * +svn_fs_x__rev_file_p2l_index(svn_fs_x__packed_number_stream_t **stream, + svn_fs_x__revision_file_t *file); + +/* Copy the L2P index info for FILE into *INFO. + */ +svn_error_t * +svn_fs_x__rev_file_l2p_info(svn_fs_x__index_info_t *info, + svn_fs_x__revision_file_t *file); + +/* Copy the P2L index info for FILE into *INFO. + */ +svn_error_t * +svn_fs_x__rev_file_p2l_info(svn_fs_x__index_info_t *info, + svn_fs_x__revision_file_t *file); + +/* File manipulation. */ + +/* Convenience wrapper around svn_io_file_aligned_seek. */ +svn_error_t * +svn_fs_x__rev_file_seek(svn_fs_x__revision_file_t *file, + apr_off_t *buffer_start, + apr_off_t offset); + +/* Convenience wrapper around svn_fs_x__get_file_offset. */ +svn_error_t * +svn_fs_x__rev_file_offset(apr_off_t *offset, + svn_fs_x__revision_file_t *file); + +/* Convenience wrapper around svn_io_file_read_full2. */ +svn_error_t * +svn_fs_x__rev_file_read(svn_fs_x__revision_file_t *file, + void *buf, + apr_size_t nbytes); + +/* Close all files and streams in FILE. They will be reopened automatically + * by any of the above access functions. */ svn_error_t * svn_fs_x__close_revision_file(svn_fs_x__revision_file_t *file);
Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.c URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.c?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.c (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.c Wed Aug 19 02:35:12 2015 @@ -53,98 +53,6 @@ (SVN_INT64_BUFFER_SIZE + 3 + APR_MD5_DIGESTSIZE * 2) -svn_error_t * -svn_fs_x__upgrade_pack_revprops(svn_fs_t *fs, - svn_fs_upgrade_notify_t notify_func, - void *notify_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) -{ - svn_fs_x__data_t *ffd = fs->fsap_data; - const char *revprops_shard_path; - const char *revprops_pack_file_dir; - apr_int64_t shard; - apr_int64_t first_unpacked_shard - = ffd->min_unpacked_rev / ffd->max_files_per_dir; - - apr_pool_t *iterpool = svn_pool_create(scratch_pool); - const char *revsprops_dir = svn_dirent_join(fs->path, PATH_REVPROPS_DIR, - scratch_pool); - int compression_level = ffd->compress_packed_revprops - ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT - : SVN_DELTA_COMPRESSION_LEVEL_NONE; - - /* first, pack all revprops shards to match the packed revision shards */ - for (shard = 0; shard < first_unpacked_shard; ++shard) - { - svn_pool_clear(iterpool); - - revprops_pack_file_dir = svn_dirent_join(revsprops_dir, - apr_psprintf(iterpool, - "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD, - shard), - iterpool); - revprops_shard_path = svn_dirent_join(revsprops_dir, - apr_psprintf(iterpool, "%" APR_INT64_T_FMT, shard), - iterpool); - - SVN_ERR(svn_fs_x__pack_revprops_shard(revprops_pack_file_dir, - revprops_shard_path, - shard, ffd->max_files_per_dir, - (int)(0.9 * ffd->revprop_pack_size), - compression_level, - cancel_func, cancel_baton, iterpool)); - if (notify_func) - SVN_ERR(notify_func(notify_baton, shard, - svn_fs_upgrade_pack_revprops, iterpool)); - } - - svn_pool_destroy(iterpool); - - return SVN_NO_ERROR; -} - -svn_error_t * -svn_fs_x__upgrade_cleanup_pack_revprops(svn_fs_t *fs, - svn_fs_upgrade_notify_t notify_func, - void *notify_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) -{ - svn_fs_x__data_t *ffd = fs->fsap_data; - const char *revprops_shard_path; - apr_int64_t shard; - apr_int64_t first_unpacked_shard - = ffd->min_unpacked_rev / ffd->max_files_per_dir; - - apr_pool_t *iterpool = svn_pool_create(scratch_pool); - const char *revsprops_dir = svn_dirent_join(fs->path, PATH_REVPROPS_DIR, - scratch_pool); - - /* delete the non-packed revprops shards afterwards */ - for (shard = 0; shard < first_unpacked_shard; ++shard) - { - svn_pool_clear(iterpool); - - revprops_shard_path = svn_dirent_join(revsprops_dir, - apr_psprintf(iterpool, "%" APR_INT64_T_FMT, shard), - iterpool); - SVN_ERR(svn_fs_x__delete_revprops_shard(revprops_shard_path, - shard, ffd->max_files_per_dir, - cancel_func, cancel_baton, - iterpool)); - if (notify_func) - SVN_ERR(notify_func(notify_baton, shard, - svn_fs_upgrade_cleanup_revprops, iterpool)); - } - - svn_pool_destroy(iterpool); - - return SVN_NO_ERROR; -} - /* Revprop caching management. * * Mechanism: @@ -321,8 +229,14 @@ read_revprop_generation_file(apr_int64_t iterpool)); len = sizeof(buf); - SVN_ERR(svn_io_read_length_line(ffd->revprop_generation_file, buf, &len, - iterpool)); + SVN_ERR(svn_io_file_read(ffd->revprop_generation_file, buf, &len, + iterpool)); + /* Properly terminate the string we just read. Valid contents ends + with a '\n'. Empty the buffer in all other cases. */ + if (len > 0 && buf[len-1] == '\n') + buf[--len] = '\0'; + else + buf[0] = '\0'; /* Some data has been read. It will most likely be complete and * consistent. Extract and verify anyway. */ @@ -783,8 +697,8 @@ get_revprop_packname(svn_fs_t *fs, min_filename_len = get_min_filename_len(revprops); /* Read the content of the manifest file */ - revprops->folder - = svn_fs_x__path_revprops_pack_shard(fs, revprops->revision, result_pool); + revprops->folder = svn_fs_x__path_pack_shard(fs, revprops->revision, + result_pool); manifest_file_path = svn_dirent_join(revprops->folder, PATH_MANIFEST, result_pool); @@ -1683,8 +1597,7 @@ svn_fs_x__packed_revprop_available(svn_b svn_stringbuf_t *content = NULL; /* try to read the manifest file */ - const char *folder = svn_fs_x__path_revprops_pack_shard(fs, revision, - scratch_pool); + const char *folder = svn_fs_x__path_pack_shard(fs, revision, scratch_pool); const char *manifest_path = svn_dirent_join(folder, PATH_MANIFEST, scratch_pool); @@ -1745,18 +1658,35 @@ svn_fs_x__packed_revprop_available(svn_b /****** Packing FSX shards *********/ -svn_error_t * -svn_fs_x__copy_revprops(const char *pack_file_dir, - const char *pack_filename, - const char *shard_path, - svn_revnum_t start_rev, - svn_revnum_t end_rev, - apr_array_header_t *sizes, - apr_size_t total_size, - int compression_level, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) +/* Copy revprop files for revisions [START_REV, END_REV) from SHARD_PATH + * in filesystem FS to the pack file at PACK_FILE_NAME in PACK_FILE_DIR. + * + * The file sizes have already been determined and written to SIZES. + * Please note that this function will be executed while the filesystem + * has been locked and that revprops files will therefore not be modified + * while the pack is in progress. + * + * COMPRESSION_LEVEL defines how well the resulting pack file shall be + * compressed or whether is shall be compressed at all. TOTAL_SIZE is + * a hint on which initial buffer size we should use to hold the pack file + * content. + * + * CANCEL_FUNC and CANCEL_BATON are used as usual. Temporary allocations + * are done in SCRATCH_POOL. + */ +static svn_error_t * +copy_revprops(svn_fs_t *fs, + const char *pack_file_dir, + const char *pack_filename, + const char *shard_path, + svn_revnum_t start_rev, + svn_revnum_t end_rev, + apr_array_header_t *sizes, + apr_size_t total_size, + int compression_level, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool) { svn_stream_t *pack_stream; apr_file_t *pack_file; @@ -1790,8 +1720,7 @@ svn_fs_x__copy_revprops(const char *pack svn_pool_clear(iterpool); /* Construct the file name. */ - path = svn_dirent_join(shard_path, apr_psprintf(iterpool, "%ld", rev), - iterpool); + path = svn_fs_x__path_revprops(fs, rev, iterpool); /* Copy all the bits from the non-packed revprop file to the end of * the pack file. */ @@ -1818,7 +1747,8 @@ svn_fs_x__copy_revprops(const char *pack } svn_error_t * -svn_fs_x__pack_revprops_shard(const char *pack_file_dir, +svn_fs_x__pack_revprops_shard(svn_fs_t *fs, + const char *pack_file_dir, const char *shard_path, apr_int64_t shard, int max_files_per_dir, @@ -1839,12 +1769,7 @@ svn_fs_x__pack_revprops_shard(const char manifest_file_path = svn_dirent_join(pack_file_dir, PATH_MANIFEST, scratch_pool); - /* Remove any existing pack file for this shard, since it is incomplete. */ - SVN_ERR(svn_io_remove_dir2(pack_file_dir, TRUE, cancel_func, cancel_baton, - scratch_pool)); - - /* Create the new directory and manifest file stream. */ - SVN_ERR(svn_io_dir_make(pack_file_dir, APR_OS_DEFAULT, scratch_pool)); + /* Create the manifest file stream. */ SVN_ERR(svn_stream_open_writable(&manifest_stream, manifest_file_path, scratch_pool, scratch_pool)); @@ -1852,10 +1777,19 @@ svn_fs_x__pack_revprops_shard(const char start_rev = (svn_revnum_t) (shard * max_files_per_dir); end_rev = (svn_revnum_t) ((shard + 1) * (max_files_per_dir) - 1); if (start_rev == 0) - ++start_rev; - /* Special special case: if max_files_per_dir is 1, then at this point - start_rev == 1 and end_rev == 0 (!). Fortunately, everything just - works. */ + { + /* Never pack revprops for r0, just copy it. */ + SVN_ERR(svn_io_copy_file(svn_fs_x__path_revprops(fs, 0, iterpool), + svn_dirent_join(pack_file_dir, "p0", + scratch_pool), + TRUE, + iterpool)); + + ++start_rev; + /* Special special case: if max_files_per_dir is 1, then at this point + start_rev == 1 and end_rev == 0 (!). Fortunately, everything just + works. */ + } /* initialize the revprop size info */ sizes = apr_array_make(scratch_pool, max_files_per_dir, sizeof(apr_off_t)); @@ -1871,8 +1805,7 @@ svn_fs_x__pack_revprops_shard(const char svn_pool_clear(iterpool); /* Get the size of the file. */ - path = svn_dirent_join(shard_path, apr_psprintf(iterpool, "%ld", rev), - iterpool); + path = svn_fs_x__path_revprops(fs, rev, iterpool); SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, iterpool)); /* if we already have started a pack file and this revprop cannot be @@ -1880,11 +1813,11 @@ svn_fs_x__pack_revprops_shard(const char if (sizes->nelts != 0 && total_size + SVN_INT64_BUFFER_SIZE + finfo.size > max_pack_size) { - SVN_ERR(svn_fs_x__copy_revprops(pack_file_dir, pack_filename, - shard_path, start_rev, rev-1, - sizes, (apr_size_t)total_size, - compression_level, cancel_func, - cancel_baton, iterpool)); + SVN_ERR(copy_revprops(fs, pack_file_dir, pack_filename, + shard_path, start_rev, rev-1, + sizes, (apr_size_t)total_size, + compression_level, cancel_func, + cancel_baton, iterpool)); /* next pack file starts empty again */ apr_array_clear(sizes); @@ -1907,10 +1840,10 @@ svn_fs_x__pack_revprops_shard(const char /* write the last pack file */ if (sizes->nelts != 0) - SVN_ERR(svn_fs_x__copy_revprops(pack_file_dir, pack_filename, shard_path, - start_rev, rev-1, sizes, - (apr_size_t)total_size, compression_level, - cancel_func, cancel_baton, iterpool)); + SVN_ERR(copy_revprops(fs, pack_file_dir, pack_filename, shard_path, + start_rev, rev-1, sizes, + (apr_size_t)total_size, compression_level, + cancel_func, cancel_baton, iterpool)); /* flush the manifest file and update permissions */ SVN_ERR(svn_stream_close(manifest_stream)); @@ -1920,41 +1853,3 @@ svn_fs_x__pack_revprops_shard(const char return SVN_NO_ERROR; } - -svn_error_t * -svn_fs_x__delete_revprops_shard(const char *shard_path, - apr_int64_t shard, - int max_files_per_dir, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) -{ - if (shard == 0) - { - apr_pool_t *iterpool = svn_pool_create(scratch_pool); - int i; - - /* delete all files except the one for revision 0 */ - for (i = 1; i < max_files_per_dir; ++i) - { - const char *path; - svn_pool_clear(iterpool); - - path = svn_dirent_join(shard_path, - apr_psprintf(iterpool, "%d", i), - iterpool); - if (cancel_func) - SVN_ERR(cancel_func(cancel_baton)); - - SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool)); - } - - svn_pool_destroy(iterpool); - } - else - SVN_ERR(svn_io_remove_dir2(shard_path, TRUE, - cancel_func, cancel_baton, scratch_pool)); - - return SVN_NO_ERROR; -} - Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.h URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.h?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.h (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/revprops.h Wed Aug 19 02:35:12 2015 @@ -20,8 +20,8 @@ * ==================================================================== */ -#ifndef SVN_LIBSVN_FS__REVPROPS_H -#define SVN_LIBSVN_FS__REVPROPS_H +#ifndef SVN_LIBSVN_FS_X_REVPROPS_H +#define SVN_LIBSVN_FS_X_REVPROPS_H #include "svn_fs.h" @@ -39,42 +39,6 @@ svn_error_t * svn_fs_x__reset_revprop_generation_file(svn_fs_t *fs, apr_pool_t *scratch_pool); -/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev. - * - * NOTE: Keep the old non-packed shards around until after the format bump. - * Otherwise, re-running upgrade will drop the packed revprop shard but - * have no unpacked data anymore. Call upgrade_cleanup_pack_revprops after - * the bump. - * - * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are - * used in the usual way. Temporary allocations are done in SCRATCH_POOL. - */ -svn_error_t * -svn_fs_x__upgrade_pack_revprops(svn_fs_t *fs, - svn_fs_upgrade_notify_t notify_func, - void *notify_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - -/* In the filesystem FS, remove all non-packed revprop shards up to - * min_unpacked_rev. Temporary allocations are done in SCRATCH_POOL. - * - * NOTIFY_FUNC and NOTIFY_BATON as well as CANCEL_FUNC and CANCEL_BATON are - * used in the usual way. Cancellation is supported in the sense that we - * will cleanly abort the operation. However, there will be remnant shards - * that must be removed manually. - * - * See upgrade_pack_revprops for more info. - */ -svn_error_t * -svn_fs_x__upgrade_cleanup_pack_revprops(svn_fs_t *fs, - svn_fs_upgrade_notify_t notify_func, - void *notify_baton, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - /* Read the revprops for revision REV in FS and return them in *PROPLIST_P. * If BYPASS_CACHE is set, don't consult the disks but always read from disk. * @@ -111,37 +75,9 @@ svn_fs_x__packed_revprop_available(svn_b /****** Packing FSX shards *********/ -/* Copy revprop files for revisions [START_REV, END_REV) from SHARD_PATH - * to the pack file at PACK_FILE_NAME in PACK_FILE_DIR. - * - * The file sizes have already been determined and written to SIZES. - * Please note that this function will be executed while the filesystem - * has been locked and that revprops files will therefore not be modified - * while the pack is in progress. - * - * COMPRESSION_LEVEL defines how well the resulting pack file shall be - * compressed or whether is shall be compressed at all. TOTAL_SIZE is - * a hint on which initial buffer size we should use to hold the pack file - * content. - * - * CANCEL_FUNC and CANCEL_BATON are used as usual. Temporary allocations - * are done in SCRATCH_POOL. - */ -svn_error_t * -svn_fs_x__copy_revprops(const char *pack_file_dir, - const char *pack_filename, - const char *shard_path, - svn_revnum_t start_rev, - svn_revnum_t end_rev, - apr_array_header_t *sizes, - apr_size_t total_size, - int compression_level, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - /* For the revprop SHARD at SHARD_PATH with exactly MAX_FILES_PER_DIR - * revprop files in it, create a packed shared at PACK_FILE_DIR. + * revprop files in it, create a packed shared at PACK_FILE_DIR in + * filesystem FS. * * COMPRESSION_LEVEL defines how well the resulting pack file shall be * compressed or whether is shall be compressed at all. Individual pack @@ -152,7 +88,8 @@ svn_fs_x__copy_revprops(const char *pack * allocations are done in SCRATCH_POOL. */ svn_error_t * -svn_fs_x__pack_revprops_shard(const char *pack_file_dir, +svn_fs_x__pack_revprops_shard(svn_fs_t *fs, + const char *pack_file_dir, const char *shard_path, apr_int64_t shard, int max_files_per_dir, @@ -162,23 +99,8 @@ svn_fs_x__pack_revprops_shard(const char void *cancel_baton, apr_pool_t *scratch_pool); -/* Delete the non-packed revprop SHARD at SHARD_PATH with exactly - * MAX_FILES_PER_DIR revprop files in it. If this is shard 0, keep the - * revprop file for revision 0. - * - * CANCEL_FUNC and CANCEL_BATON are used in the usual way. Temporary - * allocations are done in SCRATCH_POOL. - */ -svn_error_t * -svn_fs_x__delete_revprops_shard(const char *shard_path, - apr_int64_t shard, - int max_files_per_dir, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool); - #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* SVN_LIBSVN_FS__REVPROPS_H */ +#endif /* SVN_LIBSVN_FS_X_REVPROPS_H */ Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.c URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.c?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.c (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.c Wed Aug 19 02:35:12 2015 @@ -376,7 +376,7 @@ svn_fs_x__string_table_builder_estimate_ static void create_table(string_sub_table_t *target, builder_table_t *source, - apr_pool_t *pool, + apr_pool_t *result_pool, apr_pool_t *scratch_pool) { int i = 0; @@ -387,7 +387,8 @@ create_table(string_sub_table_t *target, /* pack sub-strings */ target->short_string_count = (apr_size_t)source->short_strings->nelts; - target->short_strings = apr_palloc(pool, sizeof(*target->short_strings) * + target->short_strings = apr_palloc(result_pool, + sizeof(*target->short_strings) * target->short_string_count); for (i = 0; i < source->short_strings->nelts; ++i) { @@ -433,13 +434,14 @@ create_table(string_sub_table_t *target, /* pack long strings */ target->long_string_count = (apr_size_t)source->long_strings->nelts; - target->long_strings = apr_palloc(pool, sizeof(*target->long_strings) * + target->long_strings = apr_palloc(result_pool, + sizeof(*target->long_strings) * target->long_string_count); for (i = 0; i < source->long_strings->nelts; ++i) { svn_string_t *string = &target->long_strings[i]; *string = APR_ARRAY_IDX(source->long_strings, i, svn_string_t); - string->data = apr_pstrmemdup(pool, string->data, string->len); + string->data = apr_pstrmemdup(result_pool, string->data, string->len); } data->len += PADDING; /* add a few extra bytes at the end of the buffer @@ -447,25 +449,25 @@ create_table(string_sub_table_t *target, assert(data->len < data->blocksize); memset(data->data + data->len - PADDING, 0, PADDING); - target->data = apr_pmemdup(pool, data->data, data->len); + target->data = apr_pmemdup(result_pool, data->data, data->len); target->data_size = data->len; } string_table_t * svn_fs_x__string_table_create(const string_table_builder_t *builder, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t i; - string_table_t *result = apr_pcalloc(pool, sizeof(*result)); + string_table_t *result = apr_pcalloc(result_pool, sizeof(*result)); result->size = (apr_size_t)builder->tables->nelts; result->sub_tables - = apr_pcalloc(pool, result->size * sizeof(*result->sub_tables)); + = apr_pcalloc(result_pool, result->size * sizeof(*result->sub_tables)); for (i = 0; i < result->size; ++i) create_table(&result->sub_tables[i], APR_ARRAY_IDX(builder->tables, i, builder_table_t*), - pool, + result_pool, builder->pool); return result; @@ -542,7 +544,7 @@ const char* svn_fs_x__string_table_get(const string_table_t *table, apr_size_t idx, apr_size_t *length, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t table_number = idx >> TABLE_SHIFT; apr_size_t sub_index = idx & STRING_INDEX_MASK; @@ -557,7 +559,7 @@ svn_fs_x__string_table_get(const string_ if (length) *length = sub_table->long_strings[sub_index].len; - return apr_pstrmemdup(pool, + return apr_pstrmemdup(result_pool, sub_table->long_strings[sub_index].data, sub_table->long_strings[sub_index].len); } @@ -568,7 +570,7 @@ svn_fs_x__string_table_get(const string_ { string_header_t *header = sub_table->short_strings + sub_index; apr_size_t len = header->head_length + header->tail_length; - char *result = apr_palloc(pool, len + PADDING); + char *result = apr_palloc(result_pool, len + PADDING); if (length) *length = len; @@ -579,7 +581,7 @@ svn_fs_x__string_table_get(const string_ } } - return apr_pstrmemdup(pool, "", 0); + return apr_pstrmemdup(result_pool, "", 0); } svn_error_t * @@ -830,7 +832,7 @@ const char* svn_fs_x__string_table_get_func(const string_table_t *table, apr_size_t idx, apr_size_t *length, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t table_number = idx >> TABLE_SHIFT; apr_size_t sub_index = idx & STRING_INDEX_MASK; @@ -861,7 +863,7 @@ svn_fs_x__string_table_get_func(const st if (length) *length = long_strings[sub_index].len; - return apr_pstrmemdup(pool, + return apr_pstrmemdup(result_pool, str_data, long_strings[sub_index].len); } @@ -889,7 +891,7 @@ svn_fs_x__string_table_get_func(const st /* reconstruct the char data and return it */ header = table_copy.short_strings + sub_index; len = header->head_length + header->tail_length; - result = apr_palloc(pool, len + PADDING); + result = apr_palloc(result_pool, len + PADDING); if (length) *length = len; Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.h URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.h?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.h (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/string_table.h Wed Aug 19 02:35:12 2015 @@ -69,21 +69,21 @@ apr_size_t svn_fs_x__string_table_builder_estimate_size(string_table_builder_t *builder); /* From the given BUILDER object, create a string table object allocated - * in POOL that contains all strings previously added to BUILDER. + * in RESULT_POOL that contains all strings previously added to BUILDER. */ string_table_t * svn_fs_x__string_table_create(const string_table_builder_t *builder, - apr_pool_t *pool); + apr_pool_t *result_pool); /* Extract string number INDEX from TABLE and return a copy of it allocated - * in POOL. If LENGTH is not NULL, set *LENGTH to strlen() of the result - * string. Returns an empty string for invalid indexes. + * in RESULT_POOL. If LENGTH is not NULL, set *LENGTH to strlen() of the + * result string. Returns an empty string for invalid indexes. */ const char* svn_fs_x__string_table_get(const string_table_t *table, apr_size_t index, apr_size_t *length, - apr_pool_t *pool); + apr_pool_t *result_pool); /* Write a serialized representation of the string table TABLE to STREAM. * Use SCRATCH_POOL for temporary allocations. @@ -116,15 +116,15 @@ svn_fs_x__deserialize_string_table(void string_table_t **table); /* Extract string number INDEX from the cache serialized representation at - * TABLE and return a copy of it allocated in POOL. If LENGTH is not NULL, - * set *LENGTH to strlen() of the result string. Returns an empty string - * for invalid indexes. + * TABLE and return a copy of it allocated in RESULT_POOL. If LENGTH is not + * NULL, set *LENGTH to strlen() of the result string. Returns an empty + * string for invalid indexes. */ const char* svn_fs_x__string_table_get_func(const string_table_t *table, apr_size_t idx, apr_size_t *length, - apr_pool_t *pool); + apr_pool_t *result_pool); #ifdef __cplusplus } Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.c URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.c?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.c (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.c Wed Aug 19 02:35:12 2015 @@ -71,13 +71,13 @@ encode_number(apr_int64_t number, char * const char* svn_fs_x__combine_number_and_string(apr_int64_t number, const char *string, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t len = strlen(string); /* number part requires max. 10x7 bits + 1 space. * Add another 1 for the terminal 0 */ - char *key_buffer = apr_palloc(pool, len + 12); + char *key_buffer = apr_palloc(result_pool, len + 12); const char *key = key_buffer; /* Prepend the number to the string and separate them by space. No other @@ -120,7 +120,7 @@ serialize_svn_string(svn_temp_serializer /* Utility function to deserialize the STRING inside the BUFFER. */ static void -deserialize_svn_string(void *buffer, svn_string_t **string) +deserialize_svn_string(const void *buffer, svn_string_t **string) { svn_temp_deserializer__resolve(buffer, (void **)string); if (*string == NULL) @@ -173,14 +173,14 @@ svn_fs_x__serialize_apr_array(svn_temp_s void svn_fs_x__deserialize_apr_array(void *buffer, apr_array_header_t **array, - apr_pool_t *pool) + apr_pool_t *result_pool) { svn_temp_deserializer__resolve(buffer, (void **)array); if (*array == NULL) return; svn_temp_deserializer__resolve(*array, (void **)&(*array)->elts); - (*array)->pool = pool; + (*array)->pool = result_pool; } /* auxilliary structure representing the content of a directory array */ @@ -224,7 +224,7 @@ serialize_dir_entry(svn_temp_serializer_ svn_temp_serializer__push(context, (const void * const *)entry_p, - sizeof(svn_fs_x__dirent_t)); + sizeof(**entry_p)); svn_temp_serializer__add_string(context, &entry->name); @@ -293,13 +293,15 @@ serialize_dir(apr_array_header_t *entrie } /* Utility function to reconstruct a dir entries array from serialized data - * in BUFFER and DIR_DATA. Allocation will be made form POOL. + * in BUFFER and DIR_DATA. Allocation will be made form RESULT_POOL. */ static apr_array_header_t * -deserialize_dir(void *buffer, dir_data_t *dir_data, apr_pool_t *pool) +deserialize_dir(void *buffer, + dir_data_t *dir_data, + apr_pool_t *result_pool) { - apr_array_header_t *result - = apr_array_make(pool, dir_data->count, sizeof(svn_fs_x__dirent_t *)); + apr_array_header_t *result = apr_array_make(result_pool, dir_data->count, + sizeof(svn_fs_x__dirent_t *)); apr_size_t i; apr_size_t count; svn_fs_x__dirent_t *entry; @@ -326,9 +328,12 @@ deserialize_dir(void *buffer, dir_data_t return result; } -void -svn_fs_x__noderev_serialize(svn_temp_serializer__context_t *context, - svn_fs_x__noderev_t * const *noderev_p) +/** + * Serialize a NODEREV_P within the serialization CONTEXT. + */ +static void +noderev_serialize(svn_temp_serializer__context_t *context, + svn_fs_x__noderev_t * const *noderev_p) { const svn_fs_x__noderev_t *noderev = *noderev_p; if (noderev == NULL) @@ -351,11 +356,12 @@ svn_fs_x__noderev_serialize(svn_temp_ser svn_temp_serializer__pop(context); } - -void -svn_fs_x__noderev_deserialize(void *buffer, - svn_fs_x__noderev_t **noderev_p, - apr_pool_t *pool) +/** + * Deserialize a NODEREV_P within the BUFFER and associate it with. + */ +static void +noderev_deserialize(void *buffer, + svn_fs_x__noderev_t **noderev_p) { svn_fs_x__noderev_t *noderev; @@ -451,7 +457,7 @@ svn_error_t * svn_fs_x__deserialize_txdelta_window(void **item, void *buffer, apr_size_t buffer_size, - apr_pool_t *pool) + apr_pool_t *result_pool) { svn_txdelta_window_t *window; @@ -474,38 +480,6 @@ svn_fs_x__deserialize_txdelta_window(voi return SVN_NO_ERROR; } -svn_error_t * -svn_fs_x__serialize_manifest(void **data, - apr_size_t *data_len, - void *in, - apr_pool_t *pool) -{ - apr_array_header_t *manifest = in; - - *data_len = sizeof(apr_off_t) *manifest->nelts; - *data = apr_palloc(pool, *data_len); - memcpy(*data, manifest->elts, *data_len); - - return SVN_NO_ERROR; -} - -svn_error_t * -svn_fs_x__deserialize_manifest(void **out, - void *data, - apr_size_t data_len, - apr_pool_t *pool) -{ - apr_array_header_t *manifest = apr_array_make(pool, 1, sizeof(apr_off_t)); - - manifest->nelts = (int) (data_len / sizeof(apr_off_t)); - manifest->nalloc = (int) (data_len / sizeof(apr_off_t)); - manifest->elts = (char*)data; - - *out = manifest; - - return SVN_NO_ERROR; -} - /* Auxiliary structure representing the content of a properties hash. This structure is much easier to (de-)serialize than an apr_hash. */ @@ -611,9 +585,9 @@ svn_error_t * svn_fs_x__deserialize_properties(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool) + apr_pool_t *result_pool) { - apr_hash_t *hash = svn_hash__make(pool); + apr_hash_t *hash = svn_hash__make(result_pool); properties_data_t *properties = (properties_data_t *)data; size_t i; @@ -661,7 +635,7 @@ svn_fs_x__serialize_node_revision(void * pool); /* serialize the noderev */ - svn_fs_x__noderev_serialize(context, &noderev); + noderev_serialize(context, &noderev); /* return serialized data */ serialized = svn_temp_serializer__get(context); @@ -675,13 +649,13 @@ svn_error_t * svn_fs_x__deserialize_node_revision(void **item, void *buffer, apr_size_t buffer_size, - apr_pool_t *pool) + apr_pool_t *result_pool) { /* Copy the _full_ buffer as it also contains the sub-structures. */ svn_fs_x__noderev_t *noderev = (svn_fs_x__noderev_t *)buffer; /* fixup of all pointers etc. */ - svn_fs_x__noderev_deserialize(noderev, &noderev, pool); + noderev_deserialize(noderev, &noderev); /* done */ *item = noderev; @@ -723,13 +697,13 @@ svn_error_t * svn_fs_x__deserialize_dir_entries(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool) + apr_pool_t *result_pool) { /* Copy the _full_ buffer as it also contains the sub-structures. */ dir_data_t *dir_data = (dir_data_t *)data; /* reconstruct the hash from the serialized data */ - *out = deserialize_dir(dir_data, dir_data, pool); + *out = deserialize_dir(dir_data, dir_data, result_pool); return SVN_NO_ERROR; } @@ -1035,11 +1009,8 @@ svn_fs_x__serialize_rep_header(void **da void *in, apr_pool_t *pool) { - svn_fs_x__rep_header_t *copy = apr_palloc(pool, sizeof(*copy)); - *copy = *(svn_fs_x__rep_header_t *)in; - *data_len = sizeof(svn_fs_x__rep_header_t); - *data = copy; + *data = in; return SVN_NO_ERROR; } @@ -1048,12 +1019,8 @@ svn_error_t * svn_fs_x__deserialize_rep_header(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool) + apr_pool_t *result_pool) { - svn_fs_x__rep_header_t *copy = apr_palloc(pool, sizeof(*copy)); - SVN_ERR_ASSERT(data_len == sizeof(*copy)); - - *copy = *(svn_fs_x__rep_header_t *)data; *out = data; return SVN_NO_ERROR; @@ -1088,8 +1055,7 @@ serialize_change(svn_temp_serializer__co */ static void deserialize_change(void *buffer, - svn_fs_x__change_t **change_p, - apr_pool_t *pool) + svn_fs_x__change_t **change_p) { svn_fs_x__change_t * change; @@ -1142,7 +1108,7 @@ svn_fs_x__serialize_changes(void **data, svn_temp_serializer__push(context, (const void * const *)&changes.changes, - changes.count * sizeof(svn_fs_x__change_t*)); + changes.count * sizeof(**changes.changes)); for (i = 0; i < changes.count; ++i) serialize_change(context, &changes.changes[i]); @@ -1162,11 +1128,11 @@ svn_error_t * svn_fs_x__deserialize_changes(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool) + apr_pool_t *result_pool) { int i; changes_data_t *changes = (changes_data_t *)data; - apr_array_header_t *array = apr_array_make(pool, 0, + apr_array_header_t *array = apr_array_make(result_pool, 0, sizeof(svn_fs_x__change_t *)); /* de-serialize our auxiliary data structure */ @@ -1175,8 +1141,7 @@ svn_fs_x__deserialize_changes(void **out /* de-serialize each entry and add it to the array */ for (i = 0; i < changes->count; ++i) deserialize_change(changes->changes, - (svn_fs_x__change_t **)&changes->changes[i], - pool); + (svn_fs_x__change_t **)&changes->changes[i]); /* Use the changes buffer as the array's data buffer * (DATA remains valid for at least as long as POOL). */ @@ -1189,149 +1154,4 @@ svn_fs_x__deserialize_changes(void **out return SVN_NO_ERROR; } - -/* Auxiliary structure representing the content of a svn_mergeinfo_t hash. - This structure is much easier to (de-)serialize than an APR array. - */ -typedef struct mergeinfo_data_t -{ - /* number of paths in the hash */ - unsigned count; - - /* COUNT keys (paths) */ - const char **keys; - - /* COUNT keys lengths (strlen of path) */ - apr_ssize_t *key_lengths; - - /* COUNT entries, each giving the number of ranges for the key */ - int *range_counts; - - /* all ranges in a single, concatenated buffer */ - svn_merge_range_t *ranges; -} mergeinfo_data_t; - -svn_error_t * -svn_fs_x__serialize_mergeinfo(void **data, - apr_size_t *data_len, - void *in, - apr_pool_t *pool) -{ - svn_mergeinfo_t mergeinfo = in; - mergeinfo_data_t merges; - svn_temp_serializer__context_t *context; - svn_stringbuf_t *serialized; - apr_hash_index_t *hi; - unsigned i; - int k; - apr_size_t range_count; - - /* initialize our auxiliary data structure */ - merges.count = apr_hash_count(mergeinfo); - merges.keys = apr_palloc(pool, sizeof(*merges.keys) * merges.count); - merges.key_lengths = apr_palloc(pool, sizeof(*merges.key_lengths) * - merges.count); - merges.range_counts = apr_palloc(pool, sizeof(*merges.range_counts) * - merges.count); - - i = 0; - range_count = 0; - for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi), ++i) - { - svn_rangelist_t *ranges; - apr_hash_this(hi, (const void**)&merges.keys[i], - &merges.key_lengths[i], - (void **)&ranges); - merges.range_counts[i] = ranges->nelts; - range_count += ranges->nelts; - } - - merges.ranges = apr_palloc(pool, sizeof(*merges.ranges) * range_count); - - i = 0; - for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi)) - { - svn_rangelist_t *ranges = apr_hash_this_val(hi); - for (k = 0; k < ranges->nelts; ++k, ++i) - merges.ranges[i] = *APR_ARRAY_IDX(ranges, k, svn_merge_range_t*); - } - - /* serialize it and all its elements */ - context = svn_temp_serializer__init(&merges, - sizeof(merges), - range_count * 30, - pool); - - /* keys array */ - svn_temp_serializer__push(context, - (const void * const *)&merges.keys, - merges.count * sizeof(*merges.keys)); - - for (i = 0; i < merges.count; ++i) - svn_temp_serializer__add_string(context, &merges.keys[i]); - - svn_temp_serializer__pop(context); - - /* key lengths array */ - svn_temp_serializer__add_leaf(context, - (const void * const *)&merges.key_lengths, - merges.count * sizeof(*merges.key_lengths)); - - /* range counts array */ - svn_temp_serializer__add_leaf(context, - (const void * const *)&merges.range_counts, - merges.count * sizeof(*merges.range_counts)); - - /* ranges */ - svn_temp_serializer__add_leaf(context, - (const void * const *)&merges.ranges, - range_count * sizeof(*merges.ranges)); - - /* return the serialized result */ - serialized = svn_temp_serializer__get(context); - - *data = serialized->data; - *data_len = serialized->len; - - return SVN_NO_ERROR; -} - -svn_error_t * -svn_fs_x__deserialize_mergeinfo(void **out, - void *data, - apr_size_t data_len, - apr_pool_t *pool) -{ - unsigned i; - int k, n; - mergeinfo_data_t *merges = (mergeinfo_data_t *)data; - svn_mergeinfo_t mergeinfo; - - /* de-serialize our auxiliary data structure */ - svn_temp_deserializer__resolve(merges, (void**)&merges->keys); - svn_temp_deserializer__resolve(merges, (void**)&merges->key_lengths); - svn_temp_deserializer__resolve(merges, (void**)&merges->range_counts); - svn_temp_deserializer__resolve(merges, (void**)&merges->ranges); - - /* de-serialize keys and add entries to the result */ - n = 0; - mergeinfo = svn_hash__make(pool); - for (i = 0; i < merges->count; ++i) - { - svn_rangelist_t *ranges = apr_array_make(pool, - merges->range_counts[i], - sizeof(svn_merge_range_t*)); - for (k = 0; k < merges->range_counts[i]; ++k, ++n) - APR_ARRAY_PUSH(ranges, svn_merge_range_t*) = &merges->ranges[n]; - - svn_temp_deserializer__resolve(merges->keys, - (void**)&merges->keys[i]); - apr_hash_set(mergeinfo, merges->keys[i], merges->key_lengths[i], ranges); - } - - /* done */ - *out = mergeinfo; - - return SVN_NO_ERROR; -} Modified: subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.h URL: http://svn.apache.org/viewvc/subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.h?rev=1696514&r1=1696513&r2=1696514&view=diff ============================================================================== --- subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.h (original) +++ subversion/branches/patch-exec/subversion/libsvn_fs_x/temp_serializer.h Wed Aug 19 02:35:12 2015 @@ -20,8 +20,8 @@ * ==================================================================== */ -#ifndef SVN_LIBSVN_FS__TEMP_SERIALIZER_H -#define SVN_LIBSVN_FS__TEMP_SERIALIZER_H +#ifndef SVN_LIBSVN_FS_X_TEMP_SERIALIZER_H +#define SVN_LIBSVN_FS_X_TEMP_SERIALIZER_H #include "private/svn_temp_serializer.h" #include "fs.h" @@ -29,28 +29,12 @@ /** * Prepend the @a number to the @a string in a space efficient way such that * no other (number,string) combination can produce the same result. - * Allocate temporaries as well as the result from @a pool. + * Allocate the result from @a result_pool. */ const char* svn_fs_x__combine_number_and_string(apr_int64_t number, const char *string, - apr_pool_t *pool); - -/** - * Serialize a @a noderev_p within the serialization @a context. - */ -void -svn_fs_x__noderev_serialize(struct svn_temp_serializer__context_t *context, - svn_fs_x__noderev_t * const *noderev_p); - -/** - * Deserialize a @a noderev_p within the @a buffer and associate it with - * @a pool. - */ -void -svn_fs_x__noderev_deserialize(void *buffer, - svn_fs_x__noderev_t **noderev_p, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Serialize APR array @a *a within the serialization @a context. @@ -62,12 +46,12 @@ svn_fs_x__serialize_apr_array(struct svn /** * Deserialize APR @a *array within the @a buffer. Set its pool member to - * @a pool. The elements within the array must not contain pointers. + * @a result_pool. The elements within the array must not contain pointers. */ void svn_fs_x__deserialize_apr_array(void *buffer, apr_array_header_t **array, - apr_pool_t *pool); + apr_pool_t *result_pool); /** @@ -104,27 +88,7 @@ svn_error_t * svn_fs_x__deserialize_txdelta_window(void **item, void *buffer, apr_size_t buffer_size, - apr_pool_t *pool); - -/** - * Implements #svn_cache__serialize_func_t for a manifest - * (@a in is an #apr_array_header_t of apr_off_t elements). - */ -svn_error_t * -svn_fs_x__serialize_manifest(void **data, - apr_size_t *data_len, - void *in, - apr_pool_t *pool); - -/** - * Implements #svn_cache__deserialize_func_t for a manifest - * (@a *out is an #apr_array_header_t of apr_off_t elements). - */ -svn_error_t * -svn_fs_x__deserialize_manifest(void **out, - void *data, - apr_size_t data_len, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Implements #svn_cache__serialize_func_t for a properties hash @@ -144,7 +108,7 @@ svn_error_t * svn_fs_x__deserialize_properties(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Implements #svn_cache__serialize_func_t for #svn_fs_x__noderev_t @@ -162,7 +126,7 @@ svn_error_t * svn_fs_x__deserialize_node_revision(void **item, void *buffer, apr_size_t buffer_size, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Implements #svn_cache__serialize_func_t for a directory contents array @@ -180,7 +144,7 @@ svn_error_t * svn_fs_x__deserialize_dir_entries(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Implements #svn_cache__partial_getter_func_t. Set (apr_off_t) @a *out @@ -258,7 +222,7 @@ svn_error_t * svn_fs_x__deserialize_rep_header(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool); + apr_pool_t *result_pool); /** * Implements #svn_cache__serialize_func_t for an #apr_array_header_t of @@ -278,24 +242,6 @@ svn_error_t * svn_fs_x__deserialize_changes(void **out, void *data, apr_size_t data_len, - apr_pool_t *pool); - -/** - * Implements #svn_cache__serialize_func_t for #svn_mergeinfo_t objects. - */ -svn_error_t * -svn_fs_x__serialize_mergeinfo(void **data, - apr_size_t *data_len, - void *in, - apr_pool_t *pool); - -/** - * Implements #svn_cache__deserialize_func_t for #svn_mergeinfo_t objects. - */ -svn_error_t * -svn_fs_x__deserialize_mergeinfo(void **out, - void *data, - apr_size_t data_len, - apr_pool_t *pool); + apr_pool_t *result_pool); #endif