mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-03 19:50:34 +01:00 
			
		
		
		
	crucible: use set instead of vector in BtrfsExtentWalker
This gets rid of some more big memsets. It may replace them with a lot of tiny mallocs, though. If this turns out to be a bad idea then at least we can easily revert the change.
This commit is contained in:
		@@ -707,6 +707,12 @@ namespace crucible {
 | 
			
		||||
		return offset + len;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool
 | 
			
		||||
	BtrfsIoctlSearchHeader::operator<(const BtrfsIoctlSearchHeader &that) const
 | 
			
		||||
	{
 | 
			
		||||
		return tie(objectid, type, offset, len, transid) < tie(that.objectid, that.type, that.offset, that.len, that.transid);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bool
 | 
			
		||||
	BtrfsIoctlSearchKey::do_ioctl_nothrow(int fd)
 | 
			
		||||
	{
 | 
			
		||||
@@ -727,13 +733,12 @@ namespace crucible {
 | 
			
		||||
		static_cast<btrfs_ioctl_search_key&>(*this) = ioctl_ptr->key;
 | 
			
		||||
 | 
			
		||||
		m_result.clear();
 | 
			
		||||
		m_result.reserve(nr_items);
 | 
			
		||||
 | 
			
		||||
		size_t offset = pointer_distance(ioctl_ptr->buf, ioctl_ptr);
 | 
			
		||||
		for (decltype(nr_items) i = 0; i < nr_items; ++i) {
 | 
			
		||||
			BtrfsIoctlSearchHeader item;
 | 
			
		||||
			offset = item.set_data(ioctl_arg, offset);
 | 
			
		||||
			m_result.push_back(item);
 | 
			
		||||
			m_result.insert(item);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user