From: Andre Noll Date: Fri, 24 Apr 2009 09:37:08 +0000 (+0200) Subject: Merge commit 'athcx/bloom' X-Git-Tag: v0.1.0~14 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=e505632b96561200b3d5d308b14b853d48952aab;p=adu.git Merge commit 'athcx/bloom' Conflicts: create.c --- e505632b96561200b3d5d308b14b853d48952aab diff --cc create.c index 87b0b9a,408ab63..0394412 --- a/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; + dir_size += s.st_size; + dir_files++; - 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, + 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; }