Lines Matching refs:bh
50 typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
89 static __always_inline void set_buffer_##name(struct buffer_head *bh) \
91 if (!test_bit(BH_##bit, &(bh)->b_state)) \
92 set_bit(BH_##bit, &(bh)->b_state); \
94 static __always_inline void clear_buffer_##name(struct buffer_head *bh) \
96 clear_bit(BH_##bit, &(bh)->b_state); \
98 static __always_inline int buffer_##name(const struct buffer_head *bh) \
100 return test_bit(BH_##bit, &(bh)->b_state); \
107 static __always_inline int test_set_buffer_##name(struct buffer_head *bh) \
109 return test_and_set_bit(BH_##bit, &(bh)->b_state); \
111 static __always_inline int test_clear_buffer_##name(struct buffer_head *bh) \
113 return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
138 static __always_inline void set_buffer_uptodate(struct buffer_head *bh) in BUFFER_FNS()
148 if (test_bit(BH_Uptodate, &bh->b_state)) in BUFFER_FNS()
156 set_bit(BH_Uptodate, &bh->b_state); in BUFFER_FNS()
159 static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) in clear_buffer_uptodate() argument
161 clear_bit(BH_Uptodate, &bh->b_state); in clear_buffer_uptodate()
164 static __always_inline int buffer_uptodate(const struct buffer_head *bh) in buffer_uptodate() argument
170 return test_bit_acquire(BH_Uptodate, &bh->b_state); in buffer_uptodate()
173 #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) argument
191 void mark_buffer_dirty(struct buffer_head *bh);
192 void mark_buffer_write_io_error(struct buffer_head *bh);
193 void touch_buffer(struct buffer_head *bh);
194 void set_bh_page(struct buffer_head *bh,
201 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
202 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
203 void end_buffer_async_write(struct buffer_head *bh, int uptodate);
206 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
213 static inline void clean_bdev_bh_alias(struct buffer_head *bh) in clean_bdev_bh_alias() argument
215 clean_bdev_aliases(bh->b_bdev, bh->b_blocknr, 1); in clean_bdev_bh_alias()
218 void mark_buffer_async_write(struct buffer_head *bh);
220 wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
234 void free_buffer_head(struct buffer_head * bh);
235 void unlock_buffer(struct buffer_head *bh);
236 void __lock_buffer(struct buffer_head *bh);
237 int sync_dirty_buffer(struct buffer_head *bh);
238 int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
239 void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
243 int bh_uptodate_or_lock(struct buffer_head *bh);
244 int __bh_read(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
312 static inline void get_bh(struct buffer_head *bh) in get_bh() argument
314 atomic_inc(&bh->b_count); in get_bh()
317 static inline void put_bh(struct buffer_head *bh) in put_bh() argument
320 atomic_dec(&bh->b_count); in put_bh()
323 static inline void brelse(struct buffer_head *bh) in brelse() argument
325 if (bh) in brelse()
326 __brelse(bh); in brelse()
329 static inline void bforget(struct buffer_head *bh) in bforget() argument
331 if (bh) in bforget()
332 __bforget(bh); in bforget()
373 map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) in map_bh() argument
375 set_buffer_mapped(bh); in map_bh()
376 bh->b_bdev = sb->s_bdev; in map_bh()
377 bh->b_blocknr = block; in map_bh()
378 bh->b_size = sb->s_blocksize; in map_bh()
381 static inline void wait_on_buffer(struct buffer_head *bh) in wait_on_buffer() argument
384 if (buffer_locked(bh)) in wait_on_buffer()
385 __wait_on_buffer(bh); in wait_on_buffer()
388 static inline int trylock_buffer(struct buffer_head *bh) in trylock_buffer() argument
390 return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state)); in trylock_buffer()
393 static inline void lock_buffer(struct buffer_head *bh) in lock_buffer() argument
396 if (!trylock_buffer(bh)) in lock_buffer()
397 __lock_buffer(bh); in lock_buffer()
414 static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags) in bh_readahead() argument
416 if (!buffer_uptodate(bh) && trylock_buffer(bh)) { in bh_readahead()
417 if (!buffer_uptodate(bh)) in bh_readahead()
418 __bh_read(bh, op_flags, false); in bh_readahead()
420 unlock_buffer(bh); in bh_readahead()
424 static inline void bh_read_nowait(struct buffer_head *bh, blk_opf_t op_flags) in bh_read_nowait() argument
426 if (!bh_uptodate_or_lock(bh)) in bh_read_nowait()
427 __bh_read(bh, op_flags, false); in bh_read_nowait()
431 static inline int bh_read(struct buffer_head *bh, blk_opf_t op_flags) in bh_read() argument
433 if (bh_uptodate_or_lock(bh)) in bh_read()
435 return __bh_read(bh, op_flags, true); in bh_read()