aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 6d600a69fc9d..580af3dfc0eb 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -261,6 +261,12 @@ static __le32 ext4_dirent_csum(struct inode *inode,
261 return cpu_to_le32(csum); 261 return cpu_to_le32(csum);
262} 262}
263 263
264static void warn_no_space_for_csum(struct inode *inode)
265{
266 ext4_warning(inode->i_sb, "no space in directory inode %lu leaf for "
267 "checksum. Please run e2fsck -D.", inode->i_ino);
268}
269
264int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent) 270int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent)
265{ 271{
266 struct ext4_dir_entry_tail *t; 272 struct ext4_dir_entry_tail *t;
@@ -271,8 +277,7 @@ int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent)
271 277
272 t = get_dirent_tail(inode, dirent); 278 t = get_dirent_tail(inode, dirent);
273 if (!t) { 279 if (!t) {
274 EXT4_ERROR_INODE(inode, "metadata_csum set but no space in dir " 280 warn_no_space_for_csum(inode);
275 "leaf for checksum. Please run e2fsck -D.");
276 return 0; 281 return 0;
277 } 282 }
278 283
@@ -294,8 +299,7 @@ static void ext4_dirent_csum_set(struct inode *inode,
294 299
295 t = get_dirent_tail(inode, dirent); 300 t = get_dirent_tail(inode, dirent);
296 if (!t) { 301 if (!t) {
297 EXT4_ERROR_INODE(inode, "metadata_csum set but no space in dir " 302 warn_no_space_for_csum(inode);
298 "leaf for checksum. Please run e2fsck -D.");
299 return; 303 return;
300 } 304 }
301 305
@@ -377,8 +381,7 @@ static int ext4_dx_csum_verify(struct inode *inode,
377 count = le16_to_cpu(c->count); 381 count = le16_to_cpu(c->count);
378 if (count_offset + (limit * sizeof(struct dx_entry)) > 382 if (count_offset + (limit * sizeof(struct dx_entry)) >
379 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) { 383 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
380 EXT4_ERROR_INODE(inode, "metadata_csum set but no space for " 384 warn_no_space_for_csum(inode);
381 "tree checksum found. Run e2fsck -D.");
382 return 1; 385 return 1;
383 } 386 }
384 t = (struct dx_tail *)(((struct dx_entry *)c) + limit); 387 t = (struct dx_tail *)(((struct dx_entry *)c) + limit);
@@ -408,8 +411,7 @@ static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent)
408 count = le16_to_cpu(c->count); 411 count = le16_to_cpu(c->count);
409 if (count_offset + (limit * sizeof(struct dx_entry)) > 412 if (count_offset + (limit * sizeof(struct dx_entry)) >
410 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) { 413 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
411 EXT4_ERROR_INODE(inode, "metadata_csum set but no space for " 414 warn_no_space_for_csum(inode);
412 "tree checksum. Run e2fsck -D.");
413 return; 415 return;
414 } 416 }
415 t = (struct dx_tail *)(((struct dx_entry *)c) + limit); 417 t = (struct dx_tail *)(((struct dx_entry *)c) + limit);