Mailinglist Archive: opensuse (946 mails)

< Previous Next >
Re: [opensuse] About relatime and lazytime
On 26/09/17 07:13 PM, Carlos E. R. wrote:
It doesn't matter. Even if you just change a byte in a single sector of
the file, and only that sector is written, still the timestamp of the
file changes and has to be written.

In traditional unix and linux this action is more or less immediate.
With lazytime it delays.

https://lwn.net/Articles/621046/

None of this addresses my question.

And it is related to your question.
The man page says
This mount option significantly reduces writes
to the inode table for workloads that perform
frequent random writes to preallocated files.
The key there is "preallocated".

The way I read 'relatime' is that if set if drags 'access' up when modify is
changes so that the condition accesstime < modifytime can never occur.
The way I read that, it means that if 'lazytime' is set then it doesn't matter
one way or another. If 'lazytime' is set then unless the man page conditions
are met there will not be a write of the inode.

But...

it does say;

The on-disk timestamps are updated only when:

- the inode needs to be updated for some change
unrelated to file timestamps

Now one view is that the inode contains the file allocation map.
So if that alters, then the timestamps (and the map if you want to retain
integrity) get written. Then relatime matters as well.

But if the file is preallocated, the example I gave of a database, the
allocation map isn't changed as the file is updated by the field being modified.
Yes, this constitutes modifying the file so mtime alters. But surely many
database operations are read-modify-write so the atime is altered anyway?

Which gets back to my question about the other kinds of files - that is, not
database files -- where the condition for lazytime to apply exist.

When you can identify those you can look into the semantics of the interaction
of lazytime and relatime.

But as far as I can see all the other apps, even if just changing 'het' to 'the'
in a text document, end up modifying the file map 'cos they rewrite the whole
file and allocate it anew in one of few possible ways. So lazytime doesn't
apply.

Find me a non-database use case and lets see if it can be write-without-read.

===================

Let my hyotheseise.

Suppose you have a FS that allocates 4K blocks at a time, so the smallest
allocation is 4K even if the file size is 1 byte.

Then:-

echo -n "hello " > hw.txt
echo "world\n" >> hw.txt

We know that the final "hello world" fits in 4K so there will only be the one
block. But will the system append the "world\n" in the original block without
altering the map, or will an new file be created and the the old, original one
discarded as a new one is created?

$ echo -n "hello " > hw.txt
$ ls -li hw.txt
101 -rw-r--r-- 1 aja aja 6 Sep 26 21:14 hw.txt
$ echo "world\n" >> hw.txt
$ ls -il hw.txt
101 -rw-r--r-- 1 aja aja 14 Sep 26 21:14 hw.txt


WOW!

So new we get back to my question about caching.



--
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting frowned upon?


--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >