linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 2/5] libext2fs: Fix SET_BMAP bugs in ext2fs_bmap() and ext2fs_bmap2()
Date: Sun, 29 Nov 2009 15:33:26 -0500	[thread overview]
Message-ID: <1259526809-23697-2-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1259526809-23697-1-git-send-email-tytso@mit.edu>

Don't byte-swap the block number when setting i_block[x], since the
write_inode function will take of byte swapping the inode.

The phys_blk parameter contains an input parameter in the SET_BMAP
case, so it must be passed to ext2fs_bmap2() from the legacy function
ext2fs_bmap().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/ext2fs/bmap.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index 2a86439..933036b 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -214,9 +214,6 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
 	if (block < EXT2_NDIR_BLOCKS) {
 		if (bmap_flags & BMAP_SET) {
 			b = *phys_blk;
-#ifdef WORDS_BIGENDIAN
-			b = ext2fs_swab32(b);
-#endif
 			inode_bmap(inode, block) = b;
 			inode_dirty++;
 			goto done;
@@ -325,7 +322,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
 		      blk_t *phys_blk)
 {
 	errcode_t ret;
-	blk64_t	ret_blk;
+	blk64_t	ret_blk = *phys_blk;
 
 	ret = ext2fs_bmap2(fs, ino, inode, block_buf, bmap_flags, block,
 			    0, &ret_blk);
-- 
1.6.5.216.g5288a.dirty


  reply	other threads:[~2009-11-29 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-29 20:33 [PATCH 1/5] e2fsck: detect holes in extent-mapped directories Theodore Ts'o
2009-11-29 20:33 ` Theodore Ts'o [this message]
2009-11-29 20:33 ` [PATCH 3/5] e2fsck: Fix block allocation for " Theodore Ts'o
2009-11-29 20:33 ` [PATCH 4/5] e2fsck: Don't rehash directories which can fit in a single directory block Theodore Ts'o
2009-11-29 20:33 ` [PATCH 5/5] e2fsck: Try to update on-disk bitmap in e2fsck_get_alloc_block() callback Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259526809-23697-2-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).