Commit 84840efc authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: simplify __fuse_write_file_get()

Use list_first_entry_or_null() instead of list_empty() + list_entry().
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 371e8fd0
...@@ -1815,14 +1815,13 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args, ...@@ -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) 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); spin_lock(&fi->lock);
if (!list_empty(&fi->write_files)) { ff = list_first_entry_or_null(&fi->write_files, struct fuse_file,
ff = list_entry(fi->write_files.next, struct fuse_file, write_entry);
write_entry); if (ff)
fuse_file_get(ff); fuse_file_get(ff);
}
spin_unlock(&fi->lock); spin_unlock(&fi->lock);
return ff; return ff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment