Lines Matching refs:bh
50 typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
92 static __always_inline void set_buffer_##name(struct buffer_head *bh) \
94 if (!test_bit(BH_##bit, &(bh)->b_state)) \
95 set_bit(BH_##bit, &(bh)->b_state); \
97 static __always_inline void clear_buffer_##name(struct buffer_head *bh) \
99 clear_bit(BH_##bit, &(bh)->b_state); \
101 static __always_inline int buffer_##name(const struct buffer_head *bh) \
103 return test_bit(BH_##bit, &(bh)->b_state); \
110 static __always_inline int test_set_buffer_##name(struct buffer_head *bh) \
112 return test_and_set_bit(BH_##bit, &(bh)->b_state); \
114 static __always_inline int test_clear_buffer_##name(struct buffer_head *bh) \
116 return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
141 static __always_inline void set_buffer_uptodate(struct buffer_head *bh) in BUFFER_FNS()
151 if (test_bit(BH_Uptodate, &bh->b_state)) in BUFFER_FNS()
159 set_bit(BH_Uptodate, &bh->b_state); in BUFFER_FNS()
162 static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) in clear_buffer_uptodate() argument
164 clear_bit(BH_Uptodate, &bh->b_state); in clear_buffer_uptodate()
167 static __always_inline int buffer_uptodate(const struct buffer_head *bh) in buffer_uptodate() argument
173 return test_bit_acquire(BH_Uptodate, &bh->b_state); in buffer_uptodate()
176 #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) argument
194 void mark_buffer_dirty(struct buffer_head *bh);
195 void mark_buffer_write_io_error(struct buffer_head *bh);
196 void touch_buffer(struct buffer_head *bh);
197 void set_bh_page(struct buffer_head *bh,
204 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
205 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
206 void end_buffer_async_write(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);
237 void free_buffer_head(struct buffer_head * bh);
238 void unlock_buffer(struct buffer_head *bh);
239 void __lock_buffer(struct buffer_head *bh);
240 int sync_dirty_buffer(struct buffer_head *bh);
241 int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
242 void write_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags);
246 int bh_uptodate_or_lock(struct buffer_head *bh);
247 int __bh_read(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
315 static inline void get_bh(struct buffer_head *bh) in get_bh() argument
317 atomic_inc(&bh->b_count); in get_bh()
320 static inline void put_bh(struct buffer_head *bh) in put_bh() argument
323 atomic_dec(&bh->b_count); in put_bh()
326 static inline void brelse(struct buffer_head *bh) in brelse() argument
328 if (bh) in brelse()
329 __brelse(bh); in brelse()
332 static inline void bforget(struct buffer_head *bh) in bforget() argument
334 if (bh) in bforget()
335 __bforget(bh); in bforget()
376 map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) in map_bh() argument
378 set_buffer_mapped(bh); in map_bh()
379 bh->b_bdev = sb->s_bdev; in map_bh()
380 bh->b_blocknr = block; in map_bh()
381 bh->b_size = sb->s_blocksize; in map_bh()
384 static inline void wait_on_buffer(struct buffer_head *bh) in wait_on_buffer() argument
387 if (buffer_locked(bh)) in wait_on_buffer()
388 __wait_on_buffer(bh); in wait_on_buffer()
391 static inline int trylock_buffer(struct buffer_head *bh) in trylock_buffer() argument
393 return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state)); in trylock_buffer()
396 static inline void lock_buffer(struct buffer_head *bh) in lock_buffer() argument
399 if (!trylock_buffer(bh)) in lock_buffer()
400 __lock_buffer(bh); in lock_buffer()
417 static inline void bh_readahead(struct buffer_head *bh, blk_opf_t op_flags) in bh_readahead() argument
419 if (!buffer_uptodate(bh) && trylock_buffer(bh)) { in bh_readahead()
420 if (!buffer_uptodate(bh)) in bh_readahead()
421 __bh_read(bh, op_flags, false); in bh_readahead()
423 unlock_buffer(bh); in bh_readahead()
427 static inline void bh_read_nowait(struct buffer_head *bh, blk_opf_t op_flags) in bh_read_nowait() argument
429 if (!bh_uptodate_or_lock(bh)) in bh_read_nowait()
430 __bh_read(bh, op_flags, false); in bh_read_nowait()
434 static inline int bh_read(struct buffer_head *bh, blk_opf_t op_flags) in bh_read() argument
436 if (bh_uptodate_or_lock(bh)) in bh_read()
438 return __bh_read(bh, op_flags, true); in bh_read()