diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 68 |
1 files changed, 3 insertions, 65 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index a9b399402007..0d6ca7bac6c8 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -201,7 +201,7 @@ int fsync_bdev(struct block_device *bdev) | |||
201 | * freeze_bdev -- lock a filesystem and force it into a consistent state | 201 | * freeze_bdev -- lock a filesystem and force it into a consistent state |
202 | * @bdev: blockdevice to lock | 202 | * @bdev: blockdevice to lock |
203 | * | 203 | * |
204 | * This takes the block device bd_mount_sem to make sure no new mounts | 204 | * This takes the block device bd_mount_mutex to make sure no new mounts |
205 | * happen on bdev until thaw_bdev() is called. | 205 | * happen on bdev until thaw_bdev() is called. |
206 | * If a superblock is found on this device, we take the s_umount semaphore | 206 | * If a superblock is found on this device, we take the s_umount semaphore |
207 | * on it to make sure nobody unmounts until the snapshot creation is done. | 207 | * on it to make sure nobody unmounts until the snapshot creation is done. |
@@ -210,7 +210,7 @@ struct super_block *freeze_bdev(struct block_device *bdev) | |||
210 | { | 210 | { |
211 | struct super_block *sb; | 211 | struct super_block *sb; |
212 | 212 | ||
213 | down(&bdev->bd_mount_sem); | 213 | mutex_lock(&bdev->bd_mount_mutex); |
214 | sb = get_super(bdev); | 214 | sb = get_super(bdev); |
215 | if (sb && !(sb->s_flags & MS_RDONLY)) { | 215 | if (sb && !(sb->s_flags & MS_RDONLY)) { |
216 | sb->s_frozen = SB_FREEZE_WRITE; | 216 | sb->s_frozen = SB_FREEZE_WRITE; |
@@ -264,7 +264,7 @@ void thaw_bdev(struct block_device *bdev, struct super_block *sb) | |||
264 | drop_super(sb); | 264 | drop_super(sb); |
265 | } | 265 | } |
266 | 266 | ||
267 | up(&bdev->bd_mount_sem); | 267 | mutex_unlock(&bdev->bd_mount_mutex); |
268 | } | 268 | } |
269 | EXPORT_SYMBOL(thaw_bdev); | 269 | EXPORT_SYMBOL(thaw_bdev); |
270 | 270 | ||
@@ -3051,68 +3051,6 @@ asmlinkage long sys_bdflush(int func, long data) | |||
3051 | } | 3051 | } |
3052 | 3052 | ||
3053 | /* | 3053 | /* |
3054 | * Migration function for pages with buffers. This function can only be used | ||
3055 | * if the underlying filesystem guarantees that no other references to "page" | ||
3056 | * exist. | ||
3057 | */ | ||
3058 | #ifdef CONFIG_MIGRATION | ||
3059 | int buffer_migrate_page(struct page *newpage, struct page *page) | ||
3060 | { | ||
3061 | struct address_space *mapping = page->mapping; | ||
3062 | struct buffer_head *bh, *head; | ||
3063 | int rc; | ||
3064 | |||
3065 | if (!mapping) | ||
3066 | return -EAGAIN; | ||
3067 | |||
3068 | if (!page_has_buffers(page)) | ||
3069 | return migrate_page(newpage, page); | ||
3070 | |||
3071 | head = page_buffers(page); | ||
3072 | |||
3073 | rc = migrate_page_remove_references(newpage, page, 3); | ||
3074 | if (rc) | ||
3075 | return rc; | ||
3076 | |||
3077 | bh = head; | ||
3078 | do { | ||
3079 | get_bh(bh); | ||
3080 | lock_buffer(bh); | ||
3081 | bh = bh->b_this_page; | ||
3082 | |||
3083 | } while (bh != head); | ||
3084 | |||
3085 | ClearPagePrivate(page); | ||
3086 | set_page_private(newpage, page_private(page)); | ||
3087 | set_page_private(page, 0); | ||
3088 | put_page(page); | ||
3089 | get_page(newpage); | ||
3090 | |||
3091 | bh = head; | ||
3092 | do { | ||
3093 | set_bh_page(bh, newpage, bh_offset(bh)); | ||
3094 | bh = bh->b_this_page; | ||
3095 | |||
3096 | } while (bh != head); | ||
3097 | |||
3098 | SetPagePrivate(newpage); | ||
3099 | |||
3100 | migrate_page_copy(newpage, page); | ||
3101 | |||
3102 | bh = head; | ||
3103 | do { | ||
3104 | unlock_buffer(bh); | ||
3105 | put_bh(bh); | ||
3106 | bh = bh->b_this_page; | ||
3107 | |||
3108 | } while (bh != head); | ||
3109 | |||
3110 | return 0; | ||
3111 | } | ||
3112 | EXPORT_SYMBOL(buffer_migrate_page); | ||
3113 | #endif | ||
3114 | |||
3115 | /* | ||
3116 | * Buffer-head allocation | 3054 | * Buffer-head allocation |
3117 | */ | 3055 | */ |
3118 | static kmem_cache_t *bh_cachep; | 3056 | static kmem_cache_t *bh_cachep; |