Skip to contentSkip to conversation

Btrfs: fix compile warning in fs/btrfs/inode.c

PATCH In review liubo 2 participants 3 messages Dec 8, 2010 – Dec 9, 2010 Btrfs file system

lore
Share & tools
lore

liubo

author
#0 lore raw

PATCH 1/1 Btrfs: fix compile warning in fs/btrfs/inode.c

While compiling btrfs, I got belows:

CC [M] fs/btrfs/inode.o
fs/btrfs/inode.c: In function =E2=80=98btrfs_end_dio_bio=E2=80=99:
fs/btrfs/inode.c:5720: warning: format =E2=80=98%lu=E2=80=99 expects ty= pe =E2=80=98long unsigned int=E2=80=99, but argument 4 has type =E2=80=98= sector_t=E2=80=99
LD [M] fs/btrfs/btrfs.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] fs/btrfs/btrfs.ko

This fixes the compile warning.

---
 fs/btrfs/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +0 -0
index 0f34cae..eff5aef 100644
@@ -5713,8 +5713,8 @@ static void btrfs_end_dio_bio(struct bio *bio, in=

t err)
if (err) {
printk(KERN_ERR "btrfs direct IO failed ino %lu rw %lu "
"disk_bytenr %lu len %u err no %d\n",

-		      dip->inode->i_ino, bio->bi_rw, bio->bi_sector,
-		      bio->bi_size, err);
+		      dip->inode->i_ino, bio->bi_rw,
+		      (unsigned long)bio->bi_sector, bio->bi_size, err);

dip->errors =3D 1;
=20
/*
--=20
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 5 lines · liubo

While compiling btrfs, I got belows:
=20
CC [M] fs/btrfs/inode.o
fs/btrfs/inode.c: In function =E2=80=98btrfs_end_dio_bio=E2=80=99:
fs/btrfs/inode.c:5720: warning: format =E2=80=98%lu=E2=80=99 expects =

type =E2=80=98long unsigned int=E2=80=99, but argument 4 has type =E2=80= =98sector_t=E2=80=99

fs/btrfs/inode.c static void btrfs_end_dio_bio(struct bio *bio, =

Quoted 17 lines

LD [M] fs/btrfs/btrfs.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] fs/btrfs/btrfs.ko
=20
This fixes the compile warning.
=20

---
 fs/btrfs/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

=20

fs/btrfs/inode.c +0 -0
index 0f34cae..eff5aef 100644
@@ -5713,8 +5713,8 @@ static void btrfs_end_dio_bio(struct bio *bio, =

int err)

fs/btrfs/inode.c static void btrfs_end_dio_bio(struct bio *bio, = · line 5717

Quoted 7 lines
fs/btrfs/inode.c +2 -2
 	if (err) {
 		printk(KERN_ERR "btrfs direct IO failed ino %lu rw %lu "
 		      "disk_bytenr %lu len %u err no %d\n",
-		      dip->inode->i_ino, bio->bi_rw, bio->bi_sector,
-		      bio->bi_size, err);
+		      dip->inode->i_ino, bio->bi_rw,
+		      (unsigned long)bio->bi_sector, bio->bi_size, err);

sector_t is defined by include/linux/types.h as follows.

  #ifdef CONFIG_LBDAF
  typedef u64 sector_t;
  typedef u64 blkcnt_t;
  #else
  typedef unsigned long sector_t;
  typedef unsigned long blkcnt_t;
  #endif

Therefore, I think that you should change the code as follows.=20 =20

		printk(KERN_ERR "btrfs direct IO failed ino %lu rw %lu "
		      "disk_bytenr %llu len %u err no %d\n",
		      dip->inode->i_ino, bio->bi_rw,
		      (u64)bio->bi_sector, bio->bi_size, err);
Quoted 3 lines
fs/btrfs/inode.c +0 -0
 		dip->errors =3D 1;

=20
/*

Regards,
Itoh

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
In reply to liubo
Quoted 5 lines · liubo

While compiling btrfs, I got belows:
=20
CC [M] fs/btrfs/inode.o
fs/btrfs/inode.c: In function =E2=80=98btrfs_end_dio_bio=E2=80=99:
fs/btrfs/inode.c:5720: warning: format =E2=80=98%lu=E2=80=99 expects =

type =E2=80=98long unsigned int=E2=80=99, but argument 4 has type =E2=80= =98sector_t=E2=80=99

Quoted 7 lines

LD [M] fs/btrfs/btrfs.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] fs/btrfs/btrfs.ko
=20
This fixes the compile warning.
=20

Sorry, plz ignore this.

Have seen someone post patch to fix this.

thanks,
Liu Bo

fs/btrfs/inode.c static void btrfs_end_dio_bio(struct bio *bio, =

Quoted 10 lines
---
 fs/btrfs/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

=20

fs/btrfs/inode.c +0 -0
index 0f34cae..eff5aef 100644
@@ -5713,8 +5713,8 @@ static void btrfs_end_dio_bio(struct bio *bio, =

int err)

Quoted 10 lines
fs/btrfs/inode.c +2 -2
 	if (err) {
 		printk(KERN_ERR "btrfs direct IO failed ino %lu rw %lu "
 		      "disk_bytenr %lu len %u err no %d\n",
-		      dip->inode->i_ino, bio->bi_rw, bio->bi_sector,
-		      bio->bi_size, err);
+		      dip->inode->i_ino, bio->bi_rw,
+		      (unsigned long)bio->bi_sector, bio->bi_size, err);
 		dip->errors =3D 1;

=20
/*

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html