Commit 25a5623a authored by Yoni Fogel's avatar Yoni Fogel

closes [t:4906] Split ft-serialize.c. Added (hopefully temporary) ft-pwrite.c,h

git-svn-id: file:///svn/toku/tokudb@43725 c7de825b-a66e-492c-adef-691d508d4ae1
parent 75f2f013
...@@ -32,7 +32,9 @@ set(FT_SOURCES ...@@ -32,7 +32,9 @@ set(FT_SOURCES
ftloader.c ftloader.c
ftloader-callback.c ftloader-callback.c
ft_msg.c ft_msg.c
ft_node-serialize.c
ft-ops.c ft-ops.c
ft-pwrite.c
ft-serialize.c ft-serialize.c
ft-test-helpers.c ft-test-helpers.c
ft-verify.c ft-verify.c
......
...@@ -377,4 +377,3 @@ block_allocator_get_unused_statistics(BLOCK_ALLOCATOR ba, TOKU_DB_FRAGMENTATION ...@@ -377,4 +377,3 @@ block_allocator_get_unused_statistics(BLOCK_ALLOCATOR ba, TOKU_DB_FRAGMENTATION
} }
} }
} }
...@@ -923,4 +923,6 @@ toku_ft_node_put_cmd ( ...@@ -923,4 +923,6 @@ toku_ft_node_put_cmd (
void toku_flusher_thread_set_callback(void (*callback_f)(int, void*), void* extra); void toku_flusher_thread_set_callback(void (*callback_f)(int, void*), void* extra);
enum deserialize_error_code toku_upgrade_subtree_estimates_to_stat64info(int fd, FT h);
#endif #endif
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id: ft-serialize.c 43686 2012-05-18 23:21:00Z leifwalsh $"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "includes.h"
#include "sort.h"
#include "threadpool.h"
#include "ft-pwrite.h"
#include <compress.h>
//TODO(fizzfaldt): determine if this is necessary AT ALL and try to delete
// This mutex protects pwrite from running in parallel, and also protects modifications to the block allocator.
static toku_mutex_t pwrite_mutex = { PTHREAD_MUTEX_INITIALIZER };
static int pwrite_is_locked=0;
void
toku_lock_for_pwrite(void) {
// Locks the pwrite_mutex.
toku_mutex_lock(&pwrite_mutex);
pwrite_is_locked = 1;
}
void
toku_unlock_for_pwrite(void) {
pwrite_is_locked = 0;
toku_mutex_unlock(&pwrite_mutex);
}
void
toku_full_pwrite_extend(int fd, const void *buf, size_t count, toku_off_t offset)
// requires that the pwrite has been locked
// On failure, this does not return (an assertion fails or something).
{
invariant(pwrite_is_locked);
{
int r = maybe_preallocate_in_file(fd, offset+count);
lazy_assert_zero(r);
}
toku_os_full_pwrite(fd, buf, count, offset);
}
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id: ft-serialize.c 43686 2012-05-18 23:21:00Z leifwalsh $"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#ifndef FT_PWRITE_H
#define FT_PWRITE_H
void toku_lock_for_pwrite(void);
void toku_unlock_for_pwrite(void);
void toku_full_pwrite_extend(int fd, const void *buf, size_t count, toku_off_t offset);
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment