@@ -789,17 +789,16 @@ static bool btree_dirty_folio(struct address_space *mapping,
ASSERT(subpage->dirty_bitmap);
while (cur_bit < BTRFS_SUBPAGE_BITMAP_SIZE) {
- unsigned long flags;
u64 cur;
u16 tmp = (1 << cur_bit);
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
if (!(tmp & subpage->dirty_bitmap)) {
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
cur_bit++;
continue;
}
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
cur = page_start + cur_bit * fs_info->sectorsize;
eb = find_extent_buffer(fs_info, cur);
@@ -1385,7 +1385,6 @@ static void find_next_dirty_byte(struct btrfs_fs_info *fs_info,
struct btrfs_subpage_info *spi = fs_info->subpage_info;
u64 orig_start = *start;
/* Declare as unsigned long so we can use bitmap ops */
- unsigned long flags;
int range_start_bit;
int range_end_bit;
@@ -1403,10 +1402,10 @@ static void find_next_dirty_byte(struct btrfs_fs_info *fs_info,
(offset_in_page(orig_start) >> fs_info->sectorsize_bits);
/* We should have the page locked, but just in case */
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_next_set_region(subpage->bitmaps, &range_start_bit, &range_end_bit,
spi->dirty_offset + spi->bitmap_nr_bits);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
range_start_bit -= spi->dirty_offset;
range_end_bit -= spi->dirty_offset;
@@ -2080,7 +2079,6 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
while (bit_start < fs_info->subpage_info->bitmap_nr_bits) {
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
struct extent_buffer *eb;
- unsigned long flags;
u64 start;
/*
@@ -2092,10 +2090,10 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
spin_unlock(&page->mapping->private_lock);
break;
}
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
if (!test_bit(bit_start + fs_info->subpage_info->dirty_offset,
subpage->bitmaps)) {
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
spin_unlock(&page->mapping->private_lock);
bit_start++;
continue;
@@ -2109,7 +2107,7 @@ static int submit_eb_subpage(struct page *page, struct btrfs_bio_ctrl *bio_ctrl)
* spin locks, so call find_extent_buffer_nolock().
*/
eb = find_extent_buffer_nolock(fs_info, start);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
spin_unlock(&page->mapping->private_lock);
/*
@@ -7900,8 +7900,8 @@ static void wait_subpage_spinlock(struct page *page)
* Here we just acquire the spinlock so that all existing callers
* should exit and we're safe to release/invalidate the page.
*/
- spin_lock_irq(&subpage->lock);
- spin_unlock_irq(&subpage->lock);
+ spin_lock(&subpage->lock);
+ spin_unlock(&subpage->lock);
}
static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags)
@@ -415,13 +415,12 @@ void btrfs_subpage_set_uptodate(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
uptodate, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_set(fs_info, subpage, uptodate))
SetPageUptodate(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_clear_uptodate(const struct btrfs_fs_info *fs_info,
@@ -430,12 +429,11 @@ void btrfs_subpage_clear_uptodate(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
uptodate, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
ClearPageUptodate(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_set_error(const struct btrfs_fs_info *fs_info,
@@ -444,12 +442,11 @@ void btrfs_subpage_set_error(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
error, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
SetPageError(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_clear_error(const struct btrfs_fs_info *fs_info,
@@ -458,13 +455,12 @@ void btrfs_subpage_clear_error(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
error, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_zero(fs_info, subpage, error))
ClearPageError(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_set_dirty(const struct btrfs_fs_info *fs_info,
@@ -473,11 +469,10 @@ void btrfs_subpage_set_dirty(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
dirty, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
set_page_dirty(page);
}
@@ -497,14 +492,13 @@ bool btrfs_subpage_clear_and_test_dirty(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
dirty, start, len);
- unsigned long flags;
bool last = false;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_zero(fs_info, subpage, dirty))
last = true;
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
return last;
}
@@ -524,12 +518,11 @@ void btrfs_subpage_set_writeback(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
writeback, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
set_page_writeback(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_clear_writeback(const struct btrfs_fs_info *fs_info,
@@ -538,15 +531,14 @@ void btrfs_subpage_clear_writeback(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
writeback, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_zero(fs_info, subpage, writeback)) {
ASSERT(PageWriteback(page));
end_page_writeback(page);
}
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_set_ordered(const struct btrfs_fs_info *fs_info,
@@ -555,12 +547,11 @@ void btrfs_subpage_set_ordered(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
ordered, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
SetPageOrdered(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_clear_ordered(const struct btrfs_fs_info *fs_info,
@@ -569,13 +560,12 @@ void btrfs_subpage_clear_ordered(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
ordered, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_zero(fs_info, subpage, ordered))
ClearPageOrdered(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_set_checked(const struct btrfs_fs_info *fs_info,
@@ -584,13 +574,12 @@ void btrfs_subpage_set_checked(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
checked, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
if (subpage_test_bitmap_all_set(fs_info, subpage, checked))
SetPageChecked(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
void btrfs_subpage_clear_checked(const struct btrfs_fs_info *fs_info,
@@ -599,12 +588,11 @@ void btrfs_subpage_clear_checked(const struct btrfs_fs_info *fs_info,
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private;
unsigned int start_bit = subpage_calc_start_bit(fs_info, page,
checked, start, len);
- unsigned long flags;
- spin_lock_irqsave(&subpage->lock, flags);
+ spin_lock(&subpage->lock);
bitmap_clear(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
ClearPageChecked(page);
- spin_unlock_irqrestore(&subpage->lock, flags);
+ spin_unlock(&subpage->lock);
}
/*
@@ -618,13 +606,12 @@ bool btrfs_subpage_test_##name(const struct btrfs_fs_info *fs_info, \
struct btrfs_subpage *subpage = (struct btrfs_subpage *)page->private; \
unsigned int start_bit = subpage_calc_start_bit(fs_info, page, \
name, start, len); \
- unsigned long flags; \
bool ret; \
\
- spin_lock_irqsave(&subpage->lock, flags); \
+ spin_lock(&subpage->lock); \
ret = bitmap_test_range_all_set(subpage->bitmaps, start_bit, \
len >> fs_info->sectorsize_bits); \
- spin_unlock_irqrestore(&subpage->lock, flags); \
+ spin_unlock(&subpage->lock); \
return ret; \
}
IMPLEMENT_BTRFS_SUBPAGE_TEST_OP(uptodate);
Subpage state isn't modified from irq context any more, so remove the irq disabling. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/btrfs/disk-io.c | 7 ++--- fs/btrfs/extent_io.c | 12 ++++---- fs/btrfs/inode.c | 4 +-- fs/btrfs/subpage.c | 65 ++++++++++++++++++-------------------------- 4 files changed, 36 insertions(+), 52 deletions(-)