[PATCH] btrfs-progs: mkfs: rename nodiscard option to K

2012-07-17 Thread David Sterba
The original patch named the option -T, mkfs.xfs uses -K let's keep it
same.

Signed-off-by: David Sterba dste...@suse.cz
---

Based on 8935d8436147f (current master) not yet tagged as 0.20, I hope it's
still time to fix it before it's released. Sorry for not sending the patch
earlier.

 man/mkfs.btrfs.8.in |2 +-
 mkfs.c  |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in
index fc2e1d2..ca57044 100644
--- a/man/mkfs.btrfs.8.in
+++ b/man/mkfs.btrfs.8.in
@@ -63,7 +63,7 @@ Specify the sectorsize, the minimum block allocation.
 \fB\-r\fR, \fB\-\-rootdir \fIrootdir\fR
 Specify a directory to copy into the newly created fs.
 .TP
-\fB\-T\fR, \fB\-\-nodiscard \fR
+\fB\-K\fR, \fB\-\-nodiscard \fR
 Do not perform whole device TRIM operation by default.
 .TP
 \fB\-V\fR, \fB\-\-version\fR
diff --git a/mkfs.c b/mkfs.c
index dff5eb8..394a622 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -348,7 +348,7 @@ static void print_usage(void)
fprintf(stderr, \t -n --nodesize size of btree nodes\n);
fprintf(stderr, \t -s --sectorsize min block allocation\n);
fprintf(stderr, \t -r --rootdir the source directory\n);
-   fprintf(stderr, \t -T --nodiscard do not perform whole device TRIM\n);
+   fprintf(stderr, \t -K --nodiscard do not perform whole device TRIM\n);
fprintf(stderr, %s\n, BTRFS_BUILD_VERSION);
exit(1);
 }
@@ -410,7 +410,7 @@ static struct option long_options[] = {
{ data, 1, NULL, 'd' },
{ version, 0, NULL, 'V' },
{ rootdir, 1, NULL, 'r' },
-   { nodiscard, 0, NULL, 'T' },
+   { nodiscard, 0, NULL, 'K' },
{ 0, 0, 0, 0}
 };
 
@@ -1237,7 +1237,7 @@ int main(int ac, char **av)
 
