Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs: introduce --atime-mode option to control atime update behavior #3521

Merged
merged 7 commits into from
May 9, 2023

Conversation

eryugey
Copy link
Contributor

@eryugey eryugey commented Apr 25, 2023

Currently juicefs doesn't update atime on access, so introduce --atime-mode option to select how to update atime. And support three modes:

  • noatime: don't update atime
  • relatime: update atime relative to motify or change time
  • strictatime: always update atime

Fixes: #3240
Signed-off-by: Eryu Guan [email protected]

@CLAassistant
Copy link

CLAassistant commented Apr 25, 2023

CLA assistant check
All committers have signed the CLA.

pkg/vfs/vfs.go Outdated Show resolved Hide resolved
pkg/vfs/vfs_unix.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2023

Codecov Report

Patch coverage: 51.09% and project coverage change: -0.35 ⚠️

Comparison is base (39cc73d) 56.40% compared to head (abbe13e) 56.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3521      +/-   ##
==========================================
- Coverage   56.40%   56.05%   -0.35%     
==========================================
  Files         149      149              
  Lines       36420    36992     +572     
==========================================
+ Hits        20542    20737     +195     
- Misses      13620    13978     +358     
- Partials     2258     2277      +19     
Impacted Files Coverage Δ
pkg/meta/config.go 48.61% <ø> (ø)
pkg/meta/sql.go 58.06% <19.56%> (-0.33%) ⬇️
pkg/meta/tkv.go 70.63% <39.53%> (-0.94%) ⬇️
pkg/meta/base.go 62.67% <53.84%> (-0.13%) ⬇️
pkg/meta/redis.go 66.14% <60.00%> (-0.86%) ⬇️
cmd/flags.go 94.23% <100.00%> (+0.22%) ⬆️
cmd/mount.go 55.00% <100.00%> (-1.02%) ⬇️
pkg/meta/utils.go 51.97% <100.00%> (+2.22%) ⬆️

... and 53 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@eryugey
Copy link
Contributor Author

eryugey commented Apr 26, 2023

Any advise on how tho fix this markdown lint error?
image

@SandyXSD
Copy link
Contributor

Any advise on how tho fix this markdown lint error?

Add one space around the numbers, and between Chinese word and English word.

@eryugey eryugey force-pushed the dev branch 2 times, most recently from 1fe64e8 to 0e90d62 Compare April 27, 2023 01:18
pkg/meta/redis.go Outdated Show resolved Hide resolved
@eryugey eryugey requested review from davies and SandyXSD May 5, 2023 00:42
cmd/flags.go Show resolved Hide resolved
cmd/mount.go Show resolved Hide resolved
pkg/meta/base.go Show resolved Hide resolved
pkg/meta/redis.go Show resolved Hide resolved
pkg/meta/sql.go Outdated Show resolved Hide resolved
pkg/meta/utils.go Outdated Show resolved Hide resolved
pkg/meta/utils.go Outdated Show resolved Hide resolved
@SandyXSD
Copy link
Contributor

SandyXSD commented May 6, 2023

We should also check and update the atime in Open and ReadLink.

Well, ReadLink is a bit more complicated as it doesn't get the attr for now, it can be fixed later in another PR.

eryugey added 3 commits May 7, 2023 22:26
Currently juicefs doesn't update atime on access, so introduce
--atime-mode option to select how to update atime. And support three
modes:

- noatime: don't update atime
- relatime: update atime relative to motify or change time
- strictatime: always update atime

Fixes: juicedata#3240
Signed-off-by: Eryu Guan <[email protected]>
To avoid getting attr from meta server on each atime update.

Signed-off-by: Eryu Guan <[email protected]>
To avoid getting attr again.

Signed-off-by: Eryu Guan <[email protected]>
@eryugey
Copy link
Contributor Author

eryugey commented May 7, 2023

We should also check and update the atime in Open and ReadLink.

Added touchAtime() in Open() as well.

pkg/meta/redis.go Outdated Show resolved Hide resolved
pkg/meta/sql.go Outdated Show resolved Hide resolved
pkg/meta/tkv.go Outdated Show resolved Hide resolved
eryugey added 3 commits May 8, 2023 17:54
Transaction is expensive, we could avoid starting a transaction when
touchAtime() was given a current attr, so we don't have to get attr
first.

Signed-off-by: Eryu Guan <[email protected]>
To avoid multiple atime updates in short time.

Signed-off-by: Eryu Guan <[email protected]>
pkg/meta/redis.go Outdated Show resolved Hide resolved
pkg/meta/redis.go Outdated Show resolved Hide resolved
pkg/meta/redis.go Show resolved Hide resolved
pkg/meta/redis.go Show resolved Hide resolved
@davies davies merged commit c9b7388 into juicedata:main May 9, 2023
@eryugey eryugey deleted the dev branch May 9, 2023 08:07
@eryugey
Copy link
Contributor Author

eryugey commented May 9, 2023

Thanks all for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support using atime to track file access
5 participants