From: Andre Noll Date: Thu, 25 Dec 2008 11:23:10 +0000 (+0100) Subject: Merge branch 'master' into bloom X-Git-Tag: v0.1.0~14^2~2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=25e4fb919ce9b87aeb5aa3456b687c5c3ba55a9e;p=adu.git Merge branch 'master' into bloom Conflicts: create.c --- 25e4fb919ce9b87aeb5aa3456b687c5c3ba55a9e diff --cc create.c index cd000c2,2925d57..c4d7195 --- a/create.c +++ b/create.c @@@ -167,38 -121,20 +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; + dir_size += s.st_size; + dir_files++; - ret = create_user_table(s.st_uid, &ui); ++ ret = create_user_table(conf.database_dir_arg, 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++; - ret = create_user_table(s.st_uid, &ui); - uid = s.st_uid; - ret = create_user_table(conf.database_dir_arg, uid, &ui); ++ ret = create_user_table(conf.database_dir_arg, 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; } @@@ -269,10 -173,7 +269,10 @@@ int com_create(void ret = scan_dir(conf.base_dir_arg, &zero); if (ret < 0) goto out; - ret = write_uid_file(); + ret = write_uid_file(conf.database_dir_arg); + log_bloom_stats(); out: + bloom_free(global_bloom_filter); + bloom_free(user_bloom_filter); return ret; }