Whamcloud - gitweb
LU-12511 llite: use mapping_set_error instead of opencoded set_bit 72/51372/4
authorMichal Hocko <mhocko@suse.com>
Tue, 20 Jun 2023 13:34:09 +0000 (09:34 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jul 2023 22:33:35 +0000 (22:33 +0000)
The mapping_set_error() helper sets the correct AS_ flag for the mapping
so there is no reason to open code it.  Use the helper directly.

[akpm@linux-foundation.org: be honest about conversion from -ENXIO to -EIO]
Link: http://lkml.kernel.org/r/20160912111608.2588-2-mhocko@kernel.org
Linux-commit: 5114a97a8bce7f4ead29a32b67dee85438699b9e

Change-Id: I153bc04d4745a20013820ba81572cadb37ab8f39
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51372
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/vvp_page.c

index 90af3f5..07d3906 100644 (file)
@@ -114,13 +114,11 @@ static void vvp_vmpage_error(struct inode *inode, struct page *vmpage,
                obj->vob_discard_page_warned = 0;
        } else {
                SetPageError(vmpage);
-               if (ioret == -ENOSPC) {
-                       set_bit(AS_ENOSPC, &inode->i_mapping->flags);
-               } else {
-                       if (CFS_FAIL_CHECK(OBD_FAIL_LLITE_PANIC_ON_ESTALE))
-                               LBUG();
-                       set_bit(AS_EIO, &inode->i_mapping->flags);
-               }
+               if (ioret != -ENOSPC &&
+                   CFS_FAIL_CHECK(OBD_FAIL_LLITE_PANIC_ON_ESTALE))
+                       LBUG();
+
+               mapping_set_error(inode->i_mapping, ioret);
 
                if ((ioret == -ESHUTDOWN || ioret == -EINTR ||
                     ioret == -EIO) && obj->vob_discard_page_warned == 0) {