Files
kernel_google_msm-4.9/include/linux/backing-dev.h
Lucas Wei 28ab10340e Merge android-4.9-q (4.9.258) into android-msm-pixel-4.9-lts
Merge 4.9.258 into android-4.9-q
Linux 4.9.258
    kvm: check tlbs_dirty directly
    scsi: qla2xxx: Fix crash during driver load on big endian machines
    xen-blkback: fix error handling in xen_blkbk_map()
    xen-scsiback: don't "handle" error by BUG()
    xen-netback: don't "handle" error by BUG()
    xen-blkback: don't "handle" error by BUG()
    xen/arm: don't ignore return errors from set_phys_to_machine
    Xen/gntdev: correct error checking in gntdev_map_grant_pages()
    Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
    Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
    Xen/x86: don't bail early from clear_foreign_p2m_mapping()
  * tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
      Makefile
      scripts/Makefile.build
  * tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
      scripts/Makefile.build
  * trace: Use -mcount-record for dynamic ftrace
      scripts/Makefile.build
    x86/build: Disable CET instrumentation in the kernel for 32-bit too
    vsock: fix locking in vsock_shutdown()
    vsock/virtio: update credit only if socket is not closed
  * net: watchdog: hold device global xmit lock during tx disable
      include/linux/netdevice.h
    net/vmw_vsock: improve locking in vsock_connect_timeout()
    usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
    usb: dwc3: ulpi: fix checkpatch warning
    h8300: fix PREEMPTION build, TI_PRE_COUNT undefined
  * netfilter: conntrack: skip identical origin tuple in same zone only
      net/netfilter/nf_conntrack_core.c
    xen/netback: avoid race in xenvif_rx_ring_slots_available()
    netfilter: xt_recent: Fix attempt to update deleted entry
  * bpf: Check for integer overflow when using roundup_pow_of_two()
      kernel/bpf/stackmap.c
  * memblock: do not start bottom-up allocations with kernel_end
      mm/memblock.c
    ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL
  * ovl: skip getxattr of security labels
      fs/overlayfs/copy_up.c
  * tracing: Check length before giving out the filter buffer
      kernel/trace/trace.c
  * tracing: Do not count ftrace events in top level enable output
      kernel/trace/trace_events.c
    squashfs: add more sanity checks in xattr id lookup
    squashfs: add more sanity checks in inode lookup
    squashfs: add more sanity checks in id lookup
  * futex: Cure exit race
      kernel/futex.c
  * futex: Change locking rules
      kernel/futex.c
  * futex: Ensure the correct return value from futex_lock_pi()
      kernel/futex.c
  * memcg: fix a crash in wb_workfn when a device disappears
      fs/fs-writeback.c
      include/linux/backing-dev.h
      include/trace/events/writeback.h
      mm/backing-dev.c
  * include/trace/events/writeback.h: fix -Wstringop-truncation warnings
      include/trace/events/writeback.h
  * lib/string: Add strscpy_pad() function
      include/linux/string.h
      lib/string.c
    SUNRPC: Handle 0 length opaque XDR object data properly
  * SUNRPC: Move simple_get_bytes and simple_get_netobj into private header
      include/linux/sunrpc/xdr.h
    iwlwifi: mvm: guard against device removal in reprobe
    iwlwifi: pcie: add a NULL check in iwl_pcie_txq_unmap
    iwlwifi: mvm: take mutex for calling iwl_mvm_get_sync_time()
  * af_key: relax availability checks for skb size calculation
      net/key/af_key.c
    remoteproc: qcom_q6v5_mss: Validate MBA firmware size before load
  * fgraph: Initialize tracing_graph_pause at task creation
      include/linux/ftrace.h
  * mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback()
      include/linux/memcontrol.h
      mm/page-writeback.c
    Merge 4.9.257 into android-4.9-q
