> -----Original Message-----
> From: Xinze Chi (信泽) [mailto:xmdx...@gmail.com]
> Sent: Thursday, December 03, 2015 10:18 AM
> To: Milosz Tanski
> Cc: Sage Weil; Gregory Farnum; Dan Mick; Haomai Wang; Dałek, Piotr; ceph-
> de...@vger.kernel.org
> Subject: Re: ceph encoding optimization
> 
> I write a new patch about this
> https://github.com/XinzeChi/ceph/commit/06eb471e463a4687e251273d0b5
> dfe170acbef2d
> 
> If you use __attribute__ ((packed)) after struct, we could encode many
> struct member in a batch. There is not compatibility problem if we keep the
> order of members defined in struct.
> 
> Wait for your comment.

Fields in embedded structs might be aligned, that will inhibit packed 
attribute. Also, you can't just use packed attribute on every struct that is 
encoded/decoded because that will eventually incur a performance hit. What I 
had in mind with 
https://github.com/XinzeChi/ceph/commit/06eb471e463a4687e251273d0b5dfe170acbef2d#commitcomment-14755615
 is to use temporary, packed struct, copy data from original struct/class into 
it, and then copy data from packed struct in one go.


With best regards / Pozdrawiam
Piotr Dałek


Reply via email to