while(1) {
int c;
-   c = getopt_long(ac, av, A:b:l:n:s:m:d:L:r:VMT, long_options,
+   c = getopt_long(ac, av, A:b:l:n:s:m:d:L:r:VMK, long_options,
option_index);
if (c  0)
break;
@@ -1283,7 +1283,7 @@ int main(int ac, char **av)
source_dir = optarg;
source_dir_set = 1;
break;
-   case 'T':
+   case 'K':
nodiscard=1;
break;
default:
-- 
1.7.6.233.gd79bc

--
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


[PATCH] btrfs-progs: mkfs: create root directory with 755 permissions

2012-07-17 Thread David Sterba
That's what all other mkfs do and there's no reason for 0555.

Signed-off-by: David Sterba dste...@suse.cz
---
 utils.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils.c b/utils.c
index aade9e2..cfe7c49 100644
--- a/utils.c
+++ b/utils.c
@@ -614,7 +614,7 @@ int btrfs_make_root_dir(struct btrfs_trans_handle *trans,
btrfs_set_stack_inode_size(inode_item, 0);
btrfs_set_stack_inode_nlink(inode_item, 1);
btrfs_set_stack_inode_nbytes(inode_item, root-leafsize);
-   btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0555);
+   btrfs_set_stack_inode_mode(inode_item, S_IFDIR | 0755);
btrfs_set_stack_timespec_sec(inode_item.atime, now);
btrfs_set_stack_timespec_nsec(inode_item.atime, 0);
btrfs_set_stack_timespec_sec(inode_item.ctime, now);
-- 
1.7.9

--
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


[PATCH v2] btrfs-progs: mkfs: rename nodiscard option to K

2012-07-17 Thread David Sterba
The original patch named the option -T, mkfs.xfs uses -K let's keep it
same.

Signed-off-by: David Sterba dste...@suse.cz
---

v1-v2:
original patch at
http://comments.gmane.org/gmane.comp.file-systems.btrfs/16287
listed the shot option, dunno where it got lost, adding it now.

 man/mkfs.btrfs.8.in |3 ++-
 mkfs.c  |8 
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/man/mkfs.btrfs.8.in b/man/mkfs.btrfs.8.in
index fc2e1d2..8c157c1 100644
--- a/man/mkfs.btrfs.8.in
+++ b/man/mkfs.btrfs.8.in
@@ -13,6 +13,7 @@ mkfs.btrfs \- create an btrfs filesystem
 [ \fB\-n\fP\fI nodesize\fP ]
 [ \fB\-s\fP\fI sectorsize\fP ]
 [ \fB\-r\fP\fI rootdir\fP ]
+[ \fB\-K\fP ]
 [ \fB\-h\fP ]
 [ \fB\-V\fP ]
 \fI device\fP [ \fIdevice ...\fP ]
@@ -63,7 +64,7 @@ Specify the sectorsize, the minimum block allocation.
 \fB\-r\fR, \fB\-\-rootdir \fIrootdir\fR
 Specify a directory to copy into the newly created fs.
 .TP
-\fB\-T\fR, \fB\-\-nodiscard \fR
+\fB\-K\fR, \fB\-\-nodiscard \fR
 Do not perform whole device TRIM operation by default.
 .TP
 \fB\-V\fR, \fB\-\-version\fR
diff --git a/mkfs.c b/mkfs.c
index dff5eb8..394a622 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -348,7 +348,7 @@ static void print_usage(void)
fprintf(stderr, \t -n --nodesize size of btree nodes\n);
fprintf(stderr, \t -s --sectorsize min block allocation\n);
fprintf(stderr, \t -r --rootdir the source directory\n);
-   fprintf(stderr, \t -T --nodiscard do not perform whole device TRIM\n);
+   fprintf(stderr, \t -K --nodiscard do not perform whole device TRIM\n);
fprintf(stderr, %s\n, BTRFS_BUILD_VERSION);
exit(1);
 }
@@ -410,7 +410,7 @@ static struct option long_options[] = {
{ data, 1, NULL, 'd' },
{ version, 0, NULL, 'V' },
{ rootdir, 1, NULL, 'r' },
-   { nodiscard, 0, NULL, 'T' },
+   { nodiscard, 0, NULL, 'K' },
{ 0, 0, 0, 0}
 };
 
@@ -1237,7 +1237,7 @@ int main(int ac, char **av)
 
while(1) {
int c;
-   c = getopt_long(ac, av, A:b:l:n:s:m:d:L:r:VMT, long_options,
+   c = getopt_long(ac, av, A:b:l:n:s:m:d:L:r:VMK, long_options,
option_index);
if (c  0)
break;
@@ -1283,7 +1283,7 @@ int main(int ac, char **av)
source_dir = optarg;
source_dir_set = 1;
break;
-   case 'T':
+   case 'K':
nodiscard=1;
break;
default:
-- 
1.7.9

--
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


[PATCH] btrfs-progs: fsck: understand the -s option

2012-07-17 Thread David Sterba
Short options have to be repeated at the getopt_long call.

Signed-off-by: David Sterba dste...@suse.cz
---
 btrfsck.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/btrfsck.c b/btrfsck.c
index 088b9f4..2e81adc 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -3499,7 +3499,7 @@ int main(int ac, char **av)
 
while(1) {
int c;
-   c = getopt_long(ac, av, , long_options,
+   c = getopt_long(ac, av, s:, long_options,
option_index);
if (c  0)
break;
-- 
1.7.6.233.gd79bc

--
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


[PATCH] btrfs-progs: sort devices by id in fi show

2012-07-17 Thread David Sterba
Devids are printed in descending order now, switch it to ascending.

Signed-off-by: David Sterba dste...@suse.cz
---
 btrfs-show.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/btrfs-show.c b/btrfs-show.c
index 8210fd2..2a85932 100644
--- a/btrfs-show.c
+++ b/btrfs-show.c
@@ -77,7 +77,7 @@ static void print_one_uuid(struct btrfs_fs_devices 
*fs_devices)
 
free(super_bytes_used);
 
-   list_for_each(cur, fs_devices-devices) {
+   list_for_each_prev(cur, fs_devices-devices) {
char *total_bytes;
char *bytes_used;
device = list_entry(cur, struct btrfs_device, dev_list);
-- 
1.7.6.233.gd79bc

--
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


[PATCH] Btrfs: cleanup for unused ref cache stuff

2012-07-17 Thread Liu Bo
As ref cache has been removed from btrfs, there is no user on
its lock and its check.

Signed-off-by: Liu Bo liubo2...@cn.fujitsu.com
---
 fs/btrfs/ctree.h   |3 ---
 fs/btrfs/disk-io.c |5 -
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 84ac723..df031fb 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1256,9 +1256,6 @@ struct btrfs_fs_info {
struct rb_root defrag_inodes;
atomic_t defrag_running;
 
-   spinlock_t ref_cache_lock;
-   u64 total_ref_cache_size;
-
/*
 * these three are in extended format (availability of single
 * chunks is denoted by BTRFS_AVAIL_ALLOC_BIT_SINGLE bit, other
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 047f637..6975ece 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1910,7 +1910,6 @@ int open_ctree(struct super_block *sb,
INIT_LIST_HEAD(fs_info-caching_block_groups);
spin_lock_init(fs_info-delalloc_lock);
spin_lock_init(fs_info-trans_lock);
-   spin_lock_init(fs_info-ref_cache_lock);
spin_lock_init(fs_info-fs_roots_radix_lock);
spin_lock_init(fs_info-delayed_iput_lock);
spin_lock_init(fs_info-defrag_inodes_lock);
@@ -3116,10 +3115,6 @@ int close_ctree(struct btrfs_root *root)
printk(KERN_INFO btrfs: at unmount delalloc count %llu\n,
   (unsigned long long)fs_info-delalloc_bytes);
}
-   if (fs_info-total_ref_cache_size) {
-   printk(KERN_INFO btrfs: at umount reference cache size %llu\n,
-  (unsigned long long)fs_info-total_ref_cache_size);
-   }
 
free_extent_buffer(fs_info-extent_root-node);
free_extent_buffer(fs_info-extent_root-commit_root);
-- 
1.6.5.2

--
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


Unmountable btrfs filesystem

2012-07-17 Thread Providence M. SALUMU
Hi devs,

I can't mount my btrfs-based external disk. I don't know what happened
to the disk, but usually it gets disconnected (usb cable pulled out)
buy my 8 months old daughter.

Here's the output from dmesg:

[  299.699543] parent transid verify failed on 528952573952 wanted
22726 found 22728
[  299.700947] btrfs read error corrected: ino 1 off 528952573952 (dev
/dev/sdb6 sector 585319392)
[  299.701224] btrfs: open_ctree failed

I then run btrfsck /dev/sdb6 with not much more success at all. The
output is as follows:

  Ignoring transid failure
  leaf parent key incorrect 528969142272
  parent transid verify failed on 528969142272 wanted 22728 found 22726
  Ignoring transid failure
  leaf parent key incorrect 528969142272
  btrfsck: btrfsck.c:1933: check_owner_ref: Assertion `!(rec-is_root)' failed.
  Aborted

 My btrfs-progs comes from
   repository:
git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git
   at the commit:8935d8436147f86dfbda3d8b8175a77b654b8abc
   branch:   master
and I'm running linux-3.5_rc7 kernel. (Linux-3.5_rc6 has got the same
mount issue as well)

I tried the btrfs-find-root hint (from
https://btrfs.wiki.kernel.org/index.php/Restore), but since I don't
have the lines starting with Well block n seems great..., I'm
doubtful about which block id to run btrfs-restore -t n with.

Can you help in guys?

Many thanks in advance,

- Providence.
--
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: [PATCH] Btrfs: add DEVICE_READY ioctl

2012-07-17 Thread David Sterba
On Fri, Jun 22, 2012 at 08:12:52PM +0200, Goffredo Baroncelli wrote:
 On 06/21/2012 10:10 PM, Josef Bacik wrote:
  This will be used in conjunction with btrfs device ready dev.  This is
  needed for initrd's to have a nice and lightweight way to tell if all of the
  devices needed for a file system are in the cache currently.  This keeps
  them from having to do mount+sleep loops waiting for devices to show up.
  Thanks,
  
  Signed-off-by: Josef Bacik jba...@fusionio.com
  ---
   fs/btrfs/ioctl.h   |3 ++-
   fs/btrfs/super.c   |7 +++
   fs/btrfs/volumes.c |9 -
   fs/btrfs/volumes.h |1 +
   4 files changed, 18 insertions(+), 2 deletions(-)
  
  diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
  index 497c530..34317cf 100644
  --- a/fs/btrfs/ioctl.h
  +++ b/fs/btrfs/ioctl.h
  @@ -363,5 +363,6 @@ struct btrfs_ioctl_get_dev_stats {
struct btrfs_ioctl_get_dev_stats)
   #define BTRFS_IOC_GET_AND_RESET_DEV_STATS _IOWR(BTRFS_IOCTL_MAGIC, 53, \
  struct btrfs_ioctl_get_dev_stats)
  -
  +#define BTRFS_IOC_DEVICES_READY _IOW(BTRFS_IOCTL_MAGIC, 54, \
  +struct btrfs_ioctl_vol_args)
 
 What is the purpose of the ioctl args ? This could confuses the user (as
 programmer). However IIRC for the other ioctls without argument the same
 policy was applied.Maybe a better name than btrfs_ioctl_vol_args would
 help, like btrfs_generic_ioctl.
 
 Anyway, I suggest to return not a boolean value but a pair of integers:
 both the number of devices registered and the total number of devices.
 Better would be the dev-id found and the dev-id missing. This could help
 a lot the diagnostic of mount problem.

I thought that this could be implemented in a more generic way,
something like a DEVICE_QUERY, where we can get all sorts of details
about the particular device.

And if the device is not already discovered and cached, then the query
would simply indicate this.

 Finally I am starting to think that we should definitely switch to a
 /sys/btrfs style of interface

I'm all for a sysfs interface, having an ioctl way of retrieving
information is good, but not practical for use from scripting languages,
namely for writing tests.

There are some guys working on the sysfs patches, I did preliminary
reviews. The first step is to bring back the core sysfs support (mostly
done iirc) and then exporting various information.
I'll check what's the status.

 think something like:
 
 /sys/btrfs/fs-uuid/dev-uuid/present
size
space-occuped
number-of-error
[...]
 
 /sys/btrfs/fs-uuid/subvolume-id/read-only
 compressed
 raid-mode
 path
 [...]
 
 /sys/btrfs/fs-uuid/label
  mounted
  read-only
  compressed
  raid-mode
  [...]

That's a good start for a discussion.


david
--
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: [PATCH 0/5] btrfs: lz4/lz4hc compression

2012-07-17 Thread David Sterba
On Sat, Jul 07, 2012 at 11:06:44PM +0200, Jan Killius wrote:
 I get lots of kick the bucket messages with the newest lz4 patches.
 Is there any way to debug/fix this ?

That was a debugging message, harmless, will be removed in another
round.


david
--
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: [PATCH 0/2] Support for small units in display

2012-07-17 Thread David Sterba
On Mon, Jul 09, 2012 at 05:27:41PM +, Pierre Carrier wrote:
 I didn't test the initial patches enough.
 A second round is coming.

Please indicate the updated version by eg. adding a v2 to the subject of
the cover letter and describe the changes, makes it more clear to
maintainers/reviewers what to look at, thanks.


david
--
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: [PATCH 1/2] utils.c: fix sizes in B malloc in pretty_sizes

2012-07-17 Thread David Sterba
On Mon, Jul 09, 2012 at 05:29:34PM +, Pierre Carrier wrote:
 Before, sizes below 1KB are still displayed in KB,
 but without a unit.

Does it matter when the only size below 1KB one can get is 0 ? Though
for sake of consistency the B unit could be there in that case as well.
--
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: [PATCH 2/2] utils.c: offer to limit divisions in pretty_sizes

2012-07-17 Thread David Sterba
On Mon, Jul 09, 2012 at 05:30:21PM +, Pierre Carrier wrote:
 Dirty hack to allow inspection of sizes in lower units.

A commandline option would suit better IMHO. If this is a one-shot task
to find the sizes expressed with a different multiplier, then I don't
understhand the env variable approach. If it's meant to express all
size-related numbers with a given multiplier, than it could make sense,
but it has to be well documented and possibly a better variable name
picked.

Hugo referenced one of his patches,
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg06518.html
that adds -h or -H (1024-based and SI-based), but that does not fix the
problem that you want to se a specific size. So, I'm suggesting a
generic option

--units=PFX

where PFX can be arbitrary from KB, KiB and the rest of the list. Plus a
way to include the human-readable forms, both 1024- and SI-based.


david
--
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: [PATCH 2/2] Btrfs: kill root from btrfs_is_free_space_inode

2012-07-17 Thread David Sterba
On Tue, Jul 10, 2012 at 07:28:39PM +0800, Liu Bo wrote:
 Since root can be fetched via BTRFS_I macro directly, we can save an args
 for btrfs_is_free_space_inode().

I see a great opportunity to rename the function :) It does not cover
just the free space inode anymore and it'll be more confusing with the
btree inode case.

I don't have a better name than btrfs_is_special_inode, but am not
completely satisfied.


david
--
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: [PATCH] btrfs-progs: mkfs: rename nodiscard option to K

2012-07-17 Thread Tomasz Torcz
On Tue, Jul 17, 2012 at 11:14:17AM +0200, David Sterba wrote:
 The original patch named the option -T, mkfs.xfs uses -K let's keep it
 same.

  mkfs.ext2 used to have -K also, so one more +1 for this patch.

-- 
Tomasz TorczOnly gods can safely risk perfection,
xmpp: zdzich...@chrome.pl it's a dangerous thing for a man.  -- Alia

--
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


[PATCH 0/2] Btrfs: remove unwanted kernel log output

2012-07-17 Thread Stefan Behrens
People complained about unwanted kernel log output at mount time,
related to btrfs device I/O statistics. With these two commits, the
two messages are removed or filtered, respectively.

Stefan Behrens (2):
  Btrfs: remove unwanted printk() for btrfs device I/O stats
  Btrfs: suppress printk() if all device I/O stats are zero

 fs/btrfs/volumes.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
1.7.11.2

--
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


[PATCH 2/2] Btrfs: suppress printk() if all device I/O stats are zero

2012-07-17 Thread Stefan Behrens
Code is added to suppress the I/O stats printing at mount time if all
statistic values are zero.

Signed-off-by: Stefan Behrens sbehr...@giantdisaster.de
---
 fs/btrfs/volumes.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 6f04dae..d11606c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4877,6 +4877,14 @@ void btrfs_dev_stat_print_on_error(struct btrfs_device 
*dev)
 
 static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev)
 {
+   int i;
+
+   for (i = 0; i  BTRFS_DEV_STAT_VALUES_MAX; i++)
+   if (btrfs_dev_stat_read(dev, i) != 0)
+   break;
+   if (i == BTRFS_DEV_STAT_VALUES_MAX)
+   return; /* all values == 0, suppress message */
+
printk_in_rcu(KERN_INFO btrfs: bdev %s errs: wr %u, rd %u, flush %u, 
corrupt %u, gen %u\n,
   rcu_str_deref(dev-name),
   btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
-- 
1.7.11.2

--
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


[PATCH 1/2] Btrfs: remove unwanted printk() for btrfs device I/O stats

2012-07-17 Thread Stefan Behrens
People complained about the annoying kernel log message
btrfs: no dev_stats entry found ... (OK on first mount after mkfs)
everytime a filesystem is mounted for the first time after running
mkfs. Since the distribution of the btrfs-progs is not synchronized
to the kernel version, mkfs like it is now will be used also in the
future. Then this message is not useful to find errors, it is just
annoying. This commit removes the printk().

Signed-off-by: Stefan Behrens sbehr...@giantdisaster.de
---
 fs/btrfs/volumes.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ecaad40..6f04dae 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -4736,9 +4736,6 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
key.offset = device-devid;
ret = btrfs_search_slot(NULL, dev_root, key, path, 0, 0);
if (ret) {
-   printk_in_rcu(KERN_WARNING btrfs: no dev_stats entry 
found for device %s (devid %llu) (OK on first mount after mkfs)\n,
- rcu_str_deref(device-name),
- (unsigned long long)device-devid);
__btrfs_reset_dev_stats(device);
device-dev_stats_valid = 1;
btrfs_release_path(path);
-- 
1.7.11.2

--
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: [PATCH] Btrfs: add DEVICE_READY ioctl

2012-07-17 Thread Goffredo Baroncelli
On 07/17/2012 01:53 PM, David Sterba wrote:
 On Fri, Jun 22, 2012 at 08:12:52PM +0200, Goffredo Baroncelli wrote:
 On 06/21/2012 10:10 PM, Josef Bacik wrote:
 This will be used in conjunction with btrfs device ready dev.  This is
[]
 
 Finally I am starting to think that we should definitely switch to a
 /sys/btrfs style of interface
 
 I'm all for a sysfs interface, having an ioctl way of retrieving
 information is good, but not practical for use from scripting languages,
 namely for writing tests.

Moreover a sysfs interface is more extensible for further enanchement

 
 There are some guys working on the sysfs patches, I did preliminary
 reviews. The first step is to bring back the core sysfs support (mostly
 done iirc) and then exporting various information.
 I'll check what's the status.

Great, are there public patches, I am interested in contributing

 
 think something like:

 /sys/btrfs/fs-uuid/dev-uuid/present
size
space-occuped
number-of-error
[...]

 /sys/btrfs/fs-uuid/subvolume-id/read-only
 compressed
 raid-mode
 path
 [...]

 /sys/btrfs/fs-uuid/label
  mounted
  read-only
  compressed
  raid-mode
  [...]
 
 That's a good start for a discussion.
 
 
 david
 .
 

--
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: [PATCH v1 00/15] Btrfs: subvolume quota groups (qgroups)

2012-07-17 Thread Alex Lyakas
Jan,
I have studied to some extent the PDF and the code. I have some
questions; perhaps you can address them?

1) btrfs_qgroup_account_ref() calling btrfs_find_all_roots():
I understand that bytenr indicates some EXTENT_ITEM, which is a
back-reference for extent, which is perhaps a tree block (leaf or
node) or EXTENT_DATA. I also understand, that we want to receive a
list of subvolume roots, that reference this extent at some point in
time in the middle of a transaction. However, there is mentioning of
finding all extents that reference this extent, which is something
basic I don't understand. How an extent can back-reference another
extent? Also, how do we encounter roots (which is what we need in the
output) during this walking? Hope you can shed some light, or you can
let me continue digging in the code:)

2) btrfs_qgroup_account_ref() step 3:
I understand that at this step, we look at all roots that we cannot
reach from the new root (the one to/from which the ref is
added/removed). And we check the refcnt before/after addition/deletion
(respectively). Then we check that its refcnt before/after
addition/deletion equals to the number of reachable roots before/after
addition/deletion. I still don't understand fully why if these two
values are equal, we can update exclusive count?
My partial understanding is that such root, let's say before addition,
was exclusive owner of the extent. And now (since this root is not
reachable from new root), we are adding the extent to some disjoint
qgroup, so the previous root is not exclusive owner anymore. Is this
correct direction?

3) The paper mentions tracking groups to account for
referenced/exclusive properly during snapshot creation. Looking at
btrfs-progs, I see that currently the user is expected to correctly
indicate which values should be copied from where, and kernel (more or
less) blindly copies those values. Is this correct?

4) GROUP_RELATION items:
We have two such items for every relation. How do we know which one is
the child and which is the parent? It looks from the kernel code that
it is expected that child-qgroupid  parent-qgroupid. Is this correct?
If yes, who is enforcing this?

Thanks for your help,
Alex.

On Thu, Jul 12, 2012 at 12:43 PM, Jan Schmidt list.bt...@jan-o-sch.net wrote:
 This is a new version of Arne's qgroup patches from last October. The
 old patches didn't get the backref walking right, which is now based on
 the tree modification log.

 You can limit the space available to subvolumes or any group of
 subvolumes. You can determine the amount of space that will get freed
 when deleting a snapshot.

 The initial scan is still missing, so expect negative counters when you
 enable quotas on a non-empty volume and then delete stuff.

 Arne's introduction and concept description can still be found at

 http://sensille.com/qgroups.pdf

 You can pull these patches from my git repository

 git://git.jan-o-sch.net/btrfs-unstable qgroup

 The user mode patches required were sent at October 11, 2011 by Arne,
 subject [PATCH v0] btrfs-progs: add qgroup commands.

 I tried to include some fair benchmark results with this cover letter.
 However, I tried several disk benchmarks from the phoronix test suite,
 none of them resulted in any write throughput decrease. I will have to
 create a more realistic setup on my own to benchmark the impact of
 qgroups (suggestions welcome). For now, I just wanted to get that patch
 set out :-)

 Thanks,
 -Jan

 Arne Jansen (11):
   Btrfs: qgroup on-disk format
   Btrfs: add helper for tree enumeration
   Btrfs: check the root passed to btrfs_end_transaction
   Btrfs: added helper to create new trees
   Btrfs: qgroup state and initialization
   Btrfs: Test code to change the order of delayed-ref processing
   Btrfs: qgroup implementation and prototypes
   Btrfs: quota tree support and startup
   Btrfs: hooks to reserve qgroup space
   Btrfs: add qgroup ioctls
   Btrfs: add qgroup inheritance

 Jan Schmidt (4):
   Btrfs: fix buffer leak in btrfs_next_old_leaf
   Btrfs: join tree mod log code with the code holding back delayed refs
   Btrfs: call the qgroup accounting functions
   Btrfs: hooks for qgroup to record delayed refs

  fs/btrfs/Makefile  |2 +-
  fs/btrfs/backref.c |   30 +-
  fs/btrfs/backref.h |3 +-
  fs/btrfs/ctree.c   |  348 
  fs/btrfs/ctree.h   |  233 +++-
  fs/btrfs/delayed-ref.c |   56 +-
  fs/btrfs/delayed-ref.h |   62 +--
  fs/btrfs/disk-io.c |  134 -
  fs/btrfs/disk-io.h |6 +
  fs/btrfs/extent-tree.c |  119 -
  fs/btrfs/ioctl.c   |  244 +++-
  fs/btrfs/ioctl.h   |   62 ++-
  fs/btrfs/qgroup.c  | 1571 
 
  fs/btrfs/transaction.c |   57 ++-
  fs/btrfs/transaction.h |   11 +
  15 files changed, 2696 insertions(+), 242 deletions(-)
  create mode 100644 fs/btrfs/qgroup.c

 --
 1.7.3.4

 --
 To unsubscribe from this list: send the line unsubscribe 

Re: [PATCH v1 00/15] Btrfs: subvolume quota groups (qgroups)

2012-07-17 Thread Arne Jansen
On 07/17/2012 08:33 PM, Alex Lyakas wrote:
 Jan,
 I have studied to some extent the PDF and the code. I have some
 questions; perhaps you can address them?
 
 1) btrfs_qgroup_account_ref() calling btrfs_find_all_roots():
 I understand that bytenr indicates some EXTENT_ITEM, which is a
 back-reference for extent, which is perhaps a tree block (leaf or

Not a backreference. The EXTENT_ITEM entry is the allocation of the
extent. It also contains the back references.

 node) or EXTENT_DATA. I also understand, that we want to receive a
 list of subvolume roots, that reference this extent at some point in
 time in the middle of a transaction. However, there is mentioning of
 finding all extents that reference this extent, which is something
 basic I don't understand. How an extent can back-reference another

Here, the forward reference is meant. Tree nodes and leaves are
referenced by tree nodes, data extents are referenced by leaves.

 extent? Also, how do we encounter roots (which is what we need in the
 output) during this walking? Hope you can shed some light, or you can

iirc the root backreferences itself, which is the criterion that we
found a root.

 let me continue digging in the code:)
 
 2) btrfs_qgroup_account_ref() step 3:
 I understand that at this step, we look at all roots that we cannot
 reach from the new root (the one to/from which the ref is
 added/removed). And we check the refcnt before/after addition/deletion
 (respectively). Then we check that its refcnt before/after
 addition/deletion equals to the number of reachable roots before/after
 addition/deletion. I still don't understand fully why if these two
 values are equal, we can update exclusive count?

I would have to re-read the pdf, it's been a long time ;)

 My partial understanding is that such root, let's say before addition,
 was exclusive owner of the extent. And now (since this root is not
 reachable from new root), we are adding the extent to some disjoint
 qgroup, so the previous root is not exclusive owner anymore. Is this
 correct direction?

I think so. Drawing trees helps a lot here. Don't give up too easily,
it took us 2 weeks to work out the algorithm ;)

 
 3) The paper mentions tracking groups to account for
 referenced/exclusive properly during snapshot creation. Looking at
 btrfs-progs, I see that currently the user is expected to correctly
 indicate which values should be copied from where, and kernel (more or
 less) blindly copies those values. Is this correct?