Linux 4.9.257
    ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
    iommu/vt-d: Do not use flush-queue when caching-mode is on
    ACPI: thermal: Do not call acpi_thermal_check() directly
  * Input: xpad - sync supported devices with fork on GitHub
      drivers/input/joystick/xpad.c
    x86/apic: Add extra serialization for non-serializing MSRs
  * x86/build: Disable CET instrumentation in the kernel
      Makefile
    mm: thp: fix MADV_REMOVE deadlock on shmem THP
    mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
    mm: hugetlb: fix a race between isolating and freeing page
  * mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page
      include/linux/hugetlb.h
    ARM: footbridge: fix dc21285 PCI configuration accessors
  * mmc: core: Limit retries when analyse of SDIO tuples fails
      drivers/mmc/core/sdio_cis.c
    cifs: report error instead of invalid when revalidating a dentry fails
  * xhci: fix bounce buffer usage for non-sg list case
      drivers/usb/host/xhci-ring.c
    kretprobe: Avoid re-registration of the same kretprobe earlier
    mac80211: fix station rate table updates on assoc
    usb: dwc2: Fix endpoint direction check in ep_from_windex
    USB: usblp: don't call usb_set_interface if there's a single alt
    USB: gadget: legacy: fix an error code in eth_bind()
  * elfcore: fix building with clang
      include/linux/elfcore.h
      kernel/Makefile
    net: lapb: Copy the skb before sending a packet
    Input: i8042 - unbreak Pegatron C15B
    USB: serial: option: Adding support for Cinterion MV31
    USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000
    USB: serial: cp210x: add pid/vid for WSDA-200-USB
  * stable: clamp SUBLEVEL in 4.4 and 4.9
      Makefile
    objtool: Don't fail on missing symbol table
    scsi: ibmvfc: Set default timeout to avoid crash during migration
    mac80211: fix fast-rx encryption check
    scsi: libfc: Avoid invoking response handler twice if ep is already completed
  * futex: Handle faults correctly for PI futexes
      kernel/futex.c
  * futex: Simplify fixup_pi_state_owner()
      kernel/futex.c
  * futex: Use pi_state_update_owner() in put_pi_state()
      kernel/futex.c
  * rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Provide and use pi_state_update_owner()
      kernel/futex.c
  * futex: Replace pointless printk in fixup_owner()
      kernel/futex.c
  * futex: Avoid violating the 10th rule of futex
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Rework inconsistent rt_mutex/futex_q state
      kernel/futex.c
  * futex: Remove rt_mutex_deadlock_account_*()
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex.h
  * futex,rt_mutex: Provide futex specific rt_mutex API
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * net_sched: reject silly cell_log in qdisc_get_rtab()
      net/sched/sch_api.c
    ibmvnic: Ensure that CRQ entry read are correctly ordered
    net: dsa: bcm_sf2: put device node before return
    Merge 4.9.256 into android-4.9-q
Linux 4.9.256
    Merge 4.9.255 into android-4.9-q
