]> git.dujemihanovic.xyz Git - linux.git/commitdiff
btrfs: comment and minor simplifications in run_delalloc_nocow
authorNikolay Borisov <nborisov@suse.com>
Thu, 22 Aug 2019 14:25:23 +0000 (17:25 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:13 +0000 (14:59 +0200)
Add a comment explaining why we keep the BUG also use the already read
and cached value of extent ram bytes stored in 'ram_bytes'.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c

index aece5dd0e7a8a247697c8dab1b55364005b46d75..90c6a4813a197f5236d0e7129c857fc66b65ab74 100644 (file)
@@ -1503,16 +1503,15 @@ next_slot:
                                goto out_check;
                        nocow = true;
                } else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-                       extent_end = found_key.offset +
-                               btrfs_file_extent_ram_bytes(leaf, fi);
-                       extent_end = ALIGN(extent_end,
-                                          fs_info->sectorsize);
+                       extent_end = found_key.offset + ram_bytes;
+                       extent_end = ALIGN(extent_end, fs_info->sectorsize);
                        /* Skip extents outside of our requested range */
                        if (extent_end <= start) {
                                path->slots[0]++;
                                goto next_slot;
                        }
                } else {
+                       /* If this triggers then we have a memory corruption */
                        BUG();
                }
 out_check: