Merge commit 'athcx/bloom'
authorAndre Noll <maan@systemlinux.org>
Fri, 24 Apr 2009 09:37:08 +0000 (11:37 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 24 Apr 2009 09:37:08 +0000 (11:37 +0200)
Conflicts:

create.c

1  2 
Makefile
adu.c
adu.ggo
create.c

diff --cc Makefile
Simple merge
diff --cc adu.c
Simple merge
diff --cc adu.ggo
Simple merge
diff --cc create.c
+++ b/create.c
@@@ -121,20 -167,38 +167,38 @@@ static int scan_dir(char *dirname, uint
                if (S_ISDIR(m)) {
                        if (conf.one_file_system_given && s.st_dev != device_id)
                                continue;
 -                      ret = create_user_table(conf.database_dir_arg, s.st_uid, &ui);
+                       dir_size += s.st_size;
+                       dir_files++;
++                      ret = create_user_table(s.st_uid, &ui);
+                       if (ret < 0)
+                               goto out;
+                       ret = update_user_row(ui->table, this_dir_num,
+                               s.st_size);
+                       if (ret < 0)
+                               goto out;
                        ret = scan_dir(entry->d_name, &this_dir_num);
                        if (ret < 0)
                                goto out;
                        continue;
                }
                /* regular file */
-               size = s.st_size;
-               dir_size += size;
+               make_bloom_buf(&s, bloom_buf);
+               if (insert_global_bloom(&s, bloom_buf))
+                       DEBUG_LOG("global hard link: %s/%s\n", dirname,
+                               entry->d_name);
+               else
+                       dir_size += s.st_size;
                dir_files++;
-               uid = s.st_uid;
-               ret = create_user_table(uid, &ui);
 -              ret = create_user_table(conf.database_dir_arg, s.st_uid, &ui);
++              ret = create_user_table(s.st_uid, &ui);
                if (ret < 0)
                        goto out;
-               ret = update_user_row(ui->table, this_dir_num, &size);
+               ret = insert_user_bloom(&s, bloom_buf);
+               if (ret)
+                       DEBUG_LOG("hard link for uid %d: %s/%s\n",
+                               (unsigned)s.st_uid, dirname, entry->d_name);
+               ret = update_user_row(ui->table, this_dir_num,
+                       ret? 0 : s.st_size);
                if (ret < 0)
                        goto out;
        }
@@@ -173,7 -269,10 +269,10 @@@ int com_create(void
        ret = scan_dir(conf.base_dir_arg, &zero);
        if (ret < 0)
                goto out;
 -      ret = write_uid_file(conf.database_dir_arg);
 +      ret = write_uid_file();
+       log_bloom_stats();
  out:
+       bloom_free(global_bloom_filter);
+       bloom_free(user_bloom_filter);
        return ret;
  }