Yes. It might be useful to create a description language what you are
going to snapshot from where and let progs take care that all tracking
groups are set up properly. But that is an area for further research,
currently it has to be done by hand.

 
 4) GROUP_RELATION items:
 We have two such items for every relation. How do we know which one is
 the child and which is the parent? It looks from the kernel code that
 it is expected that child-qgroupid  parent-qgroupid. Is this correct?
 If yes, who is enforcing this?

The qgroupid contains the level, and the parent always has to have a
level greater than that of the child. I think that is checked somewhere.
As the level is encoded into the upper bits, the above relation holds.

-Arne

 
 Thanks for your help,
 Alex.
 
 On Thu, Jul 12, 2012 at 12:43 PM, Jan Schmidt list.bt...@jan-o-sch.net 
 wrote:
 This is a new version of Arne's qgroup patches from last October. The
 old patches didn't get the backref walking right, which is now based on
 the tree modification log.

 You can limit the space available to subvolumes or any group of
 subvolumes. You can determine the amount of space that will get freed
 when deleting a snapshot.

 The initial scan is still missing, so expect negative counters when you
 enable quotas on a non-empty volume and then delete stuff.

 Arne's introduction and concept description can still be found at

 http://sensille.com/qgroups.pdf

 You can pull these patches from my git repository

 git://git.jan-o-sch.net/btrfs-unstable qgroup

 The user mode patches required were sent at October 11, 2011 by Arne,
 subject [PATCH v0] btrfs-progs: add qgroup commands.

 I tried to include some fair benchmark results with this cover letter.
 However, I tried several disk benchmarks from the phoronix test suite,
 none of them resulted in any write throughput decrease. I will have to
 create a more realistic setup on my own to benchmark the impact of
 qgroups (suggestions welcome). For now, I just wanted to get that patch
 set out :-)

 Thanks,
 -Jan

 Arne Jansen (11):
   Btrfs: qgroup on-disk format
   Btrfs: add helper for tree enumeration
   Btrfs: check the root passed to btrfs_end_transaction
   Btrfs: added helper to create new trees
   Btrfs: qgroup state and initialization
   Btrfs: Test code to change the order of delayed-ref processing
   Btrfs: qgroup implementation and prototypes
   Btrfs: quota tree support and startup
   Btrfs: hooks to reserve qgroup space
   Btrfs: 

