Re: lvm volume like support

2013-03-01 Thread Marcus Sorensen
That's great, but the issue is that usually the block device version
performs better than just creating a file and using it as a raw image
or loop device. Creating a file, then running it through a SCSI target
seems like it's going in the opposite direction.

On Wed, Feb 27, 2013 at 2:57 AM, Alex Elsayed eternal...@gmail.com wrote:
 Alex Elsayed wrote:

 Roman Mamedov wrote:

 On Wed, 27 Feb 2013 13:23:23 +1100
 Fajar A. Nugraha l...@fajar.net wrote:

 snip

 This could be pretty easily put into a shell script that uses du -b and
 manually pokes configfs instead of calling tcm_node, and it'd be able to
 run without any nonstandard userspace dependencies.

 Just for fun, I decided to put my money where my mouth is and implement
 a quick scsi-target-losetup that actually worked, both for creation and
 deletion. Here it is:

 ---cut---

 #!/bin/bash

 gen_naa() {
 local UUID=$( uuidgen -r )
 UUID=${UUID//-/}
 UUID=${UUID:0:9}
 echo naa.6001405${UUID}
 }

 setup() {
 local FILE
 local INPUT_NAME
 local NAME
 local BACKEND_IDX
 local TRANSPORT_IDX
 declare -a NAA
 FILE=${1}
 INPUT_NAME=${2}
 NAME=${INPUT_NAME//\//_}
 BACKEND_IDX='-1'
 TRANSPORT_IDX='-1'

 if [[ $UID -ne 0 ]]; then
 echo You must be root in order to set up a lioloop device 2
 exit 1
 fi

 if [[ ${NAME} != ${INPUT_NAME} ]]; then
 echo The chosen name '${INPUT_NAME}' contained slashes, using 
 '${NAME}' instead 2
 fi

 declare SIZE=$(du -b ${FILE})
 SIZE=${SIZE/[^0123456789]*}

 # Load the scsi target core and backends
 modprobe target_core_mod /dev/null 21

 while BACKEND_IDX=$((BACKEND_IDX + 1)); do
 if [[ -d 
 /sys/kernel/config/target/core/fileio_${BACKEND_IDX}/${NAME} ]]; then
 echo A backstore with the name '${NAME}' already exists 2
 exit 1
 elif ! [[ -d /sys/kernel/config/target/core/fileio_${BACKEND_IDX} ]]; 
 then
 #mkdir -p 
 /sys/kernel/config/target/core/fileio_${BACKEND_IDX}/${NAME}
 # Tell it where the file is and how big it is
 tcm_node --establishdev fileio_${BACKEND_IDX}/${NAME} \
 fd_dev_name=${FILE},fd_dev_size=${SIZE}
 # Give it a unique serial
 tcm_node --setunitserialwithmd fileio_${BACKEND_IDX}/${NAME} 
 $(uuidgen -r)
 break
 fi
 done

 # Load the local scsi frontend transport
 modprobe tcm_loop /dev/null 21
 mkdir -p /sys/kernel/config/target/loopback

 NAA=( $(gen_naa) $(gen_naa) )
 # Some setup so you have a place to put LUNs
 mkdir -p /sys/kernel/config/target/loopback/${NAA[0]}/tpgt_1
 echo ${NAA[1]}  
 /sys/kernel/config/target/loopback/${NAA[0]}/tpgt_1/nexus

 # Create a fresh LUN...
 while TRANSPORT_IDX=$((TRANSPORT_IDX + 1)); do
 if ! [[ -d 
 /sys/kernel/config/target/loopback/${NAA[0]}/tpgt_1/lun/lun_${TRANSPORT_IDX}
  ]]; then
 mkdir -p 
 /sys/kernel/config/target/loopback/${NAA[0]}/tpgt_1/lun/lun_${TRANSPORT_IDX}
 # ...and map the file to it.
 ln -s 
 /sys/kernel/config/target/core/fileio_${BACKEND_IDX}/${NAME} \
 
 /sys/kernel/config/target/loopback/${NAA[0]}/tpgt_1/lun/lun_${TRANSPORT_IDX}
 break
 fi
 done
 }

 teardown() {
 local INPUT_NAME=${1}
 local NAME=${INPUT_NAME//\//_}

 if [[ $UID -ne 0 ]]; then
 echo You must be root in order to tear down a lioloop device 2
 exit 1
 fi

 if [[ ${NAME} != ${INPUT_NAME} ]]; then
 echo The chosen name '${INPUT_NAME}' contained slashes, using 
 '${NAME}' instead 2
 fi

 local FOUND=''
 for LUN in /sys/kernel/config/target/loopback/*/tpgt_1/lun/lun_*; do
 if [[ -L ${LUN}/${NAME} ]]; then
 rm -f ${LUN}/${NAME}
 FOUND=1
 fi
 done

 if [[ -z ${FOUND} ]]; then
 echo No lioloop with the name '${NAME}' was found 2
 return
 fi

 for BACKSTORE in /sys/kernel/config/target/core/fileio_*; do
 if [[ -d ${BACKSTORE}/${NAME} ]]; then
 rmdir ${BACKSTORE}/${NAME}
 fi
 done
 }

 if [[ $1 == '-d' ]]; then
 shift;
 for name in $@; do
 teardown ${name}
 done
 else
 setup $@
 fi



 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



Re: Low volume list ?

2011-09-01 Thread Marcus Sorensen
Aren't the subjects like [PATCH and [GIT specifically so people
can filter the messages how they see fit?

On Thu, Sep 1, 2011 at 9:01 AM, Swâmi Petaramesh sw...@petaramesh.org wrote:
 Hi list,

 Could it be considered to create a low-volume, user-oriented mailing-list
 that wouldn't spit an email for each and every git pull or patch, which are of
 interest to developpers only, and of no interest at all for users ?

 I personally am in need of information about BTRFS, i.e. new features,
 pitfalls, bugs, important fixes or when will btrfsck be available ?, but 
 I've
 already unsubscribed (and then re-subscribed...) twice to this list, annoyed
 by the point to which it was spamming my mailbox with information among which
 99% is of no interest to me, although 1% is very interesting :-}

 --
 Swâmi Petaramesh sw...@petaramesh.org http://petaramesh.org PGP 9076E32E

 Avant qu'une personne n'étudie le Zen, les montagnes sont les montagnes,
 les eaux sont les eaux. Après un premier aperçu de la vérité du Zen, les
 montagnes ne sont plus les montagnes, les eaux ne sont plus les eaux.
 Après l'éveil, les montagnes sont de nouveau les montagnes, les eaux de
 nouveau les eaux.
        -- Kôan Zen
 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at fs/btrfs/delayed-inode.c:1693!

2011-07-28 Thread Marcus Sorensen
I too have run into this just today, file system is nearly fresh:


[ cut here ]
kernel BUG at fs/btrfs/delayed-inode.c:1693!
invalid opcode:  [#9] SMP
CPU 21
Modules linked in: btrfs zlib_deflate ip6t_REJECT nf_conntrack_ipv6
nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6
serio_raw pcspkr amd64_edac_mod edac_core edac_mce_amd i2c_piix4
i2c_core igb dca sg ses enclosure ext4 mbcache jbd2 sd_mod crc_t10dif
ata_generic pata_acpi pata_atiixp ahci libahci megaraid_sas dm_mod
[last unloaded: scsi_wait_scan]

Pid: 4445, comm: cosd Tainted: G  D W   3.0.0 #5 Supermicro H8DGT/H8DGT
RIP: 0010:[a02756d0]  [a02756d0]
btrfs_delayed_update_inode+0x120/0x130 [btrfs]
RSP: 0018:8807ea0ddbb8  EFLAGS: 00010286
RAX: ffe4 RBX: 8804814cebe8 RCX: 00018000
RDX: 00017000 RSI: 00018000 RDI: 8807eb8f41d0
RBP: 8807ea0ddbf8 R08:  R09: 0016
R10:  R11:  R12: 8804814cec30
R13: 88067df691d8 R14: 8803f3a7da50 R15: 8807dea6a800
FS:  7fb19f027700() GS:88081f4a() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fd83c1d2000 CR3: 0007eba74000 CR4: 06e0
DR0:  DR1:  DR2: 
DR3:  DR6: 0ff0 DR7: 0400
Process cosd (pid: 4445, threadinfo 8807ea0dc000, task 8807eb022a80)
Stack:
 0001 00018000 a7f0 88067df691d8
 8803f3a7da50 88067df691d8 880654f58a30 
 8807ea0ddc48 a0233a43 8807ea5839a8 018c
Call Trace:
 [a0233a43] btrfs_update_inode+0x53/0x160 [btrfs]
 [a025cfec] btrfs_ioctl_clone+0x9bc/0xc90 [btrfs]
 [a025d5db] btrfs_ioctl+0x31b/0xd20 [btrfs]
 [811675c9] ? do_filp_open+0x49/0xa0
 [8116a27a] do_vfs_ioctl+0x9a/0x540
 [8116a7c1] sys_ioctl+0xa1/0xb0
 [8153eec2] system_call_fastpath+0x16/0x1b
Code: 00 03 00 00 8d 0c 49 48 89 ca 48 89 4d c8 e8 28 db f9 ff 85 c0
48 8b 4d c8 75 10 48 89 4b 08 e9 40 ff ff ff 0f 1f 80 00 00 00 00 0f
0b eb fe 66 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48
RIP  [a02756d0] btrfs_delayed_update_inode+0x120/0x130 [btrfs]
 RSP 8807ea0ddbb8
---[ end trace a90b454752c77b8a ]---


Just prior to this, lots of these:

[ cut here ]
WARNING: at fs/btrfs/inode.c:2194 btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]()
Hardware name: H8DGT
Modules linked in: btrfs zlib_deflate ip6t_REJECT nf_conntrack_ipv6
nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6
serio_raw pcspkr amd64_edac_mod edac_core edac_mce_amd i2c_piix4
i2c_core igb dca sg ses enclosure ext4 mbcache jbd2 sd_mod crc_t10dif
ata_generic pata_acpi pata_atiixp ahci libahci megaraid_sas dm_mod
[last unloaded: scsi_wait_scan]
Pid: 5445, comm: kworker/14:0 Tainted: GW   3.0.0 #5
Call Trace:
 [8106000f] warn_slowpath_common+0x7f/0xc0
 [8106006a] warn_slowpath_null+0x1a/0x20
 [a022f240] btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]
 [a022a835] commit_fs_roots+0xc5/0x1b0 [btrfs]
 [a022b8ee] btrfs_commit_transaction+0x40e/0x850 [btrfs]
 [81059e5f] ? dequeue_task_fair+0x20f/0x220
 [8100a78b] ? __switch_to+0x12b/0x320
 [810825d0] ? wake_up_bit+0x40/0x40
 [a022c000] ? btrfs_end_transaction+0x20/0x20 [btrfs]
 [a022c01f] do_async_commit+0x1f/0x30 [btrfs]
 [8107b971] process_one_work+0x131/0x450
 [8107d51c] worker_thread+0x17c/0x3c0
 [8107d3a0] ? manage_workers+0x220/0x220
 [81081f56] kthread+0x96/0xa0
 [81540004] kernel_thread_helper+0x4/0x10
 [81081ec0] ? kthread_worker_fn+0x1a0/0x1a0
 [8154] ? gs_change+0x13/0x13
---[ end trace a90b454752c77b80 ]---
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING: at fs/btrfs/inode.c:2204

2011-07-28 Thread Marcus Sorensen
Ahh , this was the kernel warning you mentioned over at ceph.  I just
ran into it as well, with a fresh ceph system, all storage nodes are
doing it (must be the cool thing), seems to have led to (or
coincidentally followed by) the kernel BUG at
fs/btrfs/delayed-inode.c:1693! emailed about.

WARNING: at fs/btrfs/inode.c:2194 btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]()
Hardware name: H8DGT
Modules linked in: btrfs zlib_deflate ip6t_REJECT nf_conntrack_ipv6
nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6
serio_raw pcspkr amd64_edac_mod edac_core edac_mce_amd i2c_piix4
i2c_core igb dca sg ses enclosure ext4 mbcache jbd2 sd_mod crc_t10dif
ata_generic pata_acpi pata_atiixp ahci libahci megaraid_sas dm_mod
[last unloaded: scsi_wait_scan]
Pid: 3066, comm: kworker/13:2 Tainted: GW   3.0.0 #5
Call Trace:
 [8106000f] warn_slowpath_common+0x7f/0xc0
 [8106006a] warn_slowpath_null+0x1a/0x20
 [a022f240] btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]
 [a022a835] commit_fs_roots+0xc5/0x1b0 [btrfs]
 [a022b8ee] btrfs_commit_transaction+0x40e/0x850 [btrfs]
 [8100a78b] ? __switch_to+0x12b/0x320
 [810825d0] ? wake_up_bit+0x40/0x40
 [a022c000] ? btrfs_end_transaction+0x20/0x20 [btrfs]
 [a022c01f] do_async_commit+0x1f/0x30 [btrfs]
 [8107b971] process_one_work+0x131/0x450
 [8107d51c] worker_thread+0x17c/0x3c0
 [8107d3a0] ? manage_workers+0x220/0x220
 [81081f56] kthread+0x96/0xa0
 [81540004] kernel_thread_helper+0x4/0x10
 [81081ec0] ? kthread_worker_fn+0x1a0/0x1a0
 [8154] ? gs_change+0x13/0x13
---[ end trace a90b454752c77b78 ]---
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html