From: Karel Zak Date: Mon, 23 Sep 2024 14:39:24 +0000 (+0200) Subject: libmount: improve fs->stmnt_done mask use X-Git-Tag: v2.42-start~97^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e89fd1026f451e8d3ac8f3eea2ab0eb3ee4997a2;p=thirdparty%2Futil-linux.git libmount: improve fs->stmnt_done mask use It is possible that one field in the libmnt_fs struct requires fetching multiple statmount fields using multiple STATMOUNT_* mask items. This requires changes to the way the fs->stmnt_done mask is used. Signed-off-by: Karel Zak --- diff --git a/libmount/src/fs_statmount.c b/libmount/src/fs_statmount.c index 8f05a45fd..c44e82299 100644 --- a/libmount/src/fs_statmount.c +++ b/libmount/src/fs_statmount.c @@ -305,10 +305,16 @@ int mnt_fs_fetch_statmount(struct libmnt_fs *fs, uint64_t mask) /* add default mask if on-demand enabled */ if (fs->stmnt && !fs->stmnt->disabled - && fs->stmnt->mask - && !(fs->stmnt_done & fs->stmnt->mask)) + && fs->stmnt->mask) mask |= fs->stmnt->mask; + /* call only for missing stuff */ + if (mask && fs->stmnt_done) { + mask &= ~fs->stmnt_done; /* remove what is already done */ + if (!mask) + return 0; + } + /* ignore repeated requests */ if (mask && fs->stmnt_done & mask) return 0; diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index e2381e343..94328460a 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -291,7 +291,7 @@ struct libmnt_fs { if (!(FS)->MEMBER \ && (FS)->stmnt \ && !(FS)->stmnt->disabled \ - && !((FS)->stmnt_done & (FLAGS))) \ + && ((FLAGS) & ~((FS)->stmnt_done))) \ mnt_fs_fetch_statmount((FS), (FLAGS)); }) #endif