Re: [PATCH v13 010/137] mm: Add folio flag manipulation functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 13, 2021 at 06:56:28PM -0700, Andrew Morton wrote:
> On Tue, 13 Jul 2021 11:55:04 -0400 Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> > I agree that _is_ reads nicer by itself, but paired with other ops
> > such as testset, _test_ might be better.
> > 
> > For example, in __set_page_dirty_no_writeback()
> > 
> > 	if (folio_is_dirty())
> > 		return !folio_testset_dirty()
> > 
> > is less clear about what's going on than would be:
> > 
> > 	if (folio_test_dirty())
> > 		return !folio_testset_dirty()
> 
> I like folio_is_foo().  As long as it is used consistently, we'll get
> used to it quickly.

I'm not sure that folio_is_private(), folio_is_lru(),
folio_is_waiters(), or folio_is_reclaim() really work.

> Some GNU tools are careful about appending "_p" to
> functions-which-test-something (stands for "predicate").  Having spent
> a lot of time a long time ago with my nose in this stuff, I found the
> convention to be very useful.  I think foo_is_bar() is as good as
> foo_bar_p() in this regard.

I just wish C let us put '?' on the end of a function name, but I
recognise the ambiguity with foo?bar:baz;

> And sure, the CaMeLcAsE is fugly, but it sure is useful. 
> set_page_dirty() is very different from SetPageDirty() and boy that
> visual differentiation is a relief.

Oh, I'm glad you brought that up </sarcasm>

In folios, here's how that ends up looking:

SetPageDirty() -> folio_set_dirty_flag()
		 (johannes proposes folio_set_dirty instead)
set_page_dirty() -> folio_mark_dirty()
aops->set_page_dirty() -> aops->dirty_folio()
__set_page_dirty() -> __folio_mark_dirty()
__set_page_dirty_buffers() -> block_dirty_folio()
__set_page_dirty_nobuffers() -> filemap_dirty_folio()
__set_page_dirty_no_writeback() -> dirty_folio_no_writeback()

I kind of feel that last one should be nowb_dirty_folio(), but I'm also
hoping to eliminate it; if the filesystem sets AS_NO_WRITEBACK_TAGS
in mapping->flags, then we just inline the no-writeback case into
folio_mark_dirty() (which already has it for the !mapping case).



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux