[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7682) LMDB: [PATCH] mdb_env_copy should retry open() if O_DIRECT fails



Sorry, looks like I dropped this message.

Yes, #ifdef F_NOCACHE / #elif defined O_DIRECT / #endif seems better.
Included in branch "mdb/fopen" in my repo at UiO.

On 24. des. 2013 18:18, Howard Chu wrote:
> h.b.furuseth@usit.uio.no wrote:
>> This was fixed in LMDB 0.9.9, except:  If both O_DIRECT and
>> F_NOCACHE are #defined, both are used.  Looks a bit strange.
>> Maybe just one should be used in that case.  (Which?)  Also I'm
>> still wondering if env_open needs to fail if F_NOCACHE fails.
>>
>> Anyway, maybe it should be something like this.  The "else {}"
>> is in case O_DIRECT is an unsupported dummy definiton:
>
> Isn't that in the wrong order then? What you suggest here will use O_DIRECT
> even if it's a dummy.
>
> I don't see any reason to fail the operation. They just want to make a
> copy/backup; even if the optimization of avoiding pollution of the buffer
> cache can't be done, they still want the copy to happen.
>
>> #ifdef O_DIRECT
>>      if ((rc = fcntl(newfd, F_GETFL)) != -1)
>>          (void) fcntl(newfd, F_SETFL, rc | O_DIRECT);
>>      else
>> #endif
>>      {
>> #ifdef F_NOCACHE    /* __APPLE__ */
>>          (void) fcntl(newfd, F_NOCACHE, 1);
>> #endif
>>      }

-- 
Hallvard