Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0030b645 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Linus Torvalds
Browse files

reiserfs: use reiserfs_error()



This patch makes many paths that are currently using warnings to handle
the error.

Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1e5e59d4
Loading
Loading
Loading
Loading
+29 −27
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
	unsigned int bmap_count = reiserfs_bmap_count(s);

	if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
		reiserfs_warning(s, "vs-4010",
		reiserfs_error(s, "vs-4010",
			       "block number is out of range %lu (%u)",
			       block, SB_BLOCK_COUNT(s));
		return 0;
@@ -79,14 +79,14 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
		b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
		if (block >= bmap1 &&
		    block <= bmap1 + bmap_count) {
			reiserfs_warning(s, "vs-4019", "bitmap block %lu(%u) "
			reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
				       "can't be freed or reused",
				       block, bmap_count);
			return 0;
		}
	} else {
		if (offset == 0) {
			reiserfs_warning(s, "vs-4020", "bitmap block %lu(%u) "
			reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
				       "can't be freed or reused",
				       block, bmap_count);
			return 0;
@@ -94,14 +94,14 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
	}

	if (bmap >= bmap_count) {
		reiserfs_warning(s, "vs-4030", "bitmap for requested block "
		reiserfs_error(s, "vs-4030", "bitmap for requested block "
			       "is out of range: block=%lu, bitmap_nr=%u",
			       block, bmap);
		return 0;
	}

	if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
		reiserfs_warning(s, "vs-4050", "this is root block (%u), "
		reiserfs_error(s, "vs-4050", "this is root block (%u), "
			       "it must be busy", SB_ROOT_BLOCK(s));
		return 0;
	}
@@ -153,7 +153,7 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
/* - I mean `a window of zero bits' as in description of this function - Zam. */

	if (!bi) {
		reiserfs_warning(s, "jdm-4055", "NULL bitmap info pointer "
		reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
			       "for bitmap %d", bmap_n);
		return 0;
	}
@@ -399,7 +399,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
	get_bit_address(s, block, &nr, &offset);

	if (nr >= reiserfs_bmap_count(s)) {
		reiserfs_warning(s, "vs-4075", "block %lu is out of range",
		reiserfs_error(s, "vs-4075", "block %lu is out of range",
			       block);
		return;
	}
@@ -412,7 +412,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,

	/* clear bit for the given block in bit map */
	if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
		reiserfs_warning(s, "vs-4080",
		reiserfs_error(s, "vs-4080",
			       "block %lu: bit already cleared", block);
	}
	apbi[nr].free_count++;
@@ -440,7 +440,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
		return;

	if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
		reiserfs_panic(th->t_super, "bitmap-4072",
		reiserfs_error(th->t_super, "bitmap-4072",
			       "Trying to free block outside file system "
			       "boundaries (%lu > %lu)",
			       block, sb_block_count(REISERFS_SB(s)->s_rs));
@@ -472,7 +472,7 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th,
	BUG_ON(!th->t_trans_id);
#ifdef CONFIG_REISERFS_CHECK
	if (ei->i_prealloc_count < 0)
		reiserfs_warning(th->t_super, "zam-4001",
		reiserfs_error(th->t_super, "zam-4001",
			       "inode has negative prealloc blocks count.");
#endif
	while (ei->i_prealloc_count > 0) {
@@ -509,7 +509,7 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
				i_prealloc_list);
#ifdef CONFIG_REISERFS_CHECK
		if (!ei->i_prealloc_count) {
			reiserfs_warning(th->t_super, "zam-4001",
			reiserfs_error(th->t_super, "zam-4001",
				       "inode is in prealloc list but has "
				       "no preallocated blocks.");
		}
@@ -1213,7 +1213,9 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
	unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);

	/* The first bit must ALWAYS be 1 */
	BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
	if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
		reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
			       "corrupted: first bit must be 1", bh->b_blocknr);

	info->free_count = 0;

+21 −24
Original line number Diff line number Diff line
@@ -841,7 +841,7 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
							  tail_offset);
				if (retval) {
					if (retval != -ENOSPC)
						reiserfs_warning(inode->i_sb,
						reiserfs_error(inode->i_sb,
							"clm-6004",
							"convert tail failed "
							"inode %lu, error %d",
@@ -1332,10 +1332,9 @@ void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
		/* look for the object's stat data */
		retval = search_item(inode->i_sb, &key, &path);
		if (retval == IO_ERROR) {
			reiserfs_warning(inode->i_sb, "vs-13050",
			reiserfs_error(inode->i_sb, "vs-13050",
				       "i/o failure occurred trying to "
					 "update %K stat data",
					 &key);
				       "update %K stat data", &key);
			return;
		}
		if (retval == ITEM_NOT_FOUND) {
@@ -1424,7 +1423,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
	/* look for the object's stat data */
	retval = search_item(inode->i_sb, &key, &path_to_sd);
	if (retval == IO_ERROR) {
		reiserfs_warning(inode->i_sb, "vs-13070",
		reiserfs_error(inode->i_sb, "vs-13070",
			       "i/o failure occurred trying to find "
			       "stat data of %K", &key);
		reiserfs_make_bad_inode(inode);
@@ -1678,7 +1677,7 @@ static int reiserfs_new_directory(struct reiserfs_transaction_handle *th,
	/* look for place in the tree for new item */
	retval = search_item(sb, &key, path);
	if (retval == IO_ERROR) {
		reiserfs_warning(sb, "vs-13080",
		reiserfs_error(sb, "vs-13080",
			       "i/o failure occurred creating new directory");
		return -EIO;
	}
@@ -1718,7 +1717,7 @@ static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct i
	/* look for place in the tree for new item */
	retval = search_item(sb, &key, path);
	if (retval == IO_ERROR) {
		reiserfs_warning(sb, "vs-13080",
		reiserfs_error(sb, "vs-13080",
			       "i/o failure occurred creating new symlink");
		return -EIO;
	}
@@ -2043,10 +2042,8 @@ static int grab_tail_page(struct inode *p_s_inode,
		 ** I've screwed up the code to find the buffer, or the code to
		 ** call prepare_write
		 */
		reiserfs_warning(p_s_inode->i_sb, "clm-6000",
				 "error reading block %lu on dev %s",
				 bh->b_blocknr,
				 reiserfs_bdevname(p_s_inode->i_sb));
		reiserfs_error(p_s_inode->i_sb, "clm-6000",
			       "error reading block %lu", bh->b_blocknr);
		error = -EIO;
		goto unlock;
	}
@@ -2088,7 +2085,7 @@ int reiserfs_truncate_file(struct inode *p_s_inode, int update_timestamps)
			// and get_block_create_0 could not find a block to read in,
			// which is ok.
			if (error != -ENOENT)
				reiserfs_warning(p_s_inode->i_sb, "clm-6001",
				reiserfs_error(p_s_inode->i_sb, "clm-6001",
					       "grab_tail_page failed %d",
					       error);
			page = NULL;
+10 −10
Original line number Diff line number Diff line
@@ -1291,13 +1291,13 @@ void leaf_paste_entries(struct buffer_info *bi,
			prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;

			if (prev && prev <= deh_location(&(deh[i])))
				reiserfs_warning(NULL, "vs-10240",
				reiserfs_error(sb_from_bi(bi), "vs-10240",
					       "directory item (%h) "
					       "corrupted (prev %a, "
					       "cur(%d) %a)",
					       ih, deh + i - 1, i, deh + i);
			if (next && next >= deh_location(&(deh[i])))
				reiserfs_warning(NULL, "vs-10250",
				reiserfs_error(sb_from_bi(bi), "vs-10250",
					       "directory item (%h) "
					       "corrupted (cur(%d) %a, "
					       "next %a)",
+12 −12
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
	switch (retval) {
	case ITEM_NOT_FOUND:
		if (!PATH_LAST_POSITION(path)) {
			reiserfs_warning(sb, "vs-7000", "search_by_key "
			reiserfs_error(sb, "vs-7000", "search_by_key "
				       "returned item position == 0");
			pathrelse(path);
			return IO_ERROR;
@@ -135,7 +135,7 @@ int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,

	default:
		pathrelse(path);
		reiserfs_warning(sb, "vs-7002", "no path to here");
		reiserfs_error(sb, "vs-7002", "no path to here");
		return IO_ERROR;
	}

@@ -298,7 +298,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen,
		    search_by_entry_key(dir->i_sb, &key_to_search,
					path_to_entry, de);
		if (retval == IO_ERROR) {
			reiserfs_warning(dir->i_sb, "zam-7001", "io error");
			reiserfs_error(dir->i_sb, "zam-7001", "io error");
			return IO_ERROR;
		}

@@ -481,7 +481,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
		}

		if (retval != NAME_FOUND) {
			reiserfs_warning(dir->i_sb, "zam-7002",
			reiserfs_error(dir->i_sb, "zam-7002",
				       "reiserfs_find_entry() returned "
				       "unexpected value (%d)", retval);
		}
@@ -899,7 +899,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
		goto end_rmdir;

	if (inode->i_nlink != 2 && inode->i_nlink != 1)
		reiserfs_warning(inode->i_sb, "reiserfs-7040",
		reiserfs_error(inode->i_sb, "reiserfs-7040",
			       "empty directory has nlink != 2 (%d)",
			       inode->i_nlink);

@@ -1494,7 +1494,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
	if (reiserfs_cut_from_item
	    (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL,
	     0) < 0)
		reiserfs_warning(old_dir->i_sb, "vs-7060",
		reiserfs_error(old_dir->i_sb, "vs-7060",
			       "couldn't not cut old name. Fsck later?");

	old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
+2 −2
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
		i += 2;
	}

	reiserfs_warning(s, "vs-15011", "tried to free free object id (%lu)",
	reiserfs_error(s, "vs-15011", "tried to free free object id (%lu)",
		       (long unsigned)objectid_to_release);
}

Loading