Message ID | 1307109001-19761-6-git-send-email-dedekind1@gmail.com |
---|---|
State | New, archived |
Headers | show |
On Fri, 2011-06-03 at 16:49 +0300, Artem Bityutskiy wrote: > + /* > + * Due to the way UBIFS updates the clean znode counter it may > + * temporarily be negative. > + */ > + return clean_zn_cnt > 0 ?: 1; Oh, this should be clean_zn_cnt >= 0 ?: 1;
On Fri, 2011-06-03 at 16:48 +0300, Artem Bityutskiy wrote: > On Fri, 2011-06-03 at 16:49 +0300, Artem Bityutskiy wrote: > > + /* > > + * Due to the way UBIFS updates the clean znode counter it may > > + * temporarily be negative. > > + */ > > + return clean_zn_cnt > 0 ?: 1; > > Oh, this should be clean_zn_cnt >= 0 ?: 1; Crap, sorry, stupid me :-) return clean_zn_cnt < 0 ?: clean_zn_cnt; But yeah, it is saner to not use "?:" at all: return clean_zn_cnt >= 0 ? clean_zn_cnt: 1;
diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c index ca953a9..dfc105a 100644 --- a/fs/ubifs/shrinker.c +++ b/fs/ubifs/shrinker.c @@ -284,7 +284,11 @@ int ubifs_shrinker(struct shrinker *shrink, struct shrink_control *sc) long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); if (nr == 0) - return clean_zn_cnt; + /* + * Due to the way UBIFS updates the clean znode counter it may + * temporarily be negative. + */ + return clean_zn_cnt > 0 ?: 1; if (!clean_zn_cnt) { /*