filesystem freeze: implement generic freeze feature
The ioctls for the generic freeze feature are below.
o Freeze the filesystem
int ioctl(int fd, int FIFREEZE, arg)
fd: The file descriptor of the mountpoint
FIFREEZE: request code for the freeze
arg: Ignored
Return value: 0 if the operation succeeds. Otherwise, -1
o Unfreeze the filesystem
int ioctl(int fd, int FITHAW, arg)
fd: The file descriptor of the mountpoint
FITHAW: request code for unfreeze
arg: Ignored
Return value: 0 if the operation succeeds. Otherwise, -1
Error number: If the filesystem has already been unfrozen,
errno is set to EINVAL.
[akpm@linux-foundation.org: fix CONFIG_BLOCK=n]
Signed-off-by: Takashi Sato <t-sato@yk.jp.nec.com>
Signed-off-by: Masayuki Hamaguchi <m-hamaguchi@ys.jp.nec.com>
Cc: <xfs-masters@oss.sgi.com>
Cc: <linux-ext4@vger.kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Alasdair G Kergon <agk@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
c4be0c1dc4
commit
fcccf50254
5 changed files with 130 additions and 10 deletions
|
|
@ -171,7 +171,7 @@ void __wait_on_buffer(struct buffer_head *);
|
|||
wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
|
||||
int fsync_bdev(struct block_device *);
|
||||
struct super_block *freeze_bdev(struct block_device *);
|
||||
void thaw_bdev(struct block_device *, struct super_block *);
|
||||
int thaw_bdev(struct block_device *, struct super_block *);
|
||||
int fsync_super(struct super_block *);
|
||||
int fsync_no_super(struct block_device *);
|
||||
struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
|
||||
|
|
@ -346,6 +346,15 @@ static inline int remove_inode_buffers(struct inode *inode) { return 1; }
|
|||
static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
|
||||
static inline void invalidate_bdev(struct block_device *bdev) {}
|
||||
|
||||
static inline struct super_block *freeze_bdev(struct block_device *sb)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
#endif /* _LINUX_BUFFER_HEAD_H */
|
||||
|
|
|
|||
|
|
@ -234,6 +234,8 @@ struct inodes_stat_t {
|
|||
#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
|
||||
#define FIBMAP _IO(0x00,1) /* bmap access */
|
||||
#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
|
||||
#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
|
||||
#define FITHAW _IOWR('X', 120, int) /* Thaw */
|
||||
|
||||
#define FS_IOC_GETFLAGS _IOR('f', 1, long)
|
||||
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
|
||||
|
|
@ -591,6 +593,11 @@ struct block_device {
|
|||
* care to not mess up bd_private for that case.
|
||||
*/
|
||||
unsigned long bd_private;
|
||||
|
||||
/* The counter of freeze processes */
|
||||
int bd_fsfreeze_count;
|
||||
/* Mutex for freeze */
|
||||
struct mutex bd_fsfreeze_mutex;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue