Re: O_DIRECT on macOS

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: O_DIRECT on macOS
Date: 2021-05-30 16:19:12
Message-ID: 20210530161912.GN2082@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 30, 2021 at 04:39:48PM +1200, Thomas Munro wrote:

> +BasicOpenFilePermDirect(const char *fileName, int fileFlags, mode_t fileMode,
> + bool direct)
> ...
> +#if !defined(O_DIRECT) && defined(F_NOCACHE)
> + /* macOS requires an extra step. */
> + if (direct && fcntl(fd, F_NOCACHE, 1) < 0)
> + {
> + int save_errno = errno;
> +
> + close(fd);
> + errno = save_errno;
> + ereport(ERROR,
> + (errcode_for_file_access(),
> + errmsg("could not disable kernel file caching for file \"%s\": %m",
> + fileName)));
> + }
> +#endif

Should there be an "else" to warn/error in the case that "direct" is requested
but not supported?

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Omar Kilani 2021-05-30 16:23:32 Re: Clear empty space in a page.
Previous Message Zhihong Yu 2021-05-30 14:21:28 Re: GISTSTATE is too large