mirror of https://github.com/BOINC/boinc.git
- file upload handler:
Do first read from socket before opening the disk file (an attempt to fix filesystem lockups on WCG). Increase buffer size from 16KB to 256KB. svn path=/trunk/boinc/; revision=26046
This commit is contained in:
parent
4fea52c6f2
commit
80be72e9b5
|
@ -5593,7 +5593,7 @@ David 17 Aug 2012
|
|||
vda_lib2.cpp
|
||||
vda_lib.h
|
||||
|
||||
David 17 Aug 2012
|
||||
David 18 Aug 2012
|
||||
- client: if a project has excluded GPUs of a given type,
|
||||
allow it to fetch work of that type if the # of runnable
|
||||
jobs it <= the # of non-excluded instances (rather than 0).
|
||||
|
@ -5601,3 +5601,12 @@ David 17 Aug 2012
|
|||
client/
|
||||
work_fetch.cpp,h
|
||||
rr_sim.cpp
|
||||
|
||||
David 18 Aug 2012
|
||||
- file upload handler:
|
||||
Do first read from socket before opening the disk file
|
||||
(an attempt to fix filesystem lockups on WCG).
|
||||
Increase buffer size from 16KB to 256KB.
|
||||
|
||||
sched/
|
||||
file_upload_handler.cpp
|
||||
|
|
|
@ -105,7 +105,7 @@ int return_success(const char* text) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define BLOCK_SIZE 16382
|
||||
#define BLOCK_SIZE (256*1024)
|
||||
double bytes_left=-1;
|
||||
|
||||
// read from socket, write to file
|
||||
|
@ -114,9 +114,27 @@ double bytes_left=-1;
|
|||
int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
|
||||
unsigned char buf[BLOCK_SIZE];
|
||||
struct stat sbuf;
|
||||
int pid;
|
||||
int pid, fd=0;
|
||||
|
||||
// open file. Use raw IO not buffered IO so that we can use reliable
|
||||
// caller guarantees that nbytes > offset
|
||||
//
|
||||
bytes_left = nbytes - offset;
|
||||
|
||||
while (bytes_left > 0) {
|
||||
|
||||
int n, m, to_write;
|
||||
|
||||
m = bytes_left<(double)BLOCK_SIZE ? (int)bytes_left : BLOCK_SIZE;
|
||||
|
||||
// try to get m bytes from socket (n>=0 is number actually returned)
|
||||
//
|
||||
n = fread(buf, 1, m, in);
|
||||
|
||||
// delay opening the file until we've done the first socket read
|
||||
// to avoid filesystem lockups (WCG, possible paranoia)
|
||||
//
|
||||
if (!fd) {
|
||||
// Use raw IO not buffered IO so that we can use reliable
|
||||
// posix file locking.
|
||||
// Advisory file locking is not guaranteed reliable when
|
||||
// used with stream buffered IO.
|
||||
|
@ -172,20 +190,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
|
|||
this_filename, (int)sbuf.st_size, offset
|
||||
);
|
||||
}
|
||||
|
||||
// caller guarantees that nbytes > offset
|
||||
//
|
||||
bytes_left = nbytes - offset;
|
||||
|
||||
while (bytes_left > 0) {
|
||||
|
||||
int n, m, to_write;
|
||||
|
||||
m = bytes_left<(double)BLOCK_SIZE ? (int)bytes_left : BLOCK_SIZE;
|
||||
|
||||
// try to get m bytes from socket (n>=0 is number actually returned)
|
||||
//
|
||||
n = fread(buf, 1, m, in);
|
||||
}
|
||||
|
||||
// try to write n bytes to file
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue