On 01/04/2019 11:01, Antonin Houska wrote:
> In copydir.c:copy_file() I read
>
> /* Use palloc to ensure we get a maxaligned buffer */
> buffer = palloc(COPY_BUF_SIZE);
>
> No data type wider than a single byte is used to access the data in the
> buffer, and neither read() nor write() should require any specific alignment.
> Can someone please explain why alignment matters here?
An aligned buffer can allow optimizations in the kernel, when it copies
the data. So it's not strictly required, but potentially makes the
read() and write() faster.
- Heikki