Re: about memory alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 14, 2017 at 12:12 AM Liuhao <liu.haoA@xxxxxxx> wrote:
>
> HI, developers:
>
> data.largest_data_off_in_data_bl = orig_len + sizeof(__u32);  // we are about to
> What 's mean of sizeof(__u32)?  Why add sizeof(__u32)?


We're recording here the total size of the buffer used to transmit the
data. Since the buffer includes a prefix of its own length, and that
prefix is a __u32, we add that to the actual data size.
-Greg

>
>
> Detail:
> oid write(const coll_t& cid, const ghobject_t& oid, uint64_t off, uint64_t len,
>                 const bufferlist& write_data, uint32_t flags = 0) {
>       uint32_t orig_len = data_bl.length();
>       Op* _op = _get_next_op();
>       _op->op = OP_WRITE;
>       _op->cid = _get_coll_id(cid);
>       _op->oid = _get_object_id(oid);
>       _op->off = off;
>       _op->len = len;
>       ::encode(write_data, data_bl);
>
>       assert(len == write_data.length());
>       data.fadvise_flags = data.fadvise_flags | flags;
>       if (write_data.length() > data.largest_data_len) {
>          data.largest_data_len = write_data.length();
>          data.largest_data_off = off;
>          data.largest_data_off_in_data_bl = orig_len + sizeof(__u32);  // we are about to
>       }
>       data.ops++;
> }
>
> Thanks
> --
> 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
--
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



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux