From: michael.mckay Date: Tue, 4 Sep 2012 15:31:45 +0000 (-0400) Subject: LU-1822 llite: Remove deprecated truncate handler X-Git-Tag: 2.3.55~55 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4d65293e59a844518faaa0b56efb429a0d4612d5 LU-1822 llite: Remove deprecated truncate handler Remove the ll_truncate handler. This handler was only being used to display a debug message about the truncated object. That line was moved to a different location, and the handler removed. This handler is an issue in kernels after 2.6.34 when running the patchless client. In that version of the kernel the kernel will log a kernel warning if its called and the inode has a handler for truncate. The truncate logic was updated some time ago to be more consistent with the new sequence of events. Xyratex-bug-id: MRP-597 Reviewed-by: Alexander Zarochentsev Reviewed-by: Iurii Golovach Signed-off-by: Michael McKay Change-Id: I77b372a2825fd2bdc4b215ee20a979f03dc7d64b Reviewed-on: http://review.whamcloud.com/3860 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Iurii Golovach --- diff --git a/lustre/lclient/lcommon_cl.c b/lustre/lclient/lcommon_cl.c index 1d65cf1..22e3526 100644 --- a/lustre/lclient/lcommon_cl.c +++ b/lustre/lclient/lcommon_cl.c @@ -683,22 +683,21 @@ void ccc_lock_state(const struct lu_env *env, * of finding lock in the cache. */ if (state == CLS_HELD && lock->cll_state < CLS_HELD) { - int rc; - - obj = slice->cls_obj; - inode = ccc_object_inode(obj); - attr = ccc_env_thread_attr(env); - - /* vmtruncate()->ll_truncate() first sets the i_size and then - * the kms under both a DLM lock and the - * ll_inode_size_lock(). If we don't get the - * ll_inode_size_lock() here we can match the DLM lock and - * reset i_size from the kms before the truncating path has - * updated the kms. generic_file_write can then trust the - * stale i_size when doing appending writes and effectively - * cancel the result of the truncate. Getting the - * ll_inode_size_lock() after the enqueue maintains the DLM - * -> ll_inode_size_lock() acquiring order. */ + int rc; + + obj = slice->cls_obj; + inode = ccc_object_inode(obj); + attr = ccc_env_thread_attr(env); + + /* vmtruncate() sets the i_size + * under both a DLM lock and the + * ll_inode_size_lock(). If we don't get the + * ll_inode_size_lock() here we can match the DLM lock and + * reset i_size. generic_file_write can then trust the + * stale i_size when doing appending writes and effectively + * cancel the result of the truncate. Getting the + * ll_inode_size_lock() after the enqueue maintains the DLM + * -> ll_inode_size_lock() acquiring order. */ ccc_object_size_lock(obj); rc = cl_object_attr_get(env, obj, attr); if (rc == 0) { diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e43dfb5..276a617 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -2709,7 +2709,6 @@ struct file_operations ll_file_operations_noflock = { struct inode_operations ll_file_inode_operations = { .setattr = ll_setattr, - .truncate = ll_truncate, .getattr = ll_getattr, .permission = ll_inode_permission, .setxattr = ll_setxattr, diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c index 57ec818..8ac120d 100644 --- a/lustre/llite/llite_capa.c +++ b/lustre/llite/llite_capa.c @@ -163,7 +163,7 @@ static void ll_delete_capa(struct obd_capa *ocapa) /* three places where client capa is deleted: * 1. capa_thread_main(), main place to delete expired capa. * 2. ll_clear_inode_capas() in ll_clear_inode(). - * 3. ll_truncate_free_capa() delete truncate capa explicitly in ll_truncate(). + * 3. ll_truncate_free_capa() delete truncate capa explicitly in ll_setattr_ost(). */ static int capa_thread_main(void *unused) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 385f387..70f1e44 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -688,7 +688,6 @@ int ll_writepages(struct address_space *, struct writeback_control *wbc); void ll_removepage(struct page *page); int ll_readpage(struct file *file, struct page *page); void ll_readahead_init(struct inode *inode, struct ll_readahead_state *ras); -void ll_truncate(struct inode *inode); int ll_file_punch(struct inode *, loff_t, int); ssize_t ll_file_lockless_io(struct file *, char *, size_t, loff_t *, int); void ll_clear_file_contended(struct inode*); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 2cb5910..0566ab2 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1406,8 +1406,10 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr) int rc = 0, rc1 = 0; ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu valid %x\n", inode->i_ino, - attr->ia_valid); + CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu (%p) to %llu, valid %x\n", + inode->i_ino, + inode,i_size_read(inode), + attr->ia_valid); if (ia_valid & ATTR_SIZE) { /* Check new size against VFS/VM file size limit and rlimit */ diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index e4244ba..5886590 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -63,23 +63,6 @@ #include "llite_internal.h" #include -/* this isn't where truncate starts. roughly: - * sys_truncate->ll_setattr_raw->vmtruncate->ll_truncate. setattr_raw grabs - * DLM lock on [size, EOF], i_mutex, ->lli_size_sem, and WRITE_I_ALLOC_SEM to - * avoid races. - * - * must be called under ->lli_size_sem */ -void ll_truncate(struct inode *inode) -{ - ENTRY; - - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) to %llu\n", inode->i_ino, - inode->i_generation, inode, i_size_read(inode)); - - EXIT; - return; -} /* ll_truncate */ - /** * Finalizes cl-data before exiting typical address_space operation. Dual to * ll_cl_init(). diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index c8f041e..f8b28b2 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -333,8 +333,7 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size) { int result; /* - * Only ll_inode_size_lock is taken at this level. lov_stripe_lock() - * is grabbed by ll_truncate() only over call to obd_adjust_kms(). + * Only ll_inode_size_lock is taken at this level. */ ll_inode_size_lock(inode); result = vmtruncate(inode, size); diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 205c27f..e049e18 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -1333,8 +1333,6 @@ int lov_update_punch_set(struct lov_request_set *set, req->rq_oi.oi_oa->o_blocks; } - /* Do we need to update lvb_size here? It needn't because - * it have been done in ll_truncate(). -jay */ lov_stripe_unlock(lsm); }