ceph: remove useless check for the folio
authorXiubo Li <xiubli@redhat.com>
Tue, 5 Jul 2022 02:40:23 +0000 (10:40 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 2 Aug 2022 22:54:13 +0000 (00:54 +0200)
The netfs_write_begin() won't set the folio if the return value
is non-zero.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/addr.c

index 2f886ec..de12715 100644 (file)
@@ -1326,16 +1326,13 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
        int r;
 
        r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, &folio, NULL);
-       if (r == 0)
-               folio_wait_fscache(folio);
-       if (r < 0) {
-               if (folio)
-                       folio_put(folio);
-       } else {
-               WARN_ON_ONCE(!folio_test_locked(folio));
-               *pagep = &folio->page;
-       }
-       return r;
+       if (r < 0)
+               return r;
+
+       folio_wait_fscache(folio);
+       WARN_ON_ONCE(!folio_test_locked(folio));
+       *pagep = &folio->page;
+       return 0;
 }
 
 /*