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,
208 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
209 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
210 void end_buffer_async_write(struct buffer_head *bh, int uptodate);
213 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
220 static inline void clean_bdev_bh_alias(struct buffer_head *bh) in clean_bdev_bh_alias() argument
222 clean_bdev_aliases(bh->b_bdev, bh->b_blocknr, 1); in clean_bdev_bh_alias()
225 void mark_buffer_async_write(struct buffer_head *bh);
227 wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
238 void free_buffer_head(struct buffer_head * bh);
239 void unlock_buffer(struct buffer_head *bh);
240 void __lock_buffer(struct buffer_head *bh);
241 int sync_dirty_buffer(struct buffer_head *bh);
242 int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
243 void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
247 int bh_uptodate_or_lock(struct buffer_head *bh);
248 int __bh_read(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
300 static inline void get_bh(struct buffer_head *bh) in get_bh() argument
302 atomic_inc(&bh->b_count); in get_bh()
305 static inline void put_bh(struct buffer_head *bh) in put_bh() argument
308 atomic_dec(&bh->b_count); in put_bh()
311 static inline void brelse(struct buffer_head *bh) in brelse() argument
313 if (bh) in brelse()
314 __brelse(bh); in brelse()
317 static inline void bforget(struct buffer_head *bh) in bforget() argument
319 if (bh) in bforget()
320 __bforget(bh); in bforget()
361 map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) in map_bh() argument
363 set_buffer_mapped(bh); in map_bh()
364 bh->b_bdev = sb->s_bdev; in map_bh()
365 bh->b_blocknr = block; in map_bh()
366 bh->b_size = sb->s_blocksize; in map_bh()
369 static inline void wait_on_buffer(struct buffer_head *bh) in wait_on_buffer() argument
372 if (buffer_locked(bh)) in wait_on_buffer()
373 __wait_on_buffer(bh); in wait_on_buffer()
376 static inline int trylock_buffer(struct buffer_head *bh) in trylock_buffer() argument
378 return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state)); in trylock_buffer()
381 static inline void lock_buffer(struct buffer_head *bh) in lock_buffer() argument
384 if (!trylock_buffer(bh)) in lock_buffer()
385 __lock_buffer(bh); in lock_buffer()
402 static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags) in bh_readahead() argument
404 if (!buffer_uptodate(bh) && trylock_buffer(bh)) { in bh_readahead()
405 if (!buffer_uptodate(bh)) in bh_readahead()
406 __bh_read(bh, op_flags, false); in bh_readahead()
408 unlock_buffer(bh); in bh_readahead()
412 static inline void bh_read_nowait(struct buffer_head *bh, blk_opf_t op_flags) in bh_read_nowait() argument
414 if (!bh_uptodate_or_lock(bh)) in bh_read_nowait()
415 __bh_read(bh, op_flags, false); in bh_read_nowait()
419 static inline int bh_read(struct buffer_head *bh, blk_opf_t op_flags) in bh_read() argument
421 if (bh_uptodate_or_lock(bh)) in bh_read()
423 return __bh_read(bh, op_flags, true); in bh_read()