From: Michael Vrable Date: Mon, 19 Nov 2007 17:57:42 +0000 (-0800) Subject: Drop the use of indirect blocks for storing pointers to data. X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=commitdiff_plain;h=6e0eba0d28ca8d73f199e7b4240b9da2cc96c741 Drop the use of indirect blocks for storing pointers to data. Now store the entire list of blocks that contain each file's contents inline in the metadata log, even when that list is large. Previously, the list was split out into a separate object when it contained more than 8 entries. These indirect blocks may still be useful, but they also complicate the metadata/statcache rewrite, so for the moment disable them. They may be reintroduced later. --- diff --git a/scandir.cc b/scandir.cc index 49d8c32..d5a8c86 100644 --- a/scandir.cc +++ b/scandir.cc @@ -229,33 +229,14 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, statcache->Save(path, &stat_buf, file_info["checksum"], object_list); - /* For files that only need to be broken apart into a few objects, store - * the list of objects directly. For larger files, store the data - * out-of-line and provide a pointer to the indrect object. */ - if (object_list.size() < 8) { - string blocklist = ""; - for (list::iterator i = object_list.begin(); - i != object_list.end(); ++i) { - if (i != object_list.begin()) - blocklist += " "; - blocklist += *i; - } - file_info["data"] = blocklist; - } else { - string blocklist = ""; - for (list::iterator i = object_list.begin(); - i != object_list.end(); ++i) { - blocklist += *i + "\n"; - } - - LbsObject *i = new LbsObject; - i->set_group("metadata"); - i->set_data(blocklist.data(), blocklist.size()); - i->write(tss); - file_info["data"] = "@" + i->get_name(); - segment_list.insert(i->get_ref().get_segment()); - delete i; + string blocklist = ""; + for (list::iterator i = object_list.begin(); + i != object_list.end(); ++i) { + if (i != object_list.begin()) + blocklist += "\n "; + blocklist += *i; } + file_info["data"] = blocklist; return size; }