]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ext4: improve ext_debug() msg in case of block allocation failure
authorRitesh Harjani <riteshh@linux.ibm.com>
Sun, 10 May 2020 06:24:52 +0000 (11:54 +0530)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Jun 2020 03:16:52 +0000 (23:16 -0400)
ext4_map_blocks() has ext_debug msg early at the start of function.
We also get ext_debug msg if we could allocate a block from
ext4_ext_map_blocks(). But there is no ext_debug() msg in case of
block allocation failure. So add one along with error code.

Also add more info in ext_debug() msg like how many blocks were allocated
v/s how many were requested in ext4_ext_map_blocks().

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Link: https://lore.kernel.org/r/1610ec2aa932396be00f9d552fe29da473ead176.1589086800.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/inode.c

index ff7eeb5a77efbff06369bc73a3056895f8f7c14f..7b4b0c0110ac678c2412cc82dd79537a23a3a3a7 100644 (file)
@@ -4246,10 +4246,10 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
        newblock = ext4_mb_new_blocks(handle, &ar, &err);
        if (!newblock)
                goto out2;
-       ext_debug("allocate new block: goal %llu, found %llu/%u\n",
-                 ar.goal, newblock, allocated);
        allocated_clusters = ar.len;
        ar.len = EXT4_C2B(sbi, ar.len) - offset;
+       ext_debug("allocate new block: goal %llu, found %llu/%u, requested %u\n",
+                 ar.goal, newblock, ar.len, allocated);
        if (ar.len > allocated)
                ar.len = allocated;
 
index 043ee7efce5f519ec865acb5b80227d40a848c18..0a52f98512d7895dbbb3ea99306131bbf224e802 100644 (file)
@@ -732,6 +732,10 @@ out_sem:
                                return ret;
                }
        }
+
+       if (retval < 0)
+               ext_debug("failed for inode %lu with err %d\n",
+                         inode->i_ino, retval);
        return retval;
 }