[PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Christian Brunner
We needed to get an md5 checksum of an rbd image. Since librbd is using a lot of sparse operations, this was not possible without writing an image to a local disk. With this patch exporting the image is no longer needed. You can do "rbd md5 image" and you will get the same output as you would call

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Tommi Virtanen
On Fri, Aug 26, 2011 at 11:51, Christian Brunner wrote: > +  if (!buf) { > +    len = ofs-lastofs; > +    tempbuf = (byte *) malloc(len); > +    if (!tempbuf) > +      return -ENOMEM; > +    hashbuf = tempbuf; > +  } > +  Hash->Update((const byte *) hashbuf, len); That'll still try to allocate 10

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Yehuda Sadeh Weinraub
On Fri, Aug 26, 2011 at 11:51 AM, Christian Brunner wrote: > +static int hash_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg) > +{ > +  ceph::crypto::Digest *Hash = (ceph::crypto::Digest *)arg; > +  byte *hashbuf = (byte *) buf; Looking at it again, hashbuf is pretty much useless, y

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Yehuda Sadeh Weinraub
On Fri, Aug 26, 2011 at 12:10 PM, Tommi Virtanen wrote: > On Fri, Aug 26, 2011 at 11:51, Christian Brunner wrote: >> +  if (!buf) { >> +    len = ofs-lastofs; >> +    tempbuf = (byte *) malloc(len); >> +    if (!tempbuf) >> +      return -ENOMEM; >> +    hashbuf = tempbuf; >> +  } >> +  Hash->Upd

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Christian Brunner
2011/8/26 Yehuda Sadeh Weinraub : > On Fri, Aug 26, 2011 at 11:51 AM, Christian Brunner wrote: >> +static int hash_read_cb(uint64_t ofs, size_t len, const char *buf, void >> *arg) >> +{ >> +  ceph::crypto::Digest *Hash = (ceph::crypto::Digest *)arg; >> +  byte *hashbuf = (byte *) buf; > > Looking

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Yehuda Sadeh Weinraub
On Fri, Aug 26, 2011 at 12:52 PM, Christian Brunner wrote: > 2011/8/26 Yehuda Sadeh Weinraub : >> On Fri, Aug 26, 2011 at 11:51 AM, Christian Brunner wrote: >>> +static int hash_read_cb(uint64_t ofs, size_t len, const char *buf, void >>> *arg) >>> +{ >>> +  ceph::crypto::Digest *Hash = (ceph::cr

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Tommi Virtanen
On Fri, Aug 26, 2011 at 12:25, Yehuda Sadeh Weinraub wrote: > On Fri, Aug 26, 2011 at 12:10 PM, Tommi Virtanen > 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

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Christian Brunner
2011/8/26 Tommi Virtanen : > On Fri, Aug 26, 2011 at 12:25, Yehuda Sadeh Weinraub > wrote: >> On Fri, Aug 26, 2011 at 12:10 PM, Tommi Virtanen >> 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

Re: [PATCH 2/2] rbd: add an option for md5 checksumming (v3)

2011-08-26 Thread Yehuda Sadeh Weinraub
On Fri, Aug 26, 2011 at 1:03 PM, Tommi Virtanen wrote: > On Fri, Aug 26, 2011 at 12:25, Yehuda Sadeh Weinraub > wrote: >> On Fri, Aug 26, 2011 at 12:10 PM, Tommi Virtanen >> 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