-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
linux: renameat2 flags support #12209
Changes from all commits
8594e81
55b3964
c5ae95d
a1526b9
359ce55
b3105be
2044151
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,9 @@ typedef enum zil_create { | |
#define TX_MKDIR_ACL_ATTR 19 /* mkdir with ACL + attrs */ | ||
#define TX_WRITE2 20 /* dmu_sync EALREADY write */ | ||
#define TX_SETSAXATTR 21 /* Set sa xattrs on file */ | ||
#define TX_MAX_TYPE 22 /* Max transaction type */ | ||
#define TX_RENAME_EXCHANGE 22 /* Atomic swap via renameat2 */ | ||
#define TX_RENAME_WHITEOUT 23 /* Atomic whiteout via renameat2 */ | ||
#define TX_MAX_TYPE 24 /* Max transaction type */ | ||
|
||
/* | ||
* The transactions for mkdir, symlink, remove, rmdir, link, and rename | ||
|
@@ -317,6 +319,19 @@ typedef struct { | |
/* 2 strings: names of source and destination follow this */ | ||
} lr_rename_t; | ||
|
||
typedef struct { | ||
lr_rename_t lr_rename; /* common rename portion */ | ||
/* members related to the whiteout file (based on lr_create_t) */ | ||
uint64_t lr_wfoid; /* obj id of the new whiteout file */ | ||
uint64_t lr_wmode; /* mode of object */ | ||
uint64_t lr_wuid; /* uid of whiteout */ | ||
uint64_t lr_wgid; /* gid of whiteout */ | ||
uint64_t lr_wgen; /* generation (txg of creation) */ | ||
uint64_t lr_wcrtime[2]; /* creation time */ | ||
uint64_t lr_wrdev; /* always makedev(0, 0) */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point of this (and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't really want to pass a bare There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jörgen Lundman on Slack mentioned that macOS has vnop_exchange(), that was never implemented due to needed ZIL changes. For TX_RENAME_EXCHANGE log record format obviously should be the same, but I wonder if any other OS implement TX_RENAME_WHITEOUT, will this be sufficient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be enough. FreeBSD has vop_whiteout() implemented for tmpfs and ufs, but it does not rename, it does LOOKUP or CREATE or DELETE on a whiteout dirent (d_type = DT_WHT) depending on flags. If there was some vop_rename_whiteout() then I think we should not need anything more than what is needed for rename plus to create the whiteout dirent, which is covered by these fields. I don't mind leaving lr_wrdev in that case. |
||
/* 2 strings: names of source and destination follow this */ | ||
} lr_rename_whiteout_t; | ||
|
||
typedef struct { | ||
lr_t lr_common; /* common portion of log record */ | ||
uint64_t lr_foid; /* file object to write */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be added after the next line.