Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OVvqG-0004Sm-2x for mharc-grub-devel@gnu.org; Mon, 05 Jul 2010 20:16:52 -0400 Received: from [140.186.70.92] (port=46796 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVm14-000175-CE for grub-devel@gnu.org; Mon, 05 Jul 2010 09:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVm10-0005Lk-QD for grub-devel@gnu.org; Mon, 05 Jul 2010 09:47:21 -0400 Received: from adelie.canonical.com ([91.189.90.139]:49928) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVm10-0005KO-JF for grub-devel@gnu.org; Mon, 05 Jul 2010 09:47:18 -0400 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OVm0x-0002LC-98; Mon, 05 Jul 2010 14:47:15 +0100 Received: from a88-114-89-221.elisa-laajakaista.fi ([88.114.89.221] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1OVm0w-0003x9-VN; Mon, 05 Jul 2010 14:47:15 +0100 From: Surbhi Palande To: grub-devel@gnu.org Date: Mon, 5 Jul 2010 16:47:11 +0300 Message-Id: X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Mon, 05 Jul 2010 20:16:50 -0400 Cc: Colin Watson , Alex Du , Chris Mason Subject: [PATCH 0/2] btrfs-support for grub-2 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2010 13:47:25 -0000 From: surbhi Hi All, I am attaching two patches along with this email for enabling btrfs support in grub2. Please note that the licensing for this patch needs to be sorted out as grub-2 is at GPL-v3 and btrfs support in the linux kernel is at GPL-v2. I have referred to the btrfs code in the kernel, btrfs-tools, sys-linux and legacy grub. I have used some code from sys-linux's btrfs support (written by Alek Du). As agreed in #btrfs irc, I am sending this email to Chris Mason to find out whether the code in the patch can be passed under GPLv3. The patch provides btrfs support for the following: 1) single device. 2) subvolumes. I have tested this patch using grub-fstest (using subcommands-ls, hex and crc). *I have not yet tested it by booting through the btrfs partition* This is the first version of the patch and I have listed a few changes that could be made: 1) change the storage identifiers to the grub compliant ones. 2) linkcount for symbolic links needs better handling I have a decompression support for btrfs-grub2 in an almost ready state. I will send that patch after these patches are sorted out. Please do let me know your comments. I will be glad to incorporate the changes inorder to get btrfs support into grub-2. Thanks for your time! Warm Regards, Surbhi. P/S: Following is a brief procedure with some eg. of how one can test these patches in qemu: 1) used an image created with "dd" as a hdb for qemu: kvm -hda ubuntu.img -hdb btrfs.img -m 512 -net nic,macaddr='DE:AD:BE:EF::' -net tap This is detected as /dev/sdb in qemu. 2) Booted through qemu and then did: fdisk -l /dev/sdb, created a partition table in /dev/sdb 4) Used mkfs.btrfs -A to create a filesystem at a byte reflected by the "start" field of the output of fdisk -ul and then mounted this btrfs img/partition using mount -o offset=. Populated the fs. 5) compiled grub-2 with this patch 6) tested using this command: a) grub-fstest /dev/sdb ls '(loop0,1)/' etc. Subvolumes can be created as follows: 1) mount -t btrfs /dev/sdb /mnt/btrfs 2) btrfsctl -S subvol1 /mnt 3) mount -t btrfs -o subvol=subvol1 /dev/sdb /mnt/btrfs_subvol 4) create some files, dir, links on /mnt/btrfs_subvol Now you can check the contents of the subvolume by using ./grub_fstest /dev/sdb ls '(loop0,1)/subvol1/' surbhi (2): config support for btrfs btrfs support for grub-2 conf/common.rmk | 40 +- conf/i386-pc.rmk | 4 +- conf/sparc64-ieee1275.rmk | 5 +- fs/btrfs.c | 1434 +++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs.h | 385 ++++++++++++ 5 files changed, 1843 insertions(+), 25 deletions(-) create mode 100644 fs/btrfs.c create mode 100644 fs/btrfs.h