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

+72 -29
+2 -2
MAINTAINERS
··· 5335 5335 F: drivers/scsi/u14-34f.c 5336 5336 5337 5337 UBI FILE SYSTEM (UBIFS) 5338 - M: Artem Bityutskiy <dedekind@infradead.org> 5338 + M: Artem Bityutskiy <dedekind1@gmail.com> 5339 5339 M: Adrian Hunter <adrian.hunter@nokia.com> 5340 5340 L: linux-mtd@lists.infradead.org 5341 5341 T: git git://git.infradead.org/ubifs-2.6.git ··· 5386 5386 F: include/linux/cdrom.h 5387 5387 5388 5388 UNSORTED BLOCK IMAGES (UBI) 5389 - M: Artem Bityutskiy <dedekind@infradead.org> 5389 + M: Artem Bityutskiy <dedekind1@gmail.com> 5390 5390 W: http://www.linux-mtd.infradead.org/ 5391 5391 L: linux-mtd@lists.infradead.org 5392 5392 T: git git://git.infradead.org/ubi-2.6.git
+40
drivers/mtd/ubi/kapi.c
··· 22 22 23 23 #include <linux/module.h> 24 24 #include <linux/err.h> 25 + #include <linux/namei.h> 26 + #include <linux/fs.h> 25 27 #include <asm/div64.h> 26 28 #include "ubi.h" 27 29 ··· 280 278 return ret; 281 279 } 282 280 EXPORT_SYMBOL_GPL(ubi_open_volume_nm); 281 + 282 + /** 283 + * ubi_open_volume_path - open UBI volume by its character device node path. 284 + * @pathname: volume character device node path 285 + * @mode: open mode 286 + * 287 + * This function is similar to 'ubi_open_volume()', but opens a volume the path 288 + * to its character device node. 289 + */ 290 + struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) 291 + { 292 + int error, ubi_num, vol_id; 293 + struct ubi_volume_desc *ret; 294 + struct inode *inode; 295 + struct path path; 296 + 297 + dbg_gen("open volume %s, mode %d", pathname, mode); 298 + 299 + if (!pathname || !*pathname) 300 + return ERR_PTR(-EINVAL); 301 + 302 + error = kern_path(pathname, LOOKUP_FOLLOW, &path); 303 + if (error) 304 + return ERR_PTR(error); 305 + 306 + inode = path.dentry->d_inode; 307 + ubi_num = ubi_major2num(imajor(inode)); 308 + vol_id = iminor(inode) - 1; 309 + 310 + if (vol_id >= 0 && ubi_num >= 0) 311 + ret = ubi_open_volume(ubi_num, vol_id, mode); 312 + else 313 + ret = ERR_PTR(-ENODEV); 314 + 315 + path_put(&path); 316 + return ret; 317 + } 318 + EXPORT_SYMBOL_GPL(ubi_open_volume_path); 283 319 284 320 /** 285 321 * ubi_close_volume - close UBI volume.
+11 -9
drivers/mtd/ubi/upd.c
··· 147 147 } 148 148 149 149 if (bytes == 0) { 150 + err = ubi_wl_flush(ubi); 151 + if (err) 152 + return err; 153 + 150 154 err = clear_update_marker(ubi, vol, 0); 151 155 if (err) 152 156 return err; 153 - err = ubi_wl_flush(ubi); 154 - if (!err) 155 - vol->updating = 0; 157 + vol->updating = 0; 156 158 } 157 159 158 160 vol->upd_buf = vmalloc(ubi->leb_size); ··· 364 362 365 363 ubi_assert(vol->upd_received <= vol->upd_bytes); 366 364 if (vol->upd_received == vol->upd_bytes) { 365 + err = ubi_wl_flush(ubi); 366 + if (err) 367 + return err; 367 368 /* The update is finished, clear the update marker */ 368 369 err = clear_update_marker(ubi, vol, vol->upd_bytes); 369 370 if (err) 370 371 return err; 371 - err = ubi_wl_flush(ubi); 372 - if (err == 0) { 373 - vol->updating = 0; 374 - err = to_write; 375 - vfree(vol->upd_buf); 376 - } 372 + vol->updating = 0; 373 + err = to_write; 374 + vfree(vol->upd_buf); 377 375 } 378 376 379 377 return err;
+1 -1
fs/ubifs/debug.c
··· 2014 2014 inum = key_inum_flash(c, &dent->key); 2015 2015 fscki1 = read_add_inode(c, priv, inum); 2016 2016 if (IS_ERR(fscki1)) { 2017 - err = PTR_ERR(fscki); 2017 + err = PTR_ERR(fscki1); 2018 2018 ubifs_err("error %d while processing entry node and " 2019 2019 "trying to find parent inode node %lu", 2020 2020 err, (unsigned long)inum);
+1 -12
fs/ubifs/file.c
··· 1389 1389 unsigned long nr_segs, loff_t pos) 1390 1390 { 1391 1391 int err; 1392 - ssize_t ret; 1393 1392 struct inode *inode = iocb->ki_filp->f_mapping->host; 1394 1393 struct ubifs_info *c = inode->i_sb->s_fs_info; 1395 1394 ··· 1396 1397 if (err) 1397 1398 return err; 1398 1399 1399 - ret = generic_file_aio_write(iocb, iov, nr_segs, pos); 1400 - if (ret < 0) 1401 - return ret; 1402 - 1403 - if (ret > 0 && (IS_SYNC(inode) || iocb->ki_filp->f_flags & O_SYNC)) { 1404 - err = ubifs_sync_wbufs_by_inode(c, inode); 1405 - if (err) 1406 - return err; 1407 - } 1408 - 1409 - return ret; 1400 + return generic_file_aio_write(iocb, iov, nr_segs, pos); 1410 1401 } 1411 1402 1412 1403 static int ubifs_set_page_dirty(struct page *page)
+15 -5
fs/ubifs/super.c
··· 1842 1842 * @name: UBI volume name 1843 1843 * @mode: UBI volume open mode 1844 1844 * 1845 - * There are several ways to specify UBI volumes when mounting UBIFS: 1846 - * o ubiX_Y - UBI device number X, volume Y; 1847 - * o ubiY - UBI device number 0, volume Y; 1845 + * The primary method of mounting UBIFS is by specifying the UBI volume 1846 + * character device node path. However, UBIFS may also be mounted withoug any 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 1851 * o ubiX:NAME - mount UBI device X, volume with name NAME; 1849 1852 * o ubi:NAME - mount UBI device 0, volume with name NAME. 1850 1853 * 1851 1854 * Alternative '!' separator may be used instead of ':' (because some shells 1852 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 1854 - * case of failure. 1856 + * returns UBI volume description object in case of success and a negative 1857 + * error code in case of failure. 1855 1858 */ 1856 1859 static struct ubi_volume_desc *open_ubi(const char *name, int mode) 1857 1860 { 1861 + struct ubi_volume_desc *ubi; 1858 1862 int dev, vol; 1859 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 1871 if (name[0] != 'u' || name[1] != 'b' || name[2] != 'i') 1862 1872 return ERR_PTR(-EINVAL); 1863 1873
+2
include/linux/mtd/ubi.h
··· 174 174 struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); 175 175 struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, 176 176 int mode); 177 + struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode); 178 + 177 179 int ubi_register_volume_notifier(struct notifier_block *nb, 178 180 int ignore_existing); 179 181 int ubi_unregister_volume_notifier(struct notifier_block *nb);