On Wed, Jan 22, 2020 at 03:32:16PM -0500, Josef Bacik wrote: > On 1/22/20 7:23 AM, fdmanana@xxxxxxxxxx wrote: > > From: Filipe Manana <fdmanana@xxxxxxxx> > > > > Each new element added to the mod seq list is always appended to the list, > > and each one gets a sequence number coming from a counter which gets > > incremented everytime a new element is added to the list (or a new node > > is added to the tree mod log rbtree). Therefore the element with the > > lowest sequence number is always the first element in the list. > > > > So just remove the list iteration at btrfs_put_tree_mod_seq() that > > computes the minimum sequence number in the list and replace it with > > a check for the first element's sequence number. > > > > Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx> > > This looks like a prime place for list_first_entry_or_null, but I'm not married > to it The if (!list_empty()) looks more readable to me as it's explicit, only implied by list_first_entry_or_null.
