summaryrefslogtreecommitdiff
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2021-10-22 17:03:02 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2021-10-22 17:03:02 +0200
commit84840efc3c0f225ee5597e0a013e9da03afc73c6 (patch)
tree79c45ff9ea1e88cdb647753539aa2568fbe492c3 /fs/fuse/file.c
parent371e8fd02969383204b1f6023451125dbc20dfbd (diff)
fuse: simplify __fuse_write_file_get()
Use list_first_entry_or_null() instead of list_empty() + list_entry(). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index be13f695e1d6..31266ca9c1f2 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1815,14 +1815,13 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args,
static struct fuse_file *__fuse_write_file_get(struct fuse_inode *fi)
{
- struct fuse_file *ff = NULL;
+ struct fuse_file *ff;
spin_lock(&fi->lock);
- if (!list_empty(&fi->write_files)) {
- ff = list_entry(fi->write_files.next, struct fuse_file,
- write_entry);
+ ff = list_first_entry_or_null(&fi->write_files, struct fuse_file,
+ write_entry);
+ if (ff)
fuse_file_get(ff);
- }
spin_unlock(&fi->lock);
return ff;