Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Jan 27, 2013

Implement native versions of AllocateFileRange() for:

  • Linux: posix_fallocate()
  • Mac OSX: fcntl(..., F_PREALLOCATE, ...)
  • Windows: SetEndOfFile()

This should prevent the double-writing fallback that is used currently.

@BitcoinPullTester
Copy link

@sipa
Copy link
Member Author

sipa commented Jan 28, 2013

Test plan: either (1) start syncing from scratch or (2) delete the blocks/rev* files and start a -reindex. In both cases, at any point in time, should the filesize of the blk* files be a multiple of 16 MiB and the rev* files a multiple of 1 MiB.

@BitcoinPullTester
Copy link

@CodeShark
Copy link
Contributor

The test succeeded under OS X Version 10.8.2

@gmaxwell
Copy link
Contributor

Reindex test passes on Fedora 16/17. Needs windows testing.

@gavinandresen
Copy link
Contributor

This is just an optimization, yes?

I think it can wait for 0.8.1.

@sipa
Copy link
Member Author

sipa commented Jan 28, 2013

Indeed an optimization, but one that is easy to test. Ok for 0.8.1.

@jgarzik
Copy link
Contributor

jgarzik commented Jan 30, 2013

Nit: use #elif

ACK

@sipa
Copy link
Member Author

sipa commented Jan 30, 2013

Added a commit to drop the pre-allocated padding when finalizing a block file (=moving to a next one).

@gmaxwell
Copy link
Contributor

ah, good to not waste 30MiB...

@sipa
Copy link
Member Author

sipa commented Jan 30, 2013

@gmaxwell Largest advantage is the ability to cat the files together to create a bootstrap.dat :)

... though I'm sure people would otherwise complain about wasted disk space too :p

@BitcoinPullTester
Copy link

@laanwj
Copy link
Member

laanwj commented Feb 4, 2013

ACK

gavinandresen added a commit that referenced this pull request Feb 22, 2013
Native versions for AllocateFileRange()
@gavinandresen gavinandresen merged commit b8f4e42 into bitcoin:master Feb 22, 2013
@sipa sipa deleted the prealloc branch May 3, 2013 18:50
laudney pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request Mar 19, 2014
Native versions for AllocateFileRange()
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants