Skip to contentSkip to conversation

Building btrfs as a dkms module on Debian

DISCUSSION Yuri D'Elia 2 participants 3 messages Feb 15, 2011 – Feb 16, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi everyone. I was trying to test a more recent version of btrfs on my = current kernel (2.6.37) using dkms, without success.

I followed these instructions:

https://btrfs.wiki.kernel.org/index.php/Btrfs_source_repositories

- cloned the repo
- symlinked to /usr/src/btrfs-git
- patched version.sh:

Please note version.sh requires bash (better to change the shebang or f= ix the script).
Even with the patch, version.sh run on a shallow repository generates a=
"-dirty" version. I assume this is OK, even though there are no local =
changes.

- run version.sh
- dkms add -m btrfs -v git
- dkms build -m btrfs -v git fails with:

/var/lib/dkms/btrfs/git/build/extent-tree.c: In function =E2=80=98btrfs= _issue_discard=E2=80=99:
/var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: =E2=80=98BLKDE= V_IFL_WAIT=E2=80=99 undeclared (first use in this function) /var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: (Each undeclar= ed identifier is reported only once /var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: for each funct= ion it appears in.) /var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: =E2=80=98BLKDE= V_IFL_BARRIER=E2=80=99 undeclared (first use in this function)

I assume BLKDEV_IFL_WAIT/BARRIER was added in later kernels? Is there a way to make it build btrfs for 2.6.37?

Thanks

--
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 1 line · Yuri D'Elia

Hi everyone. I was trying to test a more recent version of btrfs on m=

y current kernel (2.6.37) using dkms, without success.

Quoted 10 lines

=20
I followed these instructions:
=20
https://btrfs.wiki.kernel.org/index.php/Btrfs_source_repositories
=20
- cloned the repo
- symlinked to /usr/src/btrfs-git
- patched version.sh:
=20
Please note version.sh requires bash (better to change the shebang or=

fix the script).

Quoted 1 line

Even with the patch, version.sh run on a shallow repository generates=

a "-dirty" version. I assume this is OK, even though there are no loca=
l changes.

Quoted 6 lines

=20
- run version.sh
- dkms add -m btrfs -v git
- dkms build -m btrfs -v git fails with:
=20
/var/lib/dkms/btrfs/git/build/extent-tree.c: In function =E2=80=98btr=

fs_issue_discard=E2=80=99:

Quoted 1 line

/var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: =E2=80=98BLK=

DEV_IFL_WAIT=E2=80=99 undeclared (first use in this function)

Quoted 1 line

/var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: (Each undecl=

ared identifier is reported only once

Quoted 1 line

/var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: for each fun=

ction it appears in.)

Quoted 1 line

/var/lib/dkms/btrfs/git/build/extent-tree.c:1747: error: =E2=80=98BLK=

DEV_IFL_BARRIER=E2=80=99 undeclared (first use in this function)

Quoted 3 lines

=20
I assume BLKDEV_IFL_WAIT/BARRIER was added in later kernels? Is there a way to make it build btrfs for 2.6.37?

in commit fbd9b09a177a481eda256447c881f014f29034fe:
include/linux/blkdev.h:

#define BLKDEV_IFL_WAIT         (1 << BLKDEV_WAIT)
#define BLKDEV_IFL_BARRIER      (1 << BLKDEV_BARRIER)
#define BLKDEV_IFL_SECURE       (1 << BLKDEV_SECURE)

Maybe this is helpful.:)

thanks,
liubo

Quoted 5 lines

=20
Thanks
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
=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

#2 lore raw
Quoted 11 lines · On Wed, 16 Feb 2011 10:51:43 +0800 liubo <[email protected]> wrote:
Quoted 2 lines

I assume BLKDEV_IFL_WAIT/BARRIER was added in later kernels? Is there a way to make it build btrfs for 2.6.37?

in commit fbd9b09a177a481eda256447c881f014f29034fe:
include/linux/blkdev.h:

#define BLKDEV_IFL_WAIT         (1 << BLKDEV_WAIT)
#define BLKDEV_IFL_BARRIER      (1 << BLKDEV_BARRIER)
#define BLKDEV_IFL_SECURE       (1 << BLKDEV_SECURE)

Maybe this is helpful.:)

I've worked more on this today. There was a lot of restructuring of blkdev in 2.6.38, but in stock 2.6.37 only BLKDEV_SECURE has any effect.

Just in case, I'm posting here the changes required to backport current btrfs to 2.6.37 (just a few minor changes).

commit db77ab6c70a5c148ff4ab6d354603609c0eb73aa

Author: Yuri D'Elia <[email protected]>
Date:   Wed Feb 16 18:27:54 2011 +0100

Backport changes for compilation under 2.6.37

fs/btrfs/disk-io.c +2 -2
index 3e1ea3e..7022ac8 100644
@@ -2131,7 +2131,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
 	if (uptodate) {
 		set_buffer_uptodate(bh);
 	} else {
-		if (!buffer_eopnotsupp(bh) && printk_ratelimit()) {
+		if (printk_ratelimit()) {
 			printk(KERN_WARNING "lost page write due to "
 					"I/O error on %s\n",
 				       bdevname(bh->b_bdev, b));
@@ -2269,7 +2269,7 @@ static int write_dev_supers(struct btrfs_device *device,
 		}
 
 		if (i == last_barrier && do_barriers && device->barriers) {
-			ret = submit_bh(WRITE_BARRIER, bh);
+			ret = submit_bh(WRITE_FLUSH_FUA, bh);
 			if (ret == -EOPNOTSUPP) {
 				printk("btrfs: disabling barriers on dev %s\n",
 				       device->name);
fs/btrfs/dkms.conf new file +6 -0
new file mode 100644
index 0000000..10b8fb9
@@ -0,0 +1,6 @@
+PACKAGE_NAME="btrfs"
+PACKAGE_VERSION="20110214"
+BUILT_MODULE_NAME[0]="btrfs"
+DEST_MODULE_LOCATION[0]="/kernel/fs/btrfs/"
+AUTOINSTALL="yes"
+REMAKE_INITRD="yes"
fs/btrfs/extent-tree.c +1 -2
index a7aaa10..f3c96fc 100644
@@ -1743,8 +1743,7 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,
 static void btrfs_issue_discard(struct block_device *bdev,
 				u64 start, u64 len)
 {
-	blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL,
-			BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+	blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 0);
 }
 
 static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
fs/btrfs/extent_io.c +4 -0
index e7aeba2..06fd0d0 100644
@@ -16,6 +16,10 @@
 #include "ctree.h"
 #include "btrfs_inode.h"
 
+#define INIT_RCU_HEAD(ptr) do { \
+       (ptr)->next = NULL; (ptr)->func = NULL; \
+} while (0)
+
 static struct kmem_cache *extent_state_cache;
 static struct kmem_cache *extent_buffer_cache;
 
fs/btrfs/version.h +3 -3
index 9bf3946..d7c55c6 100644
@@ -1,4 +1,4 @@
-#ifndef __BTRFS_VERSION_H
-#define __BTRFS_VERSION_H
-#define BTRFS_BUILD_VERSION "Btrfs"
+#ifndef __BUILD_VERSION
+#define __BUILD_VERSION
+#define BTRFS_BUILD_VERSION "Btrfs 2011-02-14_16:21:37_-0500_c26a920-dirty"
 #endif
fs/btrfs/version.sh +1 -5
index 1ca1952..2c1d0b5 100644
@@ -12,10 +12,7 @@ which git &> /dev/null
 if [ $? == 0 ]; then
     git branch >& /dev/null
     if [ $? == 0 ]; then
-	    if head=`git rev-parse --verify HEAD 2>/dev/null`; then
-		if tag=`git describe --tags 2>/dev/null`; then
-		    v="$tag"
-		fi
+		v="`git show --format='%ci_%h'|head -n 1|sed -e 's/[^a-z0-9_:-]/_/ig'`"
 
 		# Are there uncommitted changes?
 		git update-index --refresh --unmerged > /dev/null
@@ -24,7 +21,6 @@ if [ $? == 0 ]; then
 		    | read dummy; then
 		    v="$v"-dirty
 		fi
-	    fi
     fi
 fi