Lines 41-46
Link Here
|
41 |
#include <linux/mount.h> |
41 |
#include <linux/mount.h> |
42 |
#include <linux/slab.h> |
42 |
#include <linux/slab.h> |
43 |
#include <linux/migrate.h> |
43 |
#include <linux/migrate.h> |
|
|
44 |
#include <linux/delay.h> |
44 |
|
45 |
|
45 |
static int read_block(struct inode *inode, void *addr, unsigned int block, |
46 |
static int read_block(struct inode *inode, void *addr, unsigned int block, |
46 |
struct ubifs_data_node *dn) |
47 |
struct ubifs_data_node *dn) |
Lines 372-378
static int allocate_budget(struct ubifs_info *c, struct page *page,
Link Here
|
372 |
req.dirtied_page = 1; |
373 |
req.dirtied_page = 1; |
373 |
|
374 |
|
374 |
if (appending) { |
375 |
if (appending) { |
|
|
376 |
printk("{WRITE_ITER} Step 2. Appending page %ps by allocate_budget, ino=%lu LOCK UI ==\n", page, page->mapping->host->i_ino); |
375 |
mutex_lock(&ui->ui_mutex); |
377 |
mutex_lock(&ui->ui_mutex); |
|
|
378 |
printk("{WRITE_ITER} Step 2. Appending page %ps by allocate_budget, ino=%lu LOCK UI --\n", page, page->mapping->host->i_ino); |
376 |
if (!ui->dirty) |
379 |
if (!ui->dirty) |
377 |
/* |
380 |
/* |
378 |
* The inode is clean but we will have to mark |
381 |
* The inode is clean but we will have to mark |
Lines 436-446
static int ubifs_write_begin(struct file *file, struct address_space *mapping,
Link Here
|
436 |
if (unlikely(c->ro_error)) |
439 |
if (unlikely(c->ro_error)) |
437 |
return -EROFS; |
440 |
return -EROFS; |
438 |
|
441 |
|
|
|
442 |
printk("{WRITE_ITER} Step 1. Get page by ubifs_write_begin, ino=%lu LOCK PAGE ==\n", inode->i_ino); |
439 |
/* Try out the fast-path part first */ |
443 |
/* Try out the fast-path part first */ |
440 |
page = grab_cache_page_write_begin(mapping, index, flags); |
444 |
page = grab_cache_page_write_begin(mapping, index, flags); |
441 |
if (unlikely(!page)) |
445 |
if (unlikely(!page)) |
442 |
return -ENOMEM; |
446 |
return -ENOMEM; |
443 |
|
447 |
|
|
|
448 |
printk("{WRITE_ITER} Step 1. Get page %ps by ubifs_write_begin, ino=%lu LOCK PAGE --\n", page, page->mapping->host->i_ino); |
444 |
if (!PageUptodate(page)) { |
449 |
if (!PageUptodate(page)) { |
445 |
/* The page is not loaded from the flash */ |
450 |
/* The page is not loaded from the flash */ |
446 |
if (!(pos & ~PAGE_MASK) && len == PAGE_SIZE) { |
451 |
if (!(pos & ~PAGE_MASK) && len == PAGE_SIZE) { |
Lines 586-595
static int ubifs_write_end(struct file *file, struct address_space *mapping,
Link Here
|
586 |
__mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
591 |
__mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
587 |
ubifs_assert(c, mutex_is_locked(&ui->ui_mutex)); |
592 |
ubifs_assert(c, mutex_is_locked(&ui->ui_mutex)); |
588 |
mutex_unlock(&ui->ui_mutex); |
593 |
mutex_unlock(&ui->ui_mutex); |
|
|
594 |
printk("{WRITE_ITER} Step 3. ubifs_write_end appending write page=%ps, ino=%lu UNLOCK UI ++\n", page, page->mapping->host->i_ino); |
589 |
} |
595 |
} |
590 |
|
596 |
|
591 |
out: |
597 |
out: |
592 |
unlock_page(page); |
598 |
unlock_page(page); |
|
|
599 |
printk("{WRITE_ITER} Step 3. Fill page %ps by ubifs_write_end, ino=%lu UNLOCK PAGE ++\n", page, page->mapping->host->i_ino); |
593 |
put_page(page); |
600 |
put_page(page); |
594 |
return copied; |
601 |
return copied; |
595 |
} |
602 |
} |
Lines 786-797
static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
Link Here
|
786 |
|
793 |
|
787 |
if (page_offset > end_index) |
794 |
if (page_offset > end_index) |
788 |
break; |
795 |
break; |
|
|
796 |
msleep(400); |
789 |
page = find_or_create_page(mapping, page_offset, ra_gfp_mask); |
797 |
page = find_or_create_page(mapping, page_offset, ra_gfp_mask); |
790 |
if (!page) |
798 |
if (!page) |
791 |
break; |
799 |
break; |
792 |
if (!PageUptodate(page)) |
800 |
if (!PageUptodate(page)) |
793 |
err = populate_page(c, page, bu, &n); |
801 |
err = populate_page(c, page, bu, &n); |
794 |
unlock_page(page); |
802 |
unlock_page(page); |
|
|
803 |
printk("[READ] Step 2. ubifs_do_bulk_read page=%ps ino=%lu UNLOCK page ++\n", page, inode->i_ino); |
795 |
put_page(page); |
804 |
put_page(page); |
796 |
if (err) |
805 |
if (err) |
797 |
break; |
806 |
break; |
Lines 839-846
static int ubifs_bulk_read(struct page *page)
Link Here
|
839 |
* Bulk-read is protected by @ui->ui_mutex, but it is an optimization, |
848 |
* Bulk-read is protected by @ui->ui_mutex, but it is an optimization, |
840 |
* so don't bother if we cannot lock the mutex. |
849 |
* so don't bother if we cannot lock the mutex. |
841 |
*/ |
850 |
*/ |
|
|
851 |
printk("[READ] Step 1. ubifs_bulk_read ino=%lu page=%ps LOCK UI ==\n", inode->i_ino, page); |
852 |
if (ui->read_in_a_row == 2) |
853 |
msleep(100); |
842 |
if (!mutex_trylock(&ui->ui_mutex)) |
854 |
if (!mutex_trylock(&ui->ui_mutex)) |
843 |
return 0; |
855 |
return 0; |
|
|
856 |
printk("[READ] Step 1. ubifs_bulk_read ino=%lu page=%ps LOCK UI --\n", inode->i_ino, page); |
844 |
|
857 |
|
845 |
if (index != last_page_read + 1) { |
858 |
if (index != last_page_read + 1) { |
846 |
/* Turn off bulk-read if we stop reading sequentially */ |
859 |
/* Turn off bulk-read if we stop reading sequentially */ |
Lines 885-890
static int ubifs_bulk_read(struct page *page)
Link Here
|
885 |
|
898 |
|
886 |
out_unlock: |
899 |
out_unlock: |
887 |
mutex_unlock(&ui->ui_mutex); |
900 |
mutex_unlock(&ui->ui_mutex); |
|
|
901 |
printk("[READ] Step 3. ubifs_bulk_read ino=%lu page=%ps bulked=%d UNLOCK UI ++\n", inode->i_ino, page, err); |
888 |
return err; |
902 |
return err; |
889 |
} |
903 |
} |
890 |
|
904 |
|
Lines 950-955
static int do_writepage(struct page *page, int len)
Link Here
|
950 |
|
964 |
|
951 |
kunmap(page); |
965 |
kunmap(page); |
952 |
unlock_page(page); |
966 |
unlock_page(page); |
|
|
967 |
if (!strncmp(page->mapping->host->i_sb->s_type->name, "ubifs", strlen("ubifs")) && page->mapping->host->i_ino == 65) |
968 |
printk("<WRITE> Step 3. do_writepage page=%ps data=%c%c%c UNLOCK PAGE ++.\n", page, ((char *)kmap_atomic(page))[0], ((char *)kmap_atomic(page))[1], ((char *)kmap_atomic(page))[2]); |
953 |
end_page_writeback(page); |
969 |
end_page_writeback(page); |
954 |
return err; |
970 |
return err; |
955 |
} |
971 |
} |