aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/patches-2.6.28
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-01-18 09:59:55 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-01-18 09:59:55 +0000
commit97f15b8e222e03849513b9790c41db887f853f7e (patch)
tree05c38d88f4045a58befe2a4a75b22ab12993c48e /target/linux/generic-2.6/patches-2.6.28
parentec6c55d9aae2d74dad9fb12ed3e0184736a1258e (diff)
downloadupstream-97f15b8e222e03849513b9790c41db887f853f7e.tar.gz
upstream-97f15b8e222e03849513b9790c41db887f853f7e.tar.bz2
upstream-97f15b8e222e03849513b9790c41db887f853f7e.zip
[kernel] generic-2.6: add yaffs fs fixes for 2.6.28
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14085 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic-2.6/patches-2.6.28')
-rw-r--r--target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch120
1 files changed, 120 insertions, 0 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch b/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch
new file mode 100644
index 0000000000..012ba04f07
--- /dev/null
+++ b/target/linux/generic-2.6/patches-2.6.28/514-yaffs_2.6.28_fixes.patch
@@ -0,0 +1,120 @@
+--- a/fs/yaffs2/yaffs_fs.c
++++ b/fs/yaffs2/yaffs_fs.c
+@@ -207,10 +207,20 @@ static int yaffs_writepage(struct page *
+ #else
+ static int yaffs_writepage(struct page *page);
+ #endif
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++static int yaffs_write_begin(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned flags,
++ struct page **pagep, void **fsdata);
++static int yaffs_write_end(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned copied,
++ struct page *pg, void *fsdata);
++#else
+ static int yaffs_prepare_write(struct file *f, struct page *pg,
+ unsigned offset, unsigned to);
+ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
+ unsigned to);
++#endif
+
+ static int yaffs_readlink(struct dentry *dentry, char __user * buffer,
+ int buflen);
+@@ -223,8 +233,13 @@ static int yaffs_follow_link(struct dent
+ static struct address_space_operations yaffs_file_address_operations = {
+ .readpage = yaffs_readpage,
+ .writepage = yaffs_writepage,
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++ .write_begin = yaffs_write_begin,
++ .write_end = yaffs_write_end,
++#else
+ .prepare_write = yaffs_prepare_write,
+ .commit_write = yaffs_commit_write,
++#endif
+ };
+
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22))
+@@ -687,6 +702,74 @@ static int yaffs_writepage(struct page *
+ return (nWritten == nBytes) ? 0 : -ENOSPC;
+ }
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
++static int yaffs_write_begin(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned flags,
++ struct page **pagep, void **fsdata)
++{
++ struct page *pg;
++ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
++ int ret = 0;
++
++ pg = __grab_cache_page(mapping, index);
++ if (!pg)
++ return -ENOMEM;
++
++ *pagep = pg;
++
++ T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_write_begin\n"));
++ if (!Page_Uptodate(pg)) {
++ ret = yaffs_readpage_nolock(f, pg);
++ if (ret)
++ goto err_unlock;
++ }
++
++ T(YAFFS_TRACE_OS, (KERN_DEBUG "yaffs_write_begin\n"));
++ return 0;
++
++ err_unlock:
++ unlock_page(pg);
++ page_cache_release(pg);
++ return ret;
++}
++
++static int yaffs_write_end(struct file *f, struct address_space *mapping,
++ loff_t pos, unsigned len, unsigned copied,
++ struct page *pg, void *fsdata)
++{
++ void *addr = page_address(pg) + (pos & (PAGE_CACHE_SIZE - 1));
++ loff_t pos2;
++ int nBytes = copied;
++ int nWritten;
++
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG "yaffs_write_end addr %x pos %x nBytes %d\n", (unsigned)addr,
++ (unsigned)pos, nBytes));
++
++ pos2 = pos;
++ nWritten = yaffs_file_write(f, addr, nBytes, &pos2);
++
++ if (nWritten != nBytes) {
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG
++ "yaffs_write_end not same size nWritten %d nBytes %d\n",
++ nWritten, nBytes));
++ SetPageError(pg);
++ ClearPageUptodate(pg);
++ } else {
++ SetPageUptodate(pg);
++ }
++
++ T(YAFFS_TRACE_OS,
++ (KERN_DEBUG "yaffs_write_end returning %d\n",
++ nWritten == nBytes ? nWritten : 0));
++
++ unlock_page(pg);
++ page_cache_release(pg);
++
++ return (nWritten == nBytes) ? nWritten : 0;
++}
++#else
+ static int yaffs_prepare_write(struct file *f, struct page *pg,
+ unsigned offset, unsigned to)
+ {
+@@ -735,6 +818,7 @@ static int yaffs_commit_write(struct fil
+ return nWritten == nBytes ? 0 : nWritten;
+
+ }
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) */
+
+ static void yaffs_FillInodeFromObject(struct inode *inode, yaffs_Object * obj)
+ {