840 ui->bulk_read = 1;
841 }
842
843
844
845
846
847 if (mutex_trylock(&c->bu_mutex))
848 bu = &c->bu;
849 else {
850 bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN);
851 if (!bu)
852 goto out_unlock;
853
854 bu->buf = NULL;
855 allocated = 1;
856 }
857
858 bu->buf_len = c->max_bu_buf_len;
859 data_key_init(c, &bu->key, inode->i_ino,
860 page->index << UBIFS_BLOCKS_PER_PAGE_SHIFT);
861 err = ubifs_do_bulk_read(c, bu, page);
862
863 if (!allocated)
864 mutex_unlock(&c->bu_mutex);
865 else
866 kfree(bu);
867
868out_unlock:
869 mutex_unlock(&ui->ui_mutex);
870 return err;
871}
872
873static int ubifs_readpage(struct file *file, struct page *page)
874{
875 if (ubifs_bulk_read(page))
876 return 0;
877 do_readpage(page);
878 unlock_page(page);
879 return 0;
880}