Remove redundant code related to fuse_file_fail_immediately().

Signed-off-by: Liu Kui <kui....@virtuozzo.com>
---
 fs/fuse/dev.c    | 10 +++++-----
 fs/fuse/file.c   | 15 ++++++++-------
 fs/fuse/fuse_i.h |  9 ++-------
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 292709b337bd..25dc27b40861 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -672,21 +672,21 @@ static int fuse_request_queue_background(struct fuse_req 
*req)
        }
        __set_bit(FR_ISREPLY, &req->flags);
 
-       if (fc->kio.op && req->args->async && !nonblocking && 
READ_ONCE(fc->connected) &&
-               (!ff || !test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state))) {
-               int ret = fc->kio.op->req_classify(req, false, false);
+       if (fc->kio.op && req->args->async && !nonblocking) {
+               ret = fc->kio.op->req_classify(req, false, false);
                if (likely(!ret)) {
                        unsigned int bkt = fuse_qhash_bucket();
+
                        __clear_bit(FR_BACKGROUND, &req->flags);
                        __set_bit(FR_NO_ACCT, &req->flags);
                        if (wait_event_killable_exclusive(fc->qhash[bkt].waitq,
                                                
(atomic_read(&fc->qhash[bkt].num_reqs) < fuse_qhash_bucket_len ||
                                           !READ_ONCE(fc->connected) ||
-                                          (ff && 
test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state)))))
+                                          fuse_file_fail_immediately(ff))))
                                return -EIO;
                        if (!READ_ONCE(fc->connected))
                                return -ENOTCONN;
-                       if (ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, 
&ff->ff_state))
+                       if (fuse_file_fail_immediately(ff))
                                return -EIO;
                        req->qhash = bkt;
                        atomic_inc(&fc->qhash[bkt].num_reqs);
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 3796e45e1b71..656233fe40d0 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1163,7 +1163,7 @@ static int fuse_do_readpage(struct file *file, struct 
page *page,
         */
        fuse_wait_on_page_writeback(inode, page->index);
        spin_lock(&ff->lock);
-       if (unlikely(__fuse_file_fail_immediately(ff))) {
+       if (unlikely(fuse_file_fail_immediately(ff))) {
                spin_unlock(&ff->lock);
                return -EIO;
        }
@@ -1320,7 +1320,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, 
struct file *file)
                ap->args.end = fuse_readpages_end;
 
                spin_lock(&ff->lock);
-               if (unlikely(__fuse_file_fail_immediately(ff))) {
+               if (unlikely(fuse_file_fail_immediately(ff))) {
                        spin_unlock(&ff->lock);
                        INIT_LIST_HEAD(&ia->revoke_entry);
                        err = -EIO;
@@ -2568,7 +2568,7 @@ static void fuse_writepages_send(struct fuse_fill_wb_data 
*data)
        int i;
 
        spin_lock(&fi->lock);
-       if (test_bit(FUSE_S_FAIL_IMMEDIATELY, &data->ff->ff_state)) {
+       if (fuse_file_fail_immediately(data->ff)) {
                shoot_on_sight = 1;
                fi->writectr++;
        } else {
@@ -2858,7 +2858,7 @@ static int fuse_write_begin(struct file *file, struct 
address_space *mapping,
 
        fuse_wait_on_page_writeback(mapping->host, folio->index);
 
-       if (fuse_file_fail_immediately(file)) {
+       if (fuse_file_fail_immediately(file->private_data)) {
                err = -EIO;
                goto cleanup;
        }
@@ -2976,9 +2976,10 @@ static void fuse_vma_close(struct vm_area_struct *vma)
 static vm_fault_t fuse_page_mkwrite(struct vm_fault *vmf)
 {
        struct page *page = vmf->page;
-       struct inode *inode = file_inode(vmf->vma->vm_file);
+       struct file *file = vmf->vma->vm_file;
+       struct inode *inode = file_inode(file);
 
-       file_update_time(vmf->vma->vm_file);
+       file_update_time(file);
        lock_page(page);
        if (page->mapping != inode->i_mapping) {
                unlock_page(page);
@@ -2986,7 +2987,7 @@ static vm_fault_t fuse_page_mkwrite(struct vm_fault *vmf)
        }
 
        fuse_wait_on_page_writeback(inode, page->index);
-       if (fuse_file_fail_immediately(vmf->vma->vm_file)) {
+       if (fuse_file_fail_immediately(file->private_data)) {
                unlock_page(page);
                return VM_FAULT_SIGSEGV;
        }
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 104cf1596085..d4bb4ecdd916 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1553,14 +1553,9 @@ static inline void fuse_dio_wait(struct fuse_inode *fi)
        fuse_write_dio_wait(fi);
 }
 
-static inline bool __fuse_file_fail_immediately(struct fuse_file *ff)
+static inline bool fuse_file_fail_immediately(struct fuse_file *ff)
 {
-       return test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state);
-}
-
-static inline bool fuse_file_fail_immediately(struct file *file)
-{
-       return  __fuse_file_fail_immediately(file->private_data);
+       return ff && test_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state);
 }
 
 /**
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to