Merge branches 'acpica-fixes', 'acpi-video' and 'acpi-processor'
[cascardo/linux.git] / fs / nilfs2 / ioctl.c
index e8fe248..358b57e 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Written by Koji Sato <koji@osrg.net>.
+ * Written by Koji Sato.
  */
 
 #include <linux/fs.h>
@@ -783,6 +779,7 @@ static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
        size_t nmembs = argv->v_nmembs;
        struct nilfs_bmap *bmap = NILFS_I(nilfs->ns_dat)->i_bmap;
        struct nilfs_bdesc *bdescs = buf;
+       struct buffer_head *bh;
        int ret, i;
 
        for (i = 0; i < nmembs; i++) {
@@ -800,12 +797,16 @@ static int nilfs_ioctl_mark_blocks_dirty(struct the_nilfs *nilfs,
                        /* skip dead block */
                        continue;
                if (bdescs[i].bd_level == 0) {
-                       ret = nilfs_mdt_mark_block_dirty(nilfs->ns_dat,
-                                                        bdescs[i].bd_offset);
-                       if (ret < 0) {
+                       ret = nilfs_mdt_get_block(nilfs->ns_dat,
+                                                 bdescs[i].bd_offset,
+                                                 false, NULL, &bh);
+                       if (unlikely(ret)) {
                                WARN_ON(ret == -ENOENT);
                                return ret;
                        }
+                       mark_buffer_dirty(bh);
+                       nilfs_mdt_mark_dirty(nilfs->ns_dat);
+                       put_bh(bh);
                } else {
                        ret = nilfs_bmap_mark(bmap, bdescs[i].bd_offset,
                                              bdescs[i].bd_level);