Commit 6889e783 authored by Dave Chinner's avatar Dave Chinner

Merge branch 'xfs-misc-fixes-for-3.18-3' into for-next

parents 75e58ce4 a8b1ee8b
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include "time.h"
#include "kmem.h" #include "kmem.h"
#include "xfs_message.h" #include "xfs_message.h"
......
...@@ -2563,7 +2563,8 @@ xfs_da_get_buf( ...@@ -2563,7 +2563,8 @@ xfs_da_get_buf(
mapp, nmap, 0); mapp, nmap, 0);
error = bp ? bp->b_error : -EIO; error = bp ? bp->b_error : -EIO;
if (error) { if (error) {
xfs_trans_brelse(trans, bp); if (bp)
xfs_trans_brelse(trans, bp);
goto out_free; goto out_free;
} }
......
...@@ -445,6 +445,8 @@ __xfs_sb_from_disk( ...@@ -445,6 +445,8 @@ __xfs_sb_from_disk(
to->sb_features_incompat = be32_to_cpu(from->sb_features_incompat); to->sb_features_incompat = be32_to_cpu(from->sb_features_incompat);
to->sb_features_log_incompat = to->sb_features_log_incompat =
be32_to_cpu(from->sb_features_log_incompat); be32_to_cpu(from->sb_features_log_incompat);
/* crc is only used on disk, not in memory; just init to 0 here. */
to->sb_crc = 0;
to->sb_pad = 0; to->sb_pad = 0;
to->sb_pquotino = be64_to_cpu(from->sb_pquotino); to->sb_pquotino = be64_to_cpu(from->sb_pquotino);
to->sb_lsn = be64_to_cpu(from->sb_lsn); to->sb_lsn = be64_to_cpu(from->sb_lsn);
...@@ -550,6 +552,9 @@ xfs_sb_to_disk( ...@@ -550,6 +552,9 @@ xfs_sb_to_disk(
if (!fields) if (!fields)
return; return;
/* We should never write the crc here, it's updated in the IO path */
fields &= ~XFS_SB_CRC;
xfs_sb_quota_to_disk(to, from, &fields); xfs_sb_quota_to_disk(to, from, &fields);
while (fields) { while (fields) {
f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
......
/*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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 the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_SUPPORT_TIME_H__
#define __XFS_SUPPORT_TIME_H__
#include <linux/sched.h>
#include <linux/time.h>
typedef struct timespec timespec_t;
static inline void delay(long ticks)
{
schedule_timeout_uninterruptible(ticks);
}
static inline void nanotime(struct timespec *tvp)
{
*tvp = CURRENT_TIME;
}
#endif /* __XFS_SUPPORT_TIME_H__ */
...@@ -560,6 +560,13 @@ xfs_cancel_ioend( ...@@ -560,6 +560,13 @@ xfs_cancel_ioend(
do { do {
next_bh = bh->b_private; next_bh = bh->b_private;
clear_buffer_async_write(bh); clear_buffer_async_write(bh);
/*
* The unwritten flag is cleared when added to the
* ioend. We're not submitting for I/O so mark the
* buffer unwritten again for next time around.
*/
if (ioend->io_type == XFS_IO_UNWRITTEN)
set_buffer_unwritten(bh);
unlock_buffer(bh); unlock_buffer(bh);
} while ((bh = next_bh) != NULL); } while ((bh = next_bh) != NULL);
......
...@@ -1368,14 +1368,14 @@ xfs_zero_file_space( ...@@ -1368,14 +1368,14 @@ xfs_zero_file_space(
if (start_boundary < end_boundary - 1) { if (start_boundary < end_boundary - 1) {
/* /*
* punch out delayed allocation blocks and the page cache over * Writeback the range to ensure any inode size updates due to
* the conversion range * appending writes make it to disk (otherwise we could just
* punch out the delalloc blocks).
*/ */
xfs_ilock(ip, XFS_ILOCK_EXCL); error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
error = xfs_bmap_punch_delalloc_range(ip, start_boundary, end_boundary - 1);
XFS_B_TO_FSBT(mp, start_boundary), if (error)
XFS_B_TO_FSB(mp, end_boundary - start_boundary)); goto out;
xfs_iunlock(ip, XFS_ILOCK_EXCL);
truncate_pagecache_range(VFS_I(ip), start_boundary, truncate_pagecache_range(VFS_I(ip), start_boundary,
end_boundary - 1); end_boundary - 1);
......
...@@ -654,7 +654,7 @@ xfs_ialloc( ...@@ -654,7 +654,7 @@ xfs_ialloc(
xfs_inode_t *ip; xfs_inode_t *ip;
uint flags; uint flags;
int error; int error;
timespec_t tv; struct timespec tv;
/* /*
* Call the space management code to pick * Call the space management code to pick
...@@ -720,7 +720,7 @@ xfs_ialloc( ...@@ -720,7 +720,7 @@ xfs_ialloc(
ip->i_d.di_nextents = 0; ip->i_d.di_nextents = 0;
ASSERT(ip->i_d.di_nblocks == 0); ASSERT(ip->i_d.di_nblocks == 0);
nanotime(&tv); tv = current_fs_time(mp->m_super);
ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
ip->i_d.di_atime = ip->i_d.di_mtime; ip->i_d.di_atime = ip->i_d.di_mtime;
...@@ -769,6 +769,8 @@ xfs_ialloc( ...@@ -769,6 +769,8 @@ xfs_ialloc(
di_flags |= XFS_DIFLAG_EXTSZINHERIT; di_flags |= XFS_DIFLAG_EXTSZINHERIT;
ip->i_d.di_extsize = pip->i_d.di_extsize; ip->i_d.di_extsize = pip->i_d.di_extsize;
} }
if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
di_flags |= XFS_DIFLAG_PROJINHERIT;
} else if (S_ISREG(mode)) { } else if (S_ISREG(mode)) {
if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT)
di_flags |= XFS_DIFLAG_REALTIME; di_flags |= XFS_DIFLAG_REALTIME;
...@@ -789,8 +791,6 @@ xfs_ialloc( ...@@ -789,8 +791,6 @@ xfs_ialloc(
if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) && if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) &&
xfs_inherit_nosymlinks) xfs_inherit_nosymlinks)
di_flags |= XFS_DIFLAG_NOSYMLINKS; di_flags |= XFS_DIFLAG_NOSYMLINKS;
if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
di_flags |= XFS_DIFLAG_PROJINHERIT;
if ((pip->i_d.di_flags & XFS_DIFLAG_NODEFRAG) && if ((pip->i_d.di_flags & XFS_DIFLAG_NODEFRAG) &&
xfs_inherit_nodefrag) xfs_inherit_nodefrag)
di_flags |= XFS_DIFLAG_NODEFRAG; di_flags |= XFS_DIFLAG_NODEFRAG;
......
...@@ -102,7 +102,7 @@ xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size) ...@@ -102,7 +102,7 @@ xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
{ {
xfs_fsize_t i_size = i_size_read(VFS_I(ip)); xfs_fsize_t i_size = i_size_read(VFS_I(ip));
if (new_size > i_size) if (new_size > i_size || new_size < 0)
new_size = i_size; new_size = i_size;
return new_size > ip->i_d.di_size ? new_size : 0; return new_size > ip->i_d.di_size ? new_size : 0;
} }
......
...@@ -615,7 +615,7 @@ xfs_iflush_done( ...@@ -615,7 +615,7 @@ xfs_iflush_done(
blip = bp->b_fspriv; blip = bp->b_fspriv;
prev = NULL; prev = NULL;
while (blip != NULL) { while (blip != NULL) {
if (lip->li_cb != xfs_iflush_done) { if (blip->li_cb != xfs_iflush_done) {
prev = blip; prev = blip;
blip = blip->li_bio_list; blip = blip->li_bio_list;
continue; continue;
......
...@@ -968,8 +968,6 @@ xfs_set_diflags( ...@@ -968,8 +968,6 @@ xfs_set_diflags(
di_flags |= XFS_DIFLAG_NOATIME; di_flags |= XFS_DIFLAG_NOATIME;
if (xflags & XFS_XFLAG_NODUMP) if (xflags & XFS_XFLAG_NODUMP)
di_flags |= XFS_DIFLAG_NODUMP; di_flags |= XFS_DIFLAG_NODUMP;
if (xflags & XFS_XFLAG_PROJINHERIT)
di_flags |= XFS_DIFLAG_PROJINHERIT;
if (xflags & XFS_XFLAG_NODEFRAG) if (xflags & XFS_XFLAG_NODEFRAG)
di_flags |= XFS_DIFLAG_NODEFRAG; di_flags |= XFS_DIFLAG_NODEFRAG;
if (xflags & XFS_XFLAG_FILESTREAM) if (xflags & XFS_XFLAG_FILESTREAM)
...@@ -981,6 +979,8 @@ xfs_set_diflags( ...@@ -981,6 +979,8 @@ xfs_set_diflags(
di_flags |= XFS_DIFLAG_NOSYMLINKS; di_flags |= XFS_DIFLAG_NOSYMLINKS;
if (xflags & XFS_XFLAG_EXTSZINHERIT) if (xflags & XFS_XFLAG_EXTSZINHERIT)
di_flags |= XFS_DIFLAG_EXTSZINHERIT; di_flags |= XFS_DIFLAG_EXTSZINHERIT;
if (xflags & XFS_XFLAG_PROJINHERIT)
di_flags |= XFS_DIFLAG_PROJINHERIT;
} else if (S_ISREG(ip->i_d.di_mode)) { } else if (S_ISREG(ip->i_d.di_mode)) {
if (xflags & XFS_XFLAG_REALTIME) if (xflags & XFS_XFLAG_REALTIME)
di_flags |= XFS_DIFLAG_REALTIME; di_flags |= XFS_DIFLAG_REALTIME;
...@@ -1231,13 +1231,25 @@ xfs_ioctl_setattr( ...@@ -1231,13 +1231,25 @@ xfs_ioctl_setattr(
} }
if (mask & FSX_EXTSIZE)
ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
if (mask & FSX_XFLAGS) { if (mask & FSX_XFLAGS) {
xfs_set_diflags(ip, fa->fsx_xflags); xfs_set_diflags(ip, fa->fsx_xflags);
xfs_diflags_to_linux(ip); xfs_diflags_to_linux(ip);
} }
/*
* Only set the extent size hint if we've already determined that the
* extent size hint should be set on the inode. If no extent size flags
* are set on the inode then unconditionally clear the extent size hint.
*/
if (mask & FSX_EXTSIZE) {
int extsize = 0;
if (ip->i_d.di_flags &
(XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
ip->i_d.di_extsize = extsize;
}
xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
......
...@@ -160,6 +160,7 @@ xfs_ioctl32_bstat_copyin( ...@@ -160,6 +160,7 @@ xfs_ioctl32_bstat_copyin(
get_user(bstat->bs_gen, &bstat32->bs_gen) || get_user(bstat->bs_gen, &bstat32->bs_gen) ||
get_user(bstat->bs_projid_lo, &bstat32->bs_projid_lo) || get_user(bstat->bs_projid_lo, &bstat32->bs_projid_lo) ||
get_user(bstat->bs_projid_hi, &bstat32->bs_projid_hi) || get_user(bstat->bs_projid_hi, &bstat32->bs_projid_hi) ||
get_user(bstat->bs_forkoff, &bstat32->bs_forkoff) ||
get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) || get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) ||
get_user(bstat->bs_dmstate, &bstat32->bs_dmstate) || get_user(bstat->bs_dmstate, &bstat32->bs_dmstate) ||
get_user(bstat->bs_aextents, &bstat32->bs_aextents)) get_user(bstat->bs_aextents, &bstat32->bs_aextents))
...@@ -214,6 +215,7 @@ xfs_bulkstat_one_fmt_compat( ...@@ -214,6 +215,7 @@ xfs_bulkstat_one_fmt_compat(
put_user(buffer->bs_gen, &p32->bs_gen) || put_user(buffer->bs_gen, &p32->bs_gen) ||
put_user(buffer->bs_projid, &p32->bs_projid) || put_user(buffer->bs_projid, &p32->bs_projid) ||
put_user(buffer->bs_projid_hi, &p32->bs_projid_hi) || put_user(buffer->bs_projid_hi, &p32->bs_projid_hi) ||
put_user(buffer->bs_forkoff, &p32->bs_forkoff) ||
put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) || put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) ||
put_user(buffer->bs_dmstate, &p32->bs_dmstate) || put_user(buffer->bs_dmstate, &p32->bs_dmstate) ||
put_user(buffer->bs_aextents, &p32->bs_aextents)) put_user(buffer->bs_aextents, &p32->bs_aextents))
......
...@@ -67,8 +67,9 @@ typedef struct compat_xfs_bstat { ...@@ -67,8 +67,9 @@ typedef struct compat_xfs_bstat {
__u32 bs_gen; /* generation count */ __u32 bs_gen; /* generation count */
__u16 bs_projid_lo; /* lower part of project id */ __u16 bs_projid_lo; /* lower part of project id */
#define bs_projid bs_projid_lo /* (previously just bs_projid) */ #define bs_projid bs_projid_lo /* (previously just bs_projid) */
__u16 bs_forkoff; /* inode fork offset in bytes */
__u16 bs_projid_hi; /* high part of project id */ __u16 bs_projid_hi; /* high part of project id */
unsigned char bs_pad[12]; /* pad space, unused */ unsigned char bs_pad[10]; /* pad space, unused */
__u32 bs_dmevmask; /* DMIG event mask */ __u32 bs_dmevmask; /* DMIG event mask */
__u16 bs_dmstate; /* DMIG state info */ __u16 bs_dmstate; /* DMIG state info */
__u16 bs_aextents; /* attribute number of extents */ __u16 bs_aextents; /* attribute number of extents */
......
...@@ -404,8 +404,8 @@ xfs_quota_calc_throttle( ...@@ -404,8 +404,8 @@ xfs_quota_calc_throttle(
int shift = 0; int shift = 0;
struct xfs_dquot *dq = xfs_inode_dquot(ip, type); struct xfs_dquot *dq = xfs_inode_dquot(ip, type);
/* over hi wmark, squash the prealloc completely */ /* no dq, or over hi wmark, squash the prealloc completely */
if (dq->q_res_bcount >= dq->q_prealloc_hi_wmark) { if (!dq || dq->q_res_bcount >= dq->q_prealloc_hi_wmark) {
*qblocks = 0; *qblocks = 0;
*qfreesp = 0; *qfreesp = 0;
return; return;
......
...@@ -639,7 +639,8 @@ xfs_inumbers( ...@@ -639,7 +639,8 @@ xfs_inumbers(
xfs_buf_relse(agbp); xfs_buf_relse(agbp);
agbp = NULL; agbp = NULL;
agino = 0; agino = 0;
} while (++agno < mp->m_sb.sb_agcount); agno++;
} while (agno < mp->m_sb.sb_agcount);
if (!error) { if (!error) {
if (bufidx) { if (bufidx) {
......
...@@ -56,7 +56,6 @@ typedef __uint64_t __psunsigned_t; ...@@ -56,7 +56,6 @@ typedef __uint64_t __psunsigned_t;
#include "kmem.h" #include "kmem.h"
#include "mrlock.h" #include "mrlock.h"
#include "time.h"
#include "uuid.h" #include "uuid.h"
#include <linux/semaphore.h> #include <linux/semaphore.h>
...@@ -179,6 +178,11 @@ typedef __uint64_t __psunsigned_t; ...@@ -179,6 +178,11 @@ typedef __uint64_t __psunsigned_t;
#define MAX(a,b) (max(a,b)) #define MAX(a,b) (max(a,b))
#define howmany(x, y) (((x)+((y)-1))/(y)) #define howmany(x, y) (((x)+((y)-1))/(y))
static inline void delay(long ticks)
{
schedule_timeout_uninterruptible(ticks);
}
/* /*
* XFS wrapper structure for sysfs support. It depends on external data * XFS wrapper structure for sysfs support. It depends on external data
* structures and is embedded in various internal data structures to implement * structures and is embedded in various internal data structures to implement
......
...@@ -70,7 +70,7 @@ xfs_trans_ichgtime( ...@@ -70,7 +70,7 @@ xfs_trans_ichgtime(
int flags) int flags)
{ {
struct inode *inode = VFS_I(ip); struct inode *inode = VFS_I(ip);
timespec_t tv; struct timespec tv;
ASSERT(tp); ASSERT(tp);
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment