/* Return Value: 1 is returned if @bmap is dirty, or 0 if clear.  */
int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *bmap)
/* Return Value: 1 is returned if @bmap is dirty, or 0 if clear.  */
int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *bmap)
{
	int ret;
	down_write(&bmap->b_sem);
	ret = nilfs_bmap_dirty(bmap);
	nilfs_bmap_clear_dirty(bmap);
	up_write(&bmap->b_sem);
	return ret;
}