bdi: replace BDI_CAP_NO_{WRITEBACK,ACCT_DIRTY} with a single flag
Replace the two negative flags that are always used together with a single positive flag that indicates the writeback capability instead of two related non-capabilities. Also remove the pointless wrappers to just check the flag. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:

committed by
Jens Axboe

parent
823423ef55
commit
f56753ac2a
@@ -110,27 +110,14 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
|
||||
/*
|
||||
* Flags in backing_dev_info::capability
|
||||
*
|
||||
* The first three flags control whether dirty pages will contribute to the
|
||||
* VM's accounting and whether writepages() should be called for dirty pages
|
||||
* (something that would not, for example, be appropriate for ramfs)
|
||||
*
|
||||
* WARNING: these flags are closely related and should not normally be
|
||||
* used separately. The BDI_CAP_NO_ACCT_AND_WRITEBACK combines these
|
||||
* three flags into a single convenience macro.
|
||||
*
|
||||
* BDI_CAP_NO_ACCT_DIRTY: Dirty pages shouldn't contribute to accounting
|
||||
* BDI_CAP_NO_WRITEBACK: Don't write pages back
|
||||
* BDI_CAP_WRITEBACK_ACCT: Automatically account writeback pages
|
||||
* BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
|
||||
* BDI_CAP_WRITEBACK: Supports dirty page writeback, and dirty pages
|
||||
* should contribute to accounting
|
||||
* BDI_CAP_WRITEBACK_ACCT: Automatically account writeback pages
|
||||
* BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold
|
||||
*/
|
||||
#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
|
||||
#define BDI_CAP_NO_WRITEBACK 0x00000002
|
||||
#define BDI_CAP_WRITEBACK_ACCT 0x00000004
|
||||
#define BDI_CAP_STRICTLIMIT 0x00000010
|
||||
#define BDI_CAP_CGROUP_WRITEBACK 0x00000020
|
||||
|
||||
#define BDI_CAP_NO_ACCT_AND_WRITEBACK \
|
||||
(BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY)
|
||||
#define BDI_CAP_WRITEBACK (1 << 0)
|
||||
#define BDI_CAP_WRITEBACK_ACCT (1 << 1)
|
||||
#define BDI_CAP_STRICTLIMIT (1 << 2)
|
||||
|
||||
extern struct backing_dev_info noop_backing_dev_info;
|
||||
|
||||
@@ -169,24 +156,9 @@ static inline int wb_congested(struct bdi_writeback *wb, int cong_bits)
|
||||
long congestion_wait(int sync, long timeout);
|
||||
long wait_iff_congested(int sync, long timeout);
|
||||
|
||||
static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
|
||||
static inline bool mapping_can_writeback(struct address_space *mapping)
|
||||
{
|
||||
return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK);
|
||||
}
|
||||
|
||||
static inline bool bdi_cap_account_dirty(struct backing_dev_info *bdi)
|
||||
{
|
||||
return !(bdi->capabilities & BDI_CAP_NO_ACCT_DIRTY);
|
||||
}
|
||||
|
||||
static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
|
||||
{
|
||||
return bdi_cap_writeback_dirty(inode_to_bdi(mapping->host));
|
||||
}
|
||||
|
||||
static inline bool mapping_cap_account_dirty(struct address_space *mapping)
|
||||
{
|
||||
return bdi_cap_account_dirty(inode_to_bdi(mapping->host));
|
||||
return inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK;
|
||||
}
|
||||
|
||||
static inline int bdi_sched_wait(void *word)
|
||||
@@ -223,7 +195,7 @@ static inline bool inode_cgwb_enabled(struct inode *inode)
|
||||
|
||||
return cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
|
||||
cgroup_subsys_on_dfl(io_cgrp_subsys) &&
|
||||
bdi_cap_account_dirty(bdi) &&
|
||||
(bdi->capabilities & BDI_CAP_WRITEBACK) &&
|
||||
(inode->i_sb->s_iflags & SB_I_CGROUPWB);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user