Lines Matching refs:bh
48 typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
90 static __always_inline void set_buffer_##name(struct buffer_head *bh) \
92 if (!test_bit(BH_##bit, &(bh)->b_state)) \
93 set_bit(BH_##bit, &(bh)->b_state); \
95 static __always_inline void clear_buffer_##name(struct buffer_head *bh) \
97 clear_bit(BH_##bit, &(bh)->b_state); \
99 static __always_inline int buffer_##name(const struct buffer_head *bh) \
101 return test_bit(BH_##bit, &(bh)->b_state); \
108 static __always_inline int test_set_buffer_##name(struct buffer_head *bh) \
110 return test_and_set_bit(BH_##bit, &(bh)->b_state); \
112 static __always_inline int test_clear_buffer_##name(struct buffer_head *bh) \
114 return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
139 static __always_inline void set_buffer_uptodate(struct buffer_head *bh) in BUFFER_FNS()
149 if (test_bit(BH_Uptodate, &bh->b_state)) in BUFFER_FNS()
157 set_bit(BH_Uptodate, &bh->b_state); in BUFFER_FNS()
160 static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) in clear_buffer_uptodate() argument
162 clear_bit(BH_Uptodate, &bh->b_state); in clear_buffer_uptodate()
165 static __always_inline int buffer_uptodate(const struct buffer_head *bh) in buffer_uptodate() argument
171 return test_bit_acquire(BH_Uptodate, &bh->b_state); in buffer_uptodate()
174 static inline unsigned long bh_offset(const struct buffer_head *bh) in bh_offset() argument
176 return (unsigned long)(bh)->b_data & (page_size(bh->b_page) - 1); in bh_offset()
195 void mark_buffer_dirty(struct buffer_head *bh);
196 void mark_buffer_write_io_error(struct buffer_head *bh);
197 void touch_buffer(struct buffer_head *bh);
198 void folio_set_bh(struct buffer_head *bh, struct folio *folio,
205 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
206 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
209 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
216 static inline void clean_bdev_bh_alias(struct buffer_head *bh) in clean_bdev_bh_alias() argument
218 clean_bdev_aliases(bh->b_bdev, bh->b_blocknr, 1); in clean_bdev_bh_alias()
221 void mark_buffer_async_write(struct buffer_head *bh);
223 wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
236 void free_buffer_head(struct buffer_head * bh);
237 void unlock_buffer(struct buffer_head *bh);
238 void __lock_buffer(struct buffer_head *bh);
239 int sync_dirty_buffer(struct buffer_head *bh);
240 int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
241 void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
245 int bh_uptodate_or_lock(struct buffer_head *bh);
246 int __bh_read(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
296 static inline void get_bh(struct buffer_head *bh) in get_bh() argument
298 atomic_inc(&bh->b_count); in get_bh()
301 static inline void put_bh(struct buffer_head *bh) in put_bh() argument
304 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()
339 static inline void bforget(struct buffer_head *bh) in bforget() argument
341 if (bh) in bforget()
342 __bforget(bh); in bforget()
410 map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) in map_bh() argument
412 set_buffer_mapped(bh); in map_bh()
413 bh->b_bdev = sb->s_bdev; in map_bh()
414 bh->b_blocknr = block; in map_bh()
415 bh->b_size = sb->s_blocksize; in map_bh()
418 static inline void wait_on_buffer(struct buffer_head *bh) in wait_on_buffer() argument
421 if (buffer_locked(bh)) in wait_on_buffer()
422 __wait_on_buffer(bh); in wait_on_buffer()
425 static inline int trylock_buffer(struct buffer_head *bh) in trylock_buffer() argument
427 return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state)); in trylock_buffer()
430 static inline void lock_buffer(struct buffer_head *bh) in lock_buffer() argument
433 if (!trylock_buffer(bh)) in lock_buffer()
434 __lock_buffer(bh); in lock_buffer()
437 static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags) in bh_readahead() argument
439 if (!buffer_uptodate(bh) && trylock_buffer(bh)) { in bh_readahead()
440 if (!buffer_uptodate(bh)) in bh_readahead()
441 __bh_read(bh, op_flags, false); in bh_readahead()
443 unlock_buffer(bh); in bh_readahead()
447 static inline void bh_read_nowait(struct buffer_head *bh, blk_opf_t op_flags) in bh_read_nowait() argument
449 if (!bh_uptodate_or_lock(bh)) in bh_read_nowait()
450 __bh_read(bh, op_flags, false); in bh_read_nowait()
454 static inline int bh_read(struct buffer_head *bh, blk_opf_t op_flags) in bh_read() argument
456 if (bh_uptodate_or_lock(bh)) in bh_read()
458 return __bh_read(bh, op_flags, true); in bh_read()
506 struct buffer_head *get_nth_bh(struct buffer_head *bh, unsigned int count) in get_nth_bh() argument
509 bh = bh->b_this_page; in get_nth_bh()
510 get_bh(bh); in get_nth_bh()
511 return bh; in get_nth_bh()