Permalink
Browse files
Fix: ioctl search: actually use nr_items
Until now, nr_items was put in the search header for the first and each consecutive search. Instead, treat it as "I want to get at most this amount of results in total", and stop returning search results when this amount of objects is seen. This also eliminates unnecessary searches: For example, the block group lookup in the FileSystem object does a search between (vaddr BLOCK_GROUP_ITEM 0) and (vaddr BLOCK_GROUP_ITEM ULLONG_MAX) now when searching using only the vaddr. The first result comes in very quickly (afaics as quickly as when specifying the exact length in the offset field and searching for the exact key), but even with nr_items=1 set, it would do another search, starting at offset length+1 (because of incrementing the search key). This search would deliver no results, (there's no additional block group on the same objectid (vaddr). But... that additional search takes much longer. On a very large (tm) filesystem I have here (>35000 1G data chunks), the second search takes a minute to return, and reads more than 1 GiB from disk for some reason.
- Loading branch information