Linux 4.9.255
    NFC: fix possible resource leak
    NFC: fix resource leak when target index is invalid
    iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built
    iommu/vt-d: Gracefully handle DMAR units with no supported address widths
    can: dev: prevent potential information leak in can_fill_info()
    mac80211: pause TX while changing interface type
    iwlwifi: pcie: reschedule in long-running memory reads
    iwlwifi: pcie: use jiffies for memory read spin time limit
    RDMA/cxgb4: Fix the reported max_recv_sge value
  * xfrm: Fix oops in xfrm_replay_advance_bmp
      net/xfrm/xfrm_input.c
    netfilter: nft_dynset: add timeout extension to template
    ARM: imx: build suspend-imx6.S with arm instruction set
    mt7601u: fix rx buffer refcounting
    mt7601u: fix kernel crash unplugging the device
  * leds: trigger: fix potential deadlock with libata
      drivers/leds/led-triggers.c
    KVM: x86: get smi pending status correctly
    KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
  * futex: Prevent exit livelock
      kernel/futex.c
  * futex: Provide distinct return value when owner is exiting
      kernel/futex.c
  * futex: Add mutex around futex exit
      include/linux/futex.h
      include/linux/sched.h
      kernel/futex.c
  * futex: Provide state handling for exec() as well
      kernel/futex.c
  * futex: Sanitize exit state handling
      kernel/futex.c
  * futex: Mark the begin of futex exit explicitly
      include/linux/futex.h
      kernel/exit.c
      kernel/futex.c
  * futex: Set task::futex_state to DEAD right after handling futex exit
      kernel/exit.c
      kernel/futex.c
  * futex: Split futex_mm_release() for exit/exec
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * exit/exec: Seperate mm_release()
      fs/exec.c
      include/linux/sched.h
      kernel/exit.c
      kernel/fork.c
  * futex: Replace PF_EXITPIDONE with a state
      include/linux/futex.h
      include/linux/sched.h
      kernel/exit.c
      kernel/futex.c
  * futex: Move futex exit handling into futex code
      include/linux/compat.h
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * y2038: futex: Move compat implementation into futex.c
      include/linux/futex.h
      kernel/Makefile
      kernel/futex.c
    net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
  * wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
      net/wireless/wext-core.c
    ACPI: sysfs: Prefer "compatible" modalias

Bug: 181732917
Change-Id: Ice169f5980390199db8f86d42e944cdf5f37c562
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-03-12 14:56:50 +08:00

539 lines
14 KiB
C

