X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flvfs%2Ffsfilt_ext3.c;h=abdb74e2e5ee1812927b7c4f295d3fe7d28a87d8;hb=cf9e92a0adb490109f67d05da5833cfb270d92e8;hp=82f8879f3c0098cf9566b3326b6870abc78d45f5;hpb=f95393b0d0a59cf3dc2f29cffc35dcc4cc9d7728;p=fs%2Flustre-release.git diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 82f8879..abdb74e 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -82,13 +82,11 @@ extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, #include #include -#ifdef EXT3_MULTIBLOCK_ALLOCATOR #ifdef HAVE_EXT4_LDISKFS #include #else #include #endif -#endif #include "lustre_quota_fmt.h" @@ -107,6 +105,15 @@ extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, #define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS #endif +#ifdef EXT_INSERT_EXTENT_WITH_5ARGS +#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \ + ext3_ext_insert_extent(handle, inode, path, newext, flag) +#else +#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \ + ext3_ext_insert_extent(handle, inode, path, newext) +#endif + + static cfs_mem_cache_t *fcb_cache; struct fsfilt_cb_data { @@ -622,9 +629,21 @@ static int fsfilt_ext3_iocontrol(struct inode *inode, struct file *file, ENTRY; /* FIXME: Can't do this because of nested transaction deadlock */ - if (cmd == EXT3_IOC_SETFLAGS && (*(int *)arg) & EXT3_JOURNAL_DATA_FL) { - CERROR("can't set data journal flag on file\n"); - RETURN(-EPERM); + if (cmd == EXT3_IOC_SETFLAGS) { + /* We can't enable data journaling on OST objects, because + * this forces the transaction to be closed in order to + * flush the journal, but the caller will already have a + * compound transaction open to update the last_rcvd file, + * and this thread would deadlock trying to set the flag. */ + if ((*(int *)arg) & EXT3_JOURNAL_DATA_FL) { + CERROR("can't set data journal flag on file\n"); + RETURN(-EPERM); + } + /* Because the MDS does not see the EXTENTS_FL set on the + * OST objects, mask this flag into all set flags. It is + * not legal to clear this flag in any case, so we are not + * changing the functionality by doing this. b=22911 */ + *(int *)arg |= EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL; } #ifdef HAVE_EXT4_LDISKFS @@ -805,26 +824,26 @@ static int fsfilt_ext3_sync(struct super_block *sb) return ext3_force_commit(sb); } -#if defined(EXT3_MULTIBLOCK_ALLOCATOR) && (!defined(EXT3_EXT_CACHE_NO) || defined(EXT_CACHE_MARK)) -#warning "kernel code has old extents/mballoc patch, disabling" -#undef EXT3_MULTIBLOCK_ALLOCATOR -#endif #ifndef EXT3_EXTENTS_FL #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ #endif -#ifdef EXT3_MULTIBLOCK_ALLOCATOR #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) -#define fsfilt_up_truncate_sem(inode) up(&EXT3_I(inode)->truncate_sem); -#define fsfilt_down_truncate_sem(inode) down(&EXT3_I(inode)->truncate_sem); -#else -#ifdef HAVE_EXT4_LDISKFS -#define fsfilt_up_truncate_sem(inode) up_write((&EXT4_I(inode)->i_data_sem)); -#define fsfilt_down_truncate_sem(inode) down_write((&EXT4_I(inode)->i_data_sem)); +# define fsfilt_up_truncate_sem(inode) up(&LDISKFS_I(inode)->truncate_sem); +# define fsfilt_down_truncate_sem(inode) down(&LDISKFS_I(inode)->truncate_sem); #else -#define fsfilt_up_truncate_sem(inode) mutex_unlock(&EXT3_I(inode)->truncate_mutex); -#define fsfilt_down_truncate_sem(inode) mutex_lock(&EXT3_I(inode)->truncate_mutex); -#endif +# ifdef HAVE_EXT4_LDISKFS +# ifdef WALK_SPACE_HAS_DATA_SEM /* We only use it in fsfilt_map_nblocks() for now */ +# define fsfilt_up_truncate_sem(inode) do{ }while(0) +# define fsfilt_down_truncate_sem(inode) do{ }while(0) +# else +# define fsfilt_up_truncate_sem(inode) up_write((&EXT4_I(inode)->i_data_sem)) +# define fsfilt_down_truncate_sem(inode) down_write((&EXT4_I(inode)->i_data_sem)) +# endif +# else +# define fsfilt_up_truncate_sem(inode) mutex_unlock(&EXT3_I(inode)->truncate_mutex) +# define fsfilt_down_truncate_sem(inode) mutex_lock(&EXT3_I(inode)->truncate_mutex) +# endif #endif #ifndef EXT_ASSERT @@ -1025,7 +1044,7 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base, nex.ee_block = cpu_to_le32(cex->ec_block); ext3_ext_store_pblock(&nex, pblock); nex.ee_len = cpu_to_le16(count); - err = ext3_ext_insert_extent(handle, base, path, &nex); + err = fsfilt_ext3_ext_insert_extent(handle, base, path, &nex, 0); if (err) { /* free data blocks we just allocated */ /* not a good idea to call discard here directly, @@ -1172,7 +1191,6 @@ int fsfilt_ext3_map_ext_inode_pages(struct inode *inode, struct page **page, cleanup: return rc; } -#endif /* EXT3_MULTIBLOCK_ALLOCATOR */ extern int ext3_map_inode_page(struct inode *inode, struct page *page, unsigned long *blocks, int *created, int create); @@ -1204,13 +1222,12 @@ int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page, cfs_semaphore_t *optional_sem) { int rc; -#ifdef EXT3_MULTIBLOCK_ALLOCATOR + if (EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL) { rc = fsfilt_ext3_map_ext_inode_pages(inode, page, pages, blocks, created, create); return rc; } -#endif if (optional_sem != NULL) cfs_down(optional_sem); rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks,