static void bitmap_file_put(struct bitmap *bitmap) { struct file *file; struct inode *inode; unsigned long flags; spin_lock_irqsave(&bitmap->lock, flags); file = bitmap->file; bitmap->file = NULL; spin_unlock_irqrestore(&bitmap->lock, flags); bitmap_stop_daemon(bitmap); drain_write_queues(bitmap); bitmap_file_unmap(bitmap); if (file) { inode = file->f_mapping->host; spin_lock(&inode->i_lock); atomic_set(&inode->i_writecount, 1); /* allow writes again */ spin_unlock(&inode->i_lock); fput(file); } }
static void bitmap_file_put(struct bitmap *bitmap) { struct file *file; unsigned long flags; spin_lock_irqsave(&bitmap->lock, flags); file = bitmap->file; bitmap->file = NULL; spin_unlock_irqrestore(&bitmap->lock, flags); if (file) wait_event(bitmap->write_wait, atomic_read(&bitmap->pending_writes)==0); bitmap_file_unmap(bitmap); if (file) { struct inode *inode = file->f_path.dentry->d_inode; invalidate_mapping_pages(inode->i_mapping, 0, -1); fput(file); } }