/*
* include/linux/backing-dev.h
*
* low-level device information and state which is propagated up through
* to high-level code.
*/
#ifndef _LINUX_BACKING_DEV_H
#define _LINUX_BACKING_DEV_H
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/blkdev.h>
#include <linux/device.h>
#include <linux/writeback.h>
#include <linux/blk-cgroup.h>
#include <linux/backing-dev-defs.h>
#include <linux/slab.h>
int __must_check bdi_init(struct backing_dev_info *bdi);
static inline struct backing_dev_info *bdi_get(struct backing_dev_info *bdi)
{
kref_get(&bdi->refcnt);
return bdi;
}
void bdi_put(struct backing_dev_info *bdi);
__printf(3, 4)
int bdi_register(struct backing_dev_info *bdi, struct device *parent,
const char *fmt, ...);
int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
int bdi_register_owner(struct backing_dev_info *bdi, struct device *owner);
void bdi_unregister(struct backing_dev_info *bdi);
int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);
void bdi_destroy(struct backing_dev_info *bdi);
struct backing_dev_info *bdi_alloc_node(gfp_t gfp_mask, int node_id);
void wb_start_writeback(struct bdi_writeback *wb, long nr_pages,
bool range_cyclic, enum wb_reason reason);
void wb_start_background_writeback(struct bdi_writeback *wb);
void wb_workfn(struct work_struct *work);
void wb_wakeup_delayed(struct bdi_writeback *wb);
extern spinlock_t bdi_lock;
extern struct list_head bdi_list;
extern struct workqueue_struct *bdi_wq;
static inline bool wb_has_dirty_io(struct bdi_writeback *wb)
{
return test_bit(WB_has_dirty_io, &wb->state);
}
static inline bool bdi_has_dirty_io(struct backing_dev_info *bdi)
{
/*
* @bdi->tot_write_bandwidth is guaranteed to be > 0 if there are
* any dirty wbs. See wb_update_write_bandwidth().
*/
return atomic_long_read(&bdi->tot_write_bandwidth);
}
static inline void __add_wb_stat(struct bdi_writeback *wb,
enum wb_stat_item item, s64 amount)
{
__percpu_counter_add(&wb->stat[item], amount, WB_STAT_BATCH);
}
static inline void __inc_wb_stat(struct bdi_writeback *wb,
enum wb_stat_item item)
{
__add_wb_stat(wb, item, 1);
}
static inline void inc_wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
{
unsigned long flags;
local_irq_save(flags);
__inc_wb_stat(wb, item);
local_irq_restore(flags);
}
static inline void __dec_wb_stat(struct bdi_writeback *wb,
enum wb_stat_item item)
{
__add_wb_stat(wb, item, -1);
}
static inline void dec_wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
{
unsigned long flags;
local_irq_save(flags);
__dec_wb_stat(wb, item);
local_irq_restore(flags);
}
static inline s64 wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
{
return percpu_counter_read_positive(&wb->stat[item]);
}
static inline s64 __wb_stat_sum(struct bdi_writeback *wb,
enum wb_stat_item item)
{
return percpu_counter_sum_positive(&wb->stat[item]);
}
static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item)
{
s64 sum;
unsigned long flags;
local_irq_save(flags);
sum = __wb_stat_sum(wb, item);
local_irq_restore(flags);
return sum;
}
extern void wb_writeout_inc(struct bdi_writeback *wb);
/*
* maximal error of a stat counter.
*/
static inline unsigned long wb_stat_error(struct bdi_writeback *wb)
{
#ifdef CONFIG_SMP
return nr_cpu_ids * WB_STAT_BATCH;
#else
return 1;
#endif
}
int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio);
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_NO_ACCT_WB: Don't automatically account writeback pages
* BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
*
* BDI_CAP_CGROUP_WRITEBACK: Supports cgroup-aware writeback.
*/
#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
#define BDI_CAP_NO_WRITEBACK 0x00000002
#define BDI_CAP_NO_ACCT_WB 0x00000004
#define BDI_CAP_STABLE_WRITES 0x00000008
#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 | BDI_CAP_NO_ACCT_WB)
extern struct backing_dev_info noop_backing_dev_info;
/**
* writeback_in_progress - determine whether there is writeback in progress
* @wb: bdi_writeback of interest
*
* Determine whether there is writeback waiting to be handled against a
* bdi_writeback.
*/
static inline bool writeback_in_progress(struct bdi_writeback *wb)
{
return test_bit(WB_writeback_running, &wb->state);
}
static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
{
struct super_block *sb;
if (!inode)
return &noop_backing_dev_info;
sb = inode->i_sb;
#ifdef CONFIG_BLOCK
if (sb_is_blkdev_sb(sb))
return I_BDEV(inode)->bd_bdi;
#endif
return sb->s_bdi;
}
static inline int wb_congested(struct bdi_writeback *wb, int cong_bits)
{
struct backing_dev_info *bdi = wb->bdi;
if (bdi->congested_fn)
return bdi->congested_fn(bdi->congested_data, cong_bits);
return wb->congested->state & cong_bits;
}
long congestion_wait(int sync, long timeout);
long wait_iff_congested(struct pglist_data *pgdat, int sync, long timeout);
int pdflush_proc_obsolete(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos);
static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi)
{
return bdi->capabilities & BDI_CAP_STABLE_WRITES;
}
static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
{
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 bdi_cap_account_writeback(struct backing_dev_info *bdi)
{
/* Paranoia: BDI_CAP_NO_WRITEBACK implies BDI_CAP_NO_ACCT_WB */
return !(bdi->capabilities & (BDI_CAP_NO_ACCT_WB |
BDI_CAP_NO_WRITEBACK));
}
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));
}
static inline int bdi_sched_wait(void *word)
{
schedule();
return 0;
}
#ifdef CONFIG_CGROUP_WRITEBACK
struct bdi_writeback_congested *
wb_congested_get_create(struct backing_dev_info *bdi, int blkcg_id, gfp_t gfp);
void wb_congested_put(struct bdi_writeback_congested *congested);
struct bdi_writeback *wb_get_create(struct backing_dev_info *bdi,
struct cgroup_subsys_state *memcg_css,
gfp_t gfp);
void wb_memcg_offline(struct mem_cgroup *memcg);
void wb_blkcg_offline(struct blkcg *blkcg);
int inode_congested(struct inode *inode, int cong_bits);
/**
* inode_cgwb_enabled - test whether cgroup writeback is enabled on an inode
* @inode: inode of interest
*
* cgroup writeback requires support from both the bdi and filesystem.
* Also, both memcg and iocg have to be on the default hierarchy. Test
* whether all conditions are met.
*
* Note that the test result may change dynamically on the same inode
* depending on how memcg and iocg are configured.
*/
static inline bool inode_cgwb_enabled(struct inode *inode)
{
struct backing_dev_info *bdi = inode_to_bdi(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_CGROUP_WRITEBACK) &&
(inode->i_sb->s_iflags & SB_I_CGROUPWB);
}
/**
* wb_find_current - find wb for %current on a bdi
* @bdi: bdi of interest
*
* Find the wb of @bdi which matches both the memcg and blkcg of %current.
* Must be called under rcu_read_lock() which protects the returend wb.
* NULL if not found.
*/
static inline struct bdi_writeback *wb_find_current(struct backing_dev_info *bdi)
{
struct cgroup_subsys_state *memcg_css;
struct bdi_writeback *wb;
memcg_css = task_css(current, memory_cgrp_id);
if (!memcg_css->parent)
return &bdi->wb;
wb = radix_tree_lookup(&bdi->cgwb_tree, memcg_css->id);
/*
* %current's blkcg equals the effective blkcg of its memcg. No
* need to use the relatively expensive cgroup_get_e_css().
*/
if (likely(wb && wb->blkcg_css == task_css(current, io_cgrp_id)))
return wb;
return NULL;
}
/**
* wb_get_create_current - get or create wb for %current on a bdi
* @bdi: bdi of interest
* @gfp: allocation mask
*
* Equivalent to wb_get_create() on %current's memcg. This function is
* called from a relatively hot path and optimizes the common cases using
* wb_find_current().
*/
static inline struct bdi_writeback *
wb_get_create_current(struct backing_dev_info *bdi, gfp_t gfp)
{
struct bdi_writeback *wb;
rcu_read_lock();
wb = wb_find_current(bdi);
if (wb && unlikely(!wb_tryget(wb)))
wb = NULL;
rcu_read_unlock();
if (unlikely(!wb)) {
struct cgroup_subsys_state *memcg_css;
memcg_css = task_get_css(current, memory_cgrp_id);
wb = wb_get_create(bdi, memcg_css, gfp);
css_put(memcg_css);
}
return wb;
}
/**
* inode_to_wb_is_valid - test whether an inode has a wb associated
* @inode: inode of interest
*
* Returns %true if @inode has a wb associated. May be called without any
* locking.
*/
static inline bool inode_to_wb_is_valid(struct inode *inode)
{
return inode->i_wb;
}
/**
* inode_to_wb - determine the wb of an inode
* @inode: inode of interest
*
* Returns the wb @inode is currently associated with. The caller must be
* holding either @inode->i_lock, @inode->i_mapping->tree_lock, or the
* associated wb's list_lock.
*/
static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
{
#ifdef CONFIG_LOCKDEP
WARN_ON_ONCE(debug_locks &&
(!lockdep_is_held(&inode->i_lock) &&
!lockdep_is_held(&inode->i_mapping->tree_lock) &&
!lockdep_is_held(&inode->i_wb->list_lock)));
#endif
return inode->i_wb;
}
/**
* unlocked_inode_to_wb_begin - begin unlocked inode wb access transaction
* @inode: target inode
* @cookie: output param, to be passed to the end function
*
* The caller wants to access the wb associated with @inode but isn't
* holding inode->i_lock, mapping->tree_lock or wb->list_lock. This
* function determines the wb associated with @inode and ensures that the
* association doesn't change until the transaction is finished with
* unlocked_inode_to_wb_end().
*
* The caller must call unlocked_inode_to_wb_end() with *@cookie afterwards and
* can't sleep during the transaction. IRQs may or may not be disabled on
* return.
*/
static inline struct bdi_writeback *
unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
{
rcu_read_lock();
/*
* Paired with store_release in inode_switch_wb_work_fn() and
* ensures that we see the new wb if we see cleared I_WB_SWITCH.
*/
cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
if (unlikely(cookie->locked))
spin_lock_irqsave(&inode->i_mapping->tree_lock, cookie->flags);
/*
* Protected by either !I_WB_SWITCH + rcu_read_lock() or tree_lock.
* inode_to_wb() will bark. Deref directly.
*/
return inode->i_wb;
}
/**
* unlocked_inode_to_wb_end - end inode wb access transaction
* @inode: target inode
* @cookie: @cookie from unlocked_inode_to_wb_begin()
*/
static inline void unlocked_inode_to_wb_end(struct inode *inode,
struct wb_lock_cookie *cookie)
{
if (unlikely(cookie->locked))
spin_unlock_irqrestore(&inode->i_mapping->tree_lock, cookie->flags);
rcu_read_unlock();
}
#else /* CONFIG_CGROUP_WRITEBACK */
static inline bool inode_cgwb_enabled(struct inode *inode)
{
return false;
}
static inline struct bdi_writeback_congested *
wb_congested_get_create(struct backing_dev_info *bdi, int blkcg_id, gfp_t gfp)
{
atomic_inc(&bdi->wb_congested->refcnt);
return bdi->wb_congested;
}
static inline void wb_congested_put(struct bdi_writeback_congested *congested)
{
if (atomic_dec_and_test(&congested->refcnt))
kfree(congested);
}
static inline struct bdi_writeback *wb_find_current(struct backing_dev_info *bdi)
{
return &bdi->wb;
}
static inline struct bdi_writeback *
wb_get_create_current(struct backing_dev_info *bdi, gfp_t gfp)
{
return &bdi->wb;
}
static inline bool inode_to_wb_is_valid(struct inode *inode)
{
return true;
}
static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
{
return &inode_to_bdi(inode)->wb;
}
static inline struct bdi_writeback *
unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
{
return inode_to_wb(inode);
}
static inline void unlocked_inode_to_wb_end(struct inode *inode,
struct wb_lock_cookie *cookie)
{
}
static inline void wb_memcg_offline(struct mem_cgroup *memcg)
{
}
static inline void wb_blkcg_offline(struct blkcg *blkcg)
{
}
static inline int inode_congested(struct inode *inode, int cong_bits)
{
return wb_congested(&inode_to_bdi(inode)->wb, cong_bits);
}
#endif /* CONFIG_CGROUP_WRITEBACK */
static inline int inode_read_congested(struct inode *inode)
{
return inode_congested(inode, 1 << WB_sync_congested);
}
static inline int inode_write_congested(struct inode *inode)
{
return inode_congested(inode, 1 << WB_async_congested);
}
static inline int inode_rw_congested(struct inode *inode)
{
return inode_congested(inode, (1 << WB_sync_congested) |
(1 << WB_async_congested));
}
static inline int bdi_congested(struct backing_dev_info *bdi, int cong_bits)
{
return wb_congested(&bdi->wb, cong_bits);
}
static inline int bdi_read_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, 1 << WB_sync_congested);
}
static inline int bdi_write_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, 1 << WB_async_congested);
}
static inline int bdi_rw_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, (1 << WB_sync_congested) |
(1 << WB_async_congested));
}
extern const char *bdi_unknown_name;
static inline const char *bdi_dev_name(struct backing_dev_info *bdi)
{
if (!bdi || !bdi->dev)
return bdi_unknown_name;
return dev_name(bdi->dev);
}
#endif /* _LINUX_BACKING_DEV_H */