+ /*
+ * The next wrap_count bytes exist twice, in the wrap buffer
+ * and as a buffer reference in the buffer tree pool.
+ */
+ omit += wrap_count;
+ }
+ /*
+ * For buffer tree pools, the buffers in the list align, i.e. the next
+ * buffer in the list starts directly at the end of its predecessor. In
+ * this case we merge adjacent buffers and return one larger buffer
+ * instead.
+ */
+ FOR_EACH_BUFFER_REF(br, btrn) {
+ sz = btr_get_buffer_by_reference(br, &buf);
+ if (result) {
+ if (result + rv != buf)
+ goto out;
+ rv += sz;
+ } else if (sz > omit) {
+ result = buf + omit;
+ rv = sz - omit;
+ } else
+ omit -= sz;