Commit e8c96f8c authored by Tobias Klauser's avatar Tobias Klauser Committed by Linus Torvalds
Browse files

[PATCH] fs: Use ARRAY_SIZE macro


Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove a
duplicate of ARRAY_SIZE.  Some trailing whitespaces are also deleted.
Signed-off-by: default avatarTobias Klauser <tklauser@nuerscht.ch>
Cc: David Howells <dhowells@redhat.com>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Acked-by: default avatarTrond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Chris Mason <mason@suse.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Nathan Scott <nathans@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b5029622
......@@ -660,8 +660,7 @@ udf_find_anchor(struct super_block *sb)
* lastblock
* however, if the disc isn't closed, it could be 512 */
for (i=0; (!lastblock && i<sizeof(last)/sizeof(int)); i++)
{
for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) {
if (last[i] < 0 || !(bh = sb_bread(sb, last[i])))
{
ident = location = 0;
......@@ -672,7 +671,7 @@ udf_find_anchor(struct super_block *sb)
location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
udf_release_data(bh);
}
if (ident == TAG_IDENT_AVDP)
{
if (location == last[i] - UDF_SB_SESSION(sb))
......@@ -753,8 +752,7 @@ udf_find_anchor(struct super_block *sb)
}
}
for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++)
{
for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
if (UDF_SB_ANCHOR(sb)[i])
{
if (!(bh = udf_read_tagged(sb,
......@@ -1313,8 +1311,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
if (!sb)
return 1;
for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++)
{
for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb,
UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident)))
{
......@@ -1325,7 +1322,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength );
main_e = main_e >> sb->s_blocksize_bits;
main_e += main_s;
/* Locate the reserve sequence */
reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation);
reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength);
......@@ -1344,12 +1341,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
}
}
if (i == sizeof(UDF_SB_ANCHOR(sb))/sizeof(int))
{
if (i == ARRAY_SIZE(UDF_SB_ANCHOR(sb))) {
udf_debug("No Anchor block found\n");
return 1;
}
else
} else
udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]);
for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
......
......@@ -56,7 +56,7 @@ xfs_read_xfsstats(
};
/* Loop over all stats groups */
for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) {
for (i=j=len = 0; i < ARRAY_SIZE(xstats); i++) {
len += sprintf(buffer + len, xstats[i].desc);
/* inner loop does each group */
while (j < xstats[i].endpoint) {
......
......@@ -1335,7 +1335,7 @@ xfs_inactive_symlink_rmt(
*/
done = 0;
XFS_BMAP_INIT(&free_list, &first_block);
nmaps = sizeof(mval) / sizeof(mval[0]);
nmaps = ARRAY_SIZE(mval);
if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size),
XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps,
&free_list)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment