Skip to content

Commit 84840ef

Browse files
author
Miklos Szeredi
committed
fuse: simplify __fuse_write_file_get()
Use list_first_entry_or_null() instead of list_empty() + list_entry(). Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 371e8fd commit 84840ef

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/fuse/file.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,14 +1815,13 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args,
18151815

18161816
static struct fuse_file *__fuse_write_file_get(struct fuse_inode *fi)
18171817
{
1818-
struct fuse_file *ff = NULL;
1818+
struct fuse_file *ff;
18191819

18201820
spin_lock(&fi->lock);
1821-
if (!list_empty(&fi->write_files)) {
1822-
ff = list_entry(fi->write_files.next, struct fuse_file,
1823-
write_entry);
1821+
ff = list_first_entry_or_null(&fi->write_files, struct fuse_file,
1822+
write_entry);
1823+
if (ff)
18241824
fuse_file_get(ff);
1825-
}
18261825
spin_unlock(&fi->lock);
18271826

18281827
return ff;

0 commit comments

Comments
 (0)