mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-19 01:17:26 +00:00
Use 8MB as block size for files uploaded from web.
This commit is contained in:
@@ -22,6 +22,15 @@
|
||||
#define finger rabin_checksum
|
||||
#define rolling_finger rabin_rolling_checksum
|
||||
|
||||
#define BLOCK_SZ (1024*1024*1)
|
||||
#define BLOCK_MIN_SZ (1024*256)
|
||||
#define BLOCK_MAX_SZ (1024*1024*4)
|
||||
#define BLOCK_WIN_SZ 48
|
||||
|
||||
#define NAME_MAX_SZ 4096
|
||||
|
||||
#define BREAK_VALUE 0x0013 ///0x0513
|
||||
|
||||
#define READ_SIZE 1024 * 4
|
||||
|
||||
#define BYTE_TO_HEX(b) (((b)>=10)?('a'+b-10):('0'+b))
|
||||
|
@@ -6,16 +6,6 @@
|
||||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BLOCK_SZ (1024*1024*1)
|
||||
#define BLOCK_MIN_SZ (1024*256)
|
||||
#define BLOCK_MAX_SZ (1024*1024*4)
|
||||
#define BLOCK_WIN_SZ 48
|
||||
|
||||
#define NAME_MAX_SZ 4096
|
||||
|
||||
#define BREAK_VALUE 0x0013 ///0x0513
|
||||
|
||||
|
||||
#ifdef HAVE_MD5
|
||||
#include "md5.h"
|
||||
#define get_checksum md5
|
||||
|
@@ -761,6 +761,10 @@ out:
|
||||
|
||||
#endif /* SEAFILE_SERVER */
|
||||
|
||||
#define CDC_AVERAGE_BLOCK_SIZE (1 << 23) /* 8MB */
|
||||
#define CDC_MIN_BLOCK_SIZE (6 * (1 << 20)) /* 6MB */
|
||||
#define CDC_MAX_BLOCK_SIZE (10 * (1 << 20)) /* 10MB */
|
||||
|
||||
int
|
||||
seaf_fs_manager_index_blocks (SeafFSManager *mgr,
|
||||
const char *repo_id,
|
||||
@@ -791,9 +795,9 @@ seaf_fs_manager_index_blocks (SeafFSManager *mgr,
|
||||
|
||||
#if defined SEAFILE_SERVER && defined FULL_FEATURE
|
||||
if (use_cdc || version == 0) {
|
||||
cdc.block_sz = calculate_chunk_size (sb.st_size);
|
||||
cdc.block_min_sz = cdc.block_sz >> 2;
|
||||
cdc.block_max_sz = cdc.block_sz << 2;
|
||||
cdc.block_sz = CDC_AVERAGE_BLOCK_SIZE;
|
||||
cdc.block_min_sz = CDC_MIN_BLOCK_SIZE;
|
||||
cdc.block_max_sz = CDC_MAX_BLOCK_SIZE;
|
||||
cdc.write_block = seafile_write_chunk;
|
||||
memcpy (cdc.repo_id, repo_id, 36);
|
||||
cdc.version = version;
|
||||
@@ -811,9 +815,9 @@ seaf_fs_manager_index_blocks (SeafFSManager *mgr,
|
||||
}
|
||||
}
|
||||
#else
|
||||
cdc.block_sz = calculate_chunk_size (sb.st_size);
|
||||
cdc.block_min_sz = cdc.block_sz >> 2;
|
||||
cdc.block_max_sz = cdc.block_sz << 2;
|
||||
cdc.block_sz = CDC_AVERAGE_BLOCK_SIZE;
|
||||
cdc.block_min_sz = CDC_MIN_BLOCK_SIZE;
|
||||
cdc.block_max_sz = CDC_MAX_BLOCK_SIZE;
|
||||
cdc.write_block = seafile_write_chunk;
|
||||
memcpy (cdc.repo_id, repo_id, 36);
|
||||
cdc.version = version;
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#define DEFAULT_THREADS 50
|
||||
#define DEFAULT_MAX_DOWNLOAD_DIR_SIZE 100 * ((gint64)1 << 20) /* 100MB */
|
||||
#define DEFAULT_MAX_INDEXING_THREADS 1
|
||||
#define DEFAULT_FIXED_BLOCK_SIZE ((gint64)1 << 23) /* 8MB */
|
||||
|
||||
#define HOST "host"
|
||||
#define PORT "port"
|
||||
@@ -150,11 +151,11 @@ load_http_config (HttpServerStruct *htp_server, SeafileSession *session)
|
||||
"fixed_block_size",
|
||||
&error);
|
||||
if (error){
|
||||
htp_server->fixed_block_size = BLOCK_SZ;
|
||||
htp_server->fixed_block_size = DEFAULT_FIXED_BLOCK_SIZE;
|
||||
g_clear_error(&error);
|
||||
} else {
|
||||
if (fixed_block_size_mb <= 0)
|
||||
htp_server->fixed_block_size = BLOCK_SZ;
|
||||
htp_server->fixed_block_size = DEFAULT_FIXED_BLOCK_SIZE;
|
||||
else
|
||||
htp_server->fixed_block_size = fixed_block_size_mb * ((gint64)1 << 20);
|
||||
}
|
||||
|
Reference in New Issue
Block a user