]> git.neil.brown.name Git - LaFS.git/commitdiff
Fix calculation of table_size
authorNeilBrown <neilb@suse.de>
Fri, 1 Oct 2010 12:40:13 +0000 (22:40 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 1 Oct 2010 12:40:13 +0000 (22:40 +1000)
I was confused about which table I was sizing.
This is the table of which there are several in the segusage  files.

Signed-off-by: NeilBrown <neilb@suse.de>
super.c

diff --git a/super.c b/super.c
index cba689d5df539e74a58842afd473395fc40325fa..d02f80b8a3c7295c1c4a31f4368cfd61ff209831 100644 (file)
--- a/super.c
+++ b/super.c
@@ -651,14 +651,17 @@ lafs_load(struct fs *fs, struct options *op, int newest)
                        dv->tables_per_seg = dv->segment_size /
                                dv->width / dv->stride;
                        dv->rows_per_table = dv->stride;
-                       dv->tablesize = dv->rows_per_table * dv->width;
                        dv->segment_stride = dv->segment_size;
                } else {
                        dv->tables_per_seg = 1;
                        dv->rows_per_table = dv->segment_size / dv->width;
-                       dv->tablesize = dv->segment_size;
                        dv->segment_stride = dv->rows_per_table;
                }
+               /* table size is the number of blocks in the segment usage
+                * file per snapshot
+                */
+               dv->tablesize = (dv->segment_count + (1<<(fs->blocksize_bits-1)) + 1)
+                       >> (fs->blocksize_bits-1);
 
                for (j = 0; j < 2; j++)
                        dv->devaddr[j] = le64_to_cpu(dv->devblk->devaddr[j]);