mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
fs: add kerneldoc to file_{start,end}_write() helpers
and use sb_end_write() instead of open coded version. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Jens Axboe <axboe@kernel.dk> Message-Id: <20230817141337.1025891-3-amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
a370167fe5
commit
f6c05b9e5d
@@ -2539,6 +2539,13 @@ static inline bool inode_wrong_type(const struct inode *inode, umode_t mode)
|
|||||||
return (inode->i_mode ^ mode) & S_IFMT;
|
return (inode->i_mode ^ mode) & S_IFMT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* file_start_write - get write access to a superblock for regular file io
|
||||||
|
* @file: the file we want to write to
|
||||||
|
*
|
||||||
|
* This is a variant of sb_start_write() which is a noop on non-regualr file.
|
||||||
|
* Should be matched with a call to file_end_write().
|
||||||
|
*/
|
||||||
static inline void file_start_write(struct file *file)
|
static inline void file_start_write(struct file *file)
|
||||||
{
|
{
|
||||||
if (!S_ISREG(file_inode(file)->i_mode))
|
if (!S_ISREG(file_inode(file)->i_mode))
|
||||||
@@ -2553,11 +2560,17 @@ static inline bool file_start_write_trylock(struct file *file)
|
|||||||
return sb_start_write_trylock(file_inode(file)->i_sb);
|
return sb_start_write_trylock(file_inode(file)->i_sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* file_end_write - drop write access to a superblock of a regular file
|
||||||
|
* @file: the file we wrote to
|
||||||
|
*
|
||||||
|
* Should be matched with a call to file_start_write().
|
||||||
|
*/
|
||||||
static inline void file_end_write(struct file *file)
|
static inline void file_end_write(struct file *file)
|
||||||
{
|
{
|
||||||
if (!S_ISREG(file_inode(file)->i_mode))
|
if (!S_ISREG(file_inode(file)->i_mode))
|
||||||
return;
|
return;
|
||||||
__sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
|
sb_end_write(file_inode(file)->i_sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user