From 1f5dd89c8f93613b78dbe2be0f57ecb9c575d66e Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 6 Mar 2015 21:29:09 -0800 Subject: [PATCH] cas: increase reader iobuf size in WriteACI to 32KiB Consuming tar files 512 bytes at a time is silly: open("stage1.aci", O_RDONLY|O_CLOEXEC) = 3 read(3, "\37\213\10\0\0\tn\210\0\377\344\375\r|\24\325\0250\16\317\354\7Y00Q\tFE\210\272("..., 512) = 512 stat("/var/lib/rkt/tmp", ...) = 0 getpid() = 14921 open("/var/lib/rkt/tmp/925091843", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4 read(3, "\24\231\215\257\272\361]{\316\367\206s\276\377}\316\367k\347|\277t\316\367\37\316\371~\346\234\357'"..., 512) = 512 read(3, "\322\340\5T\25\312@\25\367\312\254\205\255\361\234\360\276\200\335\227\210\305\355P\356\36\30J]\374\217\214"..., 512) = 512 read(3, "\254\323\235W/~\353.j\225\3745q+|c\245\3706\306/2i\nX(\337N\2644\21X"..., 512) = 512 read(3, "#|\262\323\301x=;\331\310\304-\352\30\221\333\177\201\r\fj\203Y\210D\1\250#\10Sw\260"..., 512) = 512 ... --- cas/cas.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cas/cas.go b/cas/cas.go index 1b92871..4383d97 100644 --- a/cas/cas.go +++ b/cas/cas.go @@ -180,7 +180,7 @@ func (ds Store) WriteStream(key string, r io.Reader) error { // (i.e. the hash of the uncompressed ACI) func (ds Store) WriteACI(r io.Reader) (string, error) { // Peek at the first 512 bytes of the reader to detect filetype - br := bufio.NewReaderSize(r, 512) + br := bufio.NewReaderSize(r, 32768) hd, err := br.Peek(512) switch err { case nil: