Whamcloud - gitweb
LU-1822 llite: Remove deprecated truncate handler
authormichael.mckay <michael_mckay@xyratex.com>
Tue, 4 Sep 2012 15:31:45 +0000 (11:31 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2012 20:15:42 +0000 (16:15 -0400)
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 <Alexander_Zarochentsev@xyratex.com>
Reviewed-by: Iurii Golovach <iurii_golovach@xyratex.com>
Signed-off-by: Michael McKay <michael_mckay@xyratex.com>
Change-Id: I77b372a2825fd2bdc4b215ee20a979f03dc7d64b
Reviewed-on: http://review.whamcloud.com/3860
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Iurii Golovach <iurii.golovach@gmail.com>
lustre/lclient/lcommon_cl.c
lustre/llite/file.c
lustre/llite/llite_capa.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/rw.c
lustre/llite/vvp_io.c
lustre/lov/lov_request.c

index 1d65cf1..22e3526 100644 (file)
@@ -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) {
index e43dfb5..276a617 100644 (file)
@@ -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,
index 57ec818..8ac120d 100644 (file)
@@ -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)
 {
index 385f387..70f1e44 100644 (file)
@@ -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*);
index 2cb5910..0566ab2 100644 (file)
@@ -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 */
index e4244ba..5886590 100644 (file)
 #include "llite_internal.h"
 #include <linux/lustre_compat25.h>
 
-/* 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().
index c8f041e..f8b28b2 100644 (file)
@@ -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);
index 205c27f..e049e18 100644 (file)
@@ -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);
         }