{
if (cached_ptr && (*cached_ptr)) {
struct extent_state *state = *cached_ptr;
- if (state->state & (EXTENT_IOBITS | EXTENT_BOUNDARY)) {
- *cached_ptr = NULL;
- free_extent_state(state);
- }
+ *cached_ptr = NULL;
+ free_extent_state(state);
}
}
prefetchw(&bvec->bv_page->flags);
spin_lock(&tree->lock);
- state = find_first_extent_bit_state(tree, start, 0);
- if (state) {
+ state = find_first_extent_bit_state(tree, start, EXTENT_LOCKED);
+ if (state && state->start == start) {
/*
* take a reference on the state, unlock will drop
* the ref
unsigned long nr_written = 0;
if (wbc->sync_mode == WB_SYNC_ALL)
- write_flags = WRITE_SYNC_PLUG;
+ write_flags = WRITE_SYNC;
else
write_flags = WRITE;