Re: [PATCH v1 00/15] Btrfs: subvolume quota groups (qgroups)

2012-07-17 Thread Jan Schmidt
On 17.07.2012 21:25, Arne Jansen wrote:
 On 07/17/2012 08:33 PM, Alex Lyakas wrote:
 extent? Also, how do we encounter roots (which is what we need in the
 output) during this walking? Hope you can shed some light, or you can
 
 iirc the root backreferences itself, which is the criterion that we
 found a root.

As all the backref walking code, this differs between shared backrefs
and indirect backrefs, too. In general, the criterion is: We've got a
backref with a positive refcount, we've got a root id set for it, and we
determined that this block has no parent block.

See where find_parent_nodes adds to the roots ulist.

 let me continue digging in the code:)

Please do so :-)

-Jan
--
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: Unmountable btrfs filesystem

2012-07-17 Thread Providence M. SALUMU
Hi Kyle,

I've just tried both of the options you've suggested, they all fail :-(
btrfsch --repair /dev/sdb6 breaks with:

btrfsck: btrfsck.c:1933: check_owner_ref: Assertion `!(rec-is_root)'

I don't have more success with mount -t btrfs -o recovery command
unfortunately. Here is the output I get:

[  663.005399] parent transid verify failed on 528974954496 wanted
22723 found 22727
[  663.005928] btrfs read error corrected: ino 1 off 528974954496 (dev
/dev/sdb6 sector 585363104)
[  663.005933] btrfs: failed to read tree root on sdb6
[  663.013985] btrfs: open_ctree failed

Any other clues guys?

2012/7/17 Kyle Gates kylega...@hotmail.com:
 Have you tried mounting with the recovery option?
 mount -t btrfs -o recovery /dev/sdb6

 Did you use the btrfsck repair option?
 btrfsck --repair /dev/sdb6


 Date: Tue, 17 Jul 2012 07:13:17 -0400
 Subject: Unmountable btrfs filesystem
 From: providence.sal...@gmail.com
 To: linux-btrfs@vger.kernel.org


 Hi devs,

 I can't mount my btrfs-based external disk. I don't know what happened
 to the disk, but usually it gets disconnected (usb cable pulled out)
 buy my 8 months old daughter.

 Here's the output from dmesg:

 [ 299.699543] parent transid verify failed on 528952573952 wanted
 22726 found 22728
 [ 299.700947] btrfs read error corrected: ino 1 off 528952573952 (dev
 /dev/sdb6 sector 585319392)
 [ 299.701224] btrfs: open_ctree failed

 I then run btrfsck /dev/sdb6 with not much more success at all. The
 output is as follows:

 Ignoring transid failure
 leaf parent key incorrect 528969142272
 parent transid verify failed on 528969142272 wanted 22728 found 22726
 Ignoring transid failure
 leaf parent key incorrect 528969142272
 btrfsck: btrfsck.c:1933: check_owner_ref: Assertion `!(rec-is_root)'
 failed.
 Aborted

 My btrfs-progs comes from
 repository:
 git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git
 at the commit: 8935d8436147f86dfbda3d8b8175a77b654b8abc
 branch: master
 and I'm running linux-3.5_rc7 kernel. (Linux-3.5_rc6 has got the same
 mount issue as well)

 I tried the btrfs-find-root hint (from
 https://btrfs.wiki.kernel.org/index.php/Restore), but since I don't
 have the lines starting with Well block n seems great..., I'm
 doubtful about which block id to run btrfs-restore -t n with.

 Can you help in guys?

 Many thanks in advance,

 - Providence.
 --
 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: [PATCH 2/2] Btrfs: kill root from btrfs_is_free_space_inode

2012-07-17 Thread Liu Bo
On 07/17/2012 09:43 PM, David Sterba wrote:

 On Tue, Jul 10, 2012 at 07:28:39PM +0800, Liu Bo wrote:
 Since root can be fetched via BTRFS_I macro directly, we can save an args
 for btrfs_is_free_space_inode().
 
 I see a great opportunity to rename the function :) It does not cover
 just the free space inode anymore and it'll be more confusing with the
 btree inode case.
 
 I don't have a better name than btrfs_is_special_inode, but am not
 completely satisfied.
 


Hi David,

Seems that my patch's title is confusing you...

I made these patches to make this function return true if the inode is a free 
space inode
or an inode cache inode, but not the btree inode.

Or am I missing something? :)

thanks,
liubo

 
 david
 --
 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