2011/8/26 Tommi Virtanen <tommi.virtanen@xxxxxxxxxxxxx>: > On Fri, Aug 26, 2011 at 12:25, Yehuda Sadeh Weinraub <yehudasa@xxxxxxxxx> wrote: >> On Fri, Aug 26, 2011 at 12:10 PM, Tommi Virtanen >> <tommi.virtanen@xxxxxxxxxxxxx> wrote: >>> e.g. 8kB at a time. And at that point you might as well just use read >>> and not read_iterate, that'll do the memsetting etc for you, and then >>> you can use a static buffer and avoid malloc/free every round. There's >>> no shortcut to be had from "skipping" holes when you need to feed >>> bytes to a hash function. >> >> Well, when using read_iterate you avoid reading extra data over the >> network when the object (chunk) exists (and is sparse). We can >> probably have some optimization here, and only allocate and memset a >> buffer once for the case where len == objsize and reuse it later. > > Reading src/librbd.cc, I don't see the holes going over the wire in > either case. read() is just a simple wrapper on top of read_iterate(), > that memsets to 0 in case of a hole. Which in this case he was doing > manually, so why not just use read() in the first place. I think Yehuda meant that we could reuse the buffer to avoid the malloc/memset for every hole. But I think that the need for optimization in this case isn't really that big and the code is simpler to read without having a global buffer of zeros. Christian -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html