History

vfs: add whiteout support

Whiteout isn't actually a new file type, but is represented as a char device (Linus's idea) with 0/0 device number. This has several advantages compared to introducing a new whiteout file type: - no userspace API changes (e.g. trivial to make backups of upper layer filesystem, without losing whiteouts) - no fs image format changes (you can boot an old kernel/fsck without whiteout support and things won't break) - implementation is trivial

Miklos Szeredi committed 12 years ago

Commit 787fb6b1 parent cbdf35b2 files · +25 −0Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/fs.h+11−0
@@ -222,6 +222,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, · 221 unmodified lines
222#define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */222#define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
223#define ATTR_TIMES_SET (1 << 16)223#define ATTR_TIMES_SET (1 << 16)
224 224
225/*
226 * Whiteout is represented by a char device. The following constants define the
227 * mode and device number to use.
228 */
229#define WHITEOUT_MODE 0
230#define WHITEOUT_DEV 0
231
225/*232/*
226 * This is the Inode Attributes structure, used for notify_change(). It233 * This is the Inode Attributes structure, used for notify_change(). It
227 * uses the above definitions as flags, to know which values have changed.234 * uses the above definitions as flags, to know which values have changed.
@@ -1398,6 +1405,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino · 1170 unmodified lines
1398extern int vfs_rmdir(struct inode *, struct dentry *);1405extern int vfs_rmdir(struct inode *, struct dentry *);
1399extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);1406extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1400extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);1407extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1408extern int vfs_whiteout(struct inode *, struct dentry *);
1401 1409
1402/*1410/*
1403 * VFS dentry helper functions.1411 * VFS dentry helper functions.
@@ -1628,6 +1636,9 @@ struct super_operations { · 224 unmodified lines
1628#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)1636#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1629#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)1637#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1630 1638
1639#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
1640 (inode)->i_rdev == WHITEOUT_DEV)
1641
1631/*1642/*
1632 * Inode state bits. Protected by inode->i_lock1643 * Inode state bits. Protected by inode->i_lock
1633 *1644 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t