diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-10 12:31:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-10 12:31:45 -0500 |
commit | fc1495bf99de6f65066b3234813180301ff8b693 (patch) | |
tree | 4858db540f3c57f6f998383056ad4714b969660c | |
parent | 5476ffd2b78f06cce31a57f8611162918fe1ae3a (diff) | |
parent | b38882f5c066dc681679e90f1903eda323e605b1 (diff) |
Merge git://git.infradead.org/ubifs-2.6
* git://git.infradead.org/ubifs-2.6:
UBIFS: fix return code in check_leaf
UBI: flush wl before clearing update marker
MAINTAINERS: change e-mail of Artem Bityutskiy
UBIFS: remove manual O_SYNC handling
UBIFS: support mounting of UBI volume character devices
UBI: Add ubi_open_volume_path
-rw-r--r-- | MAINTAINERS | 4 | ||||
-rw-r--r-- | drivers/mtd/ubi/kapi.c | 40 | ||||
-rw-r--r-- | drivers/mtd/ubi/upd.c | 20 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 2 | ||||
-rw-r--r-- | fs/ubifs/file.c | 13 | ||||
-rw-r--r-- | fs/ubifs/super.c | 20 | ||||
-rw-r--r-- | include/linux/mtd/ubi.h | 2 |
7 files changed, 72 insertions, 29 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 746b706206da..d7f8668b7a72 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5335,7 +5335,7 @@ S: Maintained | |||
5335 | F: drivers/scsi/u14-34f.c | 5335 | F: drivers/scsi/u14-34f.c |
5336 | 5336 | ||
5337 | UBI FILE SYSTEM (UBIFS) | 5337 | UBI FILE SYSTEM (UBIFS) |
5338 | M: Artem Bityutskiy <dedekind@infradead.org> | 5338 | M: Artem Bityutskiy <dedekind1@gmail.com> |
5339 | M: Adrian Hunter <adrian.hunter@nokia.com> | 5339 | M: Adrian Hunter <adrian.hunter@nokia.com> |
5340 | L: linux-mtd@lists.infradead.org | 5340 | L: linux-mtd@lists.infradead.org |
5341 | T: git git://git.infradead.org/ubifs-2.6.git | 5341 | T: git git://git.infradead.org/ubifs-2.6.git |
@@ -5386,7 +5386,7 @@ F: drivers/cdrom/cdrom.c | |||
5386 | F: include/linux/cdrom.h | 5386 | F: include/linux/cdrom.h |
5387 | 5387 | ||
5388 | UNSORTED BLOCK IMAGES (UBI) | 5388 | UNSORTED BLOCK IMAGES (UBI) |
5389 | M: Artem Bityutskiy <dedekind@infradead.org> | 5389 | M: Artem Bityutskiy <dedekind1@gmail.com> |
5390 | W: http://www.linux-mtd.infradead.org/ | 5390 | W: http://www.linux-mtd.infradead.org/ |
5391 | L: linux-mtd@lists.infradead.org | 5391 | L: linux-mtd@lists.infradead.org |
5392 | T: git git://git.infradead.org/ubi-2.6.git | 5392 | T: git git://git.infradead.org/ubi-2.6.git |
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 88a72e9c8beb..277786ebaa2c 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/namei.h> | ||
26 | #include <linux/fs.h> | ||
25 | #include <asm/div64.h> | 27 | #include <asm/div64.h> |
26 | #include "ubi.h" | 28 | #include "ubi.h" |
27 | 29 | ||
@@ -280,6 +282,44 @@ struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | |||
280 | EXPORT_SYMBOL_GPL(ubi_open_volume_nm); | 282 | EXPORT_SYMBOL_GPL(ubi_open_volume_nm); |
281 | 283 | ||
282 | /** | 284 | /** |
285 | * ubi_open_volume_path - open UBI volume by its character device node path. | ||
286 | * @pathname: volume character device node path | ||
287 | * @mode: open mode | ||
288 | * | ||
289 | * This function is similar to 'ubi_open_volume()', but opens a volume the path | ||
290 | * to its character device node. | ||
291 | */ | ||
292 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) | ||
293 | { | ||
294 | int error, ubi_num, vol_id; | ||
295 | struct ubi_volume_desc *ret; | ||
296 | struct inode *inode; | ||
297 | struct path path; | ||
298 | |||
299 | dbg_gen("open volume %s, mode %d", pathname, mode); | ||
300 | |||
301 | if (!pathname || !*pathname) | ||
302 | return ERR_PTR(-EINVAL); | ||
303 | |||
304 | error = kern_path(pathname, LOOKUP_FOLLOW, &path); | ||
305 | if (error) | ||
306 | return ERR_PTR(error); | ||
307 | |||
308 | inode = path.dentry->d_inode; | ||
309 | ubi_num = ubi_major2num(imajor(inode)); | ||
310 | vol_id = iminor(inode) - 1; | ||
311 | |||
312 | if (vol_id >= 0 && ubi_num >= 0) | ||
313 | ret = ubi_open_volume(ubi_num, vol_id, mode); | ||
314 | else | ||
315 | ret = ERR_PTR(-ENODEV); | ||
316 | |||
317 | path_put(&path); | ||
318 | return ret; | ||
319 | } | ||
320 | EXPORT_SYMBOL_GPL(ubi_open_volume_path); | ||
321 | |||
322 | /** | ||
283 | * ubi_close_volume - close UBI volume. | 323 | * ubi_close_volume - close UBI volume. |
284 | * @desc: volume descriptor | 324 | * @desc: volume descriptor |
285 | */ | 325 | */ |
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index 74fdc40c8627..c1d7b880c795 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c | |||
@@ -147,12 +147,14 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol, | |||
147 | } | 147 | } |
148 | 148 | ||
149 | if (bytes == 0) { | 149 | if (bytes == 0) { |
150 | err = ubi_wl_flush(ubi); | ||
151 | if (err) | ||
152 | return err; | ||
153 | |||
150 | err = clear_update_marker(ubi, vol, 0); | 154 | err = clear_update_marker(ubi, vol, 0); |
151 | if (err) | 155 | if (err) |
152 | return err; | 156 | return err; |
153 | err = ubi_wl_flush(ubi); | 157 | vol->updating = 0; |
154 | if (!err) | ||
155 | vol->updating = 0; | ||
156 | } | 158 | } |
157 | 159 | ||
158 | vol->upd_buf = vmalloc(ubi->leb_size); | 160 | vol->upd_buf = vmalloc(ubi->leb_size); |
@@ -362,16 +364,16 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol, | |||
362 | 364 | ||
363 | ubi_assert(vol->upd_received <= vol->upd_bytes); | 365 | ubi_assert(vol->upd_received <= vol->upd_bytes); |
364 | if (vol->upd_received == vol->upd_bytes) { | 366 | if (vol->upd_received == vol->upd_bytes) { |
367 | err = ubi_wl_flush(ubi); | ||
368 | if (err) | ||
369 | return err; | ||
365 | /* The update is finished, clear the update marker */ | 370 | /* The update is finished, clear the update marker */ |
366 | err = clear_update_marker(ubi, vol, vol->upd_bytes); | 371 | err = clear_update_marker(ubi, vol, vol->upd_bytes); |
367 | if (err) | 372 | if (err) |
368 | return err; | 373 | return err; |
369 | err = ubi_wl_flush(ubi); | 374 | vol->updating = 0; |
370 | if (err == 0) { | 375 | err = to_write; |
371 | vol->updating = 0; | 376 | vfree(vol->upd_buf); |
372 | err = to_write; | ||
373 | vfree(vol->upd_buf); | ||
374 | } | ||
375 | } | 377 | } |
376 | 378 | ||
377 | return err; | 379 | return err; |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index dbc093afd946..8a771c59ac3e 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -2014,7 +2014,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2014 | inum = key_inum_flash(c, &dent->key); | 2014 | inum = key_inum_flash(c, &dent->key); |
2015 | fscki1 = read_add_inode(c, priv, inum); | 2015 | fscki1 = read_add_inode(c, priv, inum); |
2016 | if (IS_ERR(fscki1)) { | 2016 | if (IS_ERR(fscki1)) { |
2017 | err = PTR_ERR(fscki); | 2017 | err = PTR_ERR(fscki1); |
2018 | ubifs_err("error %d while processing entry node and " | 2018 | ubifs_err("error %d while processing entry node and " |
2019 | "trying to find parent inode node %lu", | 2019 | "trying to find parent inode node %lu", |
2020 | err, (unsigned long)inum); | 2020 | err, (unsigned long)inum); |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 1009adc8d602..39849f887e72 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1389,7 +1389,6 @@ static ssize_t ubifs_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1389 | unsigned long nr_segs, loff_t pos) | 1389 | unsigned long nr_segs, loff_t pos) |
1390 | { | 1390 | { |
1391 | int err; | 1391 | int err; |
1392 | ssize_t ret; | ||
1393 | struct inode *inode = iocb->ki_filp->f_mapping->host; | 1392 | struct inode *inode = iocb->ki_filp->f_mapping->host; |
1394 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1393 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
1395 | 1394 | ||
@@ -1397,17 +1396,7 @@ static ssize_t ubifs_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1397 | if (err) | 1396 | if (err) |
1398 | return err; | 1397 | return err; |
1399 | 1398 | ||
1400 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); | 1399 | return generic_file_aio_write(iocb, iov, nr_segs, pos); |
1401 | if (ret < 0) | ||
1402 | return ret; | ||
1403 | |||
1404 | if (ret > 0 && (IS_SYNC(inode) || iocb->ki_filp->f_flags & O_SYNC)) { | ||
1405 | err = ubifs_sync_wbufs_by_inode(c, inode); | ||
1406 | if (err) | ||
1407 | return err; | ||
1408 | } | ||
1409 | |||
1410 | return ret; | ||
1411 | } | 1400 | } |
1412 | 1401 | ||
1413 | static int ubifs_set_page_dirty(struct page *page) | 1402 | static int ubifs_set_page_dirty(struct page *page) |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 333e181ee987..943ad5624530 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1842,22 +1842,32 @@ const struct super_operations ubifs_super_operations = { | |||
1842 | * @name: UBI volume name | 1842 | * @name: UBI volume name |
1843 | * @mode: UBI volume open mode | 1843 | * @mode: UBI volume open mode |
1844 | * | 1844 | * |
1845 | * There are several ways to specify UBI volumes when mounting UBIFS: | 1845 | * The primary method of mounting UBIFS is by specifying the UBI volume |
1846 | * o ubiX_Y - UBI device number X, volume Y; | 1846 | * character device node path. However, UBIFS may also be mounted withoug any |
1847 | * o ubiY - UBI device number 0, volume Y; | 1847 | * character device node using one of the following methods: |
1848 | * | ||
1849 | * o ubiX_Y - mount UBI device number X, volume Y; | ||
1850 | * o ubiY - mount UBI device number 0, volume Y; | ||
1848 | * o ubiX:NAME - mount UBI device X, volume with name NAME; | 1851 | * o ubiX:NAME - mount UBI device X, volume with name NAME; |
1849 | * o ubi:NAME - mount UBI device 0, volume with name NAME. | 1852 | * o ubi:NAME - mount UBI device 0, volume with name NAME. |
1850 | * | 1853 | * |
1851 | * Alternative '!' separator may be used instead of ':' (because some shells | 1854 | * Alternative '!' separator may be used instead of ':' (because some shells |
1852 | * like busybox may interpret ':' as an NFS host name separator). This function | 1855 | * like busybox may interpret ':' as an NFS host name separator). This function |
1853 | * returns ubi volume object in case of success and a negative error code in | 1856 | * returns UBI volume description object in case of success and a negative |
1854 | * case of failure. | 1857 | * error code in case of failure. |
1855 | */ | 1858 | */ |
1856 | static struct ubi_volume_desc *open_ubi(const char *name, int mode) | 1859 | static struct ubi_volume_desc *open_ubi(const char *name, int mode) |
1857 | { | 1860 | { |
1861 | struct ubi_volume_desc *ubi; | ||
1858 | int dev, vol; | 1862 | int dev, vol; |
1859 | char *endptr; | 1863 | char *endptr; |
1860 | 1864 | ||
1865 | /* First, try to open using the device node path method */ | ||
1866 | ubi = ubi_open_volume_path(name, mode); | ||
1867 | if (!IS_ERR(ubi)) | ||
1868 | return ubi; | ||
1869 | |||
1870 | /* Try the "nodev" method */ | ||
1861 | if (name[0] != 'u' || name[1] != 'b' || name[2] != 'i') | 1871 | if (name[0] != 'u' || name[1] != 'b' || name[2] != 'i') |
1862 | return ERR_PTR(-EINVAL); | 1872 | return ERR_PTR(-EINVAL); |
1863 | 1873 | ||
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 6913b71d9ab2..b31bd9e9bca3 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -174,6 +174,8 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc, | |||
174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); | 174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); |
175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | 175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, |
176 | int mode); | 176 | int mode); |
177 | struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode); | ||
178 | |||
177 | int ubi_register_volume_notifier(struct notifier_block *nb, | 179 | int ubi_register_volume_notifier(struct notifier_block *nb, |
178 | int ignore_existing); | 180 | int ignore_existing); |
179 | int ubi_unregister_volume_notifier(struct notifier_block *nb); | 181 | int ubi_unregister_volume_notifier(struct notifier_block *nb); |