From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaegeuk Kim Date: Fri, 24 May 2013 03:46:08 +0000 Subject: Re: [patch] f2fs: dereferencing an ERR_PTR Message-Id: <1369367168.10521.13.camel@kjgkr> MIME-Version: 1 Content-Type: multipart/mixed; boundary="=-6lnAKshgeF/PjQ0nKFTU" List-Id: References: <20130523100213.GA19107@elgon.mountain> <20130523101240.GG30128@mwanda> In-Reply-To: <20130523101240.GG30128@mwanda> To: Dan Carpenter Cc: kernel-janitors@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net --=-6lnAKshgeF/PjQ0nKFTU Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2013-05-23 (=EB=AA=A9), 13:12 +0300, Dan Carpenter: > Btw, Linus's new Sparse changes don't like the f2fs's NEW_ADDR > macro. >=20 > #define NEW_ADDR -1U >=20 > We use it like this: >=20 > block_t src, dest; >=20 > if (src !=3D dest && dest !=3D NEW_ADDR && dest !=3D NULL_ADDR) { >=20 > block_t is 64 bits so probably the macro should probably be: >=20 > #define NEW_ADDR ((block_t)-1) Hi, Agreed that it needs to synchronize on-disk and in-memory block address types, __le32 and u64. How about the below patch? >=20 > I'm not able to test this so there may be some reason why changing > this breaks something. In that case we could do: >=20 > #define NEW_ADDR ((u32)(block_t)-1) /* explanation */ >=20 > regards, > dan carpenter >=20 =46rom ded3c78fcb6dd8c39a8664471544942e51ff9faf Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Fri, 24 May 2013 12:41:04 +0900 Subject: [PATCH] f2fs: align data types between on-disk and in-memory block addresses Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net The on-disk block address is defined as __le32, but in-memory block address, block_t, does as u64. Let's synchronize them to 32 bits. Signed-off-by: Dan Carpenter Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 5 ++++- include/linux/f2fs_fs.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7b05029..92fd4e9 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -37,7 +37,10 @@ typecheck(unsigned long long, b) && \ ((long long)((a) - (b)) > 0)) =20 -typedef u64 block_t; +typedef u32 block_t; /* + * should not change u32, since it is the on-disk block + * address format, __le32. + */ typedef u32 nid_t; =20 struct f2fs_mount_info { diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h index df6fab8..383d5e3 100644 --- a/include/linux/f2fs_fs.h +++ b/include/linux/f2fs_fs.h @@ -20,8 +20,8 @@ #define F2FS_BLKSIZE 4096 /* support only 4KB block */ #define F2FS_MAX_EXTENSION 64 /* # of extension entries */ =20 -#define NULL_ADDR 0x0U -#define NEW_ADDR -1U +#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ +#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ =20 #define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) #define F2FS_NODE_INO(sbi) (sbi->node_ino_num) --=20 1.8.1.3.566.gaa39828 --=20 Jaegeuk Kim Samsung --=-6lnAKshgeF/PjQ0nKFTU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJRnuKAAAoJEEAUqH6CSFDSK18P/3W9BAtug5ULoWfQlzbvENsG y6QXSJqR5DR8LOlh3l5++qTWokGEPbwMrsX1eSFubDyFrjVGLwl315IJX6L8Lt6t tUD4H+cH1v8g6YHoiPLbCSqiYg+aPb1ExaLNXOc2beaIXZzd8nm+SrUseLy0vMxE zoAZTn3le6LBPhejArwfp3FKJfihyV4f/jAZV8tEL2T9nTgWvioEVPaWOqpcRy4o 0+wOix9Aul2Z0rgiMgm5s4pS2CB417py5iTbJJri5vjHR9fcaGYDn6j0WZ5/hlV3 PXKLg8SedoA+Ytp8YrogBt2fwQOYGPpblX9Z54TfezMglUgc9QCdvlkBCvGC53xJ jAIqxL5/jQAyHDO/dOnjPlfn6s1JJ5dbJDtuLg492YLoCjHsv927fRfqXzEhGSGV HMs3QwsATPLk8kwCMpUj+sTXWnSgliBDx6NuqaUYJhaXoKLb4EN5KzShavChTW56 U4O8NmCZehwCihU0ASK9HCrDZn1GlhdZHQVypGSbxzpiGWeZqsbVgu4T31ggpNEo mJJOtPOTxC5fk0mcu29ViOjuX2UhBnEp6LcIdceQDuWXAICRa+FzAIihFmerj12H IcaBHxq5qhwdhwY+L7t/k+t0/WjCbgGpkyOCI4nIBiXmg7zdMyJdFYJQVJ2JPyZV diZrsRDNtu3/D4ND1rZ0 =/yD1 -----END PGP SIGNATURE----- --=-6lnAKshgeF/PjQ0nKFTU--