Re: O_DIRECT on macOS - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: O_DIRECT on macOS
Date
Msg-id 20210530161912.GN2082@telsasoft.com
Whole thread Raw
In response to O_DIRECT on macOS  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: O_DIRECT on macOS  (Thomas Munro <thomas.munro@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: GISTSTATE is too large
Next
From: Omar Kilani
Date:
Subject: Re: Clear empty